@lifi/widget 1.15.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/{SwapsInProgress/SwapsInProgress.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 +0 -0
- package/cjs/components/ChainSelect/ChainSelect.js +35 -0
- package/cjs/components/{SwapsInProgress/SwapsInProgress.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 +1 -9
- package/cjs/components/Header/NavigationHeader.js +6 -11
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.style.js +1 -0
- package/cjs/components/SendToWallet/SendToWallet.js +6 -6
- 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 +5 -12
- package/cjs/components/SwapButton/types.d.ts +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/cjs/components/TokenList/TokenList.js +6 -2
- 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 +2 -0
- package/cjs/hooks/index.js +2 -0
- package/cjs/hooks/useChains.d.ts +1 -97
- package/cjs/hooks/useChains.js +8 -15
- 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/useWidgetEvents.d.ts +3 -0
- package/cjs/hooks/useWidgetEvents.js +13 -0
- package/cjs/i18n/en/translation.json +13 -8
- package/cjs/i18n/index.d.ts +10 -5
- 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/{components/SwapsInProgress → pages/ActiveSwapsPage}/index.js +1 -1
- package/cjs/pages/MainPage/MainPage.js +2 -3
- 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/SelectTokenPage.d.ts +2 -4
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +4 -4
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- 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/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +25 -36
- package/cjs/pages/SwapPage/SwapPage.js +5 -1
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +39 -11
- package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -7
- 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/useSettingsStore.js +5 -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 +2 -1
- 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/{SwapsInProgress/SwapsInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
- 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 +0 -0
- package/components/ChainSelect/ChainSelect.js +31 -0
- package/components/{SwapsInProgress/SwapsInProgress.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 +1 -9
- package/components/Header/NavigationHeader.js +6 -11
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.style.js +1 -0
- package/components/SendToWallet/SendToWallet.js +6 -6
- 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 +6 -13
- package/components/SwapButton/types.d.ts +2 -2
- package/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/components/TokenList/TokenList.js +6 -2
- package/config/theme.js +24 -23
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/useChains.d.ts +1 -97
- package/hooks/useChains.js +8 -15
- 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/useWidgetEvents.d.ts +3 -0
- package/hooks/useWidgetEvents.js +6 -0
- package/i18n/en/translation.json +13 -8
- package/i18n/index.d.ts +10 -5
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +14 -13
- 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 -3
- 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/SelectTokenPage.d.ts +2 -4
- package/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/pages/SelectWalletPage/SelectWalletPage.js +5 -5
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- 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/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.js +27 -38
- package/pages/SwapPage/SwapPage.js +5 -1
- package/providers/SwapFormProvider/SwapFormProvider.js +39 -11
- package/providers/WidgetProvider/WidgetProvider.js +3 -7
- 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/useSettingsStore.js +5 -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 +2 -1
- 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/SwapsInProgress/SwapsInProgress.js +0 -29
- package/cjs/components/SwapsInProgress/SwapsInProgress.style.js +0 -17
- package/cjs/components/SwapsInProgress/index.d.ts +0 -1
- package/cjs/pages/SelectTokenPage/ChainSelect.js +0 -31
- 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/SwapsInProgress/SwapsInProgress.js +0 -25
- package/components/SwapsInProgress/SwapsInProgress.style.js +0 -14
- package/components/SwapsInProgress/index.d.ts +0 -1
- package/components/SwapsInProgress/index.js +0 -1
- package/pages/SelectTokenPage/ChainSelect.js +0 -27
- package/pages/SwapPage/utils.d.ts +0 -6
- package/stores/route/useExecutingRoutes.d.ts +0 -2
- package/stores/route/useExecutingRoutes.js +0 -6
package/App.js
CHANGED
|
@@ -6,7 +6,9 @@ import { Header } from './components/Header';
|
|
|
6
6
|
import { Initializer } from './components/Initializer';
|
|
7
7
|
import { NotFound } from './components/NotFound';
|
|
8
8
|
import { PoweredBy } from './components/PoweredBy';
|
|
9
|
+
import { ActiveSwapsPage } from './pages/ActiveSwapsPage';
|
|
9
10
|
import { MainPage } from './pages/MainPage';
|
|
11
|
+
import { SelectChainPage } from './pages/SelectChainPage';
|
|
10
12
|
import { SelectTokenPage } from './pages/SelectTokenPage';
|
|
11
13
|
import { SelectWalletPage } from './pages/SelectWalletPage';
|
|
12
14
|
import { SettingsPage } from './pages/SettingsPage';
|
|
@@ -39,10 +41,28 @@ const AppRoutes = () => {
|
|
|
39
41
|
path: navigationRoutes.toToken,
|
|
40
42
|
element: _jsx(SelectTokenPage, { formType: "to" }),
|
|
41
43
|
},
|
|
44
|
+
...[
|
|
45
|
+
navigationRoutes.fromChain,
|
|
46
|
+
`${navigationRoutes.fromToken}/${navigationRoutes.fromChain}`,
|
|
47
|
+
].map((path) => ({
|
|
48
|
+
path,
|
|
49
|
+
element: _jsx(SelectChainPage, { formType: "from" }),
|
|
50
|
+
})),
|
|
51
|
+
...[
|
|
52
|
+
navigationRoutes.toChain,
|
|
53
|
+
`${navigationRoutes.toToken}/${navigationRoutes.toChain}`,
|
|
54
|
+
].map((path) => ({
|
|
55
|
+
path,
|
|
56
|
+
element: _jsx(SelectChainPage, { formType: "to" }),
|
|
57
|
+
})),
|
|
42
58
|
{
|
|
43
59
|
path: navigationRoutes.swapRoutes,
|
|
44
60
|
element: _jsx(SwapRoutesPage, {}),
|
|
45
61
|
},
|
|
62
|
+
{
|
|
63
|
+
path: navigationRoutes.activeSwaps,
|
|
64
|
+
element: _jsx(ActiveSwapsPage, {}),
|
|
65
|
+
},
|
|
46
66
|
{
|
|
47
67
|
path: navigationRoutes.swapHistory,
|
|
48
68
|
element: _jsx(SwapHistoryPage, {}),
|
|
@@ -62,6 +82,7 @@ const AppRoutes = () => {
|
|
|
62
82
|
...[
|
|
63
83
|
navigationRoutes.swapExecution,
|
|
64
84
|
`${navigationRoutes.swapRoutes}/${navigationRoutes.swapExecution}`,
|
|
85
|
+
`${navigationRoutes.activeSwaps}/${navigationRoutes.swapExecution}`,
|
|
65
86
|
].map((path) => ({
|
|
66
87
|
path,
|
|
67
88
|
element: _jsx(SwapPage, {}),
|
package/cjs/App.js
CHANGED
|
@@ -9,7 +9,9 @@ const Header_1 = require("./components/Header");
|
|
|
9
9
|
const Initializer_1 = require("./components/Initializer");
|
|
10
10
|
const NotFound_1 = require("./components/NotFound");
|
|
11
11
|
const PoweredBy_1 = require("./components/PoweredBy");
|
|
12
|
+
const ActiveSwapsPage_1 = require("./pages/ActiveSwapsPage");
|
|
12
13
|
const MainPage_1 = require("./pages/MainPage");
|
|
14
|
+
const SelectChainPage_1 = require("./pages/SelectChainPage");
|
|
13
15
|
const SelectTokenPage_1 = require("./pages/SelectTokenPage");
|
|
14
16
|
const SelectWalletPage_1 = require("./pages/SelectWalletPage");
|
|
15
17
|
const SettingsPage_1 = require("./pages/SettingsPage");
|
|
@@ -44,10 +46,28 @@ const AppRoutes = () => {
|
|
|
44
46
|
path: utils_1.navigationRoutes.toToken,
|
|
45
47
|
element: (0, jsx_runtime_1.jsx)(SelectTokenPage_1.SelectTokenPage, { formType: "to" }),
|
|
46
48
|
},
|
|
49
|
+
...[
|
|
50
|
+
utils_1.navigationRoutes.fromChain,
|
|
51
|
+
`${utils_1.navigationRoutes.fromToken}/${utils_1.navigationRoutes.fromChain}`,
|
|
52
|
+
].map((path) => ({
|
|
53
|
+
path,
|
|
54
|
+
element: (0, jsx_runtime_1.jsx)(SelectChainPage_1.SelectChainPage, { formType: "from" }),
|
|
55
|
+
})),
|
|
56
|
+
...[
|
|
57
|
+
utils_1.navigationRoutes.toChain,
|
|
58
|
+
`${utils_1.navigationRoutes.toToken}/${utils_1.navigationRoutes.toChain}`,
|
|
59
|
+
].map((path) => ({
|
|
60
|
+
path,
|
|
61
|
+
element: (0, jsx_runtime_1.jsx)(SelectChainPage_1.SelectChainPage, { formType: "to" }),
|
|
62
|
+
})),
|
|
47
63
|
{
|
|
48
64
|
path: utils_1.navigationRoutes.swapRoutes,
|
|
49
65
|
element: (0, jsx_runtime_1.jsx)(SwapRoutesPage_1.SwapRoutesPage, {}),
|
|
50
66
|
},
|
|
67
|
+
{
|
|
68
|
+
path: utils_1.navigationRoutes.activeSwaps,
|
|
69
|
+
element: (0, jsx_runtime_1.jsx)(ActiveSwapsPage_1.ActiveSwapsPage, {}),
|
|
70
|
+
},
|
|
51
71
|
{
|
|
52
72
|
path: utils_1.navigationRoutes.swapHistory,
|
|
53
73
|
element: (0, jsx_runtime_1.jsx)(SwapHistoryPage_1.SwapHistoryPage, {}),
|
|
@@ -67,6 +87,7 @@ const AppRoutes = () => {
|
|
|
67
87
|
...[
|
|
68
88
|
utils_1.navigationRoutes.swapExecution,
|
|
69
89
|
`${utils_1.navigationRoutes.swapRoutes}/${utils_1.navigationRoutes.swapExecution}`,
|
|
90
|
+
`${utils_1.navigationRoutes.activeSwaps}/${utils_1.navigationRoutes.swapExecution}`,
|
|
70
91
|
].map((path) => ({
|
|
71
92
|
path,
|
|
72
93
|
element: (0, jsx_runtime_1.jsx)(SwapPage_1.SwapPage, {}),
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActiveSwapItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const StepTimer_1 = require("../Step/StepTimer");
|
|
11
|
+
const TokenAvatar_1 = require("../TokenAvatar");
|
|
12
|
+
const ActiveSwaps_style_1 = require("./ActiveSwaps.style");
|
|
13
|
+
const ActiveSwapItem = ({ routeId, dense }) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
16
|
+
const { route, status } = (0, hooks_1.useRouteExecution)(routeId, true);
|
|
17
|
+
// TODO: replace with ES2023 findLast
|
|
18
|
+
const lastActiveStep = route === null || route === void 0 ? void 0 : route.steps.slice().reverse().find((step) => step.execution);
|
|
19
|
+
const lastActiveProcess = (_a = lastActiveStep === null || lastActiveStep === void 0 ? void 0 : lastActiveStep.execution) === null || _a === void 0 ? void 0 : _a.process.at(-1);
|
|
20
|
+
const { title } = (0, hooks_1.useProcessMessage)(lastActiveStep, lastActiveProcess);
|
|
21
|
+
if (!route || !lastActiveStep) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
navigate(utils_1.navigationRoutes.swapExecution, { state: { routeId } });
|
|
26
|
+
};
|
|
27
|
+
const getStatusComponent = () => {
|
|
28
|
+
switch (lastActiveProcess === null || lastActiveProcess === void 0 ? void 0 : lastActiveProcess.status) {
|
|
29
|
+
case 'ACTION_REQUIRED':
|
|
30
|
+
return (0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "info", fontSize: "small" });
|
|
31
|
+
case 'FAILED':
|
|
32
|
+
return (0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "error", fontSize: "small" });
|
|
33
|
+
default:
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, fontWeight: 500 }, { children: (0, jsx_runtime_1.jsx)(StepTimer_1.StepTimer, { step: lastActiveStep, hideInProgress: true }) })));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const ListItemComponent = dense ? ActiveSwaps_style_1.ListItem : ActiveSwaps_style_1.ListItemButton;
|
|
38
|
+
return ((0, jsx_runtime_1.jsxs)(ListItemComponent, Object.assign({ onClick: handleClick, dense: true, disableRipple: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsxs)(TokenAvatar_1.TokenAvatarGroup, Object.assign({ total: 2 }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: route.fromToken }), (0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: route.toToken })] })) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { sx: { margin: 0 }, disableTypography: true, primary: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontWeight: 500, lineHeight: 1, sx: {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
marginLeft: 2,
|
|
42
|
+
height: 16,
|
|
43
|
+
} }, { children: [route.fromToken.symbol, (0, jsx_runtime_1.jsx)(icons_material_1.ArrowForward, { sx: { paddingX: 0.5 } }), route.toToken.symbol] })), secondary: status !== 'success' ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1, mt: 0.75, ml: 2 }, { children: title }))) : null }), getStatusComponent()] })));
|
|
44
|
+
};
|
|
45
|
+
exports.ActiveSwapItem = ActiveSwapItem;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActiveSwaps = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_i18next_1 = require("react-i18next");
|
|
7
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
8
|
+
const providers_1 = require("../../providers");
|
|
9
|
+
const stores_1 = require("../../stores");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const Card_1 = require("../Card");
|
|
12
|
+
const ActiveSwapItem_1 = require("./ActiveSwapItem");
|
|
13
|
+
const ActiveSwaps_style_1 = require("./ActiveSwaps.style");
|
|
14
|
+
const ActiveSwaps = (props) => {
|
|
15
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
16
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
17
|
+
const { account } = (0, providers_1.useWallet)();
|
|
18
|
+
const executingRoutes = (0, stores_1.useExecutingRoutesIds)(account.address);
|
|
19
|
+
if (!(executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const handleShowAll = () => {
|
|
23
|
+
navigate(utils_1.navigationRoutes.activeSwaps);
|
|
24
|
+
};
|
|
25
|
+
const hasShowAll = (executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length) > 2;
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(ActiveSwaps_style_1.ProgressCard, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('header.activeSwaps') }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => ((0, jsx_runtime_1.jsx)(ActiveSwapItem_1.ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? ((0, jsx_runtime_1.jsx)(ActiveSwaps_style_1.ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
|
|
27
|
+
padding: theme.spacing(0.75, 2),
|
|
28
|
+
}) }, { children: t('button.showAll') }))) : null] })));
|
|
29
|
+
};
|
|
30
|
+
exports.ActiveSwaps = ActiveSwaps;
|
|
@@ -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,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShowAllButton = exports.ListItem = exports.ListItemButton = exports.ProgressCard = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const ListItemSecondaryAction_1 = require("@mui/material/ListItemSecondaryAction");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const Card_1 = require("../Card");
|
|
9
|
+
exports.ProgressCard = (0, styles_1.styled)(Card_1.Card)(({ theme }) => ({
|
|
10
|
+
borderColor: (0, styles_1.alpha)(theme.palette.secondary.main, 0.48),
|
|
11
|
+
background: (0, styles_1.alpha)(theme.palette.secondary.main, 0.08),
|
|
12
|
+
'&:hover': {
|
|
13
|
+
background: (0, styles_1.alpha)(theme.palette.secondary.main, 0.08),
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
16
|
+
exports.ListItemButton = (0, styles_1.styled)(material_1.ListItemButton)(({ theme }) => ({
|
|
17
|
+
borderRadius: theme.shape.borderRadiusSecondary,
|
|
18
|
+
paddingLeft: theme.spacing(1.5),
|
|
19
|
+
paddingRight: theme.spacing(1.5),
|
|
20
|
+
height: 64,
|
|
21
|
+
'&:hover': {
|
|
22
|
+
backgroundColor: (0, utils_1.getContrastAlphaColor)(theme, '4%'),
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
exports.ListItem = (0, styles_1.styled)(material_1.ListItem, {
|
|
26
|
+
shouldForwardProp: (prop) => prop !== 'disableRipple',
|
|
27
|
+
})(({ theme }) => ({
|
|
28
|
+
padding: theme.spacing(0, 1.5),
|
|
29
|
+
[`.${ListItemSecondaryAction_1.listItemSecondaryActionClasses.root}`]: {
|
|
30
|
+
right: theme.spacing(3),
|
|
31
|
+
},
|
|
32
|
+
'&:hover': {
|
|
33
|
+
cursor: 'pointer',
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
36
|
+
exports.ShowAllButton = (0, styles_1.styled)(material_1.Button)(({ theme }) => ({
|
|
37
|
+
'&:hover': {
|
|
38
|
+
background: 'none',
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ActiveSwapItem"), exports);
|
|
18
|
+
__exportStar(require("./ActiveSwaps"), exports);
|
|
@@ -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 {};
|
|
@@ -3,33 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Card = void 0;
|
|
4
4
|
const material_1 = require("@mui/material");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const getBackgroundColor = (theme, variant) => variant === 'selected'
|
|
7
|
+
? theme.palette.mode === 'light'
|
|
8
|
+
? (0, styles_1.alpha)(theme.palette.primary.main, 0.04)
|
|
9
|
+
: (0, styles_1.alpha)(theme.palette.primary.main, 0.42)
|
|
10
|
+
: theme.palette.background.paper;
|
|
6
11
|
exports.Card = (0, styles_1.styled)(material_1.Box, {
|
|
7
12
|
shouldForwardProp: (prop) => !['dense', 'variant', 'indented'].includes(prop),
|
|
8
|
-
})(({ theme, variant, dense, indented, onClick }) =>
|
|
9
|
-
backgroundColor
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:
|
|
14
|
-
? theme.palette.
|
|
15
|
-
:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
13
|
+
})(({ theme, variant, dense, indented, onClick }) => {
|
|
14
|
+
const backgroundColor = getBackgroundColor(theme, variant);
|
|
15
|
+
return {
|
|
16
|
+
backgroundColor,
|
|
17
|
+
border: `1px solid`,
|
|
18
|
+
borderColor: variant === 'error'
|
|
19
|
+
? theme.palette.error.main
|
|
20
|
+
: variant === 'selected'
|
|
21
|
+
? theme.palette.primary.main
|
|
22
|
+
: theme.palette.mode === 'light'
|
|
23
|
+
? theme.palette.grey[300]
|
|
24
|
+
: theme.palette.grey[800],
|
|
25
|
+
borderRadius: dense
|
|
26
|
+
? theme.shape.borderRadiusSecondary
|
|
27
|
+
: theme.shape.borderRadius,
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
position: 'relative',
|
|
30
|
+
padding: indented ? theme.spacing(2) : 0,
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
'&:hover': {
|
|
33
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
34
|
+
backgroundColor: onClick
|
|
35
|
+
? theme.palette.mode === 'light'
|
|
36
|
+
? (0, styles_1.darken)(backgroundColor, 0.02)
|
|
37
|
+
: (0, styles_1.lighten)(backgroundColor, 0.02)
|
|
38
|
+
: theme.palette.background.paper,
|
|
39
|
+
},
|
|
40
|
+
transition: theme.transitions.create(['background-color'], {
|
|
41
|
+
duration: theme.transitions.duration.enteringScreen,
|
|
42
|
+
easing: theme.transitions.easing.easeOut,
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChainSelect = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
8
|
+
const providers_1 = require("../../providers");
|
|
9
|
+
const chains_1 = require("../../stores/chains");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const ChainSelect_style_1 = require("./ChainSelect.style");
|
|
12
|
+
const useChainSelect_1 = require("./useChainSelect");
|
|
13
|
+
const ChainSelect = ({ formType }) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
16
|
+
const { chains, getChains, setCurrentChain, isLoading } = (0, useChainSelect_1.useChainSelect)(formType);
|
|
17
|
+
const [chainId] = (0, react_hook_form_1.useWatch)({
|
|
18
|
+
name: [providers_1.SwapFormKeyHelper.getChainKey(formType)],
|
|
19
|
+
});
|
|
20
|
+
const showAllChains = () => {
|
|
21
|
+
navigate(utils_1.navigationRoutes[`${formType}Chain`], {
|
|
22
|
+
state: { formType },
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const chainsToHide = ((_a = chains === null || chains === void 0 ? void 0 : chains.length) !== null && _a !== void 0 ? _a : 0) - chains_1.maxChainToOrder;
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(ChainSelect_style_1.ChainContainer, { children: [isLoading
|
|
27
|
+
? Array.from({ length: chains_1.maxChainToOrder + 1 }).map((_, index) => ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 56, height: 56, sx: { borderRadius: 1 } }, index)))
|
|
28
|
+
: getChains().map((chain) => ((0, jsx_runtime_1.jsx)(ChainSelect_style_1.ChainCard, Object.assign({ onClick: () => setCurrentChain(chain.id), variant: chainId === chain.id ? 'selected' : 'default' }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: chain.logoURI, alt: chain.key, sx: { width: 40, height: 40 } }, { children: chain.name[0] })) }), chain.id))), chainsToHide > 0 ? ((0, jsx_runtime_1.jsx)(ChainSelect_style_1.ChainCard, Object.assign({ onClick: showAllChains }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: {
|
|
29
|
+
width: 40,
|
|
30
|
+
height: 40,
|
|
31
|
+
display: 'grid',
|
|
32
|
+
placeItems: 'center',
|
|
33
|
+
} }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontWeight: 500 }, { children: ["+", chainsToHide] })) })) }))) : null] }));
|
|
34
|
+
};
|
|
35
|
+
exports.ChainSelect = ChainSelect;
|
|
@@ -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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChainContainer = exports.ChainCard = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const Card_1 = require("../../components/Card");
|
|
7
|
+
exports.ChainCard = (0, styles_1.styled)(Card_1.Card)(({ theme }) => ({
|
|
8
|
+
display: 'grid',
|
|
9
|
+
placeItems: 'center',
|
|
10
|
+
width: 56,
|
|
11
|
+
height: 56,
|
|
12
|
+
}));
|
|
13
|
+
exports.ChainContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
14
|
+
display: 'grid',
|
|
15
|
+
gridTemplateColumns: 'repeat(auto-fit, 56px)',
|
|
16
|
+
gridAutoRows: '56px',
|
|
17
|
+
justifyContent: 'space-between',
|
|
18
|
+
gap: theme.spacing(1.5),
|
|
19
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ChainSelect"), exports);
|
|
18
|
+
__exportStar(require("./useChainSelect"), exports);
|
|
@@ -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
|
+
};
|