@rango-dev/widget-embedded 0.23.1-next.3 → 0.23.1-next.31
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/dist/components/AppRouter.d.ts +1 -6
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -283
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +489 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/InProgressTransactionBadge.d.ts +4 -0
- package/dist/components/HeaderButtons/InProgressTransactionBadge.d.ts.map +1 -0
- package/dist/components/HeaderButtons/RefreshButton.d.ts.map +1 -1
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
- package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.helpers.d.ts +8 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.styles.d.ts +167 -1
- package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.types.d.ts +1 -0
- package/dist/components/NoResult/NoResult.types.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +165 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +1 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quote/QuoteTrigger.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +3 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
- package/dist/components/Quotes/Quotes.d.ts.map +1 -1
- package/dist/components/Quotes/Quotes.types.d.ts +1 -0
- package/dist/components/Quotes/Quotes.types.d.ts.map +1 -1
- package/dist/components/Quotes/SelectStrategy.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/common/ActivateTabAlert/ActivateTabAlert.d.ts.map +1 -1
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/languages.d.ts.map +1 -1
- package/dist/constants/navigationRoutes.d.ts +0 -1
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/searchFor.d.ts +7 -0
- package/dist/constants/searchFor.d.ts.map +1 -0
- package/dist/constants/settings.d.ts +6 -0
- package/dist/constants/settings.d.ts.map +1 -0
- package/dist/containers/App/App.d.ts.map +1 -1
- package/dist/containers/App/App.styles.d.ts.map +1 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.d.ts.map +1 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts +3 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -1
- package/dist/containers/Inputs/Inputs.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- package/dist/containers/Settings/Lists.d.ts +3 -0
- package/dist/containers/Settings/Lists.d.ts.map +1 -0
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.types.d.ts +13 -2
- package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -1
- package/dist/containers/Widget/Widget.d.ts.map +1 -1
- package/dist/hooks/useBootstrap/index.d.ts +2 -0
- package/dist/hooks/useBootstrap/index.d.ts.map +1 -0
- package/dist/hooks/useBootstrap/useBootstrap.d.ts +2 -0
- package/dist/hooks/useBootstrap/useBootstrap.d.ts.map +1 -0
- package/dist/hooks/useScreenDetect.d.ts +9 -0
- package/dist/hooks/useScreenDetect.d.ts.map +1 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/store/AppStore.d.ts +2 -2
- package/dist/store/app.d.ts +2 -2
- package/dist/store/slices/data.d.ts +3 -1
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/slices/settings.d.ts.map +1 -1
- package/dist/types/config.d.ts +9 -5
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/colors.d.ts +5 -3
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/common.d.ts +4 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +2 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +2 -0
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/ui.d.ts +5 -2
- package/dist/utils/ui.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/components/AppRouter.tsx +1 -29
- package/src/components/AppRoutes.tsx +0 -5
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +6 -12
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +7 -11
- package/src/components/ConfirmWalletsModal/WalletList.tsx +2 -2
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +43 -2
- package/src/components/HeaderButtons/HeaderButtons.tsx +2 -0
- package/src/components/HeaderButtons/InProgressTransactionBadge.tsx +26 -0
- package/src/components/HeaderButtons/RefreshButton.tsx +2 -1
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +10 -2
- package/src/components/HeaderButtons/WalletButton.tsx +26 -6
- package/src/components/Layout/Layout.styles.ts +3 -0
- package/src/components/Layout/Layout.tsx +4 -4
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +1 -1
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +4 -4
- package/src/components/NoResult/NoResult.helpers.ts +13 -0
- package/src/components/NoResult/NoResult.styles.ts +19 -1
- package/src/components/NoResult/NoResult.tsx +27 -16
- package/src/components/NoResult/NoResult.types.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.styles.ts +14 -1
- package/src/components/NotificationContent/NotificationContent.tsx +49 -39
- package/src/components/Quote/Quote.styles.ts +13 -14
- package/src/components/Quote/Quote.tsx +166 -145
- package/src/components/Quote/Quote.types.ts +1 -0
- package/src/components/Quote/QuoteTrigger.tsx +7 -8
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +10 -2
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +2 -2
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +2 -2
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +5 -4
- package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +7 -0
- package/src/components/QuoteSkeleton/StepSkeleton.tsx +1 -1
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +1 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +3 -3
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +1 -1
- package/src/components/Quotes/Quotes.tsx +33 -21
- package/src/components/Quotes/Quotes.types.ts +1 -0
- package/src/components/Quotes/SelectStrategy.tsx +3 -11
- package/src/components/Slippage/Slippage.tsx +11 -13
- package/src/components/SwapDetails/SwapDetails.tsx +3 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +5 -1
- package/src/components/TokenList/TokenList.tsx +9 -8
- package/src/components/common/ActivateTabAlert/ActivateTabAlert.tsx +2 -4
- package/src/constants/errors.ts +1 -1
- package/src/constants/index.ts +1 -1
- package/src/constants/languages.ts +27 -1
- package/src/constants/navigationRoutes.ts +0 -1
- package/src/constants/searchFor.ts +6 -0
- package/src/constants/settings.ts +5 -0
- package/src/containers/App/App.styles.ts +0 -4
- package/src/containers/App/App.tsx +4 -28
- package/src/containers/ExpandedQuotes/ExpandedQuotes.styles.ts +13 -0
- package/src/containers/ExpandedQuotes/ExpandedQuotes.tsx +5 -0
- package/src/containers/Inputs/Inputs.tsx +7 -1
- package/src/containers/QuoteInfo/QuoteInfo.tsx +2 -0
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +1 -0
- package/src/containers/Settings/Lists.tsx +280 -0
- package/src/containers/Wallets/Wallets.tsx +27 -10
- package/src/containers/Wallets/Wallets.types.ts +13 -2
- package/src/containers/Widget/Widget.tsx +13 -13
- package/src/hooks/useBootstrap/index.ts +1 -0
- package/src/hooks/useBootstrap/useBootstrap.ts +72 -0
- package/src/hooks/useScreenDetect.ts +49 -0
- package/src/hooks/useSwapInput.ts +7 -2
- package/src/hooks/useTheme.ts +1 -8
- package/src/hooks/useWalletList.ts +12 -0
- package/src/pages/ConfirmSwapPage.tsx +14 -5
- package/src/pages/Home.tsx +31 -7
- package/src/pages/LanguagePage.tsx +14 -1
- package/src/pages/LiquiditySourcePage.tsx +4 -3
- package/src/pages/SelectSwapItemsPage.tsx +2 -7
- package/src/pages/SettingsPage.tsx +6 -185
- package/src/store/slices/config.ts +2 -2
- package/src/store/slices/data.ts +82 -34
- package/src/store/slices/settings.ts +7 -3
- package/src/types/config.ts +9 -5
- package/src/utils/colors.ts +106 -75
- package/src/utils/common.ts +181 -0
- package/src/utils/configs.ts +12 -1
- package/src/utils/meta.ts +21 -0
- package/src/utils/swap.ts +12 -5
- package/src/utils/ui.ts +7 -5
- package/src/utils/wallets.ts +5 -47
- package/dist/hooks/useMobileDetect.d.ts +0 -3
- package/dist/hooks/useMobileDetect.d.ts.map +0 -1
- package/dist/pages/ThemePage.d.ts +0 -3
- package/dist/pages/ThemePage.d.ts.map +0 -1
- package/src/hooks/useMobileDetect.ts +0 -21
- package/src/pages/ThemePage.tsx +0 -90
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { ThemeMode } from '../../store/slices/settings';
|
|
2
|
+
import type { ListPropTypes, SvgIconProps } from '@rango-dev/ui';
|
|
3
|
+
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
5
|
+
import {
|
|
6
|
+
AutoThemeIcon,
|
|
7
|
+
BridgeIcon,
|
|
8
|
+
ChevronRightIcon,
|
|
9
|
+
DarkModeIcon,
|
|
10
|
+
Divider,
|
|
11
|
+
DoneIcon,
|
|
12
|
+
ExchangeIcon,
|
|
13
|
+
InfoIcon,
|
|
14
|
+
LanguageIcon,
|
|
15
|
+
LightModeIcon,
|
|
16
|
+
List,
|
|
17
|
+
ListItem,
|
|
18
|
+
ListItemButton,
|
|
19
|
+
Skeleton,
|
|
20
|
+
styled,
|
|
21
|
+
Switch,
|
|
22
|
+
Tabs,
|
|
23
|
+
Tooltip,
|
|
24
|
+
Typography,
|
|
25
|
+
} from '@rango-dev/ui';
|
|
26
|
+
import React from 'react';
|
|
27
|
+
import { useNavigate } from 'react-router-dom';
|
|
28
|
+
|
|
29
|
+
import { SlippageTooltipContainer as TooltipContainer } from '../../components/Slippage/Slippage.styles';
|
|
30
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
31
|
+
import { ThemeModeEnum } from '../../constants/settings';
|
|
32
|
+
import { useLanguage } from '../../hooks/useLanguage';
|
|
33
|
+
import { useAppStore } from '../../store/AppStore';
|
|
34
|
+
import { getContainer } from '../../utils/common';
|
|
35
|
+
import { getUniqueSwappersGroups, isFeatureHidden } from '../../utils/settings';
|
|
36
|
+
|
|
37
|
+
const ThemeSection = styled('div', {
|
|
38
|
+
width: '202px',
|
|
39
|
+
height: '$40',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const themesList = [
|
|
43
|
+
{
|
|
44
|
+
id: ThemeModeEnum.LIGHT,
|
|
45
|
+
icon: <LightModeIcon color="black" size={16} />,
|
|
46
|
+
tooltip: (
|
|
47
|
+
<Typography size="xsmall" variant="body">
|
|
48
|
+
{i18n.t('Light')}
|
|
49
|
+
</Typography>
|
|
50
|
+
),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: ThemeModeEnum.DARK,
|
|
54
|
+
icon: <DarkModeIcon color="black" size={14} />,
|
|
55
|
+
tooltip: (
|
|
56
|
+
<Typography size="xsmall" variant="body">
|
|
57
|
+
{i18n.t('Dark')}
|
|
58
|
+
</Typography>
|
|
59
|
+
),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: ThemeModeEnum.AUTO,
|
|
63
|
+
icon: <AutoThemeIcon color="black" size={16} />,
|
|
64
|
+
tooltip: (
|
|
65
|
+
<Typography size="xsmall" variant="body">
|
|
66
|
+
{i18n.t('Auto')}
|
|
67
|
+
</Typography>
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const getThemeIcon = (theme: ThemeMode) => {
|
|
73
|
+
const iconProps: SvgIconProps = { color: 'gray', size: 14 };
|
|
74
|
+
|
|
75
|
+
switch (theme) {
|
|
76
|
+
case 'auto':
|
|
77
|
+
return <AutoThemeIcon {...iconProps} />;
|
|
78
|
+
case 'dark':
|
|
79
|
+
return <DarkModeIcon {...iconProps} />;
|
|
80
|
+
default:
|
|
81
|
+
return <LightModeIcon {...iconProps} />;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export function SettingsLists() {
|
|
86
|
+
const navigate = useNavigate();
|
|
87
|
+
const { theme: themeConfig } = useAppStore().config;
|
|
88
|
+
const { setTheme, theme } = useAppStore();
|
|
89
|
+
const { activeLanguage, languages } = useLanguage();
|
|
90
|
+
const currentLanguage = languages.find(
|
|
91
|
+
(language) => language.local === activeLanguage
|
|
92
|
+
)?.label;
|
|
93
|
+
|
|
94
|
+
const fetchStatus = useAppStore().fetchStatus;
|
|
95
|
+
const swappers = useAppStore().swappers();
|
|
96
|
+
const disabledLiquiditySources = useAppStore().getDisabledLiquiditySources();
|
|
97
|
+
const {
|
|
98
|
+
config: { features },
|
|
99
|
+
} = useAppStore();
|
|
100
|
+
const isThemeHidden = isFeatureHidden('theme', features);
|
|
101
|
+
const isLiquidityHidden = isFeatureHidden('liquiditySource', features);
|
|
102
|
+
const isLanguageHidden = isFeatureHidden('language', features);
|
|
103
|
+
|
|
104
|
+
const infiniteApprove = useAppStore().infiniteApprove;
|
|
105
|
+
const toggleInfiniteApprove = useAppStore().toggleInfiniteApprove;
|
|
106
|
+
|
|
107
|
+
const supportedUniqueSwappersGroups = getUniqueSwappersGroups(
|
|
108
|
+
swappers,
|
|
109
|
+
disabledLiquiditySources
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const bridgeSources = supportedUniqueSwappersGroups.filter((uniqueItem) =>
|
|
113
|
+
['BRIDGE', 'AGGREGATOR', 'OFF_CHAIN'].includes(uniqueItem.type)
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const totalBridgeSources = bridgeSources.length;
|
|
117
|
+
const totalSelectedBridgeSources = bridgeSources.filter(
|
|
118
|
+
(uniqueItem) => uniqueItem.selected
|
|
119
|
+
).length;
|
|
120
|
+
|
|
121
|
+
const exchangeSources = supportedUniqueSwappersGroups.filter(
|
|
122
|
+
(uniqueItem) => uniqueItem.type === 'DEX'
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const totalExchangeSources = exchangeSources.length;
|
|
126
|
+
const totalSelectedExchangeSources = exchangeSources.filter(
|
|
127
|
+
(uniqueItem) => uniqueItem.selected
|
|
128
|
+
).length;
|
|
129
|
+
|
|
130
|
+
const handleSwapperEndItem = (totalSelected: number, total: number) => {
|
|
131
|
+
switch (fetchStatus) {
|
|
132
|
+
case 'loading':
|
|
133
|
+
return <Skeleton variant="text" size="medium" width={50} />;
|
|
134
|
+
case 'failed':
|
|
135
|
+
return (
|
|
136
|
+
<Typography variant="body" size="medium" color="$error500">
|
|
137
|
+
{i18n.t('Loading failed')}
|
|
138
|
+
</Typography>
|
|
139
|
+
);
|
|
140
|
+
default:
|
|
141
|
+
return (
|
|
142
|
+
<Typography variant="body" size="medium">
|
|
143
|
+
{`${totalSelected} / ${total}`}
|
|
144
|
+
</Typography>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const bridgeItem = {
|
|
150
|
+
id: 'bridge-item',
|
|
151
|
+
title: (
|
|
152
|
+
<Typography variant="title" size="xmedium">
|
|
153
|
+
{i18n.t('Enabled bridges')}
|
|
154
|
+
</Typography>
|
|
155
|
+
),
|
|
156
|
+
end: (
|
|
157
|
+
<>
|
|
158
|
+
{handleSwapperEndItem(totalSelectedBridgeSources, totalBridgeSources)}
|
|
159
|
+
<Divider direction="horizontal" size={8} />
|
|
160
|
+
<ChevronRightIcon color="black" />
|
|
161
|
+
</>
|
|
162
|
+
),
|
|
163
|
+
onClick: () => navigate(navigationRoutes.bridges),
|
|
164
|
+
start: <BridgeIcon color="gray" size={14} />,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const exchangeItem = {
|
|
168
|
+
id: 'exchange-item',
|
|
169
|
+
title: (
|
|
170
|
+
<Typography variant="title" size="xmedium">
|
|
171
|
+
{i18n.t('Enabled exchanges')}
|
|
172
|
+
</Typography>
|
|
173
|
+
),
|
|
174
|
+
end: (
|
|
175
|
+
<>
|
|
176
|
+
{handleSwapperEndItem(
|
|
177
|
+
totalSelectedExchangeSources,
|
|
178
|
+
totalExchangeSources
|
|
179
|
+
)}
|
|
180
|
+
<Divider direction="horizontal" size={8} />
|
|
181
|
+
<ChevronRightIcon color="gray" />
|
|
182
|
+
</>
|
|
183
|
+
),
|
|
184
|
+
start: <ExchangeIcon color="gray" size={14} />,
|
|
185
|
+
onClick: () => navigate(navigationRoutes.exchanges),
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const languageItem = {
|
|
189
|
+
id: 'language-item',
|
|
190
|
+
title: (
|
|
191
|
+
<Typography variant="title" size="xmedium">
|
|
192
|
+
{i18n.t('Language')}
|
|
193
|
+
</Typography>
|
|
194
|
+
),
|
|
195
|
+
start: <LanguageIcon color="gray" size={14} />,
|
|
196
|
+
end: (
|
|
197
|
+
<>
|
|
198
|
+
<Typography variant="body" size="medium">
|
|
199
|
+
{currentLanguage}
|
|
200
|
+
</Typography>
|
|
201
|
+
<Divider direction="horizontal" size={8} />
|
|
202
|
+
<ChevronRightIcon color="gray" />
|
|
203
|
+
</>
|
|
204
|
+
),
|
|
205
|
+
onClick: () => navigate(navigationRoutes.languages),
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const infiniteApprovalItem = {
|
|
209
|
+
id: 'infinite-approval-item',
|
|
210
|
+
title: (
|
|
211
|
+
<>
|
|
212
|
+
<Typography variant="title" size="xmedium">
|
|
213
|
+
{i18n.t('Infinite approval')}
|
|
214
|
+
</Typography>
|
|
215
|
+
<Divider direction="horizontal" size={4} />
|
|
216
|
+
<Tooltip
|
|
217
|
+
side="top"
|
|
218
|
+
sideOffset={4}
|
|
219
|
+
container={getContainer()}
|
|
220
|
+
content={
|
|
221
|
+
<TooltipContainer>
|
|
222
|
+
<Typography variant="label" size="medium" color="neutral700">
|
|
223
|
+
{i18n.t(
|
|
224
|
+
"Enabling the 'Infinite approval' mode grants unrestricted access to smart contracts of DEXes/Bridges, allowing them to utilize the approved token amount without limitations."
|
|
225
|
+
)}
|
|
226
|
+
</Typography>
|
|
227
|
+
</TooltipContainer>
|
|
228
|
+
}>
|
|
229
|
+
<InfoIcon color="gray" />
|
|
230
|
+
</Tooltip>
|
|
231
|
+
</>
|
|
232
|
+
),
|
|
233
|
+
start: <DoneIcon color="gray" size={14} />,
|
|
234
|
+
end: <Switch checked={infiniteApprove} />,
|
|
235
|
+
onClick: toggleInfiniteApprove,
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const themeItem = {
|
|
239
|
+
id: 'theme-item',
|
|
240
|
+
type: <ListItem />,
|
|
241
|
+
title: (
|
|
242
|
+
<Typography variant="title" size="xmedium">
|
|
243
|
+
{i18n.t('Theme')}
|
|
244
|
+
</Typography>
|
|
245
|
+
),
|
|
246
|
+
end: (
|
|
247
|
+
<ThemeSection>
|
|
248
|
+
<Tabs
|
|
249
|
+
container={getContainer()}
|
|
250
|
+
items={themesList}
|
|
251
|
+
value={theme}
|
|
252
|
+
onChange={(item) => setTheme(item.id as ThemeMode)}
|
|
253
|
+
type="primary"
|
|
254
|
+
borderRadius="small"
|
|
255
|
+
/>
|
|
256
|
+
</ThemeSection>
|
|
257
|
+
),
|
|
258
|
+
start: getThemeIcon(theme),
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const settingItems: ListPropTypes['items'] = isLiquidityHidden
|
|
262
|
+
? []
|
|
263
|
+
: [bridgeItem, exchangeItem];
|
|
264
|
+
|
|
265
|
+
if (!isLanguageHidden) {
|
|
266
|
+
settingItems.push(languageItem);
|
|
267
|
+
}
|
|
268
|
+
settingItems.push(infiniteApprovalItem);
|
|
269
|
+
|
|
270
|
+
if (!themeConfig?.singleTheme && !isThemeHidden) {
|
|
271
|
+
settingItems.push(themeItem);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return (
|
|
275
|
+
<List
|
|
276
|
+
type={<ListItemButton hasDivider id="_" onClick={() => console.log()} />}
|
|
277
|
+
items={settingItems}
|
|
278
|
+
/>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
OnWalletConnectionChange,
|
|
3
3
|
PropTypes,
|
|
4
4
|
WidgetContextInterface,
|
|
5
5
|
} from './Wallets.types';
|
|
@@ -10,7 +10,7 @@ import type { PropsWithChildren } from 'react';
|
|
|
10
10
|
import { Events, Provider } from '@rango-dev/wallets-react';
|
|
11
11
|
import { type Network } from '@rango-dev/wallets-shared';
|
|
12
12
|
import { isEvmBlockchain } from 'rango-sdk';
|
|
13
|
-
import React, { createContext, useEffect, useRef } from 'react';
|
|
13
|
+
import React, { createContext, useEffect, useMemo, useRef } from 'react';
|
|
14
14
|
|
|
15
15
|
import { useWalletProviders } from '../../hooks/useWalletProviders';
|
|
16
16
|
import { AppStoreProvider, useAppStore } from '../../store/AppStore';
|
|
@@ -25,6 +25,9 @@ export const WidgetContext = createContext<WidgetContextInterface>({
|
|
|
25
25
|
onConnectWallet: () => {
|
|
26
26
|
return;
|
|
27
27
|
},
|
|
28
|
+
onDisconnectWallet: () => {
|
|
29
|
+
return;
|
|
30
|
+
},
|
|
28
31
|
});
|
|
29
32
|
|
|
30
33
|
function Main(props: PropsWithChildren<PropTypes>) {
|
|
@@ -36,7 +39,8 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
36
39
|
};
|
|
37
40
|
const { providers } = useWalletProviders(props.config.wallets, walletOptions);
|
|
38
41
|
const { connectWallet, disconnectWallet } = useWalletsStore();
|
|
39
|
-
const onConnectWalletHandler = useRef<
|
|
42
|
+
const onConnectWalletHandler = useRef<OnWalletConnectionChange>();
|
|
43
|
+
const onDisconnectWalletHandler = useRef<OnWalletConnectionChange>();
|
|
40
44
|
|
|
41
45
|
useEffect(() => {
|
|
42
46
|
void fetchMeta().catch(console.log);
|
|
@@ -70,6 +74,13 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
70
74
|
}
|
|
71
75
|
} else {
|
|
72
76
|
disconnectWallet(type);
|
|
77
|
+
if (!!onDisconnectWalletHandler.current) {
|
|
78
|
+
onDisconnectWalletHandler.current(type);
|
|
79
|
+
} else {
|
|
80
|
+
console.warn(
|
|
81
|
+
`onDisconnectWallet handler hasn't been set. Are you sure?`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
73
84
|
}
|
|
74
85
|
}
|
|
75
86
|
if (event === Events.ACCOUNTS && state.connected) {
|
|
@@ -102,14 +113,20 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
102
113
|
};
|
|
103
114
|
const isActiveTab = useUiStore.use.isActiveTab();
|
|
104
115
|
|
|
116
|
+
const handlers = useMemo(
|
|
117
|
+
() => ({
|
|
118
|
+
onConnectWallet: (handler: OnWalletConnectionChange) => {
|
|
119
|
+
onConnectWalletHandler.current = handler;
|
|
120
|
+
},
|
|
121
|
+
onDisconnectWallet: (handler: OnWalletConnectionChange) => {
|
|
122
|
+
onDisconnectWalletHandler.current = handler;
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
[]
|
|
126
|
+
);
|
|
127
|
+
|
|
105
128
|
return (
|
|
106
|
-
<WidgetContext.Provider
|
|
107
|
-
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
108
|
-
value={{
|
|
109
|
-
onConnectWallet: (handler) => {
|
|
110
|
-
onConnectWalletHandler.current = handler;
|
|
111
|
-
},
|
|
112
|
-
}}>
|
|
129
|
+
<WidgetContext.Provider value={handlers}>
|
|
113
130
|
<Provider
|
|
114
131
|
allBlockChains={blockchains}
|
|
115
132
|
providers={providers}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import type { WidgetConfig } from '../../types';
|
|
2
2
|
import type { EventHandler } from '@rango-dev/wallets-react';
|
|
3
3
|
|
|
4
|
-
export type
|
|
4
|
+
export type OnWalletConnectionChange = (key: string) => void;
|
|
5
5
|
export interface WidgetContextInterface {
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* A wallet connection handler, utilized within the wallet provider,
|
|
8
|
+
* is linked to the useBootstrap hook for synchronizing the state of the last connected wallet.
|
|
9
|
+
* It's important not to override this handler in other locations.
|
|
10
|
+
*/
|
|
11
|
+
onConnectWallet(handler: OnWalletConnectionChange): void;
|
|
12
|
+
/**
|
|
13
|
+
* A wallet disconnection handler, utilized within the wallet provider,
|
|
14
|
+
* is linked to the useBootstrap hook for synchronizing the state of the last disconnected wallet.
|
|
15
|
+
* It's important not to override this handler in other locations.
|
|
16
|
+
*/
|
|
17
|
+
onDisconnectWallet(handler: OnWalletConnectionChange): void;
|
|
7
18
|
}
|
|
8
19
|
|
|
9
20
|
export interface PropTypes {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import type { WidgetProps } from './Widget.types';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
-
import React
|
|
4
|
+
import React from 'react';
|
|
5
5
|
|
|
6
|
+
import { AppRouter } from '../../components/AppRouter';
|
|
6
7
|
import { DEFAULT_CONFIG } from '../../store/slices/config';
|
|
7
|
-
import { tabManager } from '../../store/ui';
|
|
8
8
|
import { Main } from '../App';
|
|
9
9
|
import { WidgetProvider } from '../WidgetProvider';
|
|
10
10
|
|
|
11
11
|
export function Widget(props: PropsWithChildren<WidgetProps>) {
|
|
12
|
-
|
|
13
|
-
tabManager.init();
|
|
14
|
-
return tabManager.destroy;
|
|
15
|
-
}, []);
|
|
12
|
+
const isExternalWalletsEnabled = props.config?.externalWallets;
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
return (
|
|
15
|
+
<AppRouter>
|
|
16
|
+
{isExternalWalletsEnabled ? (
|
|
20
17
|
<Main />
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
) : (
|
|
19
|
+
<WidgetProvider config={props.config ?? DEFAULT_CONFIG}>
|
|
20
|
+
<Main />
|
|
21
|
+
</WidgetProvider>
|
|
22
|
+
)}
|
|
23
|
+
</AppRouter>
|
|
24
|
+
);
|
|
25
25
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useBootstrap } from './useBootstrap';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { WalletType } from '../..';
|
|
2
|
+
|
|
3
|
+
import { useQueueManager } from '@rango-dev/queue-manager-rango-preset';
|
|
4
|
+
import { splitWalletNetwork } from '@rango-dev/wallets-shared';
|
|
5
|
+
import { isEvmBlockchain } from 'rango-sdk';
|
|
6
|
+
import { useContext, useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useWallets } from '../..';
|
|
9
|
+
import { WidgetContext } from '../../containers/Wallets';
|
|
10
|
+
import { globalFont } from '../../globalStyles';
|
|
11
|
+
import { useAppStore } from '../../store/AppStore';
|
|
12
|
+
import { useNotificationStore } from '../../store/notification';
|
|
13
|
+
import { tabManager } from '../../store/ui';
|
|
14
|
+
import { useFetchApiConfig } from '../useFetchApiConfig';
|
|
15
|
+
import { useForceAutoConnect } from '../useForceAutoConnect';
|
|
16
|
+
|
|
17
|
+
export function useBootstrap() {
|
|
18
|
+
globalFont();
|
|
19
|
+
useForceAutoConnect();
|
|
20
|
+
const blockchains = useAppStore().blockchains();
|
|
21
|
+
const { canSwitchNetworkTo } = useWallets();
|
|
22
|
+
const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
|
|
23
|
+
useState('');
|
|
24
|
+
const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
|
|
25
|
+
const widgetContext = useContext(WidgetContext);
|
|
26
|
+
|
|
27
|
+
const evmChains = blockchains.filter(isEvmBlockchain);
|
|
28
|
+
|
|
29
|
+
const { fetchApiConfig } = useFetchApiConfig();
|
|
30
|
+
|
|
31
|
+
// At the moment, we only detect the disconnection of EVM wallets.
|
|
32
|
+
useQueueManager({
|
|
33
|
+
lastConnectedWallet: lastConnectedWalletWithNetwork,
|
|
34
|
+
clearDisconnectedWallet: () => {
|
|
35
|
+
setDisconnectedWallet(undefined);
|
|
36
|
+
},
|
|
37
|
+
disconnectedWallet: disconnectedWallet,
|
|
38
|
+
evmChains,
|
|
39
|
+
canSwitchNetworkTo,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
tabManager.init();
|
|
44
|
+
|
|
45
|
+
if (!useNotificationStore.persist.hasHydrated()) {
|
|
46
|
+
void useNotificationStore.persist.rehydrate();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Add handlers to the widget context for connecting and disconnecting wallets.
|
|
51
|
+
* We pass these handlers to the wallet provider to keep track of the last connected and last disconnected wallets.
|
|
52
|
+
* The 'queue-manager' uses these details to spot any changes in the connection status of the required wallet during the swap process.
|
|
53
|
+
*
|
|
54
|
+
* with this approch anyone who use the widget context can override these handlers and causes some bugs happens.
|
|
55
|
+
* it the future we should add a safer soloution like considering array of handlers .
|
|
56
|
+
* https://github.com/rango-exchange/rango-client/pull/630/files#r1518846728
|
|
57
|
+
*/
|
|
58
|
+
widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
|
|
59
|
+
widgetContext.onDisconnectWallet((walletType) => {
|
|
60
|
+
setDisconnectedWallet(walletType);
|
|
61
|
+
if (
|
|
62
|
+
walletType === splitWalletNetwork(lastConnectedWalletWithNetwork)?.[0]
|
|
63
|
+
) {
|
|
64
|
+
setLastConnectedWalletWithNetwork('');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
void fetchApiConfig().catch(console.log);
|
|
69
|
+
|
|
70
|
+
return tabManager.destroy;
|
|
71
|
+
}, []);
|
|
72
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* mobile: screen <= 480
|
|
5
|
+
* tablet: screen > 480 and screen <= 768
|
|
6
|
+
* notebook: screen > 768 & screen <= 1024
|
|
7
|
+
* large: screen > 1024 & screen <= 1200
|
|
8
|
+
* extra large: screen > 1200
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const MIN_TABLET_WIDTH = 480;
|
|
12
|
+
const MIN_NOTEBOOK_WIDTH = 768;
|
|
13
|
+
const MIN_LARGE_SCREEN_WIDTH = 1024;
|
|
14
|
+
const MIN_EXTRA_LARGE_SCREEN_WIDTH = 1200;
|
|
15
|
+
|
|
16
|
+
const useScreenDetect = () => {
|
|
17
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
18
|
+
const [isTablet, setIsTablet] = useState(false);
|
|
19
|
+
const [isNotebook, setIsNotebook] = useState(false);
|
|
20
|
+
const [isLargeScreen, setIsLargeScreen] = useState(false);
|
|
21
|
+
const [isExtraLargeScreen, setIsExtraLargeScreen] = useState(false);
|
|
22
|
+
|
|
23
|
+
const handleResize = () => {
|
|
24
|
+
setIsMobile(window.innerWidth <= MIN_TABLET_WIDTH);
|
|
25
|
+
setIsTablet(
|
|
26
|
+
window.innerWidth > MIN_TABLET_WIDTH &&
|
|
27
|
+
window.innerWidth <= MIN_NOTEBOOK_WIDTH
|
|
28
|
+
);
|
|
29
|
+
setIsNotebook(
|
|
30
|
+
window.innerWidth > MIN_NOTEBOOK_WIDTH &&
|
|
31
|
+
window.innerWidth <= MIN_LARGE_SCREEN_WIDTH
|
|
32
|
+
);
|
|
33
|
+
setIsLargeScreen(
|
|
34
|
+
window.innerWidth > MIN_LARGE_SCREEN_WIDTH &&
|
|
35
|
+
window.innerWidth <= MIN_EXTRA_LARGE_SCREEN_WIDTH
|
|
36
|
+
);
|
|
37
|
+
setIsExtraLargeScreen(window.innerWidth > MIN_EXTRA_LARGE_SCREEN_WIDTH);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
handleResize(); // Initial check
|
|
42
|
+
window.addEventListener('resize', handleResize);
|
|
43
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
return { isMobile, isTablet, isNotebook, isLargeScreen, isExtraLargeScreen };
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default useScreenDetect;
|
|
@@ -46,7 +46,11 @@ export function useSwapInput({
|
|
|
46
46
|
refetchQuote,
|
|
47
47
|
}: UseSwapInputProps): UseSwapInput {
|
|
48
48
|
const { fetch: fetchQuote, cancelFetch } = useFetchAllQuotes();
|
|
49
|
-
const {
|
|
49
|
+
const {
|
|
50
|
+
excludeLiquiditySources: configExcludeLiquiditySources,
|
|
51
|
+
features,
|
|
52
|
+
enableCentralizedSwappers,
|
|
53
|
+
} = useAppStore().config;
|
|
50
54
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
51
55
|
|
|
52
56
|
const tokens = useAppStore().tokens();
|
|
@@ -118,6 +122,7 @@ export function useSwapInput({
|
|
|
118
122
|
affiliateRef,
|
|
119
123
|
affiliatePercent,
|
|
120
124
|
affiliateWallets,
|
|
125
|
+
enableCentralizedSwappers,
|
|
121
126
|
});
|
|
122
127
|
if (isFeatureEnabled('experimentalRoute', features)) {
|
|
123
128
|
requestBody.experimental = true;
|
|
@@ -223,7 +228,7 @@ export function useSwapInput({
|
|
|
223
228
|
toToken?.blockchain,
|
|
224
229
|
shouldSkipRequest,
|
|
225
230
|
liquiditySources?.length,
|
|
226
|
-
|
|
231
|
+
configExcludeLiquiditySources,
|
|
227
232
|
disabledLiquiditySources.length,
|
|
228
233
|
userSlippage,
|
|
229
234
|
affiliateRef,
|
package/src/hooks/useTheme.ts
CHANGED
|
@@ -21,12 +21,11 @@ export function useTheme(props: WidgetTheme) {
|
|
|
21
21
|
fontFamily = DEFAULT_FONT_FAMILY,
|
|
22
22
|
borderRadius = DEFAULT_PRIMARY_RADIUS,
|
|
23
23
|
secondaryBorderRadius = DEFAULT_SECONDARY_RADIUS,
|
|
24
|
-
mode = 'auto',
|
|
25
24
|
} = props;
|
|
26
25
|
|
|
27
26
|
const [OSTheme, setOSTheme] = useState('light');
|
|
28
27
|
|
|
29
|
-
const {
|
|
28
|
+
const { theme } = useAppStore();
|
|
30
29
|
|
|
31
30
|
const { dark, light } = customizedThemeTokens(colors);
|
|
32
31
|
|
|
@@ -81,12 +80,6 @@ export function useTheme(props: WidgetTheme) {
|
|
|
81
80
|
};
|
|
82
81
|
}, []);
|
|
83
82
|
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
if (mode !== 'auto') {
|
|
86
|
-
setTheme(mode);
|
|
87
|
-
}
|
|
88
|
-
}, [mode]);
|
|
89
|
-
|
|
90
83
|
const getActiveTheme = () => {
|
|
91
84
|
const lightClassNames = lightThemeClasses.join(' ');
|
|
92
85
|
const darkClassNames = darkThemeClasses.join(' ');
|
|
@@ -109,6 +109,18 @@ export function useWalletList(params: Params) {
|
|
|
109
109
|
* but we have ethereum injected
|
|
110
110
|
*/
|
|
111
111
|
const shouldShowDefaultInjectedWallet = (wallets: WalletInfo[]) => {
|
|
112
|
+
// don't show default injected wallet when it's not installed
|
|
113
|
+
const defaultWallet = wallets.find(
|
|
114
|
+
(wallet) => wallet.type === WalletTypes.DEFAULT
|
|
115
|
+
);
|
|
116
|
+
if (!defaultWallet || defaultWallet.state === WalletState.NOT_INSTALLED) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/*
|
|
121
|
+
* if we have another evm wallet installed (except wallet connect),
|
|
122
|
+
* there is no need to show default injected wallet anymore
|
|
123
|
+
*/
|
|
112
124
|
const isEvmWalletInstalledExceptDefault = wallets.filter(
|
|
113
125
|
(wallet) =>
|
|
114
126
|
wallet.state != WalletState.NOT_INSTALLED &&
|
|
@@ -87,6 +87,7 @@ export function ConfirmSwapPage() {
|
|
|
87
87
|
const { connectedWallets } = useWalletsStore();
|
|
88
88
|
const showWalletsOnInit = !quoteWalletsConfirmed;
|
|
89
89
|
const [showWallets, setShowWallets] = useState(false);
|
|
90
|
+
const [isConfirming, setIsConfirming] = useState(false);
|
|
90
91
|
const { isActiveTab } = useUiStore();
|
|
91
92
|
const disabledLiquiditySources = useAppStore().getDisabledLiquiditySources();
|
|
92
93
|
const prevDisabledLiquiditySources = useRef(disabledLiquiditySources);
|
|
@@ -137,7 +138,9 @@ export function ConfirmSwapPage() {
|
|
|
137
138
|
};
|
|
138
139
|
|
|
139
140
|
const onConfirm = async () => {
|
|
141
|
+
setIsConfirming(true);
|
|
140
142
|
await addNewSwap();
|
|
143
|
+
setIsConfirming(false);
|
|
141
144
|
};
|
|
142
145
|
|
|
143
146
|
const onStartConfirmSwap = async () => {
|
|
@@ -326,7 +329,7 @@ export function ConfirmSwapPage() {
|
|
|
326
329
|
type="primary"
|
|
327
330
|
size="large"
|
|
328
331
|
fullWidth
|
|
329
|
-
loading={fetchingConfirmationQuote}
|
|
332
|
+
loading={fetchingConfirmationQuote || isConfirming}
|
|
330
333
|
disabled={!!confirmSwapResult.error || !isActiveTab}
|
|
331
334
|
onClick={onStartConfirmSwap}>
|
|
332
335
|
{i18n.t('Start Swap')}
|
|
@@ -336,7 +339,8 @@ export function ConfirmSwapPage() {
|
|
|
336
339
|
variant="contained"
|
|
337
340
|
type="primary"
|
|
338
341
|
size="large"
|
|
339
|
-
loading={fetchingConfirmationQuote}
|
|
342
|
+
loading={fetchingConfirmationQuote || isConfirming}
|
|
343
|
+
disabled={!isActiveTab}
|
|
340
344
|
onClick={setShowWallets.bind(null, true)}>
|
|
341
345
|
<WalletIcon size={24} />
|
|
342
346
|
</IconButton>
|
|
@@ -371,14 +375,19 @@ export function ConfirmSwapPage() {
|
|
|
371
375
|
</div>
|
|
372
376
|
<Divider size="12" />
|
|
373
377
|
|
|
374
|
-
{joinList(
|
|
378
|
+
{joinList(
|
|
379
|
+
alerts.map((alert, index) => ({
|
|
380
|
+
element: alert,
|
|
381
|
+
key: `alert-${index}`,
|
|
382
|
+
})),
|
|
383
|
+
<Divider size={10} />
|
|
384
|
+
)}
|
|
375
385
|
{alerts.length > 0 ? <Divider size={10} /> : null}
|
|
376
386
|
|
|
377
387
|
<QuoteInfo
|
|
378
388
|
quote={selectedQuote}
|
|
379
389
|
type="swap-preview"
|
|
380
|
-
expanded
|
|
381
|
-
selected
|
|
390
|
+
expanded
|
|
382
391
|
tagHidden
|
|
383
392
|
error={confirmSwapResult.error}
|
|
384
393
|
loading={fetchingConfirmationQuote}
|