From ba7e9ec0f6c90c872d129e63f9d9480dfec90be2 Mon Sep 17 00:00:00 2001 From: Monoblade <157546326+Monobladegg@users.noreply.github.com> Date: Sun, 18 Aug 2024 13:13:40 +0300 Subject: [PATCH 1/5] fixed icons --- src/widgets/shared/layouts/Header/ui/header.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/shared/layouts/Header/ui/header.scss b/src/widgets/shared/layouts/Header/ui/header.scss index a292c65..a9d8ca2 100644 --- a/src/widgets/shared/layouts/Header/ui/header.scss +++ b/src/widgets/shared/layouts/Header/ui/header.scss @@ -84,6 +84,7 @@ header { margin-top: 5px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); z-index: 1; + width: max-content } .dropdown-item { From 17c0237eca77f2f088f21d308f9239ef65daf40c Mon Sep 17 00:00:00 2001 From: Monoblade <157546326+Monobladegg@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:04:29 +0300 Subject: [PATCH 2/5] fix checking of fake home_domains --- src/pages/public/account/publicnet.tsx | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/pages/public/account/publicnet.tsx b/src/pages/public/account/publicnet.tsx index aaff22d..1a5d288 100644 --- a/src/pages/public/account/publicnet.tsx +++ b/src/pages/public/account/publicnet.tsx @@ -141,31 +141,31 @@ const PublicNet: FC = ({ id }) => { }, [account]); useEffect(() => { + if (information.tomlInfo) { const accountsMatch = information.tomlInfo.match( - /ACCOUNTS=\[([\s\S]*?)\]/ + /ACCOUNTS\s*=\s*\[([\s\S]*?)\]/ ); + if (accountsMatch && accountsMatch[1]) { const newAccounts = accountsMatch[1] - .split("\n") - .map((line) => line.trim()) - .filter((line) => line && !line.startsWith("#")) - .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 - */ - const foundAccount = newAccounts.find((accountId) => accountId === id); - if (foundAccount) { - setIsVisibleHomeDomainInfo(true); - } else { - setIsVisibleHomeDomainInfo(false); - } + .split('\n') + .map(line => line.trim()) + .filter(line => line.length > 0) + .map(line => line.replace(/^"|"$|,$/g, '')); + + + const cleanedAccounts = newAccounts.map(account => account.replace(/"/g, '')); + + const foundAccount = cleanedAccounts.some(accountId => accountId === id); + + setIsVisibleHomeDomainInfo(foundAccount); } else { + console.error("No accounts found in TOML"); setIsVisibleHomeDomainInfo(false); } } else { + console.error("No TOML info available"); setIsVisibleHomeDomainInfo(false); } }, [information.tomlInfo, id]); From 1ecc97d08402b8227170ebe603a6e3648abb80ef Mon Sep 17 00:00:00 2001 From: Monoblade <157546326+Monobladegg@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:10:43 +0300 Subject: [PATCH 3/5] fix error --- src/pages/public/account/publicnet.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/public/account/publicnet.tsx b/src/pages/public/account/publicnet.tsx index 1a5d288..e6e13b1 100644 --- a/src/pages/public/account/publicnet.tsx +++ b/src/pages/public/account/publicnet.tsx @@ -161,7 +161,6 @@ const PublicNet: FC = ({ id }) => { setIsVisibleHomeDomainInfo(foundAccount); } else { - console.error("No accounts found in TOML"); setIsVisibleHomeDomainInfo(false); } } else { From 68ea302d7c2aa4a75cc717337a631a511f7d94ed Mon Sep 17 00:00:00 2001 From: Monoblade <157546326+Monobladegg@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:12:51 +0300 Subject: [PATCH 4/5] fix error 2 --- src/pages/public/account/publicnet.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/public/account/publicnet.tsx b/src/pages/public/account/publicnet.tsx index e6e13b1..04fca63 100644 --- a/src/pages/public/account/publicnet.tsx +++ b/src/pages/public/account/publicnet.tsx @@ -164,7 +164,6 @@ const PublicNet: FC = ({ id }) => { setIsVisibleHomeDomainInfo(false); } } else { - console.error("No TOML info available"); setIsVisibleHomeDomainInfo(false); } }, [information.tomlInfo, id]); From e8a2e0b9fb8c89c8200d21d3e717a50caa81b34b Mon Sep 17 00:00:00 2001 From: Monoblade <157546326+Monobladegg@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:25:58 +0300 Subject: [PATCH 5/5] fixed undefined data --- src/pages/public/account/publicnet.tsx | 104 ++++++++++-------- .../shared/layouts/Header/ui/header.scss | 1 + 2 files changed, 60 insertions(+), 45 deletions(-) diff --git a/src/pages/public/account/publicnet.tsx b/src/pages/public/account/publicnet.tsx index 04fca63..7af2ebf 100644 --- a/src/pages/public/account/publicnet.tsx +++ b/src/pages/public/account/publicnet.tsx @@ -141,24 +141,26 @@ const PublicNet: FC = ({ id }) => { }, [account]); useEffect(() => { - if (information.tomlInfo) { const accountsMatch = information.tomlInfo.match( /ACCOUNTS\s*=\s*\[([\s\S]*?)\]/ ); - + if (accountsMatch && accountsMatch[1]) { const newAccounts = accountsMatch[1] - .split('\n') - .map(line => line.trim()) - .filter(line => line.length > 0) - .map(line => line.replace(/^"|"$|,$/g, '')); - - - const cleanedAccounts = newAccounts.map(account => account.replace(/"/g, '')); - - const foundAccount = cleanedAccounts.some(accountId => accountId === id); - + .split("\n") + .map((line) => line.trim()) + .filter((line) => line.length > 0) + .map((line) => line.replace(/^"|"$|,$/g, "")); + + const cleanedAccounts = newAccounts.map((account) => + account.replace(/"/g, "") + ); + + const foundAccount = cleanedAccounts.some( + (accountId) => accountId === id + ); + setIsVisibleHomeDomainInfo(foundAccount); } else { setIsVisibleHomeDomainInfo(false); @@ -769,39 +771,51 @@ const PublicNet: FC = ({ id }) => { information?.meta_data["ORG_DESCRIPTION"]} -
Org physical address:
-
- - {information?.meta_data && - information?.meta_data[ - "ORG_PHYSICAL_ADDRESS" - ]} - -
-
Org official email:
-
- - {information?.meta_data && - information?.meta_data[ - "ORG_OFFICIAL_EMAIL" - ]} - -
+ {information.meta_data["ORG_PHYSICAL_ADDRESS"] !== + undefined && ( + <> +
Org physical address:
+
+ + {information.meta_data && + information?.meta_data[ + "ORG_PHYSICAL_ADDRESS" + ]} + +
+ + )} + {information.meta_data["ORG_OFFICIAL_EMAIL"] !== + undefined && ( + <> +
Org official email:
+
+ + {information?.meta_data && + information?.meta_data[ + "ORG_OFFICIAL_EMAIL" + ]} + +
+ + )} )} diff --git a/src/widgets/shared/layouts/Header/ui/header.scss b/src/widgets/shared/layouts/Header/ui/header.scss index a9d8ca2..d4e078f 100644 --- a/src/widgets/shared/layouts/Header/ui/header.scss +++ b/src/widgets/shared/layouts/Header/ui/header.scss @@ -85,6 +85,7 @@ header { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); z-index: 1; width: max-content + } .dropdown-item {