@rango-dev/widget-embedded 0.12.1-next.9 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +5 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +14 -4
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +6 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +94 -17
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +18 -3
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +25 -284
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
- package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts +18 -3
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +6 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
- package/dist/components/{SelectableCategoryList/SelectableCategoryList.styles.d.ts → LoadingSwapDetails/LoadingSwapDetails.styles.d.ts} +21 -6
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
- package/dist/components/LoadingSwapDetails/index.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -1
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts +18 -3
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +24 -4
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts +24 -4
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +3 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts +6 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +23 -151
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
- package/dist/components/SettingsContainer/index.d.ts +1 -1
- package/dist/components/SettingsContainer/index.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +24 -4
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +2 -9
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +35 -153
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +6 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +6 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +24 -4
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +207 -9
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts +6 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +24 -4
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +2 -2
- package/dist/constants/routing.d.ts +12 -2
- package/dist/constants/routing.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/globalStyles.d.ts +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList.d.ts +18 -0
- package/dist/hooks/usePrepareBlockchainList.d.ts.map +1 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +3 -0
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -6
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletProviders.d.ts +3 -3
- package/dist/hooks/useWalletProviders.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts +1 -2
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts +1 -5
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/services/httpService.d.ts +0 -1
- package/dist/services/httpService.d.ts.map +1 -1
- package/dist/store/app.d.ts +26 -0
- package/dist/store/app.d.ts.map +1 -0
- package/dist/store/bestRoute.d.ts +4 -8
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +0 -2
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +8 -0
- package/dist/store/slices/config.d.ts.map +1 -0
- package/dist/store/slices/data.d.ts +26 -0
- package/dist/store/slices/data.d.ts.map +1 -0
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +5 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +3 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +6 -3
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +1 -0
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +1 -1
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +2 -2
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/readme.md +3 -1
- package/src/Widget.tsx +22 -3
- package/src/components/AppRouter.tsx +38 -7
- package/src/components/AppRoutes.tsx +4 -28
- package/src/components/BlockchainList/BlockchainList.helpers.ts +1 -1
- package/src/components/BlockchainList/BlockchainList.styles.ts +6 -5
- package/src/components/BlockchainList/BlockchainList.tsx +6 -9
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +29 -42
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +33 -7
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +48 -7
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +59 -16
- package/src/components/ConfirmWalletsModal/WalletList.tsx +66 -22
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +2 -2
- package/src/components/HeaderButtons/HeaderButtons.types.ts +1 -0
- package/src/components/HeaderButtons/HomeButtons.tsx +18 -5
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +1 -2
- package/src/components/HeaderButtons/WalletButton.tsx +4 -1
- package/src/components/Layout/Layout.styles.ts +5 -3
- package/src/components/Layout/Layout.tsx +5 -20
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/LoadingSwapDetails/index.ts +1 -0
- package/src/components/NoRoutes/NoRoutes.helper.ts +4 -2
- package/src/components/NotificationContent/NotificationContent.tsx +3 -7
- package/src/components/RouteErrors/RouteErrors.styles.ts +2 -1
- package/src/components/RouteErrors/RouteErrors.tsx +37 -26
- package/src/components/RouteErrors/RouteErrors.types.ts +3 -1
- package/src/components/RouteErrors/RouteErrorsModal.tsx +42 -14
- package/src/components/SettingsContainer/SettingsContainer.style.ts +2 -7
- package/src/components/SettingsContainer/index.ts +0 -1
- package/src/components/Slippage/Slippage.tsx +6 -2
- package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +52 -16
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +19 -33
- package/src/components/SwapDetails/SwapDetails.styles.ts +10 -14
- package/src/components/SwapDetails/SwapDetails.tsx +143 -101
- package/src/components/SwapDetails/SwapDetails.types.ts +1 -1
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +5 -4
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +6 -7
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +3 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +3 -2
- package/src/components/SwitchFromAndTo.tsx +1 -35
- package/src/components/TokenList/TokenList.helpers.ts +6 -8
- package/src/components/TokenList/TokenList.styles.ts +7 -1
- package/src/components/TokenList/TokenList.tsx +29 -23
- package/src/components/TokenList/TokenList.types.ts +1 -1
- package/src/components/UpdateUrl.tsx +7 -1
- package/src/components/WidgetEvents.tsx +9 -3
- package/src/constants/errors.ts +2 -2
- package/src/constants/routing.ts +17 -2
- package/src/constants.ts +1 -0
- package/src/globalStyles.ts +1 -4
- package/src/hooks/useFetchBestRoute.ts +2 -2
- package/src/hooks/useNavigateBack.ts +10 -0
- package/src/hooks/usePrepareBlockchainList.ts +125 -0
- package/src/hooks/useSwapInput.ts +17 -3
- package/src/hooks/useSyncStoresWithConfig.ts +102 -0
- package/src/hooks/useTheme.ts +37 -75
- package/src/hooks/useWalletProviders.ts +7 -7
- package/src/pages/ConfirmSwapPage.tsx +65 -36
- package/src/pages/HistoryPage.tsx +2 -2
- package/src/pages/Home.tsx +114 -50
- package/src/pages/LanguagePage.tsx +1 -1
- package/src/pages/LiquiditySourcePage.tsx +22 -18
- package/src/pages/SelectBlockchainPage.tsx +19 -20
- package/src/pages/SelectSwapItemsPage.tsx +66 -88
- package/src/pages/SettingsPage.tsx +42 -15
- package/src/pages/SwapDetailsPage.tsx +9 -2
- package/src/pages/ThemePage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +11 -5
- package/src/services/httpService.ts +4 -5
- package/src/store/app.ts +15 -0
- package/src/store/bestRoute.ts +45 -71
- package/src/store/meta.ts +11 -29
- package/src/store/slices/config.ts +26 -0
- package/src/store/slices/data.ts +203 -0
- package/src/store/wallets.ts +0 -27
- package/src/types/config.ts +3 -0
- package/src/utils/common.ts +3 -0
- package/src/utils/configs.ts +8 -2
- package/src/utils/meta.ts +7 -0
- package/src/utils/numbers.ts +3 -2
- package/src/utils/routing.ts +76 -14
- package/src/utils/settings.ts +15 -0
- package/src/utils/swap.ts +82 -26
- package/src/utils/time.ts +69 -36
- package/src/utils/wallets.ts +49 -29
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +0 -5
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +0 -151
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +0 -6
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/index.d.ts +0 -2
- package/dist/components/BlockchainsChip/index.d.ts.map +0 -1
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +0 -3
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +0 -4
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +0 -4
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +0 -12
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/index.d.ts +0 -2
- package/dist/components/SelectableCategoryList/index.d.ts.map +0 -1
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +0 -30
- package/src/components/BlockchainsChip/BlockchainsChip.tsx +0 -15
- package/src/components/BlockchainsChip/BlockchainsChip.types.ts +0 -4
- package/src/components/BlockchainsChip/index.ts +0 -1
- package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +0 -20
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +0 -20
- package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +0 -21
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +0 -79
- package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +0 -12
- package/src/components/SelectableCategoryList/index.ts +0 -1
|
@@ -4,6 +4,7 @@ import type { Wallet } from '../../types';
|
|
|
4
4
|
import type { WalletInfo } from '@rango-dev/ui';
|
|
5
5
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
6
6
|
|
|
7
|
+
import { i18n } from '@lingui/core';
|
|
7
8
|
import {
|
|
8
9
|
Button,
|
|
9
10
|
Divider,
|
|
@@ -18,7 +19,10 @@ import React, { useEffect, useState } from 'react';
|
|
|
18
19
|
|
|
19
20
|
import { useWallets } from '../..';
|
|
20
21
|
import { useWalletList } from '../../hooks/useWalletList';
|
|
21
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
TIME_TO_CLOSE_MODAL,
|
|
24
|
+
TIME_TO_IGNORE_MODAL,
|
|
25
|
+
} from '../../pages/WalletsPage';
|
|
22
26
|
import { useMetaStore } from '../../store/meta';
|
|
23
27
|
import { useWalletsStore } from '../../store/wallets';
|
|
24
28
|
import { getBlockchainDisplayNameFor } from '../../utils/meta';
|
|
@@ -50,12 +54,23 @@ export function WalletList(props: PropTypes) {
|
|
|
50
54
|
const [addingExperimentalChainStatus, setAddingExperimentalChainStatus] =
|
|
51
55
|
useState<'in-progress' | 'completed' | null>(null);
|
|
52
56
|
const { connect } = useWallets();
|
|
57
|
+
let modalTimerId: ReturnType<typeof setTimeout> | null = null;
|
|
53
58
|
const { list, error, handleClick } = useWalletList({
|
|
54
59
|
config,
|
|
55
60
|
chain,
|
|
56
|
-
onBeforeConnect:
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
onBeforeConnect: (type) => {
|
|
62
|
+
modalTimerId = setTimeout(() => {
|
|
63
|
+
setOpenWalletStateModal(type);
|
|
64
|
+
}, TIME_TO_IGNORE_MODAL);
|
|
65
|
+
},
|
|
66
|
+
onConnect: () => {
|
|
67
|
+
if (modalTimerId) {
|
|
68
|
+
clearTimeout(modalTimerId);
|
|
69
|
+
}
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
setOpenWalletStateModal('');
|
|
72
|
+
}, TIME_TO_CLOSE_MODAL);
|
|
73
|
+
},
|
|
59
74
|
});
|
|
60
75
|
const [sortedList, setSortedList] = useState<WalletInfo[]>(list);
|
|
61
76
|
const numberOfSupportedWallets = list.length;
|
|
@@ -129,7 +144,11 @@ export function WalletList(props: PropTypes) {
|
|
|
129
144
|
wallet.state === WalletState.CONNECTED;
|
|
130
145
|
|
|
131
146
|
const connectedWalletDescription = couldAddExperimentalChain
|
|
132
|
-
?
|
|
147
|
+
? i18n.t({
|
|
148
|
+
id: 'addChain',
|
|
149
|
+
message: 'Add {chain} chain',
|
|
150
|
+
values: { chain },
|
|
151
|
+
})
|
|
133
152
|
: conciseAddress;
|
|
134
153
|
|
|
135
154
|
const onClick = () => {
|
|
@@ -160,15 +179,13 @@ export function WalletList(props: PropTypes) {
|
|
|
160
179
|
: undefined;
|
|
161
180
|
return (
|
|
162
181
|
<>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
/>
|
|
171
|
-
)}
|
|
182
|
+
<WalletModal
|
|
183
|
+
open={openWalletStateModal === wallet.type}
|
|
184
|
+
onClose={() => setOpenWalletStateModal('')}
|
|
185
|
+
image={wallet.image}
|
|
186
|
+
state={wallet.state}
|
|
187
|
+
error={error}
|
|
188
|
+
/>
|
|
172
189
|
{!!experimentalChainWallet && (
|
|
173
190
|
<Modal
|
|
174
191
|
open={!!experimentalChainWallet && showExperimentalChainModal}
|
|
@@ -177,9 +194,18 @@ export function WalletList(props: PropTypes) {
|
|
|
177
194
|
setExperimentalChainWallet(null);
|
|
178
195
|
}}>
|
|
179
196
|
<MessageBox
|
|
180
|
-
title={
|
|
197
|
+
title={i18n.t({
|
|
198
|
+
id: 'addBlockchain',
|
|
199
|
+
message: 'Add {blockchainDisplayName} Chain',
|
|
200
|
+
values: { blockchainDisplayName },
|
|
201
|
+
})}
|
|
181
202
|
type="warning"
|
|
182
|
-
description={
|
|
203
|
+
description={i18n.t({
|
|
204
|
+
id: 'addBlockchainDescription',
|
|
205
|
+
message:
|
|
206
|
+
'You should connect a {blockchainDisplayName} supported wallet or choose a different {blockchainDisplayName} address',
|
|
207
|
+
values: { blockchainDisplayName },
|
|
208
|
+
})}>
|
|
183
209
|
<Divider size={18} />
|
|
184
210
|
<Divider size={32} />
|
|
185
211
|
<Button
|
|
@@ -191,7 +217,7 @@ export function WalletList(props: PropTypes) {
|
|
|
191
217
|
type="primary"
|
|
192
218
|
fullWidth
|
|
193
219
|
size="large">
|
|
194
|
-
Confirm
|
|
220
|
+
{i18n.t('Confirm')}
|
|
195
221
|
</Button>
|
|
196
222
|
</MessageBox>
|
|
197
223
|
</Modal>
|
|
@@ -204,8 +230,17 @@ export function WalletList(props: PropTypes) {
|
|
|
204
230
|
{addingExperimentalChainStatus === 'in-progress' ? (
|
|
205
231
|
<MessageBox
|
|
206
232
|
type="loading"
|
|
207
|
-
title={
|
|
208
|
-
|
|
233
|
+
title={i18n.t({
|
|
234
|
+
id: 'addBlockchain',
|
|
235
|
+
message: 'Add {blockchainDisplayName} Chain',
|
|
236
|
+
values: { blockchainDisplayName },
|
|
237
|
+
})}
|
|
238
|
+
description={i18n.t({
|
|
239
|
+
id: 'addBlockchainDescription',
|
|
240
|
+
message:
|
|
241
|
+
'You should connect a {blockchainDisplayName} supported wallet or choose a different {blockchainDisplayName} address',
|
|
242
|
+
values: { blockchainDisplayName },
|
|
243
|
+
})}
|
|
209
244
|
icon={
|
|
210
245
|
<LogoContainer>
|
|
211
246
|
<WalletImageContainer>
|
|
@@ -218,8 +253,17 @@ export function WalletList(props: PropTypes) {
|
|
|
218
253
|
) : (
|
|
219
254
|
<MessageBox
|
|
220
255
|
type="success"
|
|
221
|
-
title={
|
|
222
|
-
|
|
256
|
+
title={i18n.t({
|
|
257
|
+
id: 'blockchainAdded',
|
|
258
|
+
message: '{blockchainDisplayName} Chain Added',
|
|
259
|
+
values: { blockchainDisplayName },
|
|
260
|
+
})}
|
|
261
|
+
description={i18n.t({
|
|
262
|
+
id: 'blockchainAddedDescription',
|
|
263
|
+
message:
|
|
264
|
+
'{blockchainDisplayName} is added to your wallet, you can use it to swap.',
|
|
265
|
+
values: { blockchainDisplayName },
|
|
266
|
+
})}
|
|
223
267
|
/>
|
|
224
268
|
)}
|
|
225
269
|
<Divider direction="vertical" size={32} />
|
|
@@ -238,7 +282,7 @@ export function WalletList(props: PropTypes) {
|
|
|
238
282
|
{shouldShowMoreWallets && (
|
|
239
283
|
<WalletButton selected={false} onClick={onShowMore.bind(null)}>
|
|
240
284
|
<Typography variant="label" size="medium">
|
|
241
|
-
Show more wallets
|
|
285
|
+
{i18n.t('Show more wallets')}
|
|
242
286
|
<Typography variant="label" size="medium" color="$primary">
|
|
243
287
|
+{numberOfSupportedWallets - (limit ?? 0)}
|
|
244
288
|
</Typography>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { darkTheme, IconButton, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
|
-
export const HeaderButton = styled(
|
|
3
|
+
export const HeaderButton = styled(IconButton, {
|
|
4
4
|
width: '$24',
|
|
5
5
|
position: 'relative',
|
|
6
6
|
padding: '0',
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from '@rango-dev/ui';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
|
|
14
|
+
import { getContainer } from '../../utils/common';
|
|
14
15
|
import { NotificationContent } from '../NotificationContent';
|
|
15
16
|
|
|
16
17
|
import { HeaderButton } from './HeaderButtons.styles';
|
|
@@ -27,7 +28,10 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
|
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
30
|
<>
|
|
30
|
-
<Tooltip
|
|
31
|
+
<Tooltip
|
|
32
|
+
container={getContainer()}
|
|
33
|
+
side="top"
|
|
34
|
+
content={i18n.t('Refresh')}>
|
|
31
35
|
<HeaderButton
|
|
32
36
|
variant="ghost"
|
|
33
37
|
size="small"
|
|
@@ -37,12 +41,15 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
|
|
|
37
41
|
</HeaderButton>
|
|
38
42
|
</Tooltip>
|
|
39
43
|
|
|
40
|
-
<Tooltip
|
|
44
|
+
<Tooltip
|
|
45
|
+
container={getContainer()}
|
|
46
|
+
side="top"
|
|
47
|
+
content={i18n.t('Notifications')}>
|
|
41
48
|
<Popover
|
|
42
49
|
align="center"
|
|
43
50
|
collisionBoundary={layoutRef}
|
|
44
51
|
collisionPadding={{ right: 20, left: 20 }}
|
|
45
|
-
container={
|
|
52
|
+
container={getContainer()}
|
|
46
53
|
content={<NotificationContent />}>
|
|
47
54
|
<HeaderButton
|
|
48
55
|
size="small"
|
|
@@ -53,12 +60,18 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
|
|
|
53
60
|
</HeaderButton>
|
|
54
61
|
</Popover>
|
|
55
62
|
</Tooltip>
|
|
56
|
-
<Tooltip
|
|
63
|
+
<Tooltip
|
|
64
|
+
container={getContainer()}
|
|
65
|
+
side="top"
|
|
66
|
+
content={i18n.t('Settings')}>
|
|
57
67
|
<HeaderButton size="small" variant="ghost" onClick={onClickSettings}>
|
|
58
68
|
<SettingsIcon size={18} color="black" />
|
|
59
69
|
</HeaderButton>
|
|
60
70
|
</Tooltip>
|
|
61
|
-
<Tooltip
|
|
71
|
+
<Tooltip
|
|
72
|
+
container={getContainer()}
|
|
73
|
+
side="top"
|
|
74
|
+
content={i18n.t('Transactions History')}>
|
|
62
75
|
<HeaderButton size="small" variant="ghost" onClick={onClickHistory}>
|
|
63
76
|
<TransactionIcon size={18} color="black" />
|
|
64
77
|
</HeaderButton>
|
|
@@ -6,8 +6,7 @@ import { useNotificationStore } from '../../store/notification';
|
|
|
6
6
|
import { NotificationsBadgeContainer } from './HeaderButtons.styles';
|
|
7
7
|
|
|
8
8
|
export function UnreadNotificationsBadge() {
|
|
9
|
-
const getUnreadNotifications =
|
|
10
|
-
useNotificationStore.use.getUnreadNotifications();
|
|
9
|
+
const { getUnreadNotifications } = useNotificationStore();
|
|
11
10
|
|
|
12
11
|
const notificationsCount = getUnreadNotifications().length;
|
|
13
12
|
|
|
@@ -8,7 +8,10 @@ import { ConnectedIcon, HeaderButton } from './HeaderButtons.styles';
|
|
|
8
8
|
|
|
9
9
|
function WalletButton(props: PropTypes) {
|
|
10
10
|
return (
|
|
11
|
-
<Tooltip
|
|
11
|
+
<Tooltip
|
|
12
|
+
container={props.container}
|
|
13
|
+
side="top"
|
|
14
|
+
content={i18n.t('Connect Wallet')}>
|
|
12
15
|
<HeaderButton variant="ghost" size="small" onClick={props.onClick}>
|
|
13
16
|
{props.isConnected && <ConnectedIcon />}
|
|
14
17
|
<WalletIcon size={18} color="black" />
|
|
@@ -4,13 +4,13 @@ export const Container = styled('div', {
|
|
|
4
4
|
position: 'relative',
|
|
5
5
|
display: 'flex',
|
|
6
6
|
flexDirection: 'column',
|
|
7
|
-
|
|
8
|
-
borderRadius: '20px',
|
|
7
|
+
borderRadius: '$primary',
|
|
9
8
|
overflow: 'hidden !important',
|
|
10
9
|
boxShadow: '15px 15px 15px 0px rgba(0, 0, 0, 0.05)',
|
|
11
10
|
width: '95vw',
|
|
12
11
|
maxWidth: '390px',
|
|
13
12
|
maxHeight: '700px',
|
|
13
|
+
backgroundColor: '$neutral100',
|
|
14
14
|
variants: {
|
|
15
15
|
fixedHeight: {
|
|
16
16
|
true: {
|
|
@@ -23,10 +23,12 @@ export const Container = styled('div', {
|
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
export const Content = styled('div', {
|
|
26
|
+
borderTopLeftRadius: '20px',
|
|
27
|
+
borderTopRightRadius: '20px',
|
|
26
28
|
display: 'flex',
|
|
27
29
|
flexDirection: 'column',
|
|
28
30
|
flex: 1,
|
|
29
|
-
padding: '$20 $
|
|
31
|
+
padding: '$20 $20 $10 $20',
|
|
30
32
|
backgroundColor: '$background',
|
|
31
33
|
position: 'relative',
|
|
32
34
|
overflowY: 'auto',
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
import type { PropTypes, Ref } from './Layout.types';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
Divider,
|
|
7
|
-
Header,
|
|
8
|
-
theme,
|
|
9
|
-
usePaddingRight,
|
|
10
|
-
} from '@rango-dev/ui';
|
|
11
|
-
import React, { useRef } from 'react';
|
|
4
|
+
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
5
|
+
import React from 'react';
|
|
12
6
|
import { useNavigate } from 'react-router-dom';
|
|
13
7
|
|
|
14
8
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
15
9
|
import { useUiStore } from '../../store/ui';
|
|
16
10
|
import { useWalletsStore } from '../../store/wallets';
|
|
11
|
+
import { getContainer } from '../../utils/common';
|
|
17
12
|
import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
|
|
18
13
|
|
|
19
14
|
import { Container, Content, Footer } from './Layout.styles';
|
|
20
15
|
|
|
21
|
-
const DEFAULT_CONTENT_PADDING = 20;
|
|
22
|
-
|
|
23
16
|
function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
24
17
|
const {
|
|
25
18
|
children,
|
|
@@ -35,13 +28,6 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
35
28
|
useUiStore.use.connectWalletsButtonDisabled();
|
|
36
29
|
const navigate = useNavigate();
|
|
37
30
|
|
|
38
|
-
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
39
|
-
|
|
40
|
-
usePaddingRight({
|
|
41
|
-
element: contentRef.current,
|
|
42
|
-
paddingRight: noPadding ? '0' : theme.sizes[DEFAULT_CONTENT_PADDING],
|
|
43
|
-
});
|
|
44
|
-
|
|
45
31
|
const onConnectWallet = () => {
|
|
46
32
|
if (!connectWalletsButtonDisabled) {
|
|
47
33
|
navigate('/' + navigationRoutes.wallets);
|
|
@@ -57,6 +43,7 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
57
43
|
{header.suffix}
|
|
58
44
|
{header.hasConnectWallet && (
|
|
59
45
|
<WalletButton
|
|
46
|
+
container={getContainer()}
|
|
60
47
|
onClick={onConnectWallet}
|
|
61
48
|
isConnected={!!connectedWallets?.length}
|
|
62
49
|
/>
|
|
@@ -65,9 +52,7 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
65
52
|
</>
|
|
66
53
|
}
|
|
67
54
|
/>
|
|
68
|
-
<Content noPadding={noPadding}
|
|
69
|
-
{children}
|
|
70
|
-
</Content>
|
|
55
|
+
<Content noPadding={noPadding}>{children}</Content>
|
|
71
56
|
{(hasLogo || footer) && (
|
|
72
57
|
<Footer>
|
|
73
58
|
<div className="footer__content">{footer}</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { StepSkeletonPropsTypes } from './LoadingSwapDetails.types';
|
|
2
|
+
|
|
3
|
+
import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { StepContainer } from './LoadingSwapDetails.styles';
|
|
7
|
+
|
|
8
|
+
export function LoadingSwapDetailStep(props: StepSkeletonPropsTypes) {
|
|
9
|
+
const { extraInfo } = props;
|
|
10
|
+
return (
|
|
11
|
+
<StepContainer>
|
|
12
|
+
<div className="step-title">
|
|
13
|
+
<Skeleton height={28} width={28} variant="circular" />
|
|
14
|
+
<Divider direction="horizontal" size={8} />
|
|
15
|
+
<Skeleton height={15} width={148} variant="rounded" />
|
|
16
|
+
</div>
|
|
17
|
+
<div className="step-tokens">
|
|
18
|
+
<Divider direction="horizontal" size={20} />
|
|
19
|
+
<div className="step-token-info">
|
|
20
|
+
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
21
|
+
<Divider direction="horizontal" size={8} />
|
|
22
|
+
<Skeleton height={12} width={76} variant="rounded" />
|
|
23
|
+
</div>
|
|
24
|
+
<div className="step-icon-container">
|
|
25
|
+
<NextIcon color="gray" size={16} />
|
|
26
|
+
</div>
|
|
27
|
+
<div className="step-token-info">
|
|
28
|
+
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
29
|
+
<Divider direction="horizontal" size={8} />
|
|
30
|
+
<Skeleton height={12} width={76} variant="rounded" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
{extraInfo && (
|
|
34
|
+
<div className="extra-info">
|
|
35
|
+
<Divider direction="horizontal" size={20} />
|
|
36
|
+
<Skeleton height={22} width={297} variant="rectangular" />
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
</StepContainer>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { styled } from '@rango-dev/ui';
|
|
2
|
+
|
|
3
|
+
export const Container = styled('div', {
|
|
4
|
+
width: '100%',
|
|
5
|
+
height: '100%',
|
|
6
|
+
padding: '$0 $20',
|
|
7
|
+
|
|
8
|
+
'.cost': {
|
|
9
|
+
paddingTop: '$15',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
'.route-summary': {
|
|
14
|
+
padding: '$15 $0',
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
'.route-summary-item': {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
'.token-amount': {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
'.route-summary-separator': {
|
|
30
|
+
width: '0px',
|
|
31
|
+
height: '$16',
|
|
32
|
+
borderLeft: '1px solid $neutral400',
|
|
33
|
+
marginLeft: '13px',
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
'.swaps-steps': {
|
|
37
|
+
paddingBottom: '$10',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const StepContainer = styled('div', {
|
|
42
|
+
backgroundColor: '$neutral100',
|
|
43
|
+
borderRadius: '$xm',
|
|
44
|
+
padding: '$10 $15',
|
|
45
|
+
|
|
46
|
+
'.step-title': {
|
|
47
|
+
display: 'flex',
|
|
48
|
+
justifyContent: 'start',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
},
|
|
51
|
+
'.step-tokens': {
|
|
52
|
+
paddingTop: '$5',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
},
|
|
56
|
+
'.step-token-info': {
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
},
|
|
60
|
+
'.step-icon-container': {
|
|
61
|
+
padding: '$4 $6',
|
|
62
|
+
display: 'flex',
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
'.extra-info': {
|
|
68
|
+
display: 'flex',
|
|
69
|
+
paddingTop: '$10',
|
|
70
|
+
paddingBottom: '$5',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
export const StepSeparator = styled('div', {
|
|
74
|
+
width: '0px',
|
|
75
|
+
height: '$20',
|
|
76
|
+
borderLeft: '1px dashed $neutral900',
|
|
77
|
+
marginLeft: '25px',
|
|
78
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { i18n } from '@lingui/core';
|
|
2
|
+
import { ChainToken, Divider, Skeleton, Typography } from '@rango-dev/ui';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { Container, StepSeparator } from './LoadingSwapDetails.styles';
|
|
6
|
+
import { LoadingSwapDetailStep } from './LoadingSwapDetailStep';
|
|
7
|
+
|
|
8
|
+
export function LoadingSwapDetails() {
|
|
9
|
+
const routeSummary = (
|
|
10
|
+
<div className="route-summary-item">
|
|
11
|
+
<div className="token-amount">
|
|
12
|
+
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
13
|
+
<Divider size={8} direction="horizontal" />
|
|
14
|
+
<Skeleton height={15} width={148} variant="rounded" />
|
|
15
|
+
</div>
|
|
16
|
+
<Skeleton height={12} width={64} variant="rounded" />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Container>
|
|
22
|
+
<div className="cost">
|
|
23
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
24
|
+
<Divider size={4} direction="horizontal" />
|
|
25
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
26
|
+
<Divider size={4} direction="horizontal" />
|
|
27
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div className="route-summary">
|
|
31
|
+
{routeSummary}
|
|
32
|
+
<div className="route-summary-separator"></div>
|
|
33
|
+
{routeSummary}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div className="swaps-steps">
|
|
37
|
+
<Typography variant="title" size="small">
|
|
38
|
+
{i18n.t('Swaps steps')}
|
|
39
|
+
</Typography>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div className="step-container">
|
|
43
|
+
<LoadingSwapDetailStep extraInfo />
|
|
44
|
+
<StepSeparator />
|
|
45
|
+
<LoadingSwapDetailStep />
|
|
46
|
+
<StepSeparator />
|
|
47
|
+
<LoadingSwapDetailStep />
|
|
48
|
+
<StepSeparator />
|
|
49
|
+
<LoadingSwapDetailStep />
|
|
50
|
+
</div>
|
|
51
|
+
</Container>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LoadingSwapDetails } from './LoadingSwapDetails';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Info } from './NoRoutes.types';
|
|
2
2
|
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
|
|
3
5
|
import { errorMessages } from '../../constants/errors';
|
|
4
6
|
|
|
5
7
|
export function makeInfo(
|
|
@@ -16,7 +18,7 @@ export function makeInfo(
|
|
|
16
18
|
text: errorMessages.genericServerError,
|
|
17
19
|
action: {
|
|
18
20
|
onClick: refetchBestRoute,
|
|
19
|
-
title: 'Retry',
|
|
21
|
+
title: i18n.t('Retry'),
|
|
20
22
|
},
|
|
21
23
|
},
|
|
22
24
|
description: '',
|
|
@@ -37,7 +39,7 @@ export function makeInfo(
|
|
|
37
39
|
text: errorMessages.liquiditySourcesError.title,
|
|
38
40
|
action: {
|
|
39
41
|
onClick: () => toggleAllLiquiditySources(true),
|
|
40
|
-
title: 'Reset',
|
|
42
|
+
title: i18n.t('Reset'),
|
|
41
43
|
},
|
|
42
44
|
},
|
|
43
45
|
description: errorMessages.liquiditySourcesError.description,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Notification } from '../../types/notification';
|
|
2
2
|
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
3
4
|
import {
|
|
4
5
|
ChainToken,
|
|
5
6
|
ChevronRightIcon,
|
|
@@ -22,20 +23,15 @@ export function NotificationContent() {
|
|
|
22
23
|
const navigate = useNavigate();
|
|
23
24
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
24
25
|
|
|
25
|
-
const getUnreadNotifications =
|
|
26
|
-
useNotificationStore.use.getUnreadNotifications();
|
|
26
|
+
const { getUnreadNotifications } = useNotificationStore();
|
|
27
27
|
|
|
28
28
|
const notifications: Notification[] = getUnreadNotifications();
|
|
29
|
-
|
|
30
|
-
const setAsRead = useNotificationStore.use.setAsRead();
|
|
31
|
-
|
|
32
29
|
const { tokens, blockchains } = useMetaStore.use.meta();
|
|
33
30
|
const sortedNotification = notifications
|
|
34
31
|
.sort((a, b) => b.creationTime - a.creationTime)
|
|
35
32
|
.slice(0, MAX_NOTIFICATIONS_DISPLAYED);
|
|
36
33
|
|
|
37
34
|
const handleOnClick = (requestId: Notification['requestId']) => {
|
|
38
|
-
setAsRead(requestId);
|
|
39
35
|
setSelectedSwap(requestId);
|
|
40
36
|
navigate(`/swaps/${requestId}`);
|
|
41
37
|
};
|
|
@@ -77,7 +73,7 @@ export function NotificationContent() {
|
|
|
77
73
|
onClick={() => handleOnClick(notificationItem.requestId)}
|
|
78
74
|
title={
|
|
79
75
|
<Typography variant="body" size="small" color="$neutral900">
|
|
80
|
-
{notificationItem.event.message}
|
|
76
|
+
{i18n.t(notificationItem.event.message)}
|
|
81
77
|
</Typography>
|
|
82
78
|
}
|
|
83
79
|
id={notificationItem.requestId}
|
|
@@ -2,7 +2,7 @@ import { styled } from '@rango-dev/ui';
|
|
|
2
2
|
|
|
3
3
|
export const Alerts = styled('div', {
|
|
4
4
|
width: '100%',
|
|
5
|
-
paddingTop: '$
|
|
5
|
+
paddingTop: '$10',
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
export const Flex = styled('div', {
|
|
@@ -24,4 +24,5 @@ export const Item = styled('div', {
|
|
|
24
24
|
export const Action = styled('div', {
|
|
25
25
|
padding: '$2',
|
|
26
26
|
alignSelf: 'flex-start',
|
|
27
|
+
cursor: 'pointer',
|
|
27
28
|
});
|