@rango-dev/widget-embedded 0.17.1-next.10 → 0.17.1-next.12
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/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.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.d.ts +2 -1
- package/dist/index.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/dist/utils/colors.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/Quote/Quote.styles.ts +7 -0
- package/src/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx +1 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +8 -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/SwapsGroup/SwapsGroup.styles.ts +8 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +0 -2
- package/src/components/TokenList/TokenList.styles.ts +14 -2
- package/src/components/TokenList/TokenList.tsx +1 -1
- package/src/components/UpdateUrl.tsx +0 -3
- package/src/constants/navigationRoutes.ts +7 -8
- package/src/hooks/useNavigateBack.ts +3 -52
- package/src/index.ts +2 -0
- 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
- package/src/utils/colors.ts +2 -1
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,UAAU,CAAC;AAE/D,eAAO,MAAM,UAAU,QAAS,MAAM,OAAO,MAAM,WAyBlD,CAAC;AAEF,eAAO,MAAM,mBAAmB,SAAU,MAAM,SAAS,MAAM;;
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,UAAU,CAAC;AAE/D,eAAO,MAAM,UAAU,QAAS,MAAM,OAAO,MAAM,WAyBlD,CAAC;AAEF,eAAO,MAAM,mBAAmB,SAAU,MAAM,SAAS,MAAM;;CAmC9D,CAAC;AACF,eAAO,MAAM,cAAc;;wBAEJ,OAAO,WACnB,YAAY;;CAyCtB,CAAC"}
|
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.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
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",
|
|
26
|
-
"@rango-dev/ui": "^0.22.1-next.
|
|
26
|
+
"@rango-dev/ui": "^0.22.1-next.7",
|
|
27
27
|
"@rango-dev/wallets-react": "^0.8.1-next.3",
|
|
28
28
|
"@rango-dev/wallets-shared": "^0.21.1-next.3",
|
|
29
29
|
"bignumber.js": "^9.1.1",
|
|
@@ -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;
|
|
@@ -112,6 +112,13 @@ export const SummaryContainer = styled('div', {
|
|
|
112
112
|
paddingTop: '$10',
|
|
113
113
|
display: 'flex',
|
|
114
114
|
alignItems: 'center',
|
|
115
|
+
'.usd-value': {
|
|
116
|
+
$$color: '$colors$neutral600',
|
|
117
|
+
[`.${darkTheme} &`]: {
|
|
118
|
+
$$color: '$colors$neutral700',
|
|
119
|
+
},
|
|
120
|
+
color: '$$color',
|
|
121
|
+
},
|
|
115
122
|
},
|
|
116
123
|
});
|
|
117
124
|
|
|
@@ -10,7 +10,7 @@ export function QuoteErrorsModalItem(props: ModalContentData) {
|
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
<Item>
|
|
13
|
-
<Typography size="medium" variant="label"
|
|
13
|
+
<Typography size="medium" variant="label" className="_title">
|
|
14
14
|
{title}
|
|
15
15
|
</Typography>
|
|
16
16
|
<Typography
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
1
|
+
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Alerts = styled('div', {
|
|
4
4
|
width: '100%',
|
|
@@ -19,6 +19,13 @@ export const Item = styled('div', {
|
|
|
19
19
|
justifyContent: 'space-between',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
width: '100%',
|
|
22
|
+
'._title': {
|
|
23
|
+
$$color: '$colors$neutral600',
|
|
24
|
+
[`.${darkTheme} &`]: {
|
|
25
|
+
$$color: '$colors$neutral700',
|
|
26
|
+
},
|
|
27
|
+
color: '$$color',
|
|
28
|
+
},
|
|
22
29
|
});
|
|
23
30
|
|
|
24
31
|
export const Action = styled('div', {
|
|
@@ -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>
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
1
|
+
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Group = styled('div', {
|
|
4
4
|
width: '100%',
|
|
5
5
|
display: 'flex',
|
|
6
6
|
flexDirection: 'column',
|
|
7
|
+
'.group-title': {
|
|
8
|
+
$$color: '$colors$neutral600',
|
|
9
|
+
[`.${darkTheme} &`]: {
|
|
10
|
+
$$color: '$colors$neutral700',
|
|
11
|
+
},
|
|
12
|
+
color: '$$color',
|
|
13
|
+
},
|
|
7
14
|
});
|
|
8
15
|
|
|
9
16
|
export const Time = styled('div', {
|
|
@@ -34,7 +34,6 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
34
34
|
<Typography
|
|
35
35
|
variant="label"
|
|
36
36
|
size="medium"
|
|
37
|
-
color="neutral600"
|
|
38
37
|
className="group-title">
|
|
39
38
|
{i18n.t(group.title)}
|
|
40
39
|
</Typography>
|
|
@@ -68,7 +67,6 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
68
67
|
<Typography
|
|
69
68
|
variant="label"
|
|
70
69
|
size="medium"
|
|
71
|
-
color="neutral600"
|
|
72
70
|
className="group-title">
|
|
73
71
|
{i18n.t(group.title)}
|
|
74
72
|
</Typography>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { styled, Typography } from '@rango-dev/ui';
|
|
1
|
+
import { darkTheme, styled, Typography } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Container = styled('div', {
|
|
4
4
|
display: 'flex',
|
|
@@ -40,7 +40,11 @@ export const List = styled('ul', {
|
|
|
40
40
|
'& a': {
|
|
41
41
|
fontSize: '$12',
|
|
42
42
|
lineHeight: '$16',
|
|
43
|
-
color: '$neutral600',
|
|
43
|
+
$$color: '$colors$neutral600',
|
|
44
|
+
[`.${darkTheme} &`]: {
|
|
45
|
+
$$color: '$colors$neutral700',
|
|
46
|
+
},
|
|
47
|
+
color: '$$color',
|
|
44
48
|
textDecoration: 'none',
|
|
45
49
|
},
|
|
46
50
|
},
|
|
@@ -92,6 +96,14 @@ export const TagTitle = styled(Typography, {});
|
|
|
92
96
|
|
|
93
97
|
export const BalanceContainer = styled('div', {
|
|
94
98
|
textAlign: 'right',
|
|
99
|
+
|
|
100
|
+
'.usd-value': {
|
|
101
|
+
$$color: '$colors$neutral600',
|
|
102
|
+
[`.${darkTheme} &`]: {
|
|
103
|
+
$$color: '$colors$neutral700',
|
|
104
|
+
},
|
|
105
|
+
color: '$$color',
|
|
106
|
+
},
|
|
95
107
|
});
|
|
96
108
|
|
|
97
109
|
export const End = styled('ul', {
|
|
@@ -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
|
}
|
package/src/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ import { WidgetWallets } from './containers/Wallets';
|
|
|
43
43
|
import { Widget } from './containers/Widget';
|
|
44
44
|
import { useWidget } from './containers/WidgetInfo';
|
|
45
45
|
import { WidgetProvider } from './containers/WidgetProvider';
|
|
46
|
+
import { customizedThemeTokens } from './utils/ui';
|
|
46
47
|
|
|
47
48
|
export type {
|
|
48
49
|
WidgetConfig,
|
|
@@ -80,6 +81,7 @@ export {
|
|
|
80
81
|
useWidget,
|
|
81
82
|
useWallets,
|
|
82
83
|
useWidgetEvents,
|
|
84
|
+
customizedThemeTokens,
|
|
83
85
|
MainEvents,
|
|
84
86
|
RouteEventType,
|
|
85
87
|
StepEventType,
|