Skip to content

Commit

Permalink
fixed bugs at Header>current network
Browse files Browse the repository at this point in the history
  • Loading branch information
Monobladegg committed Aug 18, 2024
1 parent 254f0e2 commit 4d7f859
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
10 changes: 10 additions & 0 deletions src/pages/public/account/publicnet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ const PublicNet: FC<Props> = ({ id }) => {
.map((line) => line.replace(/^"|"$|,$|"$/g, ""))
.map((line) => line.replace(/"$/, ""));

/**
* Logic to create an array of strings where item is an accountID
* that is not fake in the home_domain set by the account
*
* example: newAccounts: string[] = ['GCGLKWJX5BPX2BOCOHYA6KUBZ67FR23DAHLG7VD3YRTGEYGZX57KUGFP',
* 'GBEUDKANIFPTFHPWJ5T3R6RIO36RQBFGHYPAQ6STH7KMNDHAT36LHOLD',
* 'GA2T6GR7VXXXBETTERSAFETHANSORRYXXXPROTECTEDBYLOBSTRVAULT']
*/

const foundAccount = newAccounts.find((accountId) => accountId === id);

if (foundAccount) {
Expand Down Expand Up @@ -891,6 +900,7 @@ const PublicNet: FC<Props> = ({ id }) => {
</p>
) : (
<span>{errorvalid}</span>

)}
</div>
</div>
Expand Down
25 changes: 16 additions & 9 deletions src/widgets/shared/layouts/Header/ui/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,14 @@ export const Header: FC = () => {
color: "#666",
}}
>
{net}
{collapseAccount(
accounts
.filter(
(account: IAccount) => account.isCurrent === true
)
.filter((account: IAccount) => account.net === net)
.map((account: IAccount) => account.accountID)[0]
)}
</span>
)}
<span
Expand Down Expand Up @@ -350,15 +357,15 @@ export const Header: FC = () => {
Network{" "}
</span>
{theme !== "day" ? (
<span className={`dropdown-selected`}>{net}</span>
<span className={`dropdown-selected`}>{net === "public" ? "Public" : "Testnet"}</span>
) : (
<span
style={{
marginInline: "5px",
color: "#666",
}}
>
{net}
{net === "public" ? "Public" : "Testnet"}
</span>
)}
<span
Expand All @@ -382,18 +389,18 @@ export const Header: FC = () => {
<div
className={`dropdown-item${
theme === "night" ? "" : "-light"
} ${net !== "testnet" ? "selected" : ""}`}
onClick={() => handleSelectNet("testnet")}
} ${net !== "public" ? "selected" : ""}`}
onClick={() => handleSelectNet("public")}
>
Testnet
Public
</div>
<div
className={`dropdown-item${
theme === "night" ? "" : "-light"
} ${net !== "public" ? "selected" : ""}`}
onClick={() => handleSelectNet("public")}
} ${net !== "testnet" ? "selected" : ""}`}
onClick={() => handleSelectNet("testnet")}
>
Public
Testnet
</div>
</div>
)}
Expand Down

0 comments on commit 4d7f859

Please sign in to comment.