Skip to content

Commit

Permalink
Merge pull request #6881 from Jarsen136/issue-6880
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwao authored Aug 23, 2023
2 parents 201d55a + 5e192b1 commit 2295849
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/base/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ItemResources } from '@/composables/useNft'
import type { Prefix } from '@kodadot1/static'

export type BaseMintedCollection = {
id: string
Expand Down Expand Up @@ -38,5 +39,5 @@ export interface CarouselNFT extends ItemResources {
}
collectionId?: string
collectionName?: string
chain?: string
chain?: Prefix
}
1 change: 1 addition & 0 deletions components/carousel/module/CarouselInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
v-if="showPrice"
:value="item.price"
inline
:prefix="item.chain"
:unit-symbol="unitSymbol" />
<p class="is-size-7 chain-name">{{ chainName }}</p>
</div>
Expand Down
13 changes: 12 additions & 1 deletion components/shared/format/Money.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,39 @@ import {
default as formatBalance,
roundTo,
} from '@/utils/format/balance'
import { chainPropListOf } from '@/utils/config/chain.config'
import type { Prefix } from '@kodadot1/static'
const props = withDefaults(
defineProps<{
value?: number | string
inline: boolean
hideUnit?: boolean
unitSymbol?: string
prefix?: Prefix
round?: number
}>(),
{
value: 0,
round: 4,
unitSymbol: '',
prefix: undefined,
}
)
const { decimals, unit } = useChain()
const tokenDecimals = computed(() =>
props.prefix ? chainPropListOf(props.prefix).tokenDecimals : decimals.value
)
const displayUnit = computed(() => props.unitSymbol || unit.value)
const finalValue = computed(() =>
round(
formatBalance(checkInvalidBalanceFilter(props.value), decimals.value, ''),
formatBalance(
checkInvalidBalanceFilter(props.value),
tokenDecimals.value,
''
),
props.round,
false
)
Expand Down

0 comments on commit 2295849

Please sign in to comment.