-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Init TreasuryDetailMythToken, #1423 * Merge branch 'polkadot-redesign-1401' into treasury-detail-mythos-1423 * Address & link, #1423 * Add tooltip, #1423
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
site/src/pages/Overview/polkadot/treasuryDetail/mythToken.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import AssetValueDisplay from "./common/assetValueDisplay"; | ||
import AssetWrapper from "./common/assetWrapper"; | ||
import TreasuryDetailItem from "./common/item"; | ||
import BigNumber from "bignumber.js"; | ||
import { toPrecision } from "../../../../utils"; | ||
import ValueDisplay from "../../../../components/ValueDisplay"; | ||
import useAssetHubForeignAssets from "../../../../hooks/assetHub/useAssetHubForeignAssets"; | ||
import { MYTH } from "../../../../constants/foreignAssets"; | ||
import { MYTH_TOKEN_ACCOUNT } from "../../../../constants/foreignAssets"; | ||
import useFiatPrice from "../../../../hooks/useFiatPrice"; | ||
import AssetItem from "./common/assetItem"; | ||
|
||
export default function TreasuryDetailMythToken() { | ||
const mythTokenAssetsBalance = useAssetHubForeignAssets(MYTH_TOKEN_ACCOUNT); | ||
const { price: mythTokenPrice, isLoading: isFiatPriceLoading } = | ||
useFiatPrice("mythos"); | ||
|
||
const mythTokenBalance = mythTokenAssetsBalance.balance; | ||
|
||
const totalValue = toPrecision( | ||
BigNumber(mythTokenBalance).multipliedBy(mythTokenPrice), | ||
MYTH.decimals, | ||
); | ||
|
||
const isLoading = isFiatPriceLoading || mythTokenAssetsBalance.isLoading; | ||
|
||
return ( | ||
<TreasuryDetailItem | ||
title="Myth Token" | ||
titleTooltipContent="Airdrop & distribution of Myth tokens" | ||
iconSrc="/imgs/data-myth.svg" | ||
content={<ValueDisplay value={totalValue} prefix="$" />} | ||
isLoading={isLoading} | ||
footer={ | ||
<AssetWrapper> | ||
<AssetItem | ||
title="Distribution Addr" | ||
titleLink={`https://assethub-polkadot.subscan.io/account/${MYTH_TOKEN_ACCOUNT}`} | ||
> | ||
<AssetValueDisplay | ||
value={mythTokenBalance} | ||
isLoading={isLoading} | ||
precision={MYTH.decimals} | ||
symbol={MYTH.symbol} | ||
valueTooltipContent={ | ||
<ValueDisplay value={totalValue} prefix="$" /> | ||
} | ||
/> | ||
</AssetItem> | ||
</AssetWrapper> | ||
} | ||
/> | ||
); | ||
} |