Skip to content

Commit

Permalink
fixes links
Browse files Browse the repository at this point in the history
  • Loading branch information
Monobladegg committed Aug 16, 2024
1 parent 13619e1 commit df11460
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
5 changes: 2 additions & 3 deletions src/pages/public/account/(BalanceItem)/ui/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ const BalanceItem: FC<Props> = ({ number, decimal, item }) => {
<a
aria-label={item?.asset_code || "Asset"}
className="asset-link"
href={`https://stellar.expert/explorer/public/asset/${
item?.asset_code || "XLM"
}-${item?.asset_issuer}`}
href={`https://stellar.expert/explorer/public/asset/${ item.asset_code ?
item?.asset_code + "-" + item?.asset_issuer : "XLM" }`}
target="_blank"
>
{item?.asset_code || "XLM"}
Expand Down
16 changes: 5 additions & 11 deletions src/pages/public/account/publicnet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ const PublicNet: FC<Props> = ({ id }) => {
}, [account]);

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

return (
<MainLayout>
Expand Down Expand Up @@ -539,12 +539,7 @@ const PublicNet: FC<Props> = ({ id }) => {
);
return (
<li className="word-break" key={key}>
{processedKey}:{" "}
<span
dangerouslySetInnerHTML={{
__html: processedValue,
}}
/>
{processedKey}: {" "}{processedValue}
</li>
);
}
Expand Down Expand Up @@ -641,9 +636,8 @@ const PublicNet: FC<Props> = ({ id }) => {
{information?.meta_data &&
information?.meta_data["ORG_NAME"] !== undefined &&
ignoredHomeDomains &&
ignoredHomeDomains.includes(
information?.meta_data["ORG_URL"]
) ? (
information?.home_domain &&
ignoredHomeDomains.includes(information?.home_domain) ? (
""
) : (
<div className="toml-props">
Expand Down
2 changes: 1 addition & 1 deletion src/shared/configs/ignored-home-domains.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["https://lobstr.co"]
["lobstr.co"]
7 changes: 7 additions & 0 deletions src/shared/configs/stellar.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ACCOUNTS = [
"GBIDGDSVQXAHGZNOETS7ADUMWCDSQJU4R53EZRK6ONP3BA42UJL5PAHR",
"GC7BWB2ME4LII3TVWTHUIT7KGJXU4D5M6JUNLQ57WA7JERDNSAEXLOAN",
"GCGLKWJX5BPX2BOCOHYA6KUBZ67FR23DAHLG7VD3YRTGEYGZX57KUGFP",
"GBEUDKANIFPTFHPWJ5T3R6RI036RQBFGHYPAQ6STH7KMNDHAT36LHOLD",
"GA2T6GR7VXXXBETTERSAFETHANSORRYXXXPROTECTEDBYLOBSTRVAULT",
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dataKeys from "@/shared/configs/data-keys.json";
import stellarSdk from "stellar-sdk";
import Link from "next/link";

// Function to decode base64 strings
const decodeBase64 = (str: string | undefined): string => {
Expand All @@ -18,9 +19,9 @@ const decodeBase64 = (str: string | undefined): string => {
const processKeys = (
key: string,
value: string
): { processedKey: string; processedValue: string } => {
): { processedKey: string; processedValue: JSX.Element } => {
const processedKey = key;
let processedValue = value;
let processedValue: JSX.Element = <span>{decodeBase64(value)}</span>;

// Convert regular expression strings to RegExp objects with boundaries and case-insensitive flag
const regexPatterns: { [type: string]: RegExp[] } = Object.entries(
Expand All @@ -39,14 +40,14 @@ const processKeys = (
switch (type) {
case "accounts":
processedValue = stellarSdk.StrKey.isValidEd25519PublicKey(decodedValue)
? `<a href="/public/account?id=${decodedValue}">${decodedValue}</a>`
: `<span>${decodedValue}</span>`;
? <Link href={`/public/account?id=${decodedValue}`} legacyBehavior><a>{decodedValue}</a></Link>
: <span>{decodedValue}</span>;
break;
case "links":
processedValue = `<a target="_blank" href="${decodedValue}">${decodedValue}</a>`;
processedValue = <Link href={decodedValue} legacyBehavior><a target="_blank">{decodedValue}</a></Link>;
break;
case "names":
processedValue = decodedValue; // Add specific processing for names if needed
processedValue = <span>{decodedValue}</span>; // Add specific processing for names if needed
break;
default:
break;
Expand All @@ -58,4 +59,4 @@ const processKeys = (
return { processedKey, processedValue };
};

export default processKeys;
export default processKeys;
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
, "src/shared/lib/popularTags" ],
, "src/shared/lib/popularTags", "src/shared/lib/processKeys/index.tsx" ],
"exclude": [
"node_modules"
]
Expand Down

0 comments on commit df11460

Please sign in to comment.