@lifi/widget 1.14.1 → 1.16.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/App.js +21 -0
- package/cjs/App.js +21 -0
- package/cjs/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
- package/cjs/components/ActiveSwaps/ActiveSwapItem.js +45 -0
- package/cjs/components/{SwapInProgress/SwapInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
- package/cjs/components/ActiveSwaps/ActiveSwaps.js +30 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +40 -0
- package/cjs/components/ActiveSwaps/index.d.ts +2 -0
- package/cjs/components/ActiveSwaps/index.js +18 -0
- package/cjs/components/Card/Card.d.ts +7 -4
- package/cjs/components/Card/Card.js +38 -28
- package/cjs/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.js +35 -0
- package/cjs/components/{SwapInProgress/SwapInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
- package/cjs/components/ChainSelect/ChainSelect.style.js +19 -0
- package/cjs/components/ChainSelect/index.d.ts +2 -0
- package/cjs/components/ChainSelect/index.js +18 -0
- package/cjs/components/ChainSelect/useChainSelect.d.ts +8 -0
- package/cjs/components/ChainSelect/useChainSelect.js +33 -0
- package/cjs/components/Header/Header.js +3 -11
- package/cjs/components/Header/NavigationHeader.js +10 -17
- package/cjs/components/Header/WalletHeader.js +4 -5
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.style.js +1 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +10 -10
- package/cjs/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +3 -3
- package/{components/SwapInProgress/SwapInProgress.d.ts → cjs/components/SendToWallet/SendToWallet.d.ts} +1 -1
- package/cjs/components/SendToWallet/SendToWallet.js +53 -0
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +19 -0
- package/cjs/components/SendToWallet/SendToWallet.style.js +15 -0
- package/cjs/components/SendToWallet/index.d.ts +1 -0
- package/cjs/components/{SwapInProgress → SendToWallet}/index.js +1 -1
- package/cjs/components/Step/CircularProgress.js +1 -1
- package/cjs/components/Step/CircularProgress.style.js +1 -1
- package/cjs/components/Step/StepProcess.js +1 -5
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/Step/StepTimer.d.ts +1 -0
- package/cjs/components/Step/StepTimer.js +6 -6
- package/cjs/components/SwapButton/SwapButton.js +10 -14
- package/cjs/components/SwapButton/types.d.ts +2 -2
- package/cjs/components/SwapInput/FormPriceHelperText.d.ts +1 -1
- package/cjs/components/SwapInput/FormPriceHelperText.js +4 -4
- package/cjs/components/SwapInput/SwapInput.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInput.js +4 -4
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.js +4 -4
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +5 -4
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +3 -3
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/cjs/components/TokenList/TokenList.js +14 -11
- package/cjs/components/TokenList/types.d.ts +1 -1
- package/cjs/config/theme.js +24 -23
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +3 -0
- package/cjs/hooks/index.js +3 -0
- package/cjs/hooks/useChains.d.ts +1 -97
- package/cjs/hooks/useChains.js +8 -15
- package/cjs/hooks/useNavigateBack.d.ts +4 -0
- package/cjs/hooks/useNavigateBack.js +18 -0
- package/cjs/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
- package/cjs/{components/Step/utils.js → hooks/useProcessMessage.js} +16 -10
- package/cjs/hooks/useRouteExecution.d.ts +1 -1
- package/cjs/hooks/useRouteExecution.js +20 -29
- package/cjs/hooks/useSwapRoutes.js +18 -7
- package/cjs/hooks/useWidgetEvents.d.ts +3 -0
- package/cjs/hooks/useWidgetEvents.js +13 -0
- package/cjs/i18n/en/translation.json +25 -15
- package/cjs/i18n/index.d.ts +20 -10
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +18 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -0
- package/cjs/pages/ActiveSwapsPage/index.d.ts +1 -0
- package/cjs/pages/ActiveSwapsPage/index.js +17 -0
- package/cjs/pages/MainPage/MainPage.js +2 -2
- package/cjs/pages/MainPage/MainSwapButton.js +3 -1
- package/cjs/pages/MainPage/SwapRoutes.js +4 -1
- package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.js +33 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.style.js +20 -0
- package/cjs/pages/SelectChainPage/index.d.ts +1 -0
- package/cjs/pages/SelectChainPage/index.js +17 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +3 -3
- package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -8
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +10 -10
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- package/cjs/pages/SettingsPage/AdvancedPreferences.js +2 -2
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +3 -6
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +3 -5
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +5 -1
- package/cjs/pages/SettingsPage/SettingsPage.js +2 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +2 -0
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +22 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/cjs/pages/SwapPage/StatusBottomSheet.js +29 -41
- package/cjs/pages/SwapPage/SwapPage.js +7 -3
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +43 -9
- package/cjs/providers/SwapFormProvider/types.d.ts +3 -1
- package/cjs/providers/SwapFormProvider/types.js +1 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +10 -4
- package/cjs/providers/WalletProvider/types.d.ts +4 -2
- package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -7
- package/cjs/providers/index.d.ts +4 -0
- package/cjs/providers/index.js +20 -0
- package/cjs/stores/chains/index.d.ts +4 -0
- package/cjs/stores/chains/index.js +20 -0
- package/cjs/stores/chains/types.d.ts +8 -0
- package/cjs/stores/chains/types.js +2 -0
- package/cjs/stores/chains/useChainOrder.d.ts +1 -0
- package/cjs/stores/chains/useChainOrder.js +12 -0
- package/cjs/stores/chains/useChainOrderStore.d.ts +19 -0
- package/cjs/stores/chains/useChainOrderStore.js +42 -0
- package/cjs/stores/chains/useInitializeChainOrder.d.ts +1 -0
- package/cjs/stores/chains/useInitializeChainOrder.js +12 -0
- package/cjs/stores/route/index.d.ts +2 -1
- package/cjs/stores/route/index.js +2 -1
- package/cjs/stores/route/useExecutingRoutesIds.d.ts +1 -0
- package/cjs/stores/route/useExecutingRoutesIds.js +20 -0
- package/cjs/stores/route/useRouteStore.js +5 -4
- package/cjs/stores/route/utils.d.ts +4 -0
- package/cjs/stores/route/utils.js +21 -0
- package/cjs/stores/settings/types.d.ts +2 -1
- package/cjs/stores/settings/useSettingsStore.d.ts +4 -2
- package/cjs/stores/settings/useSettingsStore.js +6 -2
- package/cjs/types/events.d.ts +5 -0
- package/cjs/types/events.js +9 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/widget.d.ts +3 -1
- package/cjs/utils/format.js +7 -2
- package/cjs/utils/navigationRoutes.d.ts +5 -0
- package/cjs/utils/navigationRoutes.js +31 -4
- package/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
- package/components/ActiveSwaps/ActiveSwapItem.js +41 -0
- package/components/ActiveSwaps/ActiveSwaps.d.ts +3 -0
- package/components/ActiveSwaps/ActiveSwaps.js +26 -0
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
- package/components/ActiveSwaps/ActiveSwaps.style.js +37 -0
- package/components/ActiveSwaps/index.d.ts +2 -0
- package/components/ActiveSwaps/index.js +2 -0
- package/components/Card/Card.d.ts +7 -4
- package/components/Card/Card.js +39 -29
- package/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.js +31 -0
- package/components/{SwapInProgress/SwapInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
- package/components/ChainSelect/ChainSelect.style.js +16 -0
- package/components/ChainSelect/index.d.ts +2 -0
- package/components/ChainSelect/index.js +2 -0
- package/components/ChainSelect/useChainSelect.d.ts +8 -0
- package/components/ChainSelect/useChainSelect.js +29 -0
- package/components/Header/Header.js +2 -10
- package/components/Header/NavigationHeader.js +11 -18
- package/components/Header/WalletHeader.js +1 -2
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.style.js +1 -0
- package/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
- package/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
- package/components/SelectTokenButton/SelectTokenButton.js +1 -1
- package/components/SendToWallet/SendToWallet.d.ts +3 -0
- package/components/SendToWallet/SendToWallet.js +49 -0
- package/components/SendToWallet/SendToWallet.style.d.ts +19 -0
- package/components/SendToWallet/SendToWallet.style.js +12 -0
- package/components/SendToWallet/index.d.ts +1 -0
- package/components/SendToWallet/index.js +1 -0
- package/components/Step/CircularProgress.js +3 -3
- package/components/Step/CircularProgress.style.js +1 -1
- package/components/Step/StepProcess.js +2 -6
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/Step/StepTimer.d.ts +1 -0
- package/components/Step/StepTimer.js +6 -6
- package/components/SwapButton/SwapButton.js +7 -11
- package/components/SwapButton/types.d.ts +2 -2
- package/components/SwapInput/FormPriceHelperText.d.ts +1 -1
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.d.ts +1 -1
- package/components/SwapInput/SwapInput.js +1 -1
- package/components/SwapInput/SwapInputAdornment.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.js +1 -1
- package/components/SwapRouteCard/SwapRouteCard.js +5 -4
- package/components/SwapRouteCard/SwapRouteCard.style.js +3 -3
- package/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/components/TokenList/TokenList.js +7 -4
- package/components/TokenList/types.d.ts +1 -1
- package/config/theme.js +24 -23
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/index.js +3 -0
- package/hooks/useChains.d.ts +1 -97
- package/hooks/useChains.js +8 -15
- package/hooks/useNavigateBack.d.ts +4 -0
- package/hooks/useNavigateBack.js +14 -0
- package/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
- package/{pages/SwapPage/utils.js → hooks/useProcessMessage.js} +15 -10
- package/hooks/useRouteExecution.d.ts +1 -1
- package/hooks/useRouteExecution.js +21 -30
- package/hooks/useSwapRoutes.js +18 -7
- package/hooks/useWidgetEvents.d.ts +3 -0
- package/hooks/useWidgetEvents.js +6 -0
- package/i18n/en/translation.json +25 -15
- package/i18n/index.d.ts +20 -10
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +17 -19
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +14 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +17 -0
- package/pages/ActiveSwapsPage/index.d.ts +1 -0
- package/pages/ActiveSwapsPage/index.js +1 -0
- package/pages/MainPage/MainPage.js +2 -2
- package/pages/MainPage/MainSwapButton.js +3 -1
- package/pages/MainPage/SwapRoutes.js +4 -1
- package/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
- package/pages/SelectChainPage/SelectChainPage.js +29 -0
- package/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
- package/pages/SelectChainPage/SelectChainPage.style.js +17 -0
- package/pages/SelectChainPage/index.d.ts +1 -0
- package/pages/SelectChainPage/index.js +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.js +1 -1
- package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
- package/pages/SelectTokenPage/SelectTokenPage.js +5 -9
- package/pages/SelectWalletPage/SelectWalletPage.js +10 -10
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- package/pages/SettingsPage/AdvancedPreferences.js +2 -2
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +1 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledBridgesSelect.js +4 -7
- package/pages/SettingsPage/EnabledExchangesSelect.js +4 -6
- package/pages/SettingsPage/RoutePrioritySelect.js +5 -1
- package/pages/SettingsPage/SettingsPage.js +2 -1
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +2 -0
- package/pages/SettingsPage/ShowDestinationWallet.js +18 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +5 -4
- package/pages/SwapHistoryPage/SwapHistoryPage.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.js +30 -42
- package/pages/SwapPage/SwapPage.js +9 -5
- package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -0
- package/providers/SwapFormProvider/SwapFormProvider.js +43 -9
- package/providers/SwapFormProvider/types.d.ts +3 -1
- package/providers/SwapFormProvider/types.js +1 -0
- package/providers/WalletProvider/WalletProvider.js +10 -4
- package/providers/WalletProvider/types.d.ts +4 -2
- package/providers/WidgetProvider/WidgetProvider.js +3 -7
- package/providers/index.d.ts +4 -0
- package/providers/index.js +4 -0
- package/stores/chains/index.d.ts +4 -0
- package/stores/chains/index.js +4 -0
- package/stores/chains/types.d.ts +8 -0
- package/stores/chains/types.js +1 -0
- package/stores/chains/useChainOrder.d.ts +1 -0
- package/stores/chains/useChainOrder.js +5 -0
- package/stores/chains/useChainOrderStore.d.ts +19 -0
- package/stores/chains/useChainOrderStore.js +36 -0
- package/stores/chains/useInitializeChainOrder.d.ts +1 -0
- package/stores/chains/useInitializeChainOrder.js +5 -0
- package/stores/route/index.d.ts +2 -1
- package/stores/route/index.js +2 -1
- package/stores/route/useExecutingRoutesIds.d.ts +1 -0
- package/stores/route/useExecutingRoutesIds.js +13 -0
- package/stores/route/useRouteStore.js +5 -4
- package/stores/route/utils.d.ts +4 -0
- package/stores/route/utils.js +15 -0
- package/stores/settings/types.d.ts +2 -1
- package/stores/settings/useSettingsStore.d.ts +4 -2
- package/stores/settings/useSettingsStore.js +6 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +5 -0
- package/types/events.js +6 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/widget.d.ts +3 -1
- package/utils/format.js +7 -2
- package/utils/navigationRoutes.d.ts +5 -0
- package/utils/navigationRoutes.js +30 -3
- package/cjs/components/SwapButton/SwapButton.style.d.ts +0 -65
- package/cjs/components/SwapButton/SwapButton.style.js +0 -15
- package/cjs/components/SwapInProgress/SwapInProgress.js +0 -29
- package/cjs/components/SwapInProgress/SwapInProgress.style.js +0 -17
- package/cjs/components/SwapInProgress/index.d.ts +0 -1
- package/cjs/pages/SelectTokenPage/ChainSelect.js +0 -32
- package/cjs/pages/SwapPage/utils.d.ts +0 -6
- package/cjs/pages/SwapPage/utils.js +0 -93
- package/cjs/stores/route/useExecutingRoutes.d.ts +0 -2
- package/cjs/stores/route/useExecutingRoutes.js +0 -13
- package/components/Step/utils.js +0 -89
- package/components/SwapButton/SwapButton.style.d.ts +0 -65
- package/components/SwapButton/SwapButton.style.js +0 -12
- package/components/SwapInProgress/SwapInProgress.js +0 -25
- package/components/SwapInProgress/SwapInProgress.style.js +0 -14
- package/components/SwapInProgress/index.d.ts +0 -1
- package/components/SwapInProgress/index.js +0 -1
- package/pages/SelectTokenPage/ChainSelect.js +0 -28
- package/pages/SwapPage/utils.d.ts +0 -6
- package/stores/route/useExecutingRoutes.d.ts +0 -2
- package/stores/route/useExecutingRoutes.js +0 -6
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.navigationRoutesValues = exports.navigationRoutes = void 0;
|
|
3
|
+
exports.backButtonRoutes = exports.stickyHeaderRoutes = exports.navigationRoutesValues = exports.navigationRoutes = void 0;
|
|
4
4
|
exports.navigationRoutes = {
|
|
5
5
|
home: '/',
|
|
6
|
-
selectWallet: '
|
|
6
|
+
selectWallet: 'wallet',
|
|
7
7
|
settings: 'settings',
|
|
8
|
-
fromToken: '
|
|
9
|
-
toToken: '
|
|
8
|
+
fromToken: 'from-token',
|
|
9
|
+
toToken: 'to-token',
|
|
10
|
+
fromChain: 'from-chain',
|
|
11
|
+
toChain: 'to-chain',
|
|
10
12
|
swapRoutes: 'swap-routes',
|
|
11
13
|
swapExecution: 'swap-execution',
|
|
12
14
|
swapHistory: 'swap-history',
|
|
15
|
+
activeSwaps: 'active-swaps',
|
|
13
16
|
swapDetails: 'swap-details',
|
|
14
17
|
};
|
|
15
18
|
exports.navigationRoutesValues = Object.values(exports.navigationRoutes);
|
|
19
|
+
exports.stickyHeaderRoutes = [
|
|
20
|
+
exports.navigationRoutes.selectWallet,
|
|
21
|
+
exports.navigationRoutes.fromChain,
|
|
22
|
+
exports.navigationRoutes.toChain,
|
|
23
|
+
exports.navigationRoutes.settings,
|
|
24
|
+
exports.navigationRoutes.swapRoutes,
|
|
25
|
+
exports.navigationRoutes.swapExecution,
|
|
26
|
+
exports.navigationRoutes.swapHistory,
|
|
27
|
+
exports.navigationRoutes.activeSwaps,
|
|
28
|
+
exports.navigationRoutes.swapDetails,
|
|
29
|
+
];
|
|
30
|
+
exports.backButtonRoutes = [
|
|
31
|
+
exports.navigationRoutes.selectWallet,
|
|
32
|
+
exports.navigationRoutes.settings,
|
|
33
|
+
exports.navigationRoutes.swapHistory,
|
|
34
|
+
exports.navigationRoutes.activeSwaps,
|
|
35
|
+
exports.navigationRoutes.fromToken,
|
|
36
|
+
exports.navigationRoutes.toToken,
|
|
37
|
+
exports.navigationRoutes.fromChain,
|
|
38
|
+
exports.navigationRoutes.toChain,
|
|
39
|
+
exports.navigationRoutes.swapRoutes,
|
|
40
|
+
exports.navigationRoutes.swapExecution,
|
|
41
|
+
exports.navigationRoutes.swapDetails,
|
|
42
|
+
];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowForward as ArrowForwardIcon, Info as InfoIcon, Warning as WarningIcon, } from '@mui/icons-material';
|
|
3
|
+
import { ListItemAvatar, ListItemText, Typography } from '@mui/material';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import { useProcessMessage, useRouteExecution } from '../../hooks';
|
|
6
|
+
import { navigationRoutes } from '../../utils';
|
|
7
|
+
import { StepTimer } from '../Step/StepTimer';
|
|
8
|
+
import { TokenAvatar, TokenAvatarGroup } from '../TokenAvatar';
|
|
9
|
+
import { ListItem, ListItemButton } from './ActiveSwaps.style';
|
|
10
|
+
export const ActiveSwapItem = ({ routeId, dense }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const { route, status } = useRouteExecution(routeId, true);
|
|
14
|
+
// TODO: replace with ES2023 findLast
|
|
15
|
+
const lastActiveStep = route === null || route === void 0 ? void 0 : route.steps.slice().reverse().find((step) => step.execution);
|
|
16
|
+
const lastActiveProcess = (_a = lastActiveStep === null || lastActiveStep === void 0 ? void 0 : lastActiveStep.execution) === null || _a === void 0 ? void 0 : _a.process.at(-1);
|
|
17
|
+
const { title } = useProcessMessage(lastActiveStep, lastActiveProcess);
|
|
18
|
+
if (!route || !lastActiveStep) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const handleClick = () => {
|
|
22
|
+
navigate(navigationRoutes.swapExecution, { state: { routeId } });
|
|
23
|
+
};
|
|
24
|
+
const getStatusComponent = () => {
|
|
25
|
+
switch (lastActiveProcess === null || lastActiveProcess === void 0 ? void 0 : lastActiveProcess.status) {
|
|
26
|
+
case 'ACTION_REQUIRED':
|
|
27
|
+
return _jsx(InfoIcon, { color: "info", fontSize: "small" });
|
|
28
|
+
case 'FAILED':
|
|
29
|
+
return _jsx(WarningIcon, { color: "error", fontSize: "small" });
|
|
30
|
+
default:
|
|
31
|
+
return (_jsx(Typography, Object.assign({ fontSize: 14, fontWeight: 500 }, { children: _jsx(StepTimer, { step: lastActiveStep, hideInProgress: true }) })));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const ListItemComponent = dense ? ListItem : ListItemButton;
|
|
35
|
+
return (_jsxs(ListItemComponent, Object.assign({ onClick: handleClick, dense: true, disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsxs(TokenAvatarGroup, Object.assign({ total: 2 }, { children: [_jsx(TokenAvatar, { token: route.fromToken }), _jsx(TokenAvatar, { token: route.toToken })] })) }), _jsx(ListItemText, { sx: { margin: 0 }, disableTypography: true, primary: _jsxs(Typography, Object.assign({ fontWeight: 500, lineHeight: 1, sx: {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
marginLeft: 2,
|
|
39
|
+
height: 16,
|
|
40
|
+
} }, { children: [route.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { paddingX: 0.5 } }), route.toToken.symbol] })), secondary: status !== 'success' ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1, mt: 0.75, ml: 2 }, { children: title }))) : null }), getStatusComponent()] })));
|
|
41
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Stack } from '@mui/material';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import { useWallet } from '../../providers';
|
|
6
|
+
import { useExecutingRoutesIds } from '../../stores';
|
|
7
|
+
import { navigationRoutes } from '../../utils';
|
|
8
|
+
import { CardTitle } from '../Card';
|
|
9
|
+
import { ActiveSwapItem } from './ActiveSwapItem';
|
|
10
|
+
import { ProgressCard, ShowAllButton } from './ActiveSwaps.style';
|
|
11
|
+
export const ActiveSwaps = (props) => {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const navigate = useNavigate();
|
|
14
|
+
const { account } = useWallet();
|
|
15
|
+
const executingRoutes = useExecutingRoutesIds(account.address);
|
|
16
|
+
if (!(executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const handleShowAll = () => {
|
|
20
|
+
navigate(navigationRoutes.activeSwaps);
|
|
21
|
+
};
|
|
22
|
+
const hasShowAll = (executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length) > 2;
|
|
23
|
+
return (_jsxs(ProgressCard, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('header.activeSwaps') }), _jsx(Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => (_jsx(ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? (_jsx(ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
|
|
24
|
+
padding: theme.spacing(0.75, 2),
|
|
25
|
+
}) }, { children: t('button.showAll') }))) : null] })));
|
|
26
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ProgressCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
component?: import("react").ElementType<any> | undefined;
|
|
5
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
|
+
variant?: ("default" | "error" | "selected") | undefined;
|
|
11
|
+
dense?: boolean | undefined;
|
|
12
|
+
indented?: boolean | undefined;
|
|
13
|
+
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
14
|
+
}, {}, {}>;
|
|
15
|
+
export declare const ListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
|
|
16
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
17
|
+
centerRipple?: boolean | undefined;
|
|
18
|
+
children?: import("react").ReactNode;
|
|
19
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
20
|
+
disabled?: boolean | undefined;
|
|
21
|
+
disableRipple?: boolean | undefined;
|
|
22
|
+
disableTouchRipple?: boolean | undefined;
|
|
23
|
+
focusRipple?: boolean | undefined;
|
|
24
|
+
focusVisibleClassName?: string | undefined;
|
|
25
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
26
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
27
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
28
|
+
tabIndex?: number | undefined;
|
|
29
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
30
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
31
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
32
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
33
|
+
}, "className" | "style" | "classes" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "autoFocus" | "dense" | "divider" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
34
|
+
export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
35
|
+
button?: false | undefined;
|
|
36
|
+
} & import("@mui/material").ListItemBaseProps & {
|
|
37
|
+
components?: {
|
|
38
|
+
Root?: import("react").ElementType<any> | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
componentsProps?: {
|
|
41
|
+
root?: (import("react").HTMLAttributes<HTMLDivElement> & import("@mui/material").ListItemComponentsPropsOverrides) | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
|
|
44
|
+
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
45
|
+
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
46
|
+
export declare const ShowAllButton: import("@emotion/styled").StyledComponent<{
|
|
47
|
+
children?: import("react").ReactNode;
|
|
48
|
+
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
49
|
+
color?: "inherit" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
|
|
50
|
+
disabled?: boolean | undefined;
|
|
51
|
+
disableElevation?: boolean | undefined;
|
|
52
|
+
disableFocusRipple?: boolean | undefined;
|
|
53
|
+
endIcon?: import("react").ReactNode;
|
|
54
|
+
fullWidth?: boolean | undefined;
|
|
55
|
+
href?: string | undefined;
|
|
56
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
57
|
+
startIcon?: import("react").ReactNode;
|
|
58
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
59
|
+
variant?: "text" | "outlined" | "contained" | undefined;
|
|
60
|
+
} & Omit<{
|
|
61
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
62
|
+
centerRipple?: boolean | undefined;
|
|
63
|
+
children?: import("react").ReactNode;
|
|
64
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
65
|
+
disabled?: boolean | undefined;
|
|
66
|
+
disableRipple?: boolean | undefined;
|
|
67
|
+
disableTouchRipple?: boolean | undefined;
|
|
68
|
+
focusRipple?: boolean | undefined;
|
|
69
|
+
focusVisibleClassName?: string | undefined;
|
|
70
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
71
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
72
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
73
|
+
tabIndex?: number | undefined;
|
|
74
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
75
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
76
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
77
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
78
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "size" | "startIcon" | "variant"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Button, ListItem as MuiListItem, ListItemButton as MuiListItemButton, } from '@mui/material';
|
|
2
|
+
import { listItemSecondaryActionClasses } from '@mui/material/ListItemSecondaryAction';
|
|
3
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
4
|
+
import { getContrastAlphaColor } from '../../utils';
|
|
5
|
+
import { Card } from '../Card';
|
|
6
|
+
export const ProgressCard = styled(Card)(({ theme }) => ({
|
|
7
|
+
borderColor: alpha(theme.palette.secondary.main, 0.48),
|
|
8
|
+
background: alpha(theme.palette.secondary.main, 0.08),
|
|
9
|
+
'&:hover': {
|
|
10
|
+
background: alpha(theme.palette.secondary.main, 0.08),
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
14
|
+
borderRadius: theme.shape.borderRadiusSecondary,
|
|
15
|
+
paddingLeft: theme.spacing(1.5),
|
|
16
|
+
paddingRight: theme.spacing(1.5),
|
|
17
|
+
height: 64,
|
|
18
|
+
'&:hover': {
|
|
19
|
+
backgroundColor: getContrastAlphaColor(theme, '4%'),
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
export const ListItem = styled(MuiListItem, {
|
|
23
|
+
shouldForwardProp: (prop) => prop !== 'disableRipple',
|
|
24
|
+
})(({ theme }) => ({
|
|
25
|
+
padding: theme.spacing(0, 1.5),
|
|
26
|
+
[`.${listItemSecondaryActionClasses.root}`]: {
|
|
27
|
+
right: theme.spacing(3),
|
|
28
|
+
},
|
|
29
|
+
'&:hover': {
|
|
30
|
+
cursor: 'pointer',
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
export const ShowAllButton = styled(Button)(({ theme }) => ({
|
|
34
|
+
'&:hover': {
|
|
35
|
+
background: 'none',
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import type { Theme } from '@mui/material';
|
|
1
2
|
import type { MouseEventHandler } from 'react';
|
|
2
|
-
|
|
3
|
+
declare type CardVariant = 'default' | 'selected' | 'error';
|
|
4
|
+
export declare const Card: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
|
|
3
5
|
children?: import("react").ReactNode;
|
|
4
6
|
component?: import("react").ElementType<any> | undefined;
|
|
5
7
|
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
-
sx?: import("@mui/material").SxProps<
|
|
8
|
+
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
7
9
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
10
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<
|
|
10
|
-
variant?:
|
|
11
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
12
|
+
variant?: CardVariant | undefined;
|
|
11
13
|
dense?: boolean | undefined;
|
|
12
14
|
indented?: boolean | undefined;
|
|
13
15
|
onClick?: MouseEventHandler<HTMLDivElement> | undefined;
|
|
14
16
|
}, {}, {}>;
|
|
17
|
+
export {};
|
package/components/Card/Card.js
CHANGED
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
import { Box } from '@mui/material';
|
|
2
|
-
import { darken, lighten, styled } from '@mui/material/styles';
|
|
2
|
+
import { alpha, darken, lighten, styled } from '@mui/material/styles';
|
|
3
|
+
const getBackgroundColor = (theme, variant) => variant === 'selected'
|
|
4
|
+
? theme.palette.mode === 'light'
|
|
5
|
+
? alpha(theme.palette.primary.main, 0.04)
|
|
6
|
+
: alpha(theme.palette.primary.main, 0.42)
|
|
7
|
+
: theme.palette.background.paper;
|
|
3
8
|
export const Card = styled(Box, {
|
|
4
9
|
shouldForwardProp: (prop) => !['dense', 'variant', 'indented'].includes(prop),
|
|
5
|
-
})(({ theme, variant, dense, indented, onClick }) =>
|
|
6
|
-
backgroundColor
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
:
|
|
11
|
-
? theme.palette.
|
|
12
|
-
:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
})(({ theme, variant, dense, indented, onClick }) => {
|
|
11
|
+
const backgroundColor = getBackgroundColor(theme, variant);
|
|
12
|
+
return {
|
|
13
|
+
backgroundColor,
|
|
14
|
+
border: `1px solid`,
|
|
15
|
+
borderColor: variant === 'error'
|
|
16
|
+
? theme.palette.error.main
|
|
17
|
+
: variant === 'selected'
|
|
18
|
+
? theme.palette.primary.main
|
|
19
|
+
: theme.palette.mode === 'light'
|
|
20
|
+
? theme.palette.grey[300]
|
|
21
|
+
: theme.palette.grey[800],
|
|
22
|
+
borderRadius: dense
|
|
23
|
+
? theme.shape.borderRadiusSecondary
|
|
24
|
+
: theme.shape.borderRadius,
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
position: 'relative',
|
|
27
|
+
padding: indented ? theme.spacing(2) : 0,
|
|
28
|
+
boxSizing: 'border-box',
|
|
29
|
+
'&:hover': {
|
|
30
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
31
|
+
backgroundColor: onClick
|
|
32
|
+
? theme.palette.mode === 'light'
|
|
33
|
+
? darken(backgroundColor, 0.02)
|
|
34
|
+
: lighten(backgroundColor, 0.02)
|
|
35
|
+
: theme.palette.background.paper,
|
|
36
|
+
},
|
|
37
|
+
transition: theme.transitions.create(['background-color'], {
|
|
38
|
+
duration: theme.transitions.duration.enteringScreen,
|
|
39
|
+
easing: theme.transitions.easing.easeOut,
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, Box, Skeleton, Typography } from '@mui/material';
|
|
3
|
+
import { useWatch } from 'react-hook-form';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import { SwapFormKeyHelper } from '../../providers';
|
|
6
|
+
import { maxChainToOrder } from '../../stores/chains';
|
|
7
|
+
import { navigationRoutes } from '../../utils';
|
|
8
|
+
import { ChainCard, ChainContainer } from './ChainSelect.style';
|
|
9
|
+
import { useChainSelect } from './useChainSelect';
|
|
10
|
+
export const ChainSelect = ({ formType }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const { chains, getChains, setCurrentChain, isLoading } = useChainSelect(formType);
|
|
14
|
+
const [chainId] = useWatch({
|
|
15
|
+
name: [SwapFormKeyHelper.getChainKey(formType)],
|
|
16
|
+
});
|
|
17
|
+
const showAllChains = () => {
|
|
18
|
+
navigate(navigationRoutes[`${formType}Chain`], {
|
|
19
|
+
state: { formType },
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const chainsToHide = ((_a = chains === null || chains === void 0 ? void 0 : chains.length) !== null && _a !== void 0 ? _a : 0) - maxChainToOrder;
|
|
23
|
+
return (_jsxs(ChainContainer, { children: [isLoading
|
|
24
|
+
? Array.from({ length: maxChainToOrder + 1 }).map((_, index) => (_jsx(Skeleton, { variant: "rectangular", width: 56, height: 56, sx: { borderRadius: 1 } }, index)))
|
|
25
|
+
: getChains().map((chain) => (_jsx(ChainCard, Object.assign({ onClick: () => setCurrentChain(chain.id), variant: chainId === chain.id ? 'selected' : 'default' }, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key, sx: { width: 40, height: 40 } }, { children: chain.name[0] })) }), chain.id))), chainsToHide > 0 ? (_jsx(ChainCard, Object.assign({ onClick: showAllChains }, { children: _jsx(Box, Object.assign({ sx: {
|
|
26
|
+
width: 40,
|
|
27
|
+
height: 40,
|
|
28
|
+
display: 'grid',
|
|
29
|
+
placeItems: 'center',
|
|
30
|
+
} }, { children: _jsxs(Typography, Object.assign({ fontWeight: 500 }, { children: ["+", chainsToHide] })) })) }))) : null] }));
|
|
31
|
+
};
|
package/components/{SwapInProgress/SwapInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts}
RENAMED
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const ChainCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
component?: import("react").ElementType<any> | undefined;
|
|
5
5
|
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
-
sx?: import("@mui/material
|
|
6
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
7
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
8
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material
|
|
10
|
-
variant?: "default" | "error" | undefined;
|
|
9
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
|
+
variant?: ("default" | "error" | "selected") | undefined;
|
|
11
11
|
dense?: boolean | undefined;
|
|
12
12
|
indented?: boolean | undefined;
|
|
13
13
|
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
14
14
|
}, {}, {}>;
|
|
15
|
-
export declare const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
subheader?: import("react").ReactNode;
|
|
21
|
-
subheaderTypographyProps?: import("@mui/material").TypographyProps<"span", {
|
|
22
|
-
component?: "span" | undefined;
|
|
23
|
-
}> | undefined;
|
|
24
|
-
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
25
|
-
title?: import("react").ReactNode;
|
|
26
|
-
titleTypographyProps?: import("@mui/material").TypographyProps<"span", {
|
|
27
|
-
component?: "span" | undefined;
|
|
28
|
-
}> | undefined;
|
|
15
|
+
export declare const ChainContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
16
|
+
children?: import("react").ReactNode;
|
|
17
|
+
component?: import("react").ElementType<any> | undefined;
|
|
18
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
19
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
29
20
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
30
21
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
31
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
22
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { Card } from '../../components/Card';
|
|
4
|
+
export const ChainCard = styled(Card)(({ theme }) => ({
|
|
5
|
+
display: 'grid',
|
|
6
|
+
placeItems: 'center',
|
|
7
|
+
width: 56,
|
|
8
|
+
height: 56,
|
|
9
|
+
}));
|
|
10
|
+
export const ChainContainer = styled(Box)(({ theme }) => ({
|
|
11
|
+
display: 'grid',
|
|
12
|
+
gridTemplateColumns: 'repeat(auto-fit, 56px)',
|
|
13
|
+
gridAutoRows: '56px',
|
|
14
|
+
justifyContent: 'space-between',
|
|
15
|
+
gap: theme.spacing(1.5),
|
|
16
|
+
}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EVMChain } from '@lifi/sdk';
|
|
2
|
+
import type { SwapFormDirection } from '../../providers';
|
|
3
|
+
export declare const useChainSelect: (formType: SwapFormDirection) => {
|
|
4
|
+
chains: EVMChain[] | undefined;
|
|
5
|
+
getChains: () => EVMChain[];
|
|
6
|
+
setCurrentChain: (chainId: number) => void;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form';
|
|
2
|
+
import { useChains } from '../../hooks';
|
|
3
|
+
import { SwapFormKey, SwapFormKeyHelper } from '../../providers';
|
|
4
|
+
import { useChainOrder } from '../../stores/chains';
|
|
5
|
+
export const useChainSelect = (formType) => {
|
|
6
|
+
const { setValue } = useFormContext();
|
|
7
|
+
const { chains, isLoading } = useChains();
|
|
8
|
+
const [chainOrder, setChainOrder] = useChainOrder();
|
|
9
|
+
const chainKey = SwapFormKeyHelper.getChainKey(formType);
|
|
10
|
+
const getChains = () => {
|
|
11
|
+
if (!chains) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const selectedChains = chainOrder
|
|
15
|
+
.map((chainId) => chains.find((chain) => chain.id === chainId))
|
|
16
|
+
.filter((chain) => chain);
|
|
17
|
+
return selectedChains;
|
|
18
|
+
};
|
|
19
|
+
const setCurrentChain = (chainId) => {
|
|
20
|
+
setValue(chainKey, chainId, { shouldDirty: true });
|
|
21
|
+
setValue(SwapFormKeyHelper.getTokenKey(formType), '', {
|
|
22
|
+
shouldDirty: false,
|
|
23
|
+
});
|
|
24
|
+
setValue(SwapFormKeyHelper.getAmountKey(formType), '');
|
|
25
|
+
setValue(SwapFormKey.TokenSearchFilter, '');
|
|
26
|
+
setChainOrder(chainId);
|
|
27
|
+
};
|
|
28
|
+
return { chains, getChains, setCurrentChain, isLoading };
|
|
29
|
+
};
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLocation } from 'react-router-dom';
|
|
3
|
-
import { useWidgetConfig } from '../../providers
|
|
4
|
-
import { ElementId,
|
|
3
|
+
import { useWidgetConfig } from '../../providers';
|
|
4
|
+
import { ElementId, stickyHeaderRoutes } from '../../utils';
|
|
5
5
|
import { Container } from './Header.style';
|
|
6
6
|
import { NavigationHeader } from './NavigationHeader';
|
|
7
7
|
import { WalletHeader } from './WalletHeader';
|
|
8
|
-
const stickyHeaderRoutes = [
|
|
9
|
-
navigationRoutes.selectWallet,
|
|
10
|
-
navigationRoutes.settings,
|
|
11
|
-
navigationRoutes.swapRoutes,
|
|
12
|
-
navigationRoutes.swapExecution,
|
|
13
|
-
navigationRoutes.swapHistory,
|
|
14
|
-
navigationRoutes.swapDetails,
|
|
15
|
-
];
|
|
16
8
|
const HeaderContainer = ({ children }) => {
|
|
17
9
|
const { pathname } = useLocation();
|
|
18
10
|
return (_jsx(Container, Object.assign({ id: ElementId.Header, sticky: stickyHeaderRoutes.some((route) => pathname.includes(route)) }, { children: children })));
|
|
@@ -2,32 +2,20 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { ArrowBack as ArrowBackIcon, History as HistoryIcon, SettingsOutlined as SettingsIcon, } from '@mui/icons-material';
|
|
3
3
|
import { Box, IconButton, Typography } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Route, Routes, useLocation
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
6
|
+
import { useNavigateBack } from '../../hooks';
|
|
7
|
+
import { useWallet } from '../../providers';
|
|
8
|
+
import { backButtonRoutes, navigationRoutes, navigationRoutesValues, } from '../../utils';
|
|
8
9
|
import { HeaderAppBar } from './Header.style';
|
|
9
10
|
import { useHeaderActionStore } from './useHeaderActionStore';
|
|
10
|
-
const backButtonRoutes = [
|
|
11
|
-
navigationRoutes.selectWallet,
|
|
12
|
-
navigationRoutes.settings,
|
|
13
|
-
navigationRoutes.swapHistory,
|
|
14
|
-
navigationRoutes.fromToken,
|
|
15
|
-
navigationRoutes.toToken,
|
|
16
|
-
navigationRoutes.swapRoutes,
|
|
17
|
-
navigationRoutes.swapExecution,
|
|
18
|
-
navigationRoutes.swapDetails,
|
|
19
|
-
];
|
|
20
11
|
export const NavigationHeader = () => {
|
|
21
12
|
const { t } = useTranslation();
|
|
22
|
-
const navigate =
|
|
13
|
+
const { navigate, navigateBack } = useNavigateBack();
|
|
23
14
|
const { account } = useWallet();
|
|
24
15
|
const { element } = useHeaderActionStore();
|
|
25
16
|
const { pathname } = useLocation();
|
|
26
17
|
const path = pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
27
18
|
const hasPath = navigationRoutesValues.includes(path);
|
|
28
|
-
const handleBack = () => {
|
|
29
|
-
navigate(-1);
|
|
30
|
-
};
|
|
31
19
|
const handleHeaderTitle = () => {
|
|
32
20
|
switch (path) {
|
|
33
21
|
case navigationRoutes.selectWallet:
|
|
@@ -40,8 +28,13 @@ export const NavigationHeader = () => {
|
|
|
40
28
|
return t(`header.from`);
|
|
41
29
|
case navigationRoutes.toToken:
|
|
42
30
|
return t(`header.to`);
|
|
31
|
+
case navigationRoutes.fromChain:
|
|
32
|
+
case navigationRoutes.toChain:
|
|
33
|
+
return t(`header.selectChain`);
|
|
43
34
|
case navigationRoutes.swapRoutes:
|
|
44
35
|
return t(`header.routes`);
|
|
36
|
+
case navigationRoutes.activeSwaps:
|
|
37
|
+
return t(`header.activeSwaps`);
|
|
45
38
|
case navigationRoutes.swapExecution:
|
|
46
39
|
return t(`header.swap`);
|
|
47
40
|
case navigationRoutes.swapDetails:
|
|
@@ -50,5 +43,5 @@ export const NavigationHeader = () => {
|
|
|
50
43
|
return t(`header.swap`);
|
|
51
44
|
}
|
|
52
45
|
};
|
|
53
|
-
return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick:
|
|
46
|
+
return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: navigateBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) }))) : null, _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(navigationRoutes.settings) }, { children: _jsx(SettingsIcon, {}) }))] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] })));
|
|
54
47
|
};
|