@rango-dev/widget-embedded 0.12.1-next.16 → 0.12.1-next.18
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/Layout/Layout.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +460 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
- package/dist/components/LoadingSwapDetails/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Layout/Layout.styles.ts +1 -1
- package/src/components/Layout/Layout.tsx +3 -20
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/LoadingSwapDetails/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +47 -11
- package/src/components/SwapDetails/SwapDetails.styles.ts +1 -1
- package/src/components/SwapDetails/SwapDetails.tsx +6 -11
- package/src/components/SwapDetails/SwapDetails.types.ts +1 -1
- package/src/components/SwitchFromAndTo.tsx +1 -35
- package/src/pages/SwapDetailsPage.tsx +9 -2
|
@@ -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;AAU1B,wBAAgB,eAAe,sBAoD9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.12.1-next.
|
|
3
|
+
"version": "0.12.1-next.18",
|
|
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.15.1-next.1",
|
|
24
24
|
"@rango-dev/queue-manager-rango-preset": "^0.15.1-next.5",
|
|
25
25
|
"@rango-dev/queue-manager-react": "^0.15.1-next.3",
|
|
26
|
-
"@rango-dev/ui": "^0.15.1-next.
|
|
26
|
+
"@rango-dev/ui": "^0.15.1-next.11",
|
|
27
27
|
"@rango-dev/wallets-react": "^0.1.1-next.5",
|
|
28
28
|
"@rango-dev/wallets-shared": "^0.15.1-next.3",
|
|
29
29
|
"bignumber.js": "^9.1.1",
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { PropTypes, Ref } from './Layout.types';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
Divider,
|
|
7
|
-
Header,
|
|
8
|
-
theme,
|
|
9
|
-
usePaddingRight,
|
|
10
|
-
} from '@rango-dev/ui';
|
|
11
|
-
import React, { useRef } from 'react';
|
|
4
|
+
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
5
|
+
import React from 'react';
|
|
12
6
|
import { useNavigate } from 'react-router-dom';
|
|
13
7
|
|
|
14
8
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
@@ -18,8 +12,6 @@ import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
|
|
|
18
12
|
|
|
19
13
|
import { Container, Content, Footer } from './Layout.styles';
|
|
20
14
|
|
|
21
|
-
const DEFAULT_CONTENT_PADDING = 20;
|
|
22
|
-
|
|
23
15
|
function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
24
16
|
const {
|
|
25
17
|
children,
|
|
@@ -35,13 +27,6 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
35
27
|
useUiStore.use.connectWalletsButtonDisabled();
|
|
36
28
|
const navigate = useNavigate();
|
|
37
29
|
|
|
38
|
-
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
39
|
-
|
|
40
|
-
usePaddingRight({
|
|
41
|
-
elementRef: contentRef,
|
|
42
|
-
paddingRight: noPadding ? '0' : theme.sizes[DEFAULT_CONTENT_PADDING],
|
|
43
|
-
});
|
|
44
|
-
|
|
45
30
|
const onConnectWallet = () => {
|
|
46
31
|
if (!connectWalletsButtonDisabled) {
|
|
47
32
|
navigate('/' + navigationRoutes.wallets);
|
|
@@ -65,9 +50,7 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
65
50
|
</>
|
|
66
51
|
}
|
|
67
52
|
/>
|
|
68
|
-
<Content noPadding={noPadding}
|
|
69
|
-
{children}
|
|
70
|
-
</Content>
|
|
53
|
+
<Content noPadding={noPadding}>{children}</Content>
|
|
71
54
|
{(hasLogo || footer) && (
|
|
72
55
|
<Footer>
|
|
73
56
|
<div className="footer__content">{footer}</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { StepSkeletonPropsTypes } from './LoadingSwapDetails.types';
|
|
2
|
+
|
|
3
|
+
import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { StepContainer } from './LoadingSwapDetails.styles';
|
|
7
|
+
|
|
8
|
+
export function LoadingSwapDetailStep(props: StepSkeletonPropsTypes) {
|
|
9
|
+
const { extraInfo } = props;
|
|
10
|
+
return (
|
|
11
|
+
<StepContainer>
|
|
12
|
+
<div className="step-title">
|
|
13
|
+
<Skeleton height={28} width={28} variant="circular" />
|
|
14
|
+
<Divider direction="horizontal" size={8} />
|
|
15
|
+
<Skeleton height={15} width={148} variant="rounded" />
|
|
16
|
+
</div>
|
|
17
|
+
<div className="step-tokens">
|
|
18
|
+
<Divider direction="horizontal" size={20} />
|
|
19
|
+
<div className="step-token-info">
|
|
20
|
+
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
21
|
+
<Divider direction="horizontal" size={8} />
|
|
22
|
+
<Skeleton height={12} width={76} variant="rounded" />
|
|
23
|
+
</div>
|
|
24
|
+
<div className="step-icon-container">
|
|
25
|
+
<NextIcon color="gray" size={16} />
|
|
26
|
+
</div>
|
|
27
|
+
<div className="step-token-info">
|
|
28
|
+
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
29
|
+
<Divider direction="horizontal" size={8} />
|
|
30
|
+
<Skeleton height={12} width={76} variant="rounded" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
{extraInfo && (
|
|
34
|
+
<div className="extra-info">
|
|
35
|
+
<Divider direction="horizontal" size={20} />
|
|
36
|
+
<Skeleton height={22} width={297} variant="rectangular" />
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
</StepContainer>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { styled } from '@rango-dev/ui';
|
|
2
|
+
|
|
3
|
+
export const Container = styled('div', {
|
|
4
|
+
width: '100%',
|
|
5
|
+
height: '100%',
|
|
6
|
+
padding: '$0 $20',
|
|
7
|
+
|
|
8
|
+
'.cost': {
|
|
9
|
+
paddingTop: '$15',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
'.route-summary': {
|
|
14
|
+
padding: '$15 $0',
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
'.route-summary-item': {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
'.token-amount': {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
'.route-summary-separator': {
|
|
30
|
+
width: '0px',
|
|
31
|
+
height: '$16',
|
|
32
|
+
borderLeft: '1px solid $neutral400',
|
|
33
|
+
marginLeft: '13px',
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
'.swaps-steps': {
|
|
37
|
+
paddingBottom: '$10',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const StepContainer = styled('div', {
|
|
42
|
+
backgroundColor: '$neutral100',
|
|
43
|
+
borderRadius: '$xm',
|
|
44
|
+
padding: '$10 $15',
|
|
45
|
+
|
|
46
|
+
'.step-title': {
|
|
47
|
+
display: 'flex',
|
|
48
|
+
justifyContent: 'start',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
},
|
|
51
|
+
'.step-tokens': {
|
|
52
|
+
paddingTop: '$5',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
},
|
|
56
|
+
'.step-token-info': {
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
},
|
|
60
|
+
'.step-icon-container': {
|
|
61
|
+
padding: '$4 $6',
|
|
62
|
+
display: 'flex',
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
'.extra-info': {
|
|
68
|
+
display: 'flex',
|
|
69
|
+
paddingTop: '$10',
|
|
70
|
+
paddingBottom: '$5',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
export const StepSeparator = styled('div', {
|
|
74
|
+
width: '0px',
|
|
75
|
+
height: '$20',
|
|
76
|
+
borderLeft: '1px dashed $neutral900',
|
|
77
|
+
marginLeft: '25px',
|
|
78
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { i18n } from '@lingui/core';
|
|
2
|
+
import { ChainToken, Divider, Skeleton, Typography } from '@rango-dev/ui';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { Container, StepSeparator } from './LoadingSwapDetails.styles';
|
|
6
|
+
import { LoadingSwapDetailStep } from './LoadingSwapDetailStep';
|
|
7
|
+
|
|
8
|
+
export function LoadingSwapDetails() {
|
|
9
|
+
const routeSummary = (
|
|
10
|
+
<div className="route-summary-item">
|
|
11
|
+
<div className="token-amount">
|
|
12
|
+
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
13
|
+
<Divider size={8} direction="horizontal" />
|
|
14
|
+
<Skeleton height={15} width={148} variant="rounded" />
|
|
15
|
+
</div>
|
|
16
|
+
<Skeleton height={12} width={64} variant="rounded" />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Container>
|
|
22
|
+
<div className="cost">
|
|
23
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
24
|
+
<Divider size={4} direction="horizontal" />
|
|
25
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
26
|
+
<Divider size={4} direction="horizontal" />
|
|
27
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div className="route-summary">
|
|
31
|
+
{routeSummary}
|
|
32
|
+
<div className="route-summary-separator"></div>
|
|
33
|
+
{routeSummary}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div className="swaps-steps">
|
|
37
|
+
<Typography variant="title" size="small">
|
|
38
|
+
{i18n.t('Swaps steps')}
|
|
39
|
+
</Typography>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div className="step-container">
|
|
43
|
+
<LoadingSwapDetailStep extraInfo />
|
|
44
|
+
<StepSeparator />
|
|
45
|
+
<LoadingSwapDetailStep />
|
|
46
|
+
<StepSeparator />
|
|
47
|
+
<LoadingSwapDetailStep />
|
|
48
|
+
<StepSeparator />
|
|
49
|
+
<LoadingSwapDetailStep />
|
|
50
|
+
</div>
|
|
51
|
+
</Container>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LoadingSwapDetails } from './LoadingSwapDetails';
|
|
@@ -1,33 +1,69 @@
|
|
|
1
1
|
import type { SwapDetailsPlaceholderPropTypes } from './SwapDetails.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CopyIcon,
|
|
6
|
+
IconButton,
|
|
7
|
+
NotFound,
|
|
8
|
+
Skeleton,
|
|
9
|
+
Typography,
|
|
10
|
+
} from '@rango-dev/ui';
|
|
5
11
|
import React from 'react';
|
|
6
12
|
|
|
7
13
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
8
14
|
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
9
15
|
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
10
16
|
import { Layout } from '../Layout';
|
|
17
|
+
import { LoadingSwapDetails } from '../LoadingSwapDetails';
|
|
11
18
|
|
|
12
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
Container,
|
|
21
|
+
HeaderDetails,
|
|
22
|
+
PlaceholderContainer,
|
|
23
|
+
} from './SwapDetails.styles';
|
|
13
24
|
|
|
14
25
|
export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
|
|
15
|
-
const { requestId,
|
|
26
|
+
const { requestId, showSkeleton } = props;
|
|
16
27
|
const { navigateBackFrom } = useNavigateBack();
|
|
17
28
|
|
|
18
29
|
return (
|
|
19
30
|
<Layout
|
|
31
|
+
noPadding
|
|
20
32
|
header={{
|
|
21
33
|
title: i18n.t('Swap and Bridge'),
|
|
22
34
|
onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
|
|
23
35
|
suffix: <SuffixContainer />,
|
|
24
36
|
}}>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
{showSkeleton && (
|
|
38
|
+
<Container>
|
|
39
|
+
<HeaderDetails>
|
|
40
|
+
<div className="row">
|
|
41
|
+
<Typography variant="label" size="large" color="neutral900">
|
|
42
|
+
{`${i18n.t('Request ID')}:`}
|
|
43
|
+
</Typography>
|
|
44
|
+
<div className="request-id">
|
|
45
|
+
<Typography variant="label" size="small" color="neutral900">
|
|
46
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
47
|
+
</Typography>
|
|
48
|
+
<IconButton variant="ghost">
|
|
49
|
+
<CopyIcon size={16} color="gray" />
|
|
50
|
+
</IconButton>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div className="row">
|
|
54
|
+
<Typography variant="label" size="large" color="neutral900">
|
|
55
|
+
{`${i18n.t('Created at')}:`}
|
|
56
|
+
</Typography>
|
|
57
|
+
<Typography variant="label" size="small" color="neutral900">
|
|
58
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
59
|
+
</Typography>
|
|
60
|
+
</div>
|
|
61
|
+
</HeaderDetails>
|
|
62
|
+
<LoadingSwapDetails />
|
|
63
|
+
</Container>
|
|
64
|
+
)}
|
|
65
|
+
{!showSkeleton && (
|
|
66
|
+
<PlaceholderContainer>
|
|
31
67
|
<NotFound
|
|
32
68
|
title={i18n.t('Not found')}
|
|
33
69
|
description={i18n.t(
|
|
@@ -36,8 +72,8 @@ export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
|
|
|
36
72
|
{ message: 'Swap with request ID = ${requestId} not found.' }
|
|
37
73
|
)}
|
|
38
74
|
/>
|
|
39
|
-
|
|
40
|
-
|
|
75
|
+
</PlaceholderContainer>
|
|
76
|
+
)}
|
|
41
77
|
</Layout>
|
|
42
78
|
);
|
|
43
79
|
}
|
|
@@ -16,10 +16,8 @@ import {
|
|
|
16
16
|
RouteCost,
|
|
17
17
|
RouteSummary,
|
|
18
18
|
StepDetails,
|
|
19
|
-
theme,
|
|
20
19
|
Typography,
|
|
21
20
|
useCopyToClipboard,
|
|
22
|
-
usePaddingRight,
|
|
23
21
|
} from '@rango-dev/ui';
|
|
24
22
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
25
23
|
import React, { useEffect, useRef, useState } from 'react';
|
|
@@ -65,26 +63,21 @@ import {
|
|
|
65
63
|
} from './SwapDetails.helpers';
|
|
66
64
|
import { Container, HeaderDetails, StepsList } from './SwapDetails.styles';
|
|
67
65
|
|
|
68
|
-
const DEFAULT_CONTENT_PADDING = 20;
|
|
69
|
-
|
|
70
66
|
export function SwapDetails(props: SwapDetailsProps) {
|
|
71
67
|
const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
|
|
72
|
-
const { tokens } = useMetaStore.use.meta();
|
|
73
68
|
const { canSwitchNetworkTo, connect, getWalletInfo } = useWallets();
|
|
74
69
|
const retry = useBestRouteStore.use.retry();
|
|
75
70
|
const navigate = useNavigate();
|
|
76
71
|
const { navigateBackFrom } = useNavigateBack();
|
|
77
|
-
const listRef = useRef<HTMLDivElement | null>(null);
|
|
78
72
|
const [_, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
|
|
73
|
+
const listRef = useRef<HTMLDivElement | null>(null);
|
|
79
74
|
const [modalState, setModalState] = useState<ModalState>(null);
|
|
80
75
|
const [showCompletedModal, setShowCompletedModal] = useState<
|
|
81
76
|
'success' | 'failed' | null
|
|
82
77
|
>(null);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
paddingRight: theme.sizes[DEFAULT_CONTENT_PADDING],
|
|
87
|
-
});
|
|
78
|
+
const {
|
|
79
|
+
meta: { tokens },
|
|
80
|
+
} = useMetaStore();
|
|
88
81
|
|
|
89
82
|
const onCancel = () => {
|
|
90
83
|
onCancelProps();
|
|
@@ -301,6 +294,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
301
294
|
</Typography>
|
|
302
295
|
</div>
|
|
303
296
|
</HeaderDetails>
|
|
297
|
+
|
|
304
298
|
<div className="output">
|
|
305
299
|
<RouteCost
|
|
306
300
|
fee={numberToString(
|
|
@@ -388,6 +382,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
388
382
|
})}
|
|
389
383
|
</StepsList>
|
|
390
384
|
</Container>
|
|
385
|
+
|
|
391
386
|
<SwapDetailsModal
|
|
392
387
|
state={modalState}
|
|
393
388
|
onClose={() => setModalState(null)}
|
|
@@ -1,38 +1,8 @@
|
|
|
1
1
|
import { ReverseIcon, styled } from '@rango-dev/ui';
|
|
2
|
-
import React
|
|
3
|
-
import { useInRouterContext, useSearchParams } from 'react-router-dom';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
|
|
5
|
-
import { SearchParams } from '../constants/searchParams';
|
|
6
4
|
import { useBestRouteStore } from '../store/bestRoute';
|
|
7
5
|
|
|
8
|
-
function SwitchFromAndTo({ count }: { count: number }) {
|
|
9
|
-
const firstRender = useRef(true);
|
|
10
|
-
const [searchParams, setSearchParams] = useSearchParams();
|
|
11
|
-
const outputAmount = useBestRouteStore.use.outputAmount();
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (!firstRender.current) {
|
|
15
|
-
const fromChainString = searchParams.get(SearchParams.FROM_CHAIN);
|
|
16
|
-
const fromTokenString = searchParams.get(SearchParams.FROM_TOKEN);
|
|
17
|
-
const toChainString = searchParams.get(SearchParams.TO_CHAIN);
|
|
18
|
-
const toTokenString = searchParams.get(SearchParams.TO_TOKEN);
|
|
19
|
-
setSearchParams({
|
|
20
|
-
...(toChainString && { [SearchParams.FROM_CHAIN]: toChainString }),
|
|
21
|
-
...(toTokenString && { [SearchParams.FROM_TOKEN]: toTokenString }),
|
|
22
|
-
...(fromChainString && { [SearchParams.TO_CHAIN]: fromChainString }),
|
|
23
|
-
...(fromTokenString && { [SearchParams.TO_TOKEN]: fromTokenString }),
|
|
24
|
-
...(outputAmount && {
|
|
25
|
-
[SearchParams.FROM_AMOUNT]: outputAmount.toString(),
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
firstRender.current = false;
|
|
30
|
-
}
|
|
31
|
-
}, [count]);
|
|
32
|
-
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
6
|
const SwitchButtonContainer = styled('div', {
|
|
37
7
|
position: 'absolute',
|
|
38
8
|
bottom: '-12px',
|
|
@@ -58,18 +28,14 @@ const StyledButton = styled('div', {
|
|
|
58
28
|
|
|
59
29
|
export function SwitchFromAndToButton() {
|
|
60
30
|
const switchFromAndTo = useBestRouteStore.use.switchFromAndTo();
|
|
61
|
-
const isRouterInContext = useInRouterContext();
|
|
62
|
-
const [count, setCount] = useState(0);
|
|
63
31
|
|
|
64
32
|
return (
|
|
65
33
|
<SwitchButtonContainer>
|
|
66
34
|
<StyledButton
|
|
67
35
|
onClick={() => {
|
|
68
36
|
switchFromAndTo();
|
|
69
|
-
setCount((prev) => prev + 1);
|
|
70
37
|
}}>
|
|
71
38
|
<ReverseIcon size={12} />
|
|
72
|
-
{isRouterInContext && <SwitchFromAndTo count={count} />}
|
|
73
39
|
</StyledButton>
|
|
74
40
|
</SwitchButtonContainer>
|
|
75
41
|
);
|
|
@@ -6,6 +6,7 @@ import { SwapDetails } from '../components/SwapDetails';
|
|
|
6
6
|
import { SwapDetailsPlaceholder } from '../components/SwapDetails/SwapDetails.Placeholder';
|
|
7
7
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
8
8
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
9
|
+
import { useMetaStore } from '../store/meta';
|
|
9
10
|
import { useUiStore } from '../store/ui';
|
|
10
11
|
import { getPendingSwaps } from '../utils/queue';
|
|
11
12
|
|
|
@@ -15,6 +16,9 @@ export function SwapDetailsPage() {
|
|
|
15
16
|
const pendingSwaps = getPendingSwaps(manager);
|
|
16
17
|
const requestId = useUiStore.use.selectedSwapRequestId();
|
|
17
18
|
const { navigateBackFrom } = useNavigateBack();
|
|
19
|
+
const { loadingStatus } = useMetaStore();
|
|
20
|
+
|
|
21
|
+
const showSkeleton = loading || loadingStatus === 'loading';
|
|
18
22
|
|
|
19
23
|
const selectedSwap = pendingSwaps.find(
|
|
20
24
|
({ swap }) => swap.requestId === requestId
|
|
@@ -41,9 +45,12 @@ export function SwapDetailsPage() {
|
|
|
41
45
|
};
|
|
42
46
|
const swap = selectedSwap?.swap;
|
|
43
47
|
|
|
44
|
-
if (!swap) {
|
|
48
|
+
if (!swap || showSkeleton) {
|
|
45
49
|
return (
|
|
46
|
-
<SwapDetailsPlaceholder
|
|
50
|
+
<SwapDetailsPlaceholder
|
|
51
|
+
requestId={requestId || ''}
|
|
52
|
+
showSkeleton={showSkeleton}
|
|
53
|
+
/>
|
|
47
54
|
);
|
|
48
55
|
}
|
|
49
56
|
|