Skip to content

Commit

Permalink
fix: display token name if symbol is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidsowardx committed Sep 27, 2024
1 parent febfa3d commit bd80cd3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions apps/dashboard/src/lib/token-pages/FungibleTokensPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<div class="xrd">
<FungibleTokenCard
isXrd
name={xrd.name}
address={xrd.address}
linksTo={xrd.linksTo}
amount={xrd.amount}
Expand All @@ -40,6 +41,7 @@
{#each tokens as token}
<div class="token">
<FungibleTokenCard
name={token.name}
address={token.address}
linksTo={token.linksTo}
amount={token.amount}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts">
import type { Token } from '@dashboard-pages/search-pages/account/types'
import { xrdAddress as xrdAddressStore } from '@stores'
import { indexBy, prop } from 'ramda'
import type { FungibleResource } from '@api/utils/entities/resource/fungible'
import type { Account } from '@api/utils/entities/component/account'
import type { standardMetadata } from '@api/utils/metadata'
import type { Component } from '@api/utils/entities/component'
import FungibleTokensPage from './FungibleTokensPage.svelte'
import type { Token } from './types'
export let data: {
promises: {
Expand All @@ -20,14 +20,15 @@
({
address,
metadata: {
expected: { symbol, icon_url, tags }
expected: { symbol, icon_url, tags, name }
}
}: FungibleResource): Token => ({
linksTo: `/resource/${address}`,
numberOfTags: tags?.typed.values.length ?? 0,
amount: account.resources.fungible.find(
(fungible) => fungible.address === address
)!.value,
name: name?.typed?.value,
symbol: symbol?.typed.value,
address,
iconUrl: icon_url?.typed.value
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/src/lib/token-pages/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type Token = {
address: string
amount: string
name?: string
symbol?: string
iconUrl?: string
linksTo: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import type { EntityNonFungible } from '@api/utils/entities'
import type { standardMetadata } from '@api/utils/metadata'
import type { Component } from '@api/utils/entities/component'
import NoTokens from '@dashboard/lib/token-pages/NoTokens.svelte'
import NoTokens from '@dashboard/lib/token-pages/NoTokens.svelte'
export let nonFungibleResources: Promise<NonFungibleResource[]>
export let nfts: Promise<GeneralNft[]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type BigNumber from 'bignumber.js'
import PoolUnitCards from './PoolUnitCards.svelte'
import SkeletonLoader from '@components/_base/skeleton-loader/SkeletonLoader.svelte'
import NoTokens from '@dashboard/lib/token-pages/NoTokens.svelte'
import NoTokens from '@dashboard/lib/token-pages/NoTokens.svelte'
export let poolData: Promise<
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
const tokens = [
{
name: 'Radix',
symbol: 'XRD',
address:
'account_tdx_c_1p9we7lz9az6fyarwzx2yxezx9ymfdtc6l4dsva4v36rqpek3pe',
Expand All @@ -17,6 +18,7 @@
isXrd: true
},
{
name: 'Radix',
symbol: 'PEPE',
address:
'account_tdx_c_1p9we7lz9az6fyarwzx2yxezx9ymfdtc6l4dsva4v36rqpek3pe',
Expand All @@ -26,6 +28,7 @@
linksTo: 'https://radixdlt.com'
},
{
name: 'Radix',
address:
'account_tdx_c_1p9we7lz9az6fyarwzx2yxezx9ymfdtc6l4dsva4v36rqpek3pe',
numberOfTags: 2,
Expand Down Expand Up @@ -71,6 +74,7 @@
{#each tokens as token, index}
<div style:margin-bottom="10px">
<FungibleTokenCard
name={token.name}
symbol={token.symbol}
address={token.address}
numberOfTags={token.numberOfTags}
Expand Down

0 comments on commit bd80cd3

Please sign in to comment.