diff --git a/app/testnet/account/testnet.tsx b/app/testnet/account/testnet.tsx index 2142f75..348c858 100644 --- a/app/testnet/account/testnet.tsx +++ b/app/testnet/account/testnet.tsx @@ -515,7 +515,7 @@ const PublicNet: FC = ({ id }) => { aria-label={issuer.paging_token} className="asset-link" > - {issuer.asset_code} + {issuer?.asset_code}   @@ -734,10 +734,10 @@ const PublicNet: FC = ({ id }) => { className="asset-link" > {/* */} - {item.asset_code == + {item?.asset_code == undefined ? "XLM" - : item.asset_code} + : item?.asset_code} diff --git a/src/pages/public/account/(BalanceItem)/index.ts b/src/pages/public/account/(BalanceItem)/index.ts new file mode 100644 index 0000000..420c9d2 --- /dev/null +++ b/src/pages/public/account/(BalanceItem)/index.ts @@ -0,0 +1 @@ +export {default} from "./ui" \ No newline at end of file diff --git a/src/pages/public/account/(BalanceItem)/ui/index.tsx b/src/pages/public/account/(BalanceItem)/ui/index.tsx new file mode 100644 index 0000000..5c795f1 --- /dev/null +++ b/src/pages/public/account/(BalanceItem)/ui/index.tsx @@ -0,0 +1,55 @@ +import { FC } from "react"; +import Link from "next/link"; +import { collapseAccount } from "@/pages/public/account/publicnet"; +import { Balance } from "@/shared/types"; + +interface Props { + number: string; + decimal: string; + item: Balance; +} + +const BalanceItem: FC = ({ number, decimal, item }) => { + return ( + + + {number} + {decimal} + + + + {item?.asset_code || "XLM"} + + + + + {collapseAccount(item?.asset_issuer || "")} + + + + ); +}; + +export default BalanceItem; diff --git a/src/pages/public/account/publicnet.tsx b/src/pages/public/account/publicnet.tsx index 6965b49..c9489a2 100644 --- a/src/pages/public/account/publicnet.tsx +++ b/src/pages/public/account/publicnet.tsx @@ -1,4 +1,3 @@ - "use client"; import { MainLayout } from "@/widgets"; @@ -17,6 +16,7 @@ import { useShallow } from "zustand/react/shallow"; import { Balance, Information, Signer } from "@/shared/types"; import { DocumentInfo, Issuer } from "@/shared/types"; import { processKeys } from "@/shared/lib"; +import BalanceItem from "@/pages/public/account/(BalanceItem)"; interface Props { id: string | undefined | null; @@ -32,7 +32,7 @@ export const collapseAccount = (accountId: string) => { }; const PublicNet: FC = ({ id }) => { - const account = id + const account = id; const { net } = useStore(useShallow((state) => ({ net: state.net }))); const [information, setInformation] = useState( {} as Information @@ -135,7 +135,6 @@ const PublicNet: FC = ({ id }) => { handler(); }, [account]); - return (
@@ -419,7 +418,7 @@ const PublicNet: FC = ({ id }) => { aria-label={issuer.paging_token} className="asset-link" > - {issuer.asset_code} + {issuer?.asset_code}   @@ -582,42 +581,44 @@ const PublicNet: FC = ({ id }) => {
-
- {information?.balances?.map( - (item: Balance, key: number) => { - const totalInfo = item.balance.split("."); - const number = totalInfo[0]; - const decimal = - Number(totalInfo[1]) == 0 ? "" : "." + totalInfo[1]; +
+
+ + + {information?.balances?.filter((item: Balance) => !item?.asset_code).map( + (item: Balance, index: number) => { + const totalInfo = item.balance.split("."); + const number = totalInfo[0]; + const decimal = + Number(totalInfo[1]) === 0 + ? "" + : "." + totalInfo[1]; - return ( - -
- {number} - {decimal} -
-
- {item.asset_issuer && ( -
- {collapseAccount(item.asset_issuer)} -
- )} -
- - - {/* */} - {item.asset_code == undefined - ? "XLM" - : item.asset_code} - - -
- ); - } - )} + return ( + + ); + } + )} + {information?.balances?.filter((item: Balance) => item?.asset_code).map( + (item: Balance, index: number) => { + const totalInfo = item.balance.split("."); + const number = totalInfo[0]; + const decimal = + Number(totalInfo[1]) === 0 + ? "" + : "." + totalInfo[1]; + + return ( + + ); + } + )} + +
+
diff --git a/src/shared/types/information/index.ts b/src/shared/types/information/index.ts index 2119b08..263f54a 100644 --- a/src/shared/types/information/index.ts +++ b/src/shared/types/information/index.ts @@ -52,6 +52,7 @@ export type Balance = { balance: string; asset_code?: string; asset_issuer?: string; + asset_type?: string; } export type TomlInfo = {