@rango-dev/widget-embedded 0.17.1-next.11 → 0.17.1-next.13
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/AppRoutes.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +2 -2
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/constants/navigationRoutes.d.ts +1 -2
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/hooks/useNavigateBack.d.ts +1 -3
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.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/SelectBlockchainPage.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/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AppRoutes.tsx +54 -33
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +2 -2
- package/src/components/Layout/Layout.tsx +10 -7
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/NotificationContent/NotificationContent.tsx +1 -1
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -4
- package/src/components/SwapDetails/SwapDetails.tsx +2 -5
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
- package/src/components/UpdateUrl.tsx +0 -3
- package/src/constants/navigationRoutes.ts +7 -8
- package/src/hooks/useNavigateBack.ts +3 -52
- package/src/pages/ConfirmSwapPage.tsx +10 -9
- package/src/pages/HistoryPage.tsx +1 -5
- package/src/pages/Home.tsx +6 -3
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +0 -4
- package/src/pages/SelectBlockchainPage.tsx +2 -8
- package/src/pages/SelectSwapItemsPage.tsx +4 -18
- package/src/pages/SettingsPage.tsx +0 -3
- package/src/pages/SwapDetailsPage.tsx +3 -4
- package/src/pages/ThemePage.tsx +0 -4
- package/src/pages/WalletsPage.tsx +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAkDnD,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAkDnD,wBAAgB,eAAe,sBAwR9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistoryPage.d.ts","sourceRoot":"","sources":["../../src/pages/HistoryPage.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"HistoryPage.d.ts","sourceRoot":"","sources":["../../src/pages/HistoryPage.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAmB,MAAM,OAAO,CAAC;AA0CxC,wBAAgB,WAAW,sBAoE1B"}
|
package/dist/pages/Home.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAqD3D,wBAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAqD3D,wBAAgB,IAAI,sBAsPnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LanguagePage.d.ts","sourceRoot":"","sources":["../../src/pages/LanguagePage.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LanguagePage.d.ts","sourceRoot":"","sources":["../../src/pages/LanguagePage.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,wBAAgB,YAAY,sBAwC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAgBxC,UAAU,SAAS;IACjB,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,qBAoH5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectBlockchainPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectBlockchainPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectBlockchainPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectBlockchainPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AASxC,UAAU,SAAS;IACjB,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,qBAqDpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectSwapItemsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectSwapItemsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,UAAU,SAAS;IACjB,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC;CAChC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"SelectSwapItemsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectSwapItemsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,UAAU,SAAS;IACjB,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC;CAChC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,qBA8FnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,wBAAgB,YAAY,sBA+J3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwapDetailsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SwapDetailsPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SwapDetailsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SwapDetailsPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,wBAAgB,eAAe,sBAoD9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemePage.d.ts","sourceRoot":"","sources":["../../src/pages/ThemePage.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemePage.d.ts","sourceRoot":"","sources":["../../src/pages/ThemePage.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,wBAAgB,SAAS,sBAkExB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA6B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAqBlD,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,sBAmE1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.17.1-next.
|
|
3
|
+
"version": "0.17.1-next.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lingui/core": "4.2.1",
|
|
21
21
|
"@lingui/react": "4.2.1",
|
|
22
|
-
"@rango-dev/provider-all": "^0.22.1-next.
|
|
22
|
+
"@rango-dev/provider-all": "^0.22.1-next.5",
|
|
23
23
|
"@rango-dev/queue-manager-core": "^0.22.1-next.0",
|
|
24
24
|
"@rango-dev/queue-manager-rango-preset": "^0.22.1-next.5",
|
|
25
25
|
"@rango-dev/queue-manager-react": "^0.22.1-next.0",
|
|
@@ -14,8 +14,6 @@ import { SwapDetailsPage } from '../pages/SwapDetailsPage';
|
|
|
14
14
|
import { ThemePage } from '../pages/ThemePage';
|
|
15
15
|
import { WalletsPage } from '../pages/WalletsPage';
|
|
16
16
|
|
|
17
|
-
const getAbsolutePath = (path: string) => path.replace('/', '');
|
|
18
|
-
|
|
19
17
|
export function AppRoutes() {
|
|
20
18
|
return useRoutes([
|
|
21
19
|
{
|
|
@@ -24,51 +22,74 @@ export function AppRoutes() {
|
|
|
24
22
|
},
|
|
25
23
|
{
|
|
26
24
|
path: navigationRoutes.fromSwap,
|
|
27
|
-
|
|
25
|
+
children: [
|
|
26
|
+
{
|
|
27
|
+
index: true,
|
|
28
|
+
element: <SelectSwapItemsPage type="source" />,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
path: navigationRoutes.blockchains,
|
|
32
|
+
element: <SelectBlockchainPage type="source" />,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
28
35
|
},
|
|
29
36
|
{
|
|
30
37
|
path: navigationRoutes.toSwap,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
index: true,
|
|
41
|
+
element: <SelectSwapItemsPage type="destination" />,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
path: navigationRoutes.blockchains,
|
|
45
|
+
element: <SelectBlockchainPage type="destination" />,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
40
48
|
},
|
|
41
49
|
{
|
|
42
50
|
path: navigationRoutes.settings,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
children: [
|
|
52
|
+
{
|
|
53
|
+
index: true,
|
|
54
|
+
element: <SettingsPage />,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
path: navigationRoutes.themes,
|
|
58
|
+
element: <ThemePage />,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
path: navigationRoutes.languages,
|
|
62
|
+
element: <LanguagePage />,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
path: navigationRoutes.exchanges,
|
|
66
|
+
element: <LiquiditySourcePage sourceType="Exchanges" />,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
path: navigationRoutes.bridges,
|
|
70
|
+
element: <LiquiditySourcePage sourceType="Bridges" />,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
60
73
|
},
|
|
61
|
-
{ path: navigationRoutes.swaps, element: <HistoryPage /> },
|
|
62
74
|
{
|
|
63
|
-
path: navigationRoutes.
|
|
64
|
-
|
|
75
|
+
path: navigationRoutes.swaps,
|
|
76
|
+
children: [
|
|
77
|
+
{
|
|
78
|
+
index: true,
|
|
79
|
+
element: <HistoryPage />,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
path: navigationRoutes.swapDetails,
|
|
83
|
+
element: <SwapDetailsPage />,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
65
86
|
},
|
|
66
87
|
{
|
|
67
88
|
path: navigationRoutes.wallets,
|
|
68
89
|
element: <WalletsPage />,
|
|
69
90
|
},
|
|
70
91
|
{
|
|
71
|
-
path:
|
|
92
|
+
path: navigationRoutes.confirmSwap,
|
|
72
93
|
element: <ConfirmSwapPage />,
|
|
73
94
|
},
|
|
74
95
|
]);
|
|
@@ -19,7 +19,6 @@ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
|
19
19
|
import { useNavigate } from 'react-router-dom';
|
|
20
20
|
|
|
21
21
|
import { getQuoteErrorMessage } from '../../constants/errors';
|
|
22
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
23
22
|
import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
|
|
24
23
|
import { useAppStore } from '../../store/AppStore';
|
|
25
24
|
import { useQuoteStore } from '../../store/quote';
|
|
@@ -244,7 +243,8 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
244
243
|
open={open}
|
|
245
244
|
onClose={() => {
|
|
246
245
|
if (!quoteWalletsConfirmed) {
|
|
247
|
-
|
|
246
|
+
const home = '../';
|
|
247
|
+
navigate(home, { replace: true });
|
|
248
248
|
}
|
|
249
249
|
onClose();
|
|
250
250
|
}}
|
|
@@ -3,9 +3,8 @@ import type { PropsWithChildren } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { useNavigate } from 'react-router-dom';
|
|
7
6
|
|
|
8
|
-
import {
|
|
7
|
+
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
9
8
|
import { useUiStore } from '../../store/ui';
|
|
10
9
|
import { useWalletsStore } from '../../store/wallets';
|
|
11
10
|
import { getContainer } from '../../utils/common';
|
|
@@ -26,22 +25,26 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
26
25
|
|
|
27
26
|
const connectWalletsButtonDisabled =
|
|
28
27
|
useUiStore.use.connectWalletsButtonDisabled();
|
|
29
|
-
const
|
|
28
|
+
const navigateBack = useNavigateBack();
|
|
30
29
|
|
|
31
30
|
const onConnectWallet = () => {
|
|
32
|
-
if (!connectWalletsButtonDisabled) {
|
|
33
|
-
|
|
31
|
+
if (!connectWalletsButtonDisabled && header.onWallet) {
|
|
32
|
+
header.onWallet();
|
|
34
33
|
}
|
|
35
34
|
};
|
|
35
|
+
|
|
36
|
+
const showBackButton =
|
|
37
|
+
typeof header.hasBackButton === 'undefined' || header.hasBackButton;
|
|
38
|
+
|
|
36
39
|
return (
|
|
37
40
|
<Container ref={ref} fixedHeight={fixedHeight} id="swap-box">
|
|
38
41
|
<Header
|
|
39
|
-
prefix={<>{
|
|
42
|
+
prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
|
|
40
43
|
title={header.title}
|
|
41
44
|
suffix={
|
|
42
45
|
<>
|
|
43
46
|
{header.suffix}
|
|
44
|
-
{header.
|
|
47
|
+
{header.onWallet && (
|
|
45
48
|
<WalletButton
|
|
46
49
|
container={getContainer()}
|
|
47
50
|
onClick={onConnectWallet}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface PropTypes {
|
|
2
2
|
header: {
|
|
3
3
|
title: string;
|
|
4
|
-
|
|
4
|
+
onWallet?: () => void;
|
|
5
5
|
hasSettings?: boolean;
|
|
6
6
|
suffix?: React.ReactNode;
|
|
7
|
-
|
|
7
|
+
hasBackButton?: boolean;
|
|
8
8
|
onCancel?: () => void;
|
|
9
9
|
};
|
|
10
10
|
hasLogo?: boolean;
|
|
@@ -33,7 +33,7 @@ export function SlippageWarningModal(props: PropsTypes) {
|
|
|
33
33
|
<Button
|
|
34
34
|
size="small"
|
|
35
35
|
variant="ghost"
|
|
36
|
-
onClick={() => navigate('
|
|
36
|
+
onClick={() => navigate('../' + navigationRoutes.settings)}>
|
|
37
37
|
<Typography variant="label" size="medium" color="$neutral900">
|
|
38
38
|
{i18n.t('Change settings')}
|
|
39
39
|
</Typography>
|
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
} from '@rango-dev/ui';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
14
|
-
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
15
13
|
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
16
14
|
import { Layout } from '../Layout';
|
|
17
15
|
import { LoadingSwapDetails } from '../LoadingSwapDetails';
|
|
@@ -24,14 +22,12 @@ import {
|
|
|
24
22
|
|
|
25
23
|
export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
|
|
26
24
|
const { requestId, showSkeleton } = props;
|
|
27
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
28
25
|
|
|
29
26
|
return (
|
|
30
27
|
<Layout
|
|
31
28
|
noPadding
|
|
32
29
|
header={{
|
|
33
30
|
title: i18n.t('Swap and Bridge'),
|
|
34
|
-
onBack: () => navigateBackFrom(navigationRoutes.swapDetails),
|
|
35
31
|
suffix: <SuffixContainer />,
|
|
36
32
|
}}>
|
|
37
33
|
{showSkeleton && (
|
|
@@ -22,7 +22,6 @@ import { useWallets } from '@rango-dev/wallets-react';
|
|
|
22
22
|
import React, { useEffect, useRef, useState } from 'react';
|
|
23
23
|
import { useNavigate } from 'react-router-dom';
|
|
24
24
|
|
|
25
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
26
25
|
import {
|
|
27
26
|
GAS_FEE_MAX_DECIMALS,
|
|
28
27
|
GAS_FEE_MIN_DECIMALS,
|
|
@@ -33,7 +32,6 @@ import {
|
|
|
33
32
|
USD_VALUE_MAX_DECIMALS,
|
|
34
33
|
USD_VALUE_MIN_DECIMALS,
|
|
35
34
|
} from '../../constants/routing';
|
|
36
|
-
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
37
35
|
import { useAppStore } from '../../store/AppStore';
|
|
38
36
|
import { useNotificationStore } from '../../store/notification';
|
|
39
37
|
import { useQuoteStore } from '../../store/quote';
|
|
@@ -68,7 +66,6 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
68
66
|
const tokens = useAppStore().tokens();
|
|
69
67
|
const retry = useQuoteStore.use.retry();
|
|
70
68
|
const navigate = useNavigate();
|
|
71
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
72
69
|
const [_, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
|
|
73
70
|
const listRef = useRef<HTMLDivElement | null>(null);
|
|
74
71
|
const [modalState, setModalState] = useState<ModalState>(null);
|
|
@@ -237,7 +234,6 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
237
234
|
noPadding
|
|
238
235
|
header={{
|
|
239
236
|
title: i18n.t('Swap and Bridge'),
|
|
240
|
-
onBack: () => navigateBackFrom(navigationRoutes.swapDetails),
|
|
241
237
|
onCancel:
|
|
242
238
|
swap.status === 'running' ? () => setModalState('cancel') : undefined,
|
|
243
239
|
suffix: swap.status !== 'running' && (
|
|
@@ -265,7 +261,8 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
265
261
|
onClick={() => {
|
|
266
262
|
retry(swap, { blockchains: blockchains, tokens: tokens });
|
|
267
263
|
setTimeout(() => {
|
|
268
|
-
|
|
264
|
+
const home = '../../';
|
|
265
|
+
navigate(home);
|
|
269
266
|
}, 0);
|
|
270
267
|
}}>
|
|
271
268
|
{i18n.t('Try again')}
|
|
@@ -12,8 +12,6 @@ import {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { useNavigate } from 'react-router-dom';
|
|
14
14
|
|
|
15
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
16
|
-
|
|
17
15
|
export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
18
16
|
const {
|
|
19
17
|
open,
|
|
@@ -70,7 +68,10 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
70
68
|
variant="contained"
|
|
71
69
|
type="primary"
|
|
72
70
|
size="large"
|
|
73
|
-
onClick={() =>
|
|
71
|
+
onClick={() => {
|
|
72
|
+
const home = '../../';
|
|
73
|
+
navigate(home);
|
|
74
|
+
}}>
|
|
74
75
|
<Typography variant="title" size="medium" color="neutral100">
|
|
75
76
|
{i18n.t('Done')}
|
|
76
77
|
</Typography>
|
|
@@ -66,9 +66,6 @@ export function UpdateUrl() {
|
|
|
66
66
|
fromAmount =
|
|
67
67
|
searchParamsRef.current[SearchParams.FROM_AMOUNT] || inputAmount;
|
|
68
68
|
} else {
|
|
69
|
-
if (location.state === 'redirect') {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
69
|
fromChainString = fromBlockchain?.name || '';
|
|
73
70
|
fromTokenString =
|
|
74
71
|
(fromToken?.symbol || '') +
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export const navigationRoutes = {
|
|
2
2
|
home: '/',
|
|
3
3
|
fromSwap: 'from-swap',
|
|
4
|
-
fromBlockchain: '/from-swap/blockchains',
|
|
5
|
-
toBlockchain: '/to-swap/blockchains',
|
|
6
4
|
toSwap: 'to-swap',
|
|
5
|
+
blockchains: 'blockchains',
|
|
7
6
|
settings: 'settings',
|
|
8
|
-
liquiditySources: '
|
|
9
|
-
themes: '
|
|
10
|
-
bridges: '
|
|
11
|
-
exchanges: '
|
|
12
|
-
languages: '
|
|
7
|
+
liquiditySources: 'liquidity-sources',
|
|
8
|
+
themes: 'themes',
|
|
9
|
+
bridges: 'bridges',
|
|
10
|
+
exchanges: 'exchanges',
|
|
11
|
+
languages: 'languages',
|
|
13
12
|
swaps: 'swaps',
|
|
14
13
|
wallets: 'wallets',
|
|
15
14
|
confirmSwap: 'confirm-swap',
|
|
16
|
-
swapDetails: '
|
|
15
|
+
swapDetails: ':requestId',
|
|
17
16
|
};
|
|
@@ -1,55 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useNavigate } from 'react-router-dom';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { useQuoteStore } from '../store/quote';
|
|
5
|
-
|
|
6
|
-
export function useNavigateBack() {
|
|
7
|
-
const isRouterInContext = useInRouterContext();
|
|
3
|
+
export function useNavigateBack(): () => void {
|
|
8
4
|
const navigate = useNavigate();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
navigationRoutes;
|
|
12
|
-
|
|
13
|
-
const navigateBackFrom = (currentRoute: string) => {
|
|
14
|
-
if (currentRoute === navigationRoutes.swapDetails) {
|
|
15
|
-
return navigate('/' + navigationRoutes.swaps, { replace: true });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
!isRouterInContext ||
|
|
20
|
-
(window.history.state && window.history.state.idx > 0)
|
|
21
|
-
) {
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
23
|
-
navigate(-1);
|
|
24
|
-
} else {
|
|
25
|
-
if (
|
|
26
|
-
[navigationRoutes.settings, navigationRoutes.wallets].includes(
|
|
27
|
-
currentRoute
|
|
28
|
-
) &&
|
|
29
|
-
quoteWalletsConfirmed
|
|
30
|
-
) {
|
|
31
|
-
return navigate('/' + navigationRoutes.confirmSwap, { replace: true });
|
|
32
|
-
}
|
|
33
|
-
if (
|
|
34
|
-
[
|
|
35
|
-
navigationRoutes.fromSwap,
|
|
36
|
-
navigationRoutes.toSwap,
|
|
37
|
-
navigationRoutes.settings,
|
|
38
|
-
navigationRoutes.wallets,
|
|
39
|
-
navigationRoutes.swaps,
|
|
40
|
-
navigationRoutes.confirmSwap,
|
|
41
|
-
].includes(currentRoute)
|
|
42
|
-
) {
|
|
43
|
-
navigate(navigationRoutes.home, { replace: true });
|
|
44
|
-
} else if (currentRoute === navigationRoutes.fromBlockchain) {
|
|
45
|
-
navigate('/' + navigationRoutes.fromSwap, { replace: true });
|
|
46
|
-
} else if (currentRoute === navigationRoutes.toBlockchain) {
|
|
47
|
-
navigate('/' + navigationRoutes.fromSwap, { replace: true });
|
|
48
|
-
} else if (currentRoute === navigationRoutes.liquiditySources) {
|
|
49
|
-
navigate('/' + navigationRoutes.settings, { replace: true });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return { navigateBackFrom };
|
|
5
|
+
return () => navigate(-1);
|
|
55
6
|
}
|
|
@@ -119,12 +119,11 @@ export function ConfirmSwapPage() {
|
|
|
119
119
|
{ id: confirmSwapResult.swap.requestId }
|
|
120
120
|
);
|
|
121
121
|
setSelectedSwap(confirmSwapResult.swap.requestId);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
);
|
|
122
|
+
|
|
123
|
+
const swap_url = `../${navigationRoutes.swaps}/${confirmSwapResult.swap.requestId}`;
|
|
124
|
+
navigate(swap_url, {
|
|
125
|
+
replace: true,
|
|
126
|
+
});
|
|
128
127
|
setTimeout(() => {
|
|
129
128
|
setInputAmount('');
|
|
130
129
|
}, 0);
|
|
@@ -242,8 +241,10 @@ export function ConfirmSwapPage() {
|
|
|
242
241
|
<Layout
|
|
243
242
|
header={{
|
|
244
243
|
title: i18n.t('Confirm Swap'),
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
onWallet: () => {
|
|
245
|
+
const wallets_url = `../${navigationRoutes.wallets}`;
|
|
246
|
+
navigate(wallets_url);
|
|
247
|
+
},
|
|
247
248
|
suffix: (
|
|
248
249
|
<Tooltip
|
|
249
250
|
container={getContainer()}
|
|
@@ -252,7 +253,7 @@ export function ConfirmSwapPage() {
|
|
|
252
253
|
<HeaderButton
|
|
253
254
|
size="small"
|
|
254
255
|
variant="ghost"
|
|
255
|
-
onClick={() => navigate('
|
|
256
|
+
onClick={() => navigate('../' + navigationRoutes.settings)}>
|
|
256
257
|
<SettingsIcon size={18} color="black" />
|
|
257
258
|
</HeaderButton>
|
|
258
259
|
</Tooltip>
|
|
@@ -11,8 +11,6 @@ import { Layout } from '../components/Layout';
|
|
|
11
11
|
import { SearchInput } from '../components/SearchInput';
|
|
12
12
|
import { SwapsGroup } from '../components/SwapsGroup';
|
|
13
13
|
import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
|
|
14
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
15
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
16
14
|
import { useUiStore } from '../store/ui';
|
|
17
15
|
import { groupSwapsByDate } from '../utils/date';
|
|
18
16
|
import { containsText } from '../utils/numbers';
|
|
@@ -51,7 +49,6 @@ const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
|
|
|
51
49
|
export function HistoryPage() {
|
|
52
50
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
53
51
|
const navigate = useNavigate();
|
|
54
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
55
52
|
const { manager, state } = useManager();
|
|
56
53
|
const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
|
|
57
54
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
@@ -78,7 +75,6 @@ export function HistoryPage() {
|
|
|
78
75
|
return (
|
|
79
76
|
<Layout
|
|
80
77
|
header={{
|
|
81
|
-
onBack: () => navigateBackFrom(navigationRoutes.swaps),
|
|
82
78
|
title: i18n.t('History'),
|
|
83
79
|
}}>
|
|
84
80
|
<Container>
|
|
@@ -108,7 +104,7 @@ export function HistoryPage() {
|
|
|
108
104
|
list={filteredList}
|
|
109
105
|
onSwapClick={(requestId) => {
|
|
110
106
|
setSelectedSwap(requestId);
|
|
111
|
-
navigate(
|
|
107
|
+
navigate(requestId);
|
|
112
108
|
}}
|
|
113
109
|
groupBy={groupSwapsByDate}
|
|
114
110
|
isLoading={loading}
|
package/src/pages/Home.tsx
CHANGED
|
@@ -184,7 +184,10 @@ export function Home() {
|
|
|
184
184
|
</Button>
|
|
185
185
|
}
|
|
186
186
|
header={{
|
|
187
|
-
|
|
187
|
+
onWallet: () => {
|
|
188
|
+
navigate(navigationRoutes.wallets);
|
|
189
|
+
},
|
|
190
|
+
hasBackButton: false,
|
|
188
191
|
title: i18n.t('Swap'),
|
|
189
192
|
suffix: (
|
|
190
193
|
<HomeButtons
|
|
@@ -213,7 +216,7 @@ export function Home() {
|
|
|
213
216
|
displayName: fromToken?.symbol || '',
|
|
214
217
|
image: fromToken?.image || '',
|
|
215
218
|
}}
|
|
216
|
-
onClickToken={() => navigate(
|
|
219
|
+
onClickToken={() => navigate(navigationRoutes.fromSwap)}
|
|
217
220
|
price={{
|
|
218
221
|
value: inputAmount,
|
|
219
222
|
usdValue: priceImpactInputCanNotBeComputed
|
|
@@ -272,7 +275,7 @@ export function Home() {
|
|
|
272
275
|
? errorMessages().unknownPriceError.impactTitle
|
|
273
276
|
: undefined,
|
|
274
277
|
}}
|
|
275
|
-
onClickToken={() => navigate(
|
|
278
|
+
onClickToken={() => navigate(navigationRoutes.toSwap)}
|
|
276
279
|
disabled={fetchMetaStatus === 'failed'}
|
|
277
280
|
loading={fetchMetaStatus === 'loading'}
|
|
278
281
|
/>
|
|
@@ -10,13 +10,9 @@ import React from 'react';
|
|
|
10
10
|
|
|
11
11
|
import { Layout } from '../components/Layout';
|
|
12
12
|
import { SettingsContainer } from '../components/SettingsContainer';
|
|
13
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
14
13
|
import { useLanguage } from '../hooks/useLanguage';
|
|
15
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
16
14
|
|
|
17
15
|
export function LanguagePage() {
|
|
18
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
19
|
-
|
|
20
16
|
const { activeLanguage, changeLanguage, languages } = useLanguage();
|
|
21
17
|
|
|
22
18
|
const languageList = languages.map((languageItem) => {
|
|
@@ -38,7 +34,6 @@ export function LanguagePage() {
|
|
|
38
34
|
return (
|
|
39
35
|
<Layout
|
|
40
36
|
header={{
|
|
41
|
-
onBack: () => navigateBackFrom(navigationRoutes.settings),
|
|
42
37
|
title: i18n.t('Language'),
|
|
43
38
|
}}>
|
|
44
39
|
<SettingsContainer>
|
|
@@ -23,8 +23,6 @@ import {
|
|
|
23
23
|
NotFoundContainer,
|
|
24
24
|
SettingsContainer,
|
|
25
25
|
} from '../components/SettingsContainer';
|
|
26
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
27
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
28
26
|
import { useAppStore } from '../store/AppStore';
|
|
29
27
|
import { useSettingsStore } from '../store/settings';
|
|
30
28
|
import { containsText } from '../utils/numbers';
|
|
@@ -39,7 +37,6 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
|
|
|
39
37
|
const swappers = useAppStore().swappers();
|
|
40
38
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
41
39
|
const toggleLiquiditySource = useSettingsStore.use.toggleLiquiditySource();
|
|
42
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
43
40
|
const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
|
|
44
41
|
getUniqueSwappersGroups(swappers);
|
|
45
42
|
|
|
@@ -102,7 +99,6 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
|
|
|
102
99
|
return (
|
|
103
100
|
<Layout
|
|
104
101
|
header={{
|
|
105
|
-
onBack: () => navigateBackFrom(navigationRoutes.settings),
|
|
106
102
|
title: i18n.t(sourceType),
|
|
107
103
|
suffix: (
|
|
108
104
|
<LiquiditySourceSuffix>
|