Skip to content

Commit

Permalink
Merge pull request #46 from Monobladegg/main
Browse files Browse the repository at this point in the history
fixed icons and fixed checking of fake home_domains and undefined data
  • Loading branch information
grandmotivator authored Aug 19, 2024
2 parents 23c71e5 + e8a2e0b commit e796cf0
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 47 deletions.
106 changes: 59 additions & 47 deletions src/pages/public/account/publicnet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,25 +143,25 @@ const PublicNet: FC<Props> = ({ id }) => {
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);
}
.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);
}
Expand Down Expand Up @@ -771,39 +771,51 @@ const PublicNet: FC<Props> = ({ id }) => {
information?.meta_data["ORG_DESCRIPTION"]}
</span>
</dd>
<dt>Org physical address:</dt>
<dd>
<span
className="block-select"
tabIndex={-1}
style={{
whiteSpace: "normal",
overflow: "visible",
display: "inline",
}}
>
{information?.meta_data &&
information?.meta_data[
"ORG_PHYSICAL_ADDRESS"
]}
</span>
</dd>
<dt>Org official email:</dt>
<dd>
<a
href={`mailto:${
information?.meta_data &&
information?.meta_data["ORG_OFFICIAL_EMAIL"]
}`}
target="_blank"
rel="noreferrer noopener"
>
{information?.meta_data &&
information?.meta_data[
"ORG_OFFICIAL_EMAIL"
]}
</a>
</dd>
{information.meta_data["ORG_PHYSICAL_ADDRESS"] !==
undefined && (
<>
<dt>Org physical address:</dt>
<dd>
<span
className="block-select"
tabIndex={-1}
style={{
whiteSpace: "normal",
overflow: "visible",
display: "inline",
}}
>
{information.meta_data &&
information?.meta_data[
"ORG_PHYSICAL_ADDRESS"
]}
</span>
</dd>
</>
)}
{information.meta_data["ORG_OFFICIAL_EMAIL"] !==
undefined && (
<>
<dt>Org official email:</dt>
<dd>
<a
href={`mailto:${
information?.meta_data &&
information?.meta_data[
"ORG_OFFICIAL_EMAIL"
]
}`}
target="_blank"
rel="noreferrer noopener"
>
{information?.meta_data &&
information?.meta_data[
"ORG_OFFICIAL_EMAIL"
]}
</a>
</dd>
</>
)}
</dl>
)}
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/shared/layouts/Header/ui/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ header {
margin-top: 5px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
z-index: 1;
width: max-content

}

.dropdown-item {
Expand Down

0 comments on commit e796cf0

Please sign in to comment.