@rango-dev/ui 0.1.10-next.84 → 0.1.10-next.87
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/BestRoute/BestRoute.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +1 -0
- package/dist/components/Icon/CopyIcon.d.ts +3 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/types.d.ts +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -1
- package/dist/components/TextField/TextField.stories.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/containers/SwapHistory/SwapHistory.d.ts +3 -0
- package/dist/ui.cjs.development.js +263 -31
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +262 -32
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/components/BestRoute/BestRoute.tsx +1 -1
- package/src/components/Drawer/Drawer.tsx +11 -15
- package/src/components/Icon/CopyIcon.tsx +59 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/Icon/types.tsx +2 -1
- package/src/components/SecondaryPage/SecondaryPage.tsx +1 -0
- package/src/components/StepDetail/StepDetail.tsx +1 -1
- package/src/components/SwapContainer/SwapContainer.tsx +2 -1
- package/src/components/SwapDetail/SwapDetail.tsx +4 -4
- package/src/components/VirtualizedList/VirtualizedList.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/containers/History/History.tsx +2 -1
- package/src/containers/SwapHistory/SwapHistory.tsx +226 -85
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/ui",
|
|
3
|
-
"version": "0.1.10-next.
|
|
3
|
+
"version": "0.1.10-next.87",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"@radix-ui/react-radio-group": "^1.1.1",
|
|
73
73
|
"@radix-ui/react-switch": "^1.0.1",
|
|
74
74
|
"@radix-ui/react-tooltip": "^1.0.2",
|
|
75
|
-
"@rango-dev/wallets-shared": "^0.1.11-next.
|
|
75
|
+
"@rango-dev/wallets-shared": "^0.1.11-next.78",
|
|
76
76
|
"@stitches/react": "^1.2.8",
|
|
77
77
|
"@types/react-color": "^3.0.6",
|
|
78
|
-
"rango-sdk": "^0.1.
|
|
78
|
+
"rango-sdk": "^0.1.18",
|
|
79
79
|
"react-color": "^2.19.3",
|
|
80
80
|
"react-virtualized-auto-sizer": "^1.0.7",
|
|
81
81
|
"react-window": "^1.8.8",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
2
|
import { styled } from '../../theme';
|
|
4
3
|
import { CloseIcon } from '../Icon';
|
|
5
4
|
import { Typography } from '../Typography';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
6
|
|
|
7
7
|
export interface PropTypes {
|
|
8
8
|
title?: string;
|
|
@@ -13,6 +13,7 @@ export interface PropTypes {
|
|
|
13
13
|
anchor?: 'bottom' | 'left' | 'right' | 'top';
|
|
14
14
|
showClose?: boolean;
|
|
15
15
|
footer?: React.ReactNode;
|
|
16
|
+
container: Element | null;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const BackDrop = styled('div', {
|
|
@@ -21,18 +22,21 @@ const BackDrop = styled('div', {
|
|
|
21
22
|
left: '0',
|
|
22
23
|
width: '100%',
|
|
23
24
|
height: '100%',
|
|
24
|
-
|
|
25
|
+
zIndex: 9999999,
|
|
25
26
|
backgroundColor: 'rgba(0,0,0,.1)',
|
|
27
|
+
borderRadius: '$10',
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
const DrawerContainer = styled('div', {
|
|
29
|
-
position: '
|
|
31
|
+
position: 'absolute',
|
|
30
32
|
boxShadow: '$s',
|
|
31
33
|
background: '$background',
|
|
32
34
|
padding: '$20',
|
|
33
35
|
display: 'flex',
|
|
34
36
|
flexDirection: 'column',
|
|
35
37
|
justifyContent: 'space-between',
|
|
38
|
+
zIndex: 9999999,
|
|
39
|
+
borderRadius: '$10',
|
|
36
40
|
|
|
37
41
|
variants: {
|
|
38
42
|
anchor: {
|
|
@@ -42,8 +46,6 @@ const DrawerContainer = styled('div', {
|
|
|
42
46
|
height: '100%',
|
|
43
47
|
minWidth: '300px',
|
|
44
48
|
maxWidth: '90%',
|
|
45
|
-
borderTopRightRadius: '$10',
|
|
46
|
-
borderBottomRightRadius: '$10',
|
|
47
49
|
},
|
|
48
50
|
right: {
|
|
49
51
|
top: 0,
|
|
@@ -51,24 +53,16 @@ const DrawerContainer = styled('div', {
|
|
|
51
53
|
height: '100%',
|
|
52
54
|
minWidth: '300px',
|
|
53
55
|
maxWidth: '90%',
|
|
54
|
-
borderTopLeftRadius: '$10',
|
|
55
|
-
borderBottomLeftRadius: '$10',
|
|
56
56
|
},
|
|
57
57
|
bottom: {
|
|
58
58
|
bottom: 0,
|
|
59
59
|
width: '100%',
|
|
60
60
|
maxHeight: '90%',
|
|
61
|
-
borderTopRightRadius: '$10',
|
|
62
|
-
borderTopLeftRadius: '$10',
|
|
63
|
-
|
|
64
61
|
},
|
|
65
62
|
top: {
|
|
66
63
|
top: 0,
|
|
67
64
|
width: '100%',
|
|
68
65
|
maxHeight: '90%',
|
|
69
|
-
borderBottomRightRadius: '$10',
|
|
70
|
-
borderBottomLeftRadius: '$10',
|
|
71
|
-
|
|
72
66
|
},
|
|
73
67
|
},
|
|
74
68
|
},
|
|
@@ -88,7 +82,7 @@ const Body = styled('div', {
|
|
|
88
82
|
});
|
|
89
83
|
const Footer = styled('footer', {
|
|
90
84
|
width: '100%',
|
|
91
|
-
marginTop:'$28'
|
|
85
|
+
marginTop: '$28',
|
|
92
86
|
});
|
|
93
87
|
|
|
94
88
|
export function Drawer(props: PropTypes) {
|
|
@@ -101,6 +95,7 @@ export function Drawer(props: PropTypes) {
|
|
|
101
95
|
anchor = 'bottom',
|
|
102
96
|
showClose = false,
|
|
103
97
|
footer,
|
|
98
|
+
container,
|
|
104
99
|
} = props;
|
|
105
100
|
|
|
106
101
|
const handleBackDropClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
@@ -110,6 +105,7 @@ export function Drawer(props: PropTypes) {
|
|
|
110
105
|
return (
|
|
111
106
|
<>
|
|
112
107
|
{open &&
|
|
108
|
+
container &&
|
|
113
109
|
createPortal(
|
|
114
110
|
<BackDrop onClick={handleBackDropClick}>
|
|
115
111
|
<DrawerContainer anchor={anchor} style={containerStyle}>
|
|
@@ -121,7 +117,7 @@ export function Drawer(props: PropTypes) {
|
|
|
121
117
|
<Footer>{footer}</Footer>
|
|
122
118
|
</DrawerContainer>
|
|
123
119
|
</BackDrop>,
|
|
124
|
-
|
|
120
|
+
container
|
|
125
121
|
)}
|
|
126
122
|
</>
|
|
127
123
|
);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SvgWithFillColor } from './common';
|
|
3
|
+
import { IconProps } from './types';
|
|
4
|
+
|
|
5
|
+
export const CopyIcon: React.FC<IconProps> = ({
|
|
6
|
+
size = 16,
|
|
7
|
+
color,
|
|
8
|
+
...props
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<SvgWithFillColor
|
|
12
|
+
width={size}
|
|
13
|
+
height={size}
|
|
14
|
+
viewBox="0 0 64 64"
|
|
15
|
+
color={color}
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
className="_icon"
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
<g id="Text-files">
|
|
21
|
+
<path
|
|
22
|
+
d="M53.9791489,9.1429005H50.010849c-0.0826988,0-0.1562004,0.0283995-0.2331009,0.0469999V5.0228
|
|
23
|
+
C49.7777481,2.253,47.4731483,0,44.6398468,0h-34.422596C7.3839517,0,5.0793519,2.253,5.0793519,5.0228v46.8432999
|
|
24
|
+
c0,2.7697983,2.3045998,5.0228004,5.1378999,5.0228004h6.0367002v2.2678986C16.253952,61.8274002,18.4702511,64,21.1954517,64
|
|
25
|
+
h32.783699c2.7252007,0,4.9414978-2.1725998,4.9414978-4.8432007V13.9861002
|
|
26
|
+
C58.9206467,11.3155003,56.7043495,9.1429005,53.9791489,9.1429005z M7.1110516,51.8661003V5.0228
|
|
27
|
+
c0-1.6487999,1.3938999-2.9909999,3.1062002-2.9909999h34.422596c1.7123032,0,3.1062012,1.3422,3.1062012,2.9909999v46.8432999
|
|
28
|
+
c0,1.6487999-1.393898,2.9911003-3.1062012,2.9911003h-34.422596C8.5049515,54.8572006,7.1110516,53.5149002,7.1110516,51.8661003z
|
|
29
|
+
M56.8888474,59.1567993c0,1.550602-1.3055,2.8115005-2.9096985,2.8115005h-32.783699
|
|
30
|
+
c-1.6042004,0-2.9097996-1.2608986-2.9097996-2.8115005v-2.2678986h26.3541946
|
|
31
|
+
c2.8333015,0,5.1379013-2.2530022,5.1379013-5.0228004V11.1275997c0.0769005,0.0186005,0.1504021,0.0469999,0.2331009,0.0469999
|
|
32
|
+
h3.9682999c1.6041985,0,2.9096985,1.2609005,2.9096985,2.8115005V59.1567993z"
|
|
33
|
+
/>
|
|
34
|
+
<path
|
|
35
|
+
d="M38.6031494,13.2063999H16.253952c-0.5615005,0-1.0159006,0.4542999-1.0159006,1.0158005
|
|
36
|
+
c0,0.5615997,0.4544001,1.0158997,1.0159006,1.0158997h22.3491974c0.5615005,0,1.0158997-0.4542999,1.0158997-1.0158997
|
|
37
|
+
C39.6190491,13.6606998,39.16465,13.2063999,38.6031494,13.2063999z"
|
|
38
|
+
/>
|
|
39
|
+
<path
|
|
40
|
+
d="M38.6031494,21.3334007H16.253952c-0.5615005,0-1.0159006,0.4542999-1.0159006,1.0157986
|
|
41
|
+
c0,0.5615005,0.4544001,1.0159016,1.0159006,1.0159016h22.3491974c0.5615005,0,1.0158997-0.454401,1.0158997-1.0159016
|
|
42
|
+
C39.6190491,21.7877007,39.16465,21.3334007,38.6031494,21.3334007z"
|
|
43
|
+
/>
|
|
44
|
+
<path
|
|
45
|
+
d="M38.6031494,29.4603004H16.253952c-0.5615005,0-1.0159006,0.4543991-1.0159006,1.0158997
|
|
46
|
+
s0.4544001,1.0158997,1.0159006,1.0158997h22.3491974c0.5615005,0,1.0158997-0.4543991,1.0158997-1.0158997
|
|
47
|
+
S39.16465,29.4603004,38.6031494,29.4603004z"
|
|
48
|
+
/>
|
|
49
|
+
<path
|
|
50
|
+
d="M28.4444485,37.5872993H16.253952c-0.5615005,0-1.0159006,0.4543991-1.0159006,1.0158997
|
|
51
|
+
s0.4544001,1.0158997,1.0159006,1.0158997h12.1904964c0.5615025,0,1.0158005-0.4543991,1.0158005-1.0158997
|
|
52
|
+
S29.0059509,37.5872993,28.4444485,37.5872993z"
|
|
53
|
+
/>
|
|
54
|
+
</g>
|
|
55
|
+
</SvgWithFillColor>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
CopyIcon.toString = () => '._icon';
|
|
@@ -86,7 +86,7 @@ export function StepDetail({
|
|
|
86
86
|
</StepLogoContainer>
|
|
87
87
|
<Detail pl={direction === 'horizontal'}>
|
|
88
88
|
<Typography noWrap variant={direction === 'vertical' ? 'body2' : 'h6'}>
|
|
89
|
-
{parseFloat(amount).toFixed(2)} {symbol}
|
|
89
|
+
{amount ? parseFloat(amount).toFixed(2) : '?'} {symbol}
|
|
90
90
|
</Typography>
|
|
91
91
|
<SubTitle noWrap variant="caption">
|
|
92
92
|
on {blockchain}
|
|
@@ -15,6 +15,7 @@ const MainContainer = styled('div', {
|
|
|
15
15
|
alignItems: 'end',
|
|
16
16
|
padding: '$16 $24',
|
|
17
17
|
boxSizing: 'border-box',
|
|
18
|
+
position: 'relative',
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
const ContentContainer = styled('div', {
|
|
@@ -30,7 +31,7 @@ export function SwapContainer(props: PropsWithChildren<PropTypes>) {
|
|
|
30
31
|
const { children, style } = props;
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
|
-
<MainContainer style={style}>
|
|
34
|
+
<MainContainer style={style} id="swap-box">
|
|
34
35
|
<ContentContainer>{children}</ContentContainer>
|
|
35
36
|
</MainContainer>
|
|
36
37
|
);
|
|
@@ -127,10 +127,10 @@ export function SwapDetail({
|
|
|
127
127
|
<ArrowRight />
|
|
128
128
|
</Arrow>
|
|
129
129
|
<StepDetail
|
|
130
|
-
logo={lastStep.
|
|
131
|
-
symbol={lastStep.
|
|
132
|
-
chainLogo={lastStep.
|
|
133
|
-
blockchain={lastStep.
|
|
130
|
+
logo={lastStep.toLogo}
|
|
131
|
+
symbol={lastStep.toSymbol}
|
|
132
|
+
chainLogo={lastStep.toBlockchainLogo}
|
|
133
|
+
blockchain={lastStep.toBlockchain}
|
|
134
134
|
amount={lastStep.outputAmount}
|
|
135
135
|
/>
|
|
136
136
|
</SwapContainer>
|
|
@@ -43,8 +43,8 @@ export function VirtualizedList(props: PropsWithChildren<PropTypes>) {
|
|
|
43
43
|
ref={ref}
|
|
44
44
|
itemSize={() => size}
|
|
45
45
|
itemCount={itemCount}
|
|
46
|
-
height={height}
|
|
47
|
-
width={width}
|
|
46
|
+
height={height || 0}
|
|
47
|
+
width={width || 0}
|
|
48
48
|
onItemsRendered={onItemsRendered}
|
|
49
49
|
>
|
|
50
50
|
{({ index, style }) =>
|
package/src/components/index.ts
CHANGED
|
@@ -35,6 +35,7 @@ const filteredHistory = (
|
|
|
35
35
|
const Group = styled('div', {
|
|
36
36
|
marginBottom: '$24',
|
|
37
37
|
paddingRight: '$8',
|
|
38
|
+
maxHeight: '600px',
|
|
38
39
|
});
|
|
39
40
|
const GroupTitle = styled(Typography, {
|
|
40
41
|
color: '$neutrals500',
|
|
@@ -78,7 +79,7 @@ export function History({
|
|
|
78
79
|
onBack={onBack}
|
|
79
80
|
textField={true}
|
|
80
81
|
textFieldPlaceholder="Search By Blockchain Or Token"
|
|
81
|
-
title="
|
|
82
|
+
title="Swaps"
|
|
82
83
|
>
|
|
83
84
|
{(searchedFor) => {
|
|
84
85
|
const filterSwaps = filteredHistory(list, searchedFor);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
StepDetail,
|
|
4
4
|
SecondaryPage,
|
|
@@ -6,6 +6,12 @@ import {
|
|
|
6
6
|
Typography,
|
|
7
7
|
CheckCircleIcon,
|
|
8
8
|
InfoCircleIcon,
|
|
9
|
+
CopyIcon,
|
|
10
|
+
Spacer,
|
|
11
|
+
CheckSquareIcon,
|
|
12
|
+
Button,
|
|
13
|
+
Alert,
|
|
14
|
+
Drawer,
|
|
9
15
|
} from '../../components';
|
|
10
16
|
import { styled } from '../../theme';
|
|
11
17
|
import {
|
|
@@ -17,6 +23,7 @@ import {
|
|
|
17
23
|
Fee,
|
|
18
24
|
} from '../ConfirmSwap/ConfirmSwap';
|
|
19
25
|
import { PendingSwap } from '../History/types';
|
|
26
|
+
import { pulse } from '../../components/BestRoute/BestRoute';
|
|
20
27
|
|
|
21
28
|
const StyledAnchor = styled('a', {
|
|
22
29
|
color: '$primary',
|
|
@@ -49,109 +56,243 @@ const Error = styled(Description, {
|
|
|
49
56
|
|
|
50
57
|
export const Line = styled('div', {
|
|
51
58
|
width: '0',
|
|
59
|
+
minHeight: '$16',
|
|
52
60
|
marginLeft: '$12',
|
|
53
61
|
border: '1px dashed $foreground',
|
|
54
62
|
borderRadius: 'inherit',
|
|
55
63
|
});
|
|
56
64
|
|
|
65
|
+
const RequestIdContainer = styled('div', {
|
|
66
|
+
cursor: 'pointer',
|
|
67
|
+
backgroundColor: '$neutrals200',
|
|
68
|
+
padding: '$4',
|
|
69
|
+
display: 'flex',
|
|
70
|
+
justifyContent: 'center',
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
borderRadius: '$5',
|
|
73
|
+
marginBottom: '$16',
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const RequestId = styled(Typography, {
|
|
77
|
+
color: '$warning500',
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const CancelButtonContainer = styled('div', {
|
|
81
|
+
display: 'flex',
|
|
82
|
+
justifyContent: 'center',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const StepContainer = styled('div', {
|
|
87
|
+
variants: {
|
|
88
|
+
hasNotStarted: {
|
|
89
|
+
true: {
|
|
90
|
+
filter: 'grayscale(100%)',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
isRunning: {
|
|
94
|
+
true: {
|
|
95
|
+
animation: `${pulse} 2s ease-in-out infinite`,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
57
101
|
export interface PropTypes {
|
|
58
102
|
pendingSwap: PendingSwap;
|
|
103
|
+
onCopy: (requestId: string) => void;
|
|
59
104
|
onBack: () => void;
|
|
105
|
+
isCopied: boolean;
|
|
106
|
+
onCancel: (requestId: string) => void;
|
|
60
107
|
}
|
|
61
108
|
|
|
62
109
|
export function SwapHistory(props: PropTypes) {
|
|
63
|
-
const { pendingSwap, onBack } = props;
|
|
110
|
+
const { pendingSwap, onBack, onCopy, isCopied, onCancel } = props;
|
|
111
|
+
const [showDrawer, setShowDrawer] = useState(false);
|
|
64
112
|
|
|
65
113
|
return (
|
|
66
|
-
<SecondaryPage title="
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<Dot />
|
|
80
|
-
</RelativeContainer>
|
|
114
|
+
<SecondaryPage title="Swap Details" textField={false} onBack={onBack}>
|
|
115
|
+
<div style={{ overflow: 'hidden' }}>
|
|
116
|
+
<div>
|
|
117
|
+
<Typography variant="body1"> request ID :</Typography>
|
|
118
|
+
<RequestIdContainer
|
|
119
|
+
onClick={onCopy.bind(null, pendingSwap?.requestId)}
|
|
120
|
+
>
|
|
121
|
+
<RequestId variant="body1">{pendingSwap?.requestId}</RequestId>
|
|
122
|
+
<Spacer size={12} />
|
|
123
|
+
{isCopied ? (
|
|
124
|
+
<CheckSquareIcon color="success" size={18} />
|
|
125
|
+
) : (
|
|
126
|
+
<CopyIcon color="warning" size={18} />
|
|
81
127
|
)}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
128
|
+
</RequestIdContainer>
|
|
129
|
+
</div>
|
|
130
|
+
<div style={{ overflow: 'auto', position: 'relative' }}>
|
|
131
|
+
{pendingSwap?.steps.map((step, index) => (
|
|
132
|
+
<StepContainer
|
|
133
|
+
key={index}
|
|
134
|
+
hasNotStarted={step.status === 'created'}
|
|
135
|
+
isRunning={
|
|
136
|
+
step.status != 'failed' &&
|
|
137
|
+
step.status != 'success' &&
|
|
138
|
+
step.status != 'created'
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
{index === 0 && (
|
|
142
|
+
<RelativeContainer>
|
|
143
|
+
<StepDetail
|
|
144
|
+
logo={step.fromLogo}
|
|
145
|
+
symbol={step.fromSymbol}
|
|
146
|
+
chainLogo={step.fromBlockchainLogo}
|
|
147
|
+
blockchain={step.fromBlockchain}
|
|
148
|
+
amount={pendingSwap.inputAmount}
|
|
149
|
+
/>
|
|
150
|
+
<Dot />
|
|
151
|
+
</RelativeContainer>
|
|
152
|
+
)}
|
|
153
|
+
<Line />
|
|
154
|
+
<SwapperContainer>
|
|
155
|
+
<SwapperLogo src={step.swapperLogo} alt={step.swapperId} />
|
|
156
|
+
<div>
|
|
92
157
|
<Typography ml={4} variant="caption">
|
|
93
|
-
{step.
|
|
158
|
+
{step.swapperType} from {step.fromSymbol} to {step.toSymbol}
|
|
159
|
+
via {step.swapperId}
|
|
94
160
|
</Typography>
|
|
95
|
-
|
|
161
|
+
<Fee>
|
|
162
|
+
<GasIcon />
|
|
163
|
+
<Typography ml={4} variant="caption">
|
|
164
|
+
{step.feeInUsd} estimated gas fee
|
|
165
|
+
</Typography>
|
|
166
|
+
</Fee>
|
|
167
|
+
</div>
|
|
168
|
+
</SwapperContainer>
|
|
169
|
+
<div
|
|
170
|
+
style={{
|
|
171
|
+
display: 'flex',
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
<InternalDetailsContainer>
|
|
175
|
+
<Line />
|
|
176
|
+
{!!step.explorerUrl && (
|
|
177
|
+
<div>
|
|
178
|
+
{step.explorerUrl.map((item, index) => (
|
|
179
|
+
<InternalDetail key={index}>
|
|
180
|
+
<DescriptionContainer>
|
|
181
|
+
<CheckCircleIcon color="success" />
|
|
182
|
+
<Description variant="body2">
|
|
183
|
+
{!item.description ? (
|
|
184
|
+
<b>View transaction</b>
|
|
185
|
+
) : (
|
|
186
|
+
<b>
|
|
187
|
+
{item.description
|
|
188
|
+
.substring(0, 1)
|
|
189
|
+
.toUpperCase()}
|
|
190
|
+
{item.description.substring(1)}
|
|
191
|
+
</b>
|
|
192
|
+
)}
|
|
193
|
+
</Description>
|
|
194
|
+
</DescriptionContainer>
|
|
195
|
+
<StyledAnchor
|
|
196
|
+
href={item.url}
|
|
197
|
+
target="_blank"
|
|
198
|
+
rel="noreferrer"
|
|
199
|
+
key={index}
|
|
200
|
+
>
|
|
201
|
+
TX-Link
|
|
202
|
+
</StyledAnchor>
|
|
203
|
+
</InternalDetail>
|
|
204
|
+
))}
|
|
205
|
+
{step.status === 'failed' && (
|
|
206
|
+
<InternalDetail>
|
|
207
|
+
<DescriptionContainer>
|
|
208
|
+
<InfoCircleIcon color="error" />
|
|
209
|
+
<Error variant="body2">Step failed</Error>
|
|
210
|
+
</DescriptionContainer>
|
|
211
|
+
</InternalDetail>
|
|
212
|
+
)}
|
|
213
|
+
</div>
|
|
214
|
+
)}
|
|
215
|
+
</InternalDetailsContainer>
|
|
96
216
|
</div>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
217
|
+
{index + 1 === pendingSwap.steps.length && <ArrowDown />}
|
|
218
|
+
<StepDetail
|
|
219
|
+
logo={step.toLogo}
|
|
220
|
+
symbol={step.toSymbol}
|
|
221
|
+
chainLogo={step.toBlockchainLogo}
|
|
222
|
+
blockchain={step.toBlockchain}
|
|
223
|
+
amount={step.outputAmount}
|
|
224
|
+
/>
|
|
225
|
+
</StepContainer>
|
|
226
|
+
))}
|
|
227
|
+
{pendingSwap?.status === 'running' && (
|
|
228
|
+
<CancelButtonContainer>
|
|
229
|
+
<Button
|
|
230
|
+
variant="contained"
|
|
231
|
+
type="error"
|
|
232
|
+
onClick={setShowDrawer.bind(null, true)}
|
|
233
|
+
>
|
|
234
|
+
Cancel
|
|
235
|
+
</Button>
|
|
236
|
+
</CancelButtonContainer>
|
|
237
|
+
)}
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
<Drawer
|
|
241
|
+
onClose={setShowDrawer.bind(null, false)}
|
|
242
|
+
open={showDrawer}
|
|
243
|
+
showClose={true}
|
|
244
|
+
anchor="bottom"
|
|
245
|
+
title="Cancel Progress"
|
|
246
|
+
content={
|
|
247
|
+
<>
|
|
248
|
+
<Alert type="warning">
|
|
249
|
+
<Typography variant="body2">
|
|
250
|
+
<p>
|
|
251
|
+
Warning: Rango <u>neither reverts</u> your transaction
|
|
252
|
+
<u>nor refunds</u> you if you've already signed and sent a
|
|
253
|
+
transaction to the blockchain since it's out of Rango's
|
|
254
|
+
control. Beware that "Cancel" only stops next steps from being
|
|
255
|
+
executed.
|
|
256
|
+
</p>
|
|
257
|
+
<Spacer size={12} direction="vertical" />
|
|
258
|
+
<p>
|
|
259
|
+
If you have already signed your transaction to blockchain, you
|
|
260
|
+
should wait for that to complete or rollback
|
|
261
|
+
</p>
|
|
262
|
+
</Typography>
|
|
263
|
+
</Alert>
|
|
264
|
+
</>
|
|
265
|
+
}
|
|
266
|
+
footer={
|
|
267
|
+
<div
|
|
268
|
+
style={{
|
|
269
|
+
display: 'flex',
|
|
270
|
+
justifyContent: 'center',
|
|
271
|
+
alignItems: 'center',
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
274
|
+
<Button
|
|
275
|
+
variant="contained"
|
|
276
|
+
type="success"
|
|
277
|
+
onClick={setShowDrawer.bind(null, false)}
|
|
278
|
+
>
|
|
279
|
+
Skip
|
|
280
|
+
</Button>
|
|
281
|
+
<Spacer size={16} />
|
|
282
|
+
<Button
|
|
283
|
+
variant="contained"
|
|
284
|
+
type="error"
|
|
285
|
+
onClick={() => {
|
|
286
|
+
onCancel(pendingSwap.requestId);
|
|
287
|
+
setShowDrawer(false);
|
|
101
288
|
}}
|
|
102
289
|
>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<DescriptionContainer>
|
|
110
|
-
<CheckCircleIcon color="success" />
|
|
111
|
-
<Description variant="body2">
|
|
112
|
-
{!item.description ? (
|
|
113
|
-
<b>View transaction</b>
|
|
114
|
-
) : (
|
|
115
|
-
<b>
|
|
116
|
-
{item.description.substring(0, 1).toUpperCase()}
|
|
117
|
-
{item.description.substring(1)}
|
|
118
|
-
</b>
|
|
119
|
-
)}
|
|
120
|
-
</Description>
|
|
121
|
-
</DescriptionContainer>
|
|
122
|
-
<StyledAnchor
|
|
123
|
-
href={item.url}
|
|
124
|
-
target="_blank"
|
|
125
|
-
rel="noreferrer"
|
|
126
|
-
key={index}
|
|
127
|
-
>
|
|
128
|
-
TX-Link
|
|
129
|
-
</StyledAnchor>
|
|
130
|
-
</InternalDetail>
|
|
131
|
-
))}
|
|
132
|
-
{step.status === 'failed' && (
|
|
133
|
-
<InternalDetail>
|
|
134
|
-
<DescriptionContainer>
|
|
135
|
-
<InfoCircleIcon color="error" />
|
|
136
|
-
<Error variant="body2">Step failed</Error>
|
|
137
|
-
</DescriptionContainer>
|
|
138
|
-
</InternalDetail>
|
|
139
|
-
)}
|
|
140
|
-
</div>
|
|
141
|
-
)}
|
|
142
|
-
</InternalDetailsContainer>
|
|
143
|
-
</div>
|
|
144
|
-
{index + 1 === pendingSwap.steps.length && <ArrowDown />}
|
|
145
|
-
<StepDetail
|
|
146
|
-
logo={step.toLogo}
|
|
147
|
-
symbol={step.toSymbol}
|
|
148
|
-
chainLogo={step.toBlockchainLogo}
|
|
149
|
-
blockchain={step.toBlockchain}
|
|
150
|
-
amount={step.outputAmount}
|
|
151
|
-
/>
|
|
152
|
-
</Fragment>
|
|
153
|
-
))}
|
|
154
|
-
</>
|
|
290
|
+
Cancel progress
|
|
291
|
+
</Button>
|
|
292
|
+
</div>
|
|
293
|
+
}
|
|
294
|
+
container={document.getElementById('swap-box')!}
|
|
295
|
+
/>
|
|
155
296
|
</SecondaryPage>
|
|
156
297
|
);
|
|
157
298
|
}
|