@rango-dev/ui 0.1.10-next.92 → 0.1.10
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/README.md +1 -181
- package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
- package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +6 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Header/Header.d.ts +9 -0
- package/dist/components/Header/index.d.ts +1 -0
- package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +3 -1
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +2 -1
- package/dist/components/SelectableWalletList/mock.d.ts +1 -1
- package/dist/components/Settings/Settings.d.ts +2 -1
- package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
- package/dist/components/SwapDetail/Token.d.ts +16 -0
- package/dist/components/TokenSelector/TokenSelector.d.ts +3 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +10 -17
- package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +1 -0
- package/dist/containers/ConfirmSwap/mock.d.ts +3 -0
- package/dist/containers/History/History.d.ts +6 -1
- package/dist/containers/History/index.d.ts +1 -1
- package/dist/containers/History/types.d.ts +3 -24
- package/dist/containers/SwapHistory/SwapHistory.d.ts +16 -3
- package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
- package/dist/containers/index.d.ts +0 -1
- package/dist/helper/index.d.ts +1 -0
- package/dist/types/meta.d.ts +1 -0
- package/dist/ui.cjs.development.js +1062 -838
- 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 +1061 -840
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Alert/Alert.tsx +33 -12
- package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
- package/src/components/Alert/NotFoundAlert.tsx +19 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/BestRoute/mock.ts +10 -0
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -19
- package/src/components/Button/Button.tsx +2 -1
- package/src/components/ConnectWalletsModal/mockData.ts +16 -0
- package/src/components/Divider/Divider.tsx +41 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Header/Header.tsx +39 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Icon/ArrowRightIcon.tsx +31 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +72 -22
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +15 -10
- package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -0
- package/src/components/SelectableWalletList/mock.ts +4 -3
- package/src/components/Settings/Settings.tsx +30 -11
- package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
- package/src/components/StepDetail/StepDetail.tsx +1 -0
- package/src/components/SwapContainer/SwapContainer.tsx +21 -16
- package/src/components/SwapDetail/SwapDetail.tsx +77 -115
- package/src/components/SwapDetail/Token.tsx +68 -0
- package/src/components/SwapDetail/mock.ts +1 -0
- package/src/components/TextField/TextField.tsx +1 -0
- package/src/components/TokenList/TokenItem.tsx +4 -1
- package/src/components/TokenList/TokenList.tsx +16 -18
- package/src/components/TokenSelector/TokenSelector.tsx +47 -10
- package/src/components/Wallet/Wallet.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +103 -117
- package/src/containers/ConfirmSwap/mock.ts +79 -2
- package/src/containers/History/History.tsx +57 -38
- package/src/containers/History/index.ts +1 -1
- package/src/containers/History/mock.ts +1 -0
- package/src/containers/History/types.tsx +2 -30
- package/src/containers/SwapHistory/SwapHistory.tsx +309 -165
- package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
- package/src/containers/SwapHistory/mock.ts +1 -0
- package/src/containers/index.ts +0 -1
- package/src/helper/index.ts +14 -0
- package/src/types/meta.ts +2 -0
- package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +0 -16
- package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +0 -6
- package/dist/containers/ConfirmWallets/index.d.ts +0 -1
- package/dist/containers/ConfirmWallets/mock.d.ts +0 -5
- package/dist/helper/swaps.d.ts +0 -5
- package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +0 -26
- package/src/containers/ConfirmWallets/ConfirmWallets.tsx +0 -143
- package/src/containers/ConfirmWallets/index.ts +0 -1
- package/src/containers/ConfirmWallets/mock.ts +0 -222
- package/src/helper/swaps.ts +0 -23
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from '@stitches/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { containsText } from '../../helper';
|
|
4
|
-
import {
|
|
5
|
-
import { LiquiditySource } from '../../types/meta';
|
|
4
|
+
import { LiquiditySource, LoadingStatus } from '../../types/meta';
|
|
6
5
|
import { Button } from '../Button';
|
|
7
6
|
import { LiquiditySourceList } from '../LiquiditySourceList';
|
|
8
7
|
import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
|
|
@@ -21,15 +20,19 @@ export interface PropTypes {
|
|
|
21
20
|
onBack?: () => void;
|
|
22
21
|
hasHeader?: boolean;
|
|
23
22
|
listContainerStyle?: CSSProperties;
|
|
23
|
+
loadingStatus: LoadingStatus;
|
|
24
24
|
}
|
|
25
|
-
const ActionButton = styled(Button, {
|
|
26
|
-
position: 'absolute',
|
|
27
|
-
right: 0,
|
|
28
|
-
});
|
|
29
25
|
|
|
30
26
|
export function LiquiditySourcesSelector(props: PropTypes) {
|
|
31
|
-
const {
|
|
32
|
-
|
|
27
|
+
const {
|
|
28
|
+
list,
|
|
29
|
+
onChange,
|
|
30
|
+
onBack,
|
|
31
|
+
hasHeader,
|
|
32
|
+
listContainerStyle,
|
|
33
|
+
toggleAll,
|
|
34
|
+
loadingStatus,
|
|
35
|
+
} = props;
|
|
33
36
|
|
|
34
37
|
return (
|
|
35
38
|
<SecondaryPage
|
|
@@ -37,9 +40,9 @@ export function LiquiditySourcesSelector(props: PropTypes) {
|
|
|
37
40
|
textFieldPlaceholder="Search By Name"
|
|
38
41
|
title="Liquidity Sources"
|
|
39
42
|
TopButton={
|
|
40
|
-
<
|
|
43
|
+
<Button variant="ghost" type="primary" onClick={toggleAll}>
|
|
41
44
|
{list.find((item) => item.selected) ? 'Deselect all' : 'Select all'}
|
|
42
|
-
</
|
|
45
|
+
</Button>
|
|
43
46
|
}
|
|
44
47
|
hasHeader={hasHeader}
|
|
45
48
|
onBack={onBack}
|
|
@@ -49,6 +52,8 @@ export function LiquiditySourcesSelector(props: PropTypes) {
|
|
|
49
52
|
listContainerStyle={listContainerStyle}
|
|
50
53
|
list={filterLiquiditySources(list, searchedFor)}
|
|
51
54
|
onChange={onChange}
|
|
55
|
+
loadingStatus={loadingStatus}
|
|
56
|
+
searchedFor={searchedFor}
|
|
52
57
|
/>
|
|
53
58
|
)}
|
|
54
59
|
</SecondaryPage>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { ReactNode, useState } from 'react';
|
|
2
2
|
import { styled } from '../../theme';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Divider } from '../Divider';
|
|
4
|
+
import { Header } from '../Header';
|
|
5
|
+
import { SearchIcon } from '../Icon';
|
|
6
|
+
import { TextField } from '../TextField';
|
|
6
7
|
|
|
7
8
|
export type PropTypes = (
|
|
8
9
|
| {
|
|
@@ -22,40 +23,16 @@ export type PropTypes = (
|
|
|
22
23
|
hasHeader?: boolean;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
+
const ContentContainer = styled('div', {
|
|
27
|
+
overflow: 'hidden',
|
|
26
28
|
display: 'flex',
|
|
27
29
|
flexDirection: 'column',
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
padding: '$12 0',
|
|
31
|
-
position: 'relative',
|
|
32
|
-
|
|
33
|
-
'@lg': {
|
|
34
|
-
padding: '$16 0',
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const HeaderContainer = styled('div', {
|
|
39
|
-
display: 'flex',
|
|
40
|
-
justifyContent: 'center',
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
marginBottom: '$16',
|
|
43
|
-
position: 'relative',
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const BackIcon = styled(AngleLeftIcon, {
|
|
47
|
-
position: 'absolute',
|
|
48
|
-
left: '0',
|
|
49
|
-
});
|
|
50
|
-
const StyledBackIcon = styled(BackIcon, {
|
|
51
|
-
cursor: 'pointer',
|
|
30
|
+
flex: '1',
|
|
31
|
+
padding: '0 $4',
|
|
52
32
|
});
|
|
53
33
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
overflowY: 'auto',
|
|
57
|
-
overflowX: 'hidden',
|
|
58
|
-
marginTop: '$16',
|
|
34
|
+
const TextFieldContainer = styled('div', {
|
|
35
|
+
padding: '1px',
|
|
59
36
|
});
|
|
60
37
|
|
|
61
38
|
export function SecondaryPage(props: PropTypes) {
|
|
@@ -63,32 +40,29 @@ export function SecondaryPage(props: PropTypes) {
|
|
|
63
40
|
const [searchedFor, setSearchedFor] = useState('');
|
|
64
41
|
|
|
65
42
|
return (
|
|
66
|
-
|
|
43
|
+
<>
|
|
67
44
|
{hasHeader && (
|
|
68
|
-
<
|
|
69
|
-
<StyledBackIcon size={24} onClick={onBack} />
|
|
70
|
-
<Typography variant="h4">{title}</Typography>
|
|
71
|
-
{TopButton}
|
|
72
|
-
</HeaderContainer>
|
|
45
|
+
<Header onBack={onBack} title={title || ''} suffix={TopButton} />
|
|
73
46
|
)}
|
|
74
47
|
|
|
75
|
-
{props.textField && (
|
|
76
|
-
<div>
|
|
77
|
-
<TextField
|
|
78
|
-
size="large"
|
|
79
|
-
prefix={<SearchIcon size={24} />}
|
|
80
|
-
placeholder={props.textFieldPlaceholder}
|
|
81
|
-
onChange={(event) => setSearchedFor(event.target.value)}
|
|
82
|
-
value={searchedFor}
|
|
83
|
-
autoFocus
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
|
-
)}
|
|
87
48
|
<ContentContainer>
|
|
49
|
+
{props.textField && (
|
|
50
|
+
<TextFieldContainer>
|
|
51
|
+
<TextField
|
|
52
|
+
size="large"
|
|
53
|
+
prefix={<SearchIcon size={24} />}
|
|
54
|
+
placeholder={props.textFieldPlaceholder}
|
|
55
|
+
onChange={(event) => setSearchedFor(event.target.value)}
|
|
56
|
+
value={searchedFor}
|
|
57
|
+
autoFocus
|
|
58
|
+
/>
|
|
59
|
+
<Divider size={16} />
|
|
60
|
+
</TextFieldContainer>
|
|
61
|
+
)}
|
|
88
62
|
{props.textField && props.children?.(searchedFor)}
|
|
89
63
|
{!props.textField && props.children}
|
|
90
64
|
</ContentContainer>
|
|
91
65
|
{Footer}
|
|
92
|
-
|
|
66
|
+
</>
|
|
93
67
|
);
|
|
94
68
|
}
|
|
@@ -2,6 +2,7 @@ import React, { PropsWithChildren, useEffect, useState } from 'react';
|
|
|
2
2
|
import { styled } from '../../theme';
|
|
3
3
|
import { SelectableWallet } from '../../types';
|
|
4
4
|
import { Typography } from '../Typography';
|
|
5
|
+
import { getConciseAddress } from '../../helper';
|
|
5
6
|
|
|
6
7
|
const Row = styled('div', {
|
|
7
8
|
display: 'flex',
|
|
@@ -69,6 +70,7 @@ const Container = styled('div', {
|
|
|
69
70
|
},
|
|
70
71
|
},
|
|
71
72
|
});
|
|
73
|
+
|
|
72
74
|
export interface PropTypes {
|
|
73
75
|
list: SelectableWallet[];
|
|
74
76
|
onChange: (w: SelectableWallet) => void;
|
|
@@ -102,6 +104,9 @@ export function SelectableWalletList({
|
|
|
102
104
|
>
|
|
103
105
|
<img src={w.image} alt={w.walletType} width={24} height={24} />
|
|
104
106
|
<Typography variant="body2">{w.name}</Typography>
|
|
107
|
+
<Typography variant="caption">
|
|
108
|
+
{getConciseAddress(w.address)}
|
|
109
|
+
</Typography>
|
|
105
110
|
<Circle checked={checked}>
|
|
106
111
|
<SolidCircle checked={checked} />
|
|
107
112
|
</Circle>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
-
import { SelectableWallet } from '../../
|
|
1
|
+
import { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
+
import { SelectableWallet } from '../../types';
|
|
3
3
|
|
|
4
4
|
export const data: SelectableWallet[] = [
|
|
5
5
|
{
|
|
6
|
-
|
|
6
|
+
chain: Network.BTC,
|
|
7
|
+
name: Network.BTC,
|
|
7
8
|
walletType: WalletType.META_MASK,
|
|
8
9
|
address: '0x5423e28219d6d568dcf62a8134d623e6f4a1c2df',
|
|
9
10
|
image: 'https://app.rango.exchange/wallets/metamask.svg',
|
|
@@ -4,10 +4,11 @@ import { AngleRightIcon } from '../Icon';
|
|
|
4
4
|
import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
|
|
5
5
|
import { Typography } from '../Typography';
|
|
6
6
|
import { Chip } from '../Chip';
|
|
7
|
-
import { LiquiditySource } from '../../types/meta';
|
|
7
|
+
import { LiquiditySource, LoadingStatus } from '../../types/meta';
|
|
8
8
|
import { TextField } from '../TextField';
|
|
9
9
|
import { Radio } from '../Radio';
|
|
10
10
|
import { Switch } from '../Switch';
|
|
11
|
+
import { Button } from '../Button';
|
|
11
12
|
|
|
12
13
|
const BaseContainer = styled('div', {
|
|
13
14
|
borderRadius: '$5',
|
|
@@ -71,6 +72,7 @@ export interface PropTypes {
|
|
|
71
72
|
onBack: () => void;
|
|
72
73
|
infiniteApprove: boolean;
|
|
73
74
|
toggleInfiniteApprove: (infinite: boolean) => void;
|
|
75
|
+
loadingStatus: LoadingStatus;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
export function Settings(props: PropTypes) {
|
|
@@ -89,6 +91,7 @@ export function Settings(props: PropTypes) {
|
|
|
89
91
|
onThemeChange,
|
|
90
92
|
toggleInfiniteApprove,
|
|
91
93
|
infiniteApprove,
|
|
94
|
+
loadingStatus,
|
|
92
95
|
} = props;
|
|
93
96
|
|
|
94
97
|
const [selectedSlippage, setSelectedSlippage] = useState(
|
|
@@ -167,16 +170,32 @@ export function Settings(props: PropTypes) {
|
|
|
167
170
|
<Typography variant="body1">Infinite Approval</Typography>
|
|
168
171
|
<Switch checked={infiniteApprove} onChange={toggleInfiniteApprove} />
|
|
169
172
|
</InfiniteContainer>
|
|
170
|
-
<LiquiditySourceContainer
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
<LiquiditySourceContainer>
|
|
174
|
+
<Button
|
|
175
|
+
onClick={onLiquiditySourcesClick}
|
|
176
|
+
align="start"
|
|
177
|
+
variant="ghost"
|
|
178
|
+
loading={loadingStatus === 'loading'}
|
|
179
|
+
suffix={
|
|
180
|
+
<LiquiditySourceNumber>
|
|
181
|
+
{loadingStatus === 'success' && (
|
|
182
|
+
<Typography variant="body2" color="neutrals800">
|
|
183
|
+
{liquiditySources.length !== selectedLiquiditySources.length
|
|
184
|
+
? `${selectedLiquiditySources.length} / ${liquiditySources.length}`
|
|
185
|
+
: liquiditySources.length}
|
|
186
|
+
</Typography>
|
|
187
|
+
)}
|
|
188
|
+
{loadingStatus === 'failed' && (
|
|
189
|
+
<Typography variant="body2" color="$error500">
|
|
190
|
+
Loading failed
|
|
191
|
+
</Typography>
|
|
192
|
+
)}
|
|
193
|
+
<StyledAngleRight />
|
|
194
|
+
</LiquiditySourceNumber>
|
|
195
|
+
}
|
|
196
|
+
>
|
|
197
|
+
<Typography variant="body1">Liquidity Sources</Typography>
|
|
198
|
+
</Button>
|
|
180
199
|
</LiquiditySourceContainer>
|
|
181
200
|
</>
|
|
182
201
|
);
|
|
@@ -3,36 +3,41 @@ import React, { PropsWithChildren } from 'react';
|
|
|
3
3
|
import { styled } from '../../theme';
|
|
4
4
|
|
|
5
5
|
const MainContainer = styled('div', {
|
|
6
|
+
position: 'relative',
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'column',
|
|
6
9
|
borderRadius: '$10',
|
|
7
|
-
maxWidth: '512px',
|
|
8
10
|
boxShadow: '$s',
|
|
9
|
-
minWidth: '375px',
|
|
10
11
|
width: '100%',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
flexDirection: 'column',
|
|
15
|
-
alignItems: 'end',
|
|
12
|
+
minWidth: '375px',
|
|
13
|
+
maxWidth: '512px',
|
|
14
|
+
maxHeight: '595px',
|
|
16
15
|
padding: '$16',
|
|
17
16
|
boxSizing: 'border-box',
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
backgroundColor: '$background',
|
|
18
|
+
variants: {
|
|
19
|
+
fixedHeight: {
|
|
20
|
+
true: {
|
|
21
|
+
height: '595px',
|
|
22
|
+
},
|
|
23
|
+
false: {
|
|
24
|
+
height: 'auto',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
24
28
|
});
|
|
25
29
|
|
|
26
30
|
export interface PropTypes {
|
|
27
31
|
style?: CSSProperties;
|
|
32
|
+
fixedHeight?: boolean;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
export function SwapContainer(props: PropsWithChildren<PropTypes>) {
|
|
31
|
-
const { children, style } = props;
|
|
36
|
+
const { children, style, fixedHeight = true } = props;
|
|
32
37
|
|
|
33
38
|
return (
|
|
34
|
-
<MainContainer style={style} id="swap-box">
|
|
35
|
-
|
|
39
|
+
<MainContainer style={style} id="swap-box" fixedHeight={fixedHeight}>
|
|
40
|
+
{children}
|
|
36
41
|
</MainContainer>
|
|
37
42
|
);
|
|
38
43
|
}
|
|
@@ -2,88 +2,45 @@ import React, { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { PendingSwap } from '../../containers/History/types';
|
|
3
3
|
import { styled } from '../../theme';
|
|
4
4
|
import { Button } from '../Button';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ArrowRightIcon } from '../Icon';
|
|
6
|
+
import { Spacer } from '../Spacer';
|
|
7
|
+
import { Spinner } from '../Spinner';
|
|
8
|
+
import { Token } from './Token';
|
|
7
9
|
|
|
8
10
|
const Container = styled('div', {
|
|
9
11
|
position: 'relative',
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const ButtonContainer = styled('div', {
|
|
13
|
-
paddingTop: '$8',
|
|
14
|
-
});
|
|
15
|
-
const SwapContainer = styled('div', {
|
|
16
12
|
display: 'flex',
|
|
17
13
|
justifyContent: 'space-between',
|
|
18
|
-
'
|
|
19
|
-
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
padding: '$16 0',
|
|
16
|
+
borderBottom: '1px solid $neutrals300',
|
|
17
|
+
|
|
18
|
+
'& > .info': {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
20
21
|
},
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
'.status': {
|
|
24
|
+
textTransform: 'uppercase',
|
|
25
|
+
fontWeight: 'bold',
|
|
26
|
+
fontSize: '$12',
|
|
23
27
|
},
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
failed: {
|
|
28
|
-
borderColor: '$error',
|
|
29
|
-
},
|
|
30
|
-
running: {
|
|
31
|
-
borderColor: '$neutrals400',
|
|
32
|
-
},
|
|
33
|
-
success: {
|
|
34
|
-
borderColor: '$success',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
29
|
+
'&.running': {
|
|
30
|
+
color: '$foreground',
|
|
37
31
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
display: 'flex',
|
|
41
|
-
justifyContent: 'center',
|
|
42
|
-
alignItems: 'center',
|
|
43
|
-
});
|
|
44
|
-
const Line = styled('div', {
|
|
45
|
-
height: '0',
|
|
46
|
-
width: '$20',
|
|
47
|
-
border: '1px dashed $foreground',
|
|
48
|
-
borderRadius: 'inherit',
|
|
49
|
-
'@md': {
|
|
50
|
-
width: '$36',
|
|
32
|
+
'&.failed,&.success': {
|
|
33
|
+
color: '$neutrals600',
|
|
51
34
|
},
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
|
|
36
|
+
'&.failed .status': {
|
|
37
|
+
color: '$error',
|
|
54
38
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
width: '$6',
|
|
58
|
-
height: '$6',
|
|
59
|
-
backgroundColor: '$foreground',
|
|
60
|
-
borderRadius: '50%',
|
|
61
|
-
'@lg': {
|
|
62
|
-
width: '$8',
|
|
63
|
-
height: '$8',
|
|
39
|
+
'&.success .status': {
|
|
40
|
+
color: '$success',
|
|
64
41
|
},
|
|
65
42
|
});
|
|
66
|
-
const ArrowRight = styled('div', {
|
|
67
|
-
width: '0px',
|
|
68
|
-
height: '0px',
|
|
69
|
-
borderTop: '5px solid transparent',
|
|
70
|
-
borderBottom: '5px solid transparent',
|
|
71
|
-
borderLeft: '5px solid $foreground',
|
|
72
|
-
});
|
|
73
|
-
const StatusContainer = styled('div', {
|
|
74
|
-
position: 'absolute',
|
|
75
|
-
right: '-8px',
|
|
76
|
-
top: '30%',
|
|
77
|
-
background: '$background',
|
|
78
|
-
borderRadius: '50%',
|
|
79
|
-
display: 'flex',
|
|
80
|
-
justifyContent: 'center',
|
|
81
43
|
|
|
82
|
-
'@md': {
|
|
83
|
-
top: '40%',
|
|
84
|
-
right: '-8px',
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
44
|
export interface PropTypes {
|
|
88
45
|
swap: PendingSwap;
|
|
89
46
|
status: 'running' | 'failed' | 'success';
|
|
@@ -99,52 +56,57 @@ export function SwapDetail({
|
|
|
99
56
|
const lastStep = swap.steps[swap.steps.length - 1];
|
|
100
57
|
|
|
101
58
|
return (
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
blockchain
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
59
|
+
<Button
|
|
60
|
+
variant="ghost"
|
|
61
|
+
size="free"
|
|
62
|
+
fullWidth
|
|
63
|
+
onClick={onClick.bind(null, swap.requestId)}
|
|
64
|
+
>
|
|
65
|
+
<Container className={`${status}`}>
|
|
66
|
+
<div className="info">
|
|
67
|
+
<Token
|
|
68
|
+
data={{
|
|
69
|
+
token: {
|
|
70
|
+
logo: firstStep.fromLogo,
|
|
71
|
+
symbol: firstStep.fromSymbol,
|
|
72
|
+
},
|
|
73
|
+
blockchain: {
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
logo: firstStep.fromBlockchainLogo,
|
|
76
|
+
name: firstStep.fromBlockchain,
|
|
77
|
+
},
|
|
78
|
+
amount: swap.inputAmount,
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
<Spacer size={12} />
|
|
82
|
+
<ArrowRightIcon size={12} />
|
|
83
|
+
<Spacer size={12} />
|
|
84
|
+
<Token
|
|
85
|
+
data={{
|
|
86
|
+
token: {
|
|
87
|
+
logo: lastStep.toLogo,
|
|
88
|
+
symbol: lastStep.toSymbol,
|
|
89
|
+
},
|
|
90
|
+
blockchain: {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
logo: lastStep.toBlockchainLogo,
|
|
93
|
+
name: lastStep.toBlockchain,
|
|
94
|
+
},
|
|
95
|
+
amount:
|
|
96
|
+
lastStep.outputAmount ||
|
|
97
|
+
lastStep.expectedOutputAmountHumanReadable ||
|
|
98
|
+
'',
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
<div className={`status`}>
|
|
103
|
+
{status === 'running' ? (
|
|
104
|
+
<Spinner size={24} color="primary" />
|
|
105
|
+
) : (
|
|
106
|
+
status
|
|
107
|
+
)}
|
|
108
|
+
</div>
|
|
109
|
+
</Container>
|
|
110
|
+
</Button>
|
|
149
111
|
);
|
|
150
112
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '../../theme';
|
|
3
|
+
import { Spacer } from '../Spacer';
|
|
4
|
+
|
|
5
|
+
const TokenContainer = styled('div', {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
|
|
9
|
+
'& .amount': {
|
|
10
|
+
fontWeight: 'bold',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const TokenImage = styled('div', {
|
|
15
|
+
position: 'relative',
|
|
16
|
+
width: '$24',
|
|
17
|
+
height: '$24',
|
|
18
|
+
|
|
19
|
+
img: {
|
|
20
|
+
width: '100%',
|
|
21
|
+
display: 'block',
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
'.overlay': {
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
right: -4,
|
|
27
|
+
bottom: -4,
|
|
28
|
+
width: '$16',
|
|
29
|
+
height: '$16',
|
|
30
|
+
padding: '$2',
|
|
31
|
+
borderRadius: '50%',
|
|
32
|
+
backgroundColor: '$background',
|
|
33
|
+
border: '1px solid $neutrals400',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
interface PropTypes {
|
|
38
|
+
data: {
|
|
39
|
+
token: {
|
|
40
|
+
logo: string;
|
|
41
|
+
symbol: string;
|
|
42
|
+
};
|
|
43
|
+
blockchain: {
|
|
44
|
+
logo: string;
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
amount: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function Token(props: PropTypes) {
|
|
51
|
+
return (
|
|
52
|
+
<TokenContainer>
|
|
53
|
+
<TokenImage>
|
|
54
|
+
<img src={props.data.token.logo} alt="" />
|
|
55
|
+
<div className="overlay">
|
|
56
|
+
<img
|
|
57
|
+
src={props.data.blockchain.logo}
|
|
58
|
+
alt={props.data.blockchain.name}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</TokenImage>
|
|
62
|
+
<Spacer size={8} />
|
|
63
|
+
<span className="amount">{props.data.amount}</span>
|
|
64
|
+
<Spacer size={4} />
|
|
65
|
+
{props.data.token.symbol}
|
|
66
|
+
</TokenContainer>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -40,6 +40,7 @@ export function TokenItem(props: PropTypes) {
|
|
|
40
40
|
...style,
|
|
41
41
|
height: '48px',
|
|
42
42
|
top: `${parseFloat(style?.top as string) + 0}px`,
|
|
43
|
+
padding: '0 4px',
|
|
43
44
|
}}
|
|
44
45
|
>
|
|
45
46
|
<Button
|
|
@@ -62,7 +63,9 @@ export function TokenItem(props: PropTypes) {
|
|
|
62
63
|
>
|
|
63
64
|
<TokenNameContainer>
|
|
64
65
|
<Typography variant="body1">{token.symbol}</Typography>
|
|
65
|
-
<Typography variant="
|
|
66
|
+
<Typography variant="caption" color="neutrals600">
|
|
67
|
+
{token.name}
|
|
68
|
+
</Typography>
|
|
66
69
|
</TokenNameContainer>
|
|
67
70
|
</Button>
|
|
68
71
|
</div>
|