Skip to content

Commit

Permalink
add state visibility for home domain in Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Monobladegg committed Aug 18, 2024
1 parent 00cad0c commit 254f0e2
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/pages/public/account/publicnet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const PublicNet: FC<Props> = ({ id }) => {
const [tabIndex, setTabIndex] = useState<number>(1);
const [errorvalid, setErrorvalid] = useState<string>("");
const [loading, setLoading] = useState<boolean>(false);
const [isVisibleBlockInfo, setIsVisibleBlockInfo] = useState<boolean>(true);
const [isVisibleHomeDomainInfo, setIsVisibleHomeDomainInfo] =
useState<boolean>(true);

useEffect(() => {
const checkAccount = async () => {
Expand Down Expand Up @@ -155,22 +156,18 @@ const PublicNet: FC<Props> = ({ id }) => {
const foundAccount = newAccounts.find((accountId) => accountId === id);

if (foundAccount) {
setIsVisibleBlockInfo(true);
setIsVisibleHomeDomainInfo(true);
} else {
setIsVisibleBlockInfo(false);
setIsVisibleHomeDomainInfo(false);
}
} else {
setIsVisibleBlockInfo(false);
setIsVisibleHomeDomainInfo(false);
}
} else {
setIsVisibleBlockInfo(false);
setIsVisibleHomeDomainInfo(false);
}
}, [information.tomlInfo, id]);

useEffect(() => {
console.log(isVisibleBlockInfo);
}, [isVisibleBlockInfo]);

return (
<MainLayout>
<div className="container">
Expand Down Expand Up @@ -219,22 +216,23 @@ const PublicNet: FC<Props> = ({ id }) => {
<h3>Summary</h3>
<hr className="flare"></hr>
<dl>
{information?.home_domain == undefined ? (
""
) : (
{information?.home_domain !== undefined &&
isVisibleHomeDomainInfo &&
information.home_domain &&
!ignoredHomeDomains.includes(information.home_domain) ? (
<>
<dt>Home domain:</dt>
<dd>
<a
href={`${
information?.home_domain == undefined
information?.home_domain === undefined
? "#"
: information?.home_domain
}`}
rel="noreferrer noopener"
target="_blank"
>
{information?.home_domain == undefined
{information?.home_domain === undefined
? "none"
: information?.home_domain}
</a>
Expand Down Expand Up @@ -268,7 +266,7 @@ const PublicNet: FC<Props> = ({ id }) => {
</i>
</dd>
</>
)}
) : null}
<dt>Account lock status:</dt>
<dd>
unlocked
Expand Down Expand Up @@ -669,7 +667,7 @@ const PublicNet: FC<Props> = ({ id }) => {
ignoredHomeDomains &&
information?.home_domain &&
!ignoredHomeDomains.includes(information.home_domain) &&
isVisibleBlockInfo ? (
isVisibleHomeDomainInfo ? (
<div className="toml-props">
<div className="tabs space inline-right">
<div className="tabs-header">
Expand Down

0 comments on commit 254f0e2

Please sign in to comment.