diff --git a/src/components/bridge/originInfo.tsx b/src/components/bridge/originInfo.tsx index 70efa7f4..50f34f5e 100644 --- a/src/components/bridge/originInfo.tsx +++ b/src/components/bridge/originInfo.tsx @@ -22,7 +22,7 @@ const OriginInfo = ({ getSpecificBalance, }: OriginInfoType) => { const { data } = useGetIqPriceQuery('IQ') - const exchangeRate = +data?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0 + const exchangeRate = +data?.response?.[0]?.quote?.USD?.price || 0.0 return ( diff --git a/src/components/client/BridgePage.tsx b/src/components/client/BridgePage.tsx index 99a442df..a6fd7108 100644 --- a/src/components/client/BridgePage.tsx +++ b/src/components/client/BridgePage.tsx @@ -56,7 +56,7 @@ const BridgePage = () => { const { chain } = useNetwork() const chainId = parseInt(config.chainId) const { data } = useGetIqPriceQuery('IQ') - const exchangeRate = data?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0 + const exchangeRate = data?.response?.[0]?.quote?.USD?.price || 0.0 const inputRef = useRef(null) const { iqBalanceOnEth, diff --git a/src/components/client/StakePage.tsx b/src/components/client/StakePage.tsx index e95569b7..565e18ce 100644 --- a/src/components/client/StakePage.tsx +++ b/src/components/client/StakePage.tsx @@ -54,7 +54,7 @@ const StakePage = () => { const chainId = parseInt(config.chainId) const { switchNetwork, isSuccess } = useSwitchNetwork() const { data: iqData } = useGetIqPriceQuery('IQ') - const exchangeRate = iqData?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0 + const exchangeRate = iqData?.response?.[0]?.quote?.USD?.price || 0.0 const resetValues = () => { setIsProcessingUnlock(false) setTrxHash(undefined) diff --git a/src/components/client/StatsPage.tsx b/src/components/client/StatsPage.tsx index 95e07a21..c628c07a 100644 --- a/src/components/client/StatsPage.tsx +++ b/src/components/client/StatsPage.tsx @@ -129,43 +129,46 @@ const StatsPage = () => { body="The numbers behind the IQ ecosystem." /> - {Object.entries(STATS).map(([group, val]) => ( - - - {group} - - - - {val.items.map((item, id) => ( - - {item.icon && ( - - + {Object.entries(STATS).map(([group, val]) => { + return ( + + + {group} + + + + {val.items.map((item, id) => { + let valuePrefix + if (item.label !== val.omitPrefix) { + valuePrefix = val.valuePrefix + } + return ( + + {item.icon && ( + + + + )} + + {item.label} + + + {showData(item.value, valuePrefix)} + - )} - - {item.label} - - - {showData( - item.value, - item.label === val.omitPrefix - ? undefined - : val.valuePrefix, - )} - - - ))} - - - ))} + ) + })} + + + ) + })} diff --git a/src/components/client/TreasuryPage.tsx b/src/components/client/TreasuryPage.tsx index af89ae23..915e2c7c 100644 --- a/src/components/client/TreasuryPage.tsx +++ b/src/components/client/TreasuryPage.tsx @@ -41,7 +41,7 @@ const TreasuryPage: NextPage = () => { if (treasuryValue && treasuryGraphData) { treasuryGraphData[treasuryGraphData.length - 1] = { amt: treasuryValue, - name: treasuryGraphData[treasuryGraphData.length - 1].name, + name: treasuryGraphData[treasuryGraphData.length - 1]?.name, } } diff --git a/src/components/dashboard/IQButton.tsx b/src/components/dashboard/IQButton.tsx index 801cbe89..919fcdaa 100644 --- a/src/components/dashboard/IQButton.tsx +++ b/src/components/dashboard/IQButton.tsx @@ -8,8 +8,7 @@ import { useGetIqPriceQuery } from '@/services/iqPrice' export const IQButton = (props: ButtonProps) => { const SIG_FIGS = 4 const { data, isLoading, error } = useGetIqPriceQuery('IQ') - - const iqPrice = data?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0 + const iqPrice = data?.response?.[0]?.quote?.USD?.price || 0.0 return ( <>