From 0cf2b9a1301cf894993335d2e7521b3f88b2c3fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Sim=C3=A3o?= Date: Mon, 22 Jul 2024 18:25:33 +0100 Subject: [PATCH] fix: prices --- .../src/pages/Send/components/ButtonGroup/ButtonGroup.tsx | 4 ++-- .../Send/components/TokenButtonGroup/TokenButtonGroup.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/hybrid-pay/src/pages/Send/components/ButtonGroup/ButtonGroup.tsx b/apps/hybrid-pay/src/pages/Send/components/ButtonGroup/ButtonGroup.tsx index 9871da0ef..4f71bc0e0 100644 --- a/apps/hybrid-pay/src/pages/Send/components/ButtonGroup/ButtonGroup.tsx +++ b/apps/hybrid-pay/src/pages/Send/components/ButtonGroup/ButtonGroup.tsx @@ -13,9 +13,9 @@ type InheritAttrs = Omit; type HeaderProps = Props & AriaAttrs & InheritAttrs; -const ButtonGroup = ({ onSelectionChange, selectionMode, ...props }: HeaderProps): JSX.Element => { +const ButtonGroup = ({ onSelectionChange, selectionMode, selectedKeys, ...props }: HeaderProps): JSX.Element => { const domRef = useDOMRef(null); - let state = useListState({ ...props, onSelectionChange, selectionMode }); + let state = useListState({ ...props, onSelectionChange, selectionMode, selectedKeys }); let { gridProps } = useTagGroup(props, state, domRef); return ( diff --git a/apps/hybrid-pay/src/pages/Send/components/TokenButtonGroup/TokenButtonGroup.tsx b/apps/hybrid-pay/src/pages/Send/components/TokenButtonGroup/TokenButtonGroup.tsx index 0ad91dafa..e7f71faaa 100644 --- a/apps/hybrid-pay/src/pages/Send/components/TokenButtonGroup/TokenButtonGroup.tsx +++ b/apps/hybrid-pay/src/pages/Send/components/TokenButtonGroup/TokenButtonGroup.tsx @@ -20,7 +20,7 @@ type HeaderProps = Props; const TokenButtonGroup = ({ isSelected, currency, onSelectionChange }: HeaderProps): JSX.Element => { const { locale } = useLocale(); const format = useCurrencyFormatter(); - const { getPrice } = usePrices({ baseUrl: import.meta.env.VITE_MARKET_DATA_API }); + const { getPrice, data: pricesData } = usePrices({ baseUrl: import.meta.env.VITE_MARKET_DATA_API }); const [key, setKey] = useState(); @@ -35,14 +35,14 @@ const TokenButtonGroup = ({ isSelected, currency, onSelectionChange }: HeaderPro return usdItems.map((usd) => CurrencyAmount.fromRawAmount( currency, - new Big(100000000).mul(usd).div(getPrice(currency.symbol)).round(0, 0).toNumber() + pricesData ? new Big(100000000).mul(usd).div(getPrice(currency.symbol)).round(0, 0).toNumber() : 0 ) ); } return usdItems.map((usd) => CurrencyAmount.fromBaseAmount(currency, usd)); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [currency]); + }, [currency, pricesData]); const handleSelectionChange = (key: any) => { const [selectedKey] = [...key];