@rango-dev/ui 0.1.10 → 0.1.11-next.11
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 -1
- package/dist/components/Icon/types.d.ts +1 -0
- package/dist/components/Modal/Modal.d.ts +0 -1
- package/dist/components/StepDetail/StepDetail.d.ts +3 -1
- package/dist/components/SwapDetail/Token.d.ts +1 -0
- package/dist/components/TextField/TextField.d.ts +1 -1
- package/dist/components/TokenList/TokenList.d.ts +2 -2
- package/dist/components/TokenSelector/TokenSelector.d.ts +1 -3
- package/dist/components/Typography/Typography.d.ts +1 -1
- package/dist/components/common/Image.d.ts +6 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +4 -2
- package/dist/containers/History/History.d.ts +5 -12
- package/dist/containers/History/SwapsGroup.d.ts +13 -0
- package/dist/containers/History/index.d.ts +2 -1
- package/dist/containers/SwapHistory/SwapHistory.d.ts +1 -1
- package/dist/helper/index.d.ts +3 -2
- package/dist/ui.cjs.development.js +329 -255
- 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 +328 -256
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Alert/Alert.tsx +3 -3
- package/src/components/BestRoute/BestRoute.tsx +2 -5
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +24 -21
- package/src/components/BlockchainsList/BlockchainsList.tsx +8 -6
- package/src/components/Drawer/Drawer.tsx +1 -1
- package/src/components/Icon/common.ts +10 -0
- package/src/components/Icon/types.tsx +1 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +9 -5
- package/src/components/Modal/Modal.tsx +1 -6
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +2 -1
- package/src/components/Settings/Settings.tsx +4 -3
- package/src/components/StepDetail/StepDetail.tsx +45 -12
- package/src/components/SwapContainer/SwapContainer.tsx +1 -2
- package/src/components/SwapDetail/SwapDetail.tsx +8 -16
- package/src/components/SwapDetail/Token.tsx +19 -14
- package/src/components/TextField/TextField.tsx +8 -0
- package/src/components/TokenList/TokenItem.tsx +8 -5
- package/src/components/TokenList/TokenList.tsx +2 -3
- package/src/components/TokenSelector/TokenSelector.tsx +23 -47
- package/src/components/Typography/Typography.tsx +11 -3
- package/src/components/Wallet/Wallet.tsx +8 -5
- package/src/components/common/Image.tsx +27 -0
- package/src/components/common/index.ts +1 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +9 -9
- package/src/containers/History/History.tsx +28 -71
- package/src/containers/History/SwapsGroup.tsx +59 -0
- package/src/containers/History/index.ts +2 -1
- package/src/containers/SwapHistory/SwapHistory.tsx +121 -135
- package/src/helper/index.ts +20 -5
package/package.json
CHANGED
|
@@ -72,7 +72,7 @@ export function Alert(props: PropsWithChildren<PropTypes>) {
|
|
|
72
72
|
{type === 'success' && <CheckCircleIcon color={type} size={24} />}
|
|
73
73
|
{type === 'warning' && <WarningIcon color={type} size={24} />}
|
|
74
74
|
{type === 'error' && <InfoCircleIcon color={type} size={24} />}
|
|
75
|
-
<Spacer size={
|
|
75
|
+
<Spacer size={4} />
|
|
76
76
|
</div>
|
|
77
77
|
</>
|
|
78
78
|
)}
|
|
@@ -87,10 +87,10 @@ export function Alert(props: PropsWithChildren<PropTypes>) {
|
|
|
87
87
|
>
|
|
88
88
|
{title && (
|
|
89
89
|
<>
|
|
90
|
-
<Typography className="title" variant="
|
|
90
|
+
<Typography className="title" variant="title" color={type}>
|
|
91
91
|
{title}
|
|
92
92
|
</Typography>
|
|
93
|
-
{!!children && <Spacer size={
|
|
93
|
+
{!!children && <Spacer size={4} direction="vertical" />}
|
|
94
94
|
</>
|
|
95
95
|
)}
|
|
96
96
|
{children}
|
|
@@ -7,6 +7,7 @@ import { Skeleton } from '../Skeleton';
|
|
|
7
7
|
import { Spinner } from '../Spinner';
|
|
8
8
|
import { BestRouteResponse } from 'rango-sdk';
|
|
9
9
|
import { Tooltip } from '../Tooltip';
|
|
10
|
+
import { Image } from '../common';
|
|
10
11
|
|
|
11
12
|
const Container = styled('div', {
|
|
12
13
|
borderRadius: '$5',
|
|
@@ -48,10 +49,6 @@ const HR = styled('hr', {
|
|
|
48
49
|
margin: '$8 0',
|
|
49
50
|
});
|
|
50
51
|
|
|
51
|
-
const SwapperLogo = styled('img', {
|
|
52
|
-
width: '$16',
|
|
53
|
-
height: '$16',
|
|
54
|
-
});
|
|
55
52
|
const RelativeContainer = styled('div', {
|
|
56
53
|
position: 'relative',
|
|
57
54
|
});
|
|
@@ -208,7 +205,7 @@ export function BestRoute(props: PropsWithChildren<PropTypes>) {
|
|
|
208
205
|
)}
|
|
209
206
|
<SwapperContainer>
|
|
210
207
|
<Line />
|
|
211
|
-
<
|
|
208
|
+
<Image src={swap.swapperLogo} alt={swap.swapperId} size={20} />
|
|
212
209
|
<Line />
|
|
213
210
|
</SwapperContainer>
|
|
214
211
|
|
|
@@ -13,6 +13,7 @@ import { LoaderContainer } from '../TokenSelector/TokenSelector';
|
|
|
13
13
|
|
|
14
14
|
const ListContainer = styled('div', {
|
|
15
15
|
overflowY: 'auto',
|
|
16
|
+
padding: '0 $4',
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
const filterBlockchains = (list: BlockchainMeta[], searchedFor: string) =>
|
|
@@ -60,32 +61,34 @@ export function BlockchainSelector(props: PropTypes) {
|
|
|
60
61
|
{(searchedFor) => {
|
|
61
62
|
const filteredBlockchains = filterBlockchains(list, searchedFor);
|
|
62
63
|
return (
|
|
63
|
-
|
|
64
|
+
<>
|
|
64
65
|
{loadingStatus === 'loading' && (
|
|
65
66
|
<LoaderContainer>
|
|
66
67
|
<Spinner size={24} />
|
|
67
68
|
</LoaderContainer>
|
|
68
69
|
)}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
70
|
+
<ListContainer style={listContainerStyle} key="1">
|
|
71
|
+
{loadingStatus === 'failed' && <LoadingFailedAlert />}
|
|
72
|
+
{loadingStatus === 'success' && (
|
|
73
|
+
<>
|
|
74
|
+
{filteredBlockchains.length ? (
|
|
75
|
+
<BlockchainsList
|
|
76
|
+
list={filteredBlockchains}
|
|
77
|
+
selected={selected}
|
|
78
|
+
multiSelect={multiSelect}
|
|
79
|
+
selectedList={selectedList}
|
|
80
|
+
onChange={onChange}
|
|
81
|
+
/>
|
|
82
|
+
) : (
|
|
83
|
+
<NotFoundAlert
|
|
84
|
+
catergory="Blockchain"
|
|
85
|
+
searchedFor={searchedFor}
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
</>
|
|
89
|
+
)}
|
|
90
|
+
</ListContainer>
|
|
91
|
+
</>
|
|
89
92
|
);
|
|
90
93
|
}}
|
|
91
94
|
</SecondaryPage>
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { styled } from '../../theme';
|
|
3
3
|
import { BlockchainMeta } from 'rango-sdk';
|
|
4
4
|
import { Button } from '../Button/Button';
|
|
5
|
-
import { FilledCircle } from '../common';
|
|
5
|
+
import { FilledCircle, Image } from '../common';
|
|
6
6
|
import { Typography } from '../Typography';
|
|
7
7
|
|
|
8
8
|
export interface PropTypes {
|
|
@@ -22,10 +22,8 @@ const ListContainer = styled('div', {
|
|
|
22
22
|
height: '100%',
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
maxHeight: '1.5rem',
|
|
28
|
-
marginRight: '$4',
|
|
25
|
+
const ImageContainer = styled('div', {
|
|
26
|
+
paddingRight: '$4',
|
|
29
27
|
});
|
|
30
28
|
|
|
31
29
|
export function BlockchainsList(props: PropTypes) {
|
|
@@ -55,7 +53,11 @@ export function BlockchainsList(props: PropTypes) {
|
|
|
55
53
|
type={isSelect(blockchain.name) ? 'primary' : undefined}
|
|
56
54
|
variant="outlined"
|
|
57
55
|
size="large"
|
|
58
|
-
prefix={
|
|
56
|
+
prefix={
|
|
57
|
+
<ImageContainer>
|
|
58
|
+
<Image size={24} src={blockchain.logo} />
|
|
59
|
+
</ImageContainer>
|
|
60
|
+
}
|
|
59
61
|
suffix={isSelect(blockchain.name) ? <FilledCircle /> : undefined}
|
|
60
62
|
align="start"
|
|
61
63
|
onClick={changeSelectedBlockchain.bind(null, blockchain)}
|
|
@@ -110,7 +110,7 @@ export function Drawer(props: PropTypes) {
|
|
|
110
110
|
<BackDrop onClick={handleBackDropClick}>
|
|
111
111
|
<DrawerContainer anchor={anchor} style={containerStyle}>
|
|
112
112
|
<DrawerHeader>
|
|
113
|
-
<Typography variant="
|
|
113
|
+
<Typography variant="h6">{title}</Typography>
|
|
114
114
|
{showClose && <CloseIcon size={24} onClick={onClose} />}
|
|
115
115
|
</DrawerHeader>
|
|
116
116
|
<Body>{content}</Body>
|
|
@@ -31,6 +31,11 @@ export const SvgWithStrokeColor = styled('svg', {
|
|
|
31
31
|
stroke: '$$color',
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
|
+
disabled: {
|
|
35
|
+
true: {
|
|
36
|
+
stroke: '$neutrals400',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
34
39
|
},
|
|
35
40
|
});
|
|
36
41
|
|
|
@@ -65,5 +70,10 @@ export const SvgWithFillColor = styled('svg', {
|
|
|
65
70
|
fill: '$$color',
|
|
66
71
|
},
|
|
67
72
|
},
|
|
73
|
+
disabled: {
|
|
74
|
+
true: {
|
|
75
|
+
stroke: '$neutrals400',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
68
78
|
},
|
|
69
79
|
});
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
export interface IconProps extends React.SVGAttributes<SVGElement> {
|
|
4
4
|
size?: 12 | 16 | 18 | 20 | 24 | 28 | 32 | 36 | 40;
|
|
5
5
|
color?: 'primary' | 'error' | 'warning' | 'success' | 'black' | 'white';
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export type Icon =
|
|
@@ -9,6 +9,7 @@ import { Typography } from '../Typography';
|
|
|
9
9
|
import { Spinner } from '../Spinner';
|
|
10
10
|
import { LoadingFailedAlert } from '../Alert/LoadingFailedAlert';
|
|
11
11
|
import { NotFoundAlert } from '../Alert/NotFoundAlert';
|
|
12
|
+
import { Image } from '../common';
|
|
12
13
|
|
|
13
14
|
const groupLiquiditySources = (
|
|
14
15
|
liquiditySources: LiquiditySource[]
|
|
@@ -27,6 +28,7 @@ const MainContainer = styled('div', {
|
|
|
27
28
|
loaded: {
|
|
28
29
|
true: {
|
|
29
30
|
overflowY: 'auto',
|
|
31
|
+
padding: '0 $4',
|
|
30
32
|
},
|
|
31
33
|
},
|
|
32
34
|
},
|
|
@@ -44,10 +46,8 @@ const LiquiditySourceType = styled('div', {
|
|
|
44
46
|
paddingBottom: '$8',
|
|
45
47
|
});
|
|
46
48
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
maxHeight: '$20',
|
|
50
|
-
marginRight: '$16',
|
|
49
|
+
const LiquidityImageContainer = styled('div', {
|
|
50
|
+
paddingRight: '$16',
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
const LoaderContainer = styled('div', {
|
|
@@ -185,7 +185,11 @@ const LiquiditySourceItem = ({
|
|
|
185
185
|
size="large"
|
|
186
186
|
align="start"
|
|
187
187
|
variant="outlined"
|
|
188
|
-
prefix={
|
|
188
|
+
prefix={
|
|
189
|
+
<LiquidityImageContainer>
|
|
190
|
+
<Image src={liquiditySource.logo} size={20} />
|
|
191
|
+
</LiquidityImageContainer>
|
|
192
|
+
}
|
|
189
193
|
suffix={<Switch checked={selected} />}
|
|
190
194
|
style={{ marginBottom: '12px' }}
|
|
191
195
|
onClick={onChange.bind(null, liquiditySource)}
|
|
@@ -12,7 +12,6 @@ export interface PropTypes {
|
|
|
12
12
|
content: React.ReactNode;
|
|
13
13
|
action?: React.ReactNode;
|
|
14
14
|
containerStyle?: CSSProperties;
|
|
15
|
-
contentStyle?: CSSProperties;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
const BackDrop = styled('div', {
|
|
@@ -48,7 +47,6 @@ const ModalHeader = styled('div', {
|
|
|
48
47
|
marginBottom: '$16',
|
|
49
48
|
});
|
|
50
49
|
|
|
51
|
-
const ContentContainer = styled('div', {});
|
|
52
50
|
|
|
53
51
|
export function Modal(props: PropTypes) {
|
|
54
52
|
const {
|
|
@@ -58,7 +56,6 @@ export function Modal(props: PropTypes) {
|
|
|
58
56
|
onClose,
|
|
59
57
|
containerStyle,
|
|
60
58
|
action,
|
|
61
|
-
contentStyle,
|
|
62
59
|
} = props;
|
|
63
60
|
|
|
64
61
|
const handleBackDropClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
@@ -81,9 +78,7 @@ export function Modal(props: PropTypes) {
|
|
|
81
78
|
<CloseIcon size={24} onClick={onClose} />
|
|
82
79
|
</Row>
|
|
83
80
|
</ModalHeader>
|
|
84
|
-
|
|
85
|
-
{content}
|
|
86
|
-
</ContentContainer>
|
|
81
|
+
{content}
|
|
87
82
|
</ModalContainer>
|
|
88
83
|
</BackDrop>,
|
|
89
84
|
document.body
|
|
@@ -3,6 +3,7 @@ import { styled } from '../../theme';
|
|
|
3
3
|
import { SelectableWallet } from '../../types';
|
|
4
4
|
import { Typography } from '../Typography';
|
|
5
5
|
import { getConciseAddress } from '../../helper';
|
|
6
|
+
import { Image } from '../common';
|
|
6
7
|
|
|
7
8
|
const Row = styled('div', {
|
|
8
9
|
display: 'flex',
|
|
@@ -102,7 +103,7 @@ export function SelectableWalletList({
|
|
|
102
103
|
onClick={onClick.bind(null, w)}
|
|
103
104
|
key={index}
|
|
104
105
|
>
|
|
105
|
-
<
|
|
106
|
+
<Image src={w.image} alt={w.walletType} size={24} />
|
|
106
107
|
<Typography variant="body2">{w.name}</Typography>
|
|
107
108
|
<Typography variant="caption">
|
|
108
109
|
{getConciseAddress(w.address)}
|
|
@@ -27,13 +27,13 @@ const SlippageChipsContainer = styled('div', {
|
|
|
27
27
|
const LiquiditySourceContainer = styled(BaseContainer, {
|
|
28
28
|
display: 'flex',
|
|
29
29
|
justifyContent: 'space-between',
|
|
30
|
-
marginTop: '$
|
|
30
|
+
marginTop: '$16',
|
|
31
31
|
cursor: 'pointer',
|
|
32
32
|
});
|
|
33
33
|
const InfiniteContainer = styled(BaseContainer, {
|
|
34
34
|
display: 'flex',
|
|
35
35
|
justifyContent: 'space-between',
|
|
36
|
-
marginTop: '$
|
|
36
|
+
marginTop: '$16',
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const StyledAngleRight = styled(AngleRightIcon, { marginLeft: '$8' });
|
|
@@ -45,8 +45,9 @@ const LiquiditySourceNumber = styled('div', {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
const ThemesContainer = styled(BaseContainer, {
|
|
48
|
-
marginTop: '$
|
|
48
|
+
marginTop: '$16',
|
|
49
49
|
});
|
|
50
|
+
|
|
50
51
|
const Head = styled('div', {
|
|
51
52
|
display: 'flex',
|
|
52
53
|
justifyContent: 'space-between',
|
|
@@ -50,6 +50,12 @@ const StepContainer = styled('div', {
|
|
|
50
50
|
justifyContent: 'center',
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
|
+
success: {
|
|
54
|
+
true: { filter: 'none' },
|
|
55
|
+
false: {
|
|
56
|
+
filter: 'grayscale(100%)',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
53
59
|
},
|
|
54
60
|
});
|
|
55
61
|
const Detail = styled('div', {
|
|
@@ -70,6 +76,7 @@ const Detail = styled('div', {
|
|
|
70
76
|
const SubTitle = styled(Typography, {
|
|
71
77
|
color: '$neutrals600',
|
|
72
78
|
display: 'block',
|
|
79
|
+
paddingLeft: '$8',
|
|
73
80
|
});
|
|
74
81
|
export interface PropTypes {
|
|
75
82
|
logo: string;
|
|
@@ -77,19 +84,24 @@ export interface PropTypes {
|
|
|
77
84
|
amount: string;
|
|
78
85
|
symbol: string;
|
|
79
86
|
blockchain: string;
|
|
87
|
+
estimatedAmount?: string;
|
|
80
88
|
direction?: 'horizontal' | 'vertical';
|
|
89
|
+
success?: boolean;
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
export function StepDetail({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
export function StepDetail(props: PropsWithChildren<PropTypes>) {
|
|
93
|
+
const {
|
|
94
|
+
logo,
|
|
95
|
+
chainLogo,
|
|
96
|
+
amount,
|
|
97
|
+
symbol,
|
|
98
|
+
blockchain,
|
|
99
|
+
estimatedAmount,
|
|
100
|
+
success = true,
|
|
101
|
+
direction = 'horizontal',
|
|
102
|
+
} = props;
|
|
91
103
|
return (
|
|
92
|
-
<StepContainer direction={direction}>
|
|
104
|
+
<StepContainer direction={direction} success={success}>
|
|
93
105
|
<StepLogoContainer direction={direction}>
|
|
94
106
|
<Logo src={logo} alt={symbol} />
|
|
95
107
|
<ChainLogo>
|
|
@@ -97,10 +109,31 @@ export function StepDetail({
|
|
|
97
109
|
</ChainLogo>
|
|
98
110
|
</StepLogoContainer>
|
|
99
111
|
<Detail pl={direction === 'horizontal'}>
|
|
100
|
-
|
|
101
|
-
|
|
112
|
+
{amount && (
|
|
113
|
+
<Typography
|
|
114
|
+
noWrap
|
|
115
|
+
variant={direction === 'vertical' ? 'body2' : 'title'}
|
|
116
|
+
>
|
|
117
|
+
{amount}
|
|
118
|
+
</Typography>
|
|
119
|
+
)}
|
|
120
|
+
{!amount && estimatedAmount && (
|
|
121
|
+
<Typography
|
|
122
|
+
noWrap
|
|
123
|
+
variant={direction === 'vertical' ? 'body2' : 'title'}
|
|
124
|
+
color={'$neutrals600'}
|
|
125
|
+
>
|
|
126
|
+
{estimatedAmount}
|
|
127
|
+
</Typography>
|
|
128
|
+
)}
|
|
129
|
+
|
|
130
|
+
<Typography
|
|
131
|
+
variant={direction === 'vertical' ? 'body2' : 'title'}
|
|
132
|
+
noWrap
|
|
133
|
+
>
|
|
134
|
+
{symbol}
|
|
102
135
|
</Typography>
|
|
103
|
-
<SubTitle noWrap variant="caption" color="neutrals800">
|
|
136
|
+
<SubTitle noWrap variant="caption" color="$neutrals800">
|
|
104
137
|
on {blockchain}
|
|
105
138
|
</SubTitle>
|
|
106
139
|
</Detail>
|
|
@@ -11,7 +11,6 @@ const MainContainer = styled('div', {
|
|
|
11
11
|
width: '100%',
|
|
12
12
|
minWidth: '375px',
|
|
13
13
|
maxWidth: '512px',
|
|
14
|
-
maxHeight: '595px',
|
|
15
14
|
padding: '$16',
|
|
16
15
|
boxSizing: 'border-box',
|
|
17
16
|
backgroundColor: '$background',
|
|
@@ -19,6 +18,7 @@ const MainContainer = styled('div', {
|
|
|
19
18
|
fixedHeight: {
|
|
20
19
|
true: {
|
|
21
20
|
height: '595px',
|
|
21
|
+
maxHeight: '595px',
|
|
22
22
|
},
|
|
23
23
|
false: {
|
|
24
24
|
height: 'auto',
|
|
@@ -34,7 +34,6 @@ export interface PropTypes {
|
|
|
34
34
|
|
|
35
35
|
export function SwapContainer(props: PropsWithChildren<PropTypes>) {
|
|
36
36
|
const { children, style, fixedHeight = true } = props;
|
|
37
|
-
|
|
38
37
|
return (
|
|
39
38
|
<MainContainer style={style} id="swap-box" fixedHeight={fixedHeight}>
|
|
40
39
|
{children}
|
|
@@ -6,6 +6,7 @@ import { ArrowRightIcon } from '../Icon';
|
|
|
6
6
|
import { Spacer } from '../Spacer';
|
|
7
7
|
import { Spinner } from '../Spinner';
|
|
8
8
|
import { Token } from './Token';
|
|
9
|
+
import { limitDecimalPlaces } from '../../helper';
|
|
9
10
|
|
|
10
11
|
const Container = styled('div', {
|
|
11
12
|
position: 'relative',
|
|
@@ -26,13 +27,6 @@ const Container = styled('div', {
|
|
|
26
27
|
fontSize: '$12',
|
|
27
28
|
},
|
|
28
29
|
|
|
29
|
-
'&.running': {
|
|
30
|
-
color: '$foreground',
|
|
31
|
-
},
|
|
32
|
-
'&.failed,&.success': {
|
|
33
|
-
color: '$neutrals600',
|
|
34
|
-
},
|
|
35
|
-
|
|
36
30
|
'&.failed .status': {
|
|
37
31
|
color: '$error',
|
|
38
32
|
},
|
|
@@ -71,11 +65,10 @@ export function SwapDetail({
|
|
|
71
65
|
symbol: firstStep.fromSymbol,
|
|
72
66
|
},
|
|
73
67
|
blockchain: {
|
|
74
|
-
|
|
75
|
-
logo: firstStep.fromBlockchainLogo,
|
|
68
|
+
logo: firstStep.fromBlockchainLogo || '',
|
|
76
69
|
name: firstStep.fromBlockchain,
|
|
77
70
|
},
|
|
78
|
-
amount: swap.inputAmount,
|
|
71
|
+
amount: limitDecimalPlaces(swap.inputAmount),
|
|
79
72
|
}}
|
|
80
73
|
/>
|
|
81
74
|
<Spacer size={12} />
|
|
@@ -88,14 +81,13 @@ export function SwapDetail({
|
|
|
88
81
|
symbol: lastStep.toSymbol,
|
|
89
82
|
},
|
|
90
83
|
blockchain: {
|
|
91
|
-
|
|
92
|
-
logo: lastStep.toBlockchainLogo,
|
|
84
|
+
logo: lastStep.toBlockchainLogo || '',
|
|
93
85
|
name: lastStep.toBlockchain,
|
|
94
86
|
},
|
|
95
|
-
amount:
|
|
96
|
-
|
|
97
|
-
lastStep.expectedOutputAmountHumanReadable ||
|
|
98
|
-
|
|
87
|
+
amount: limitDecimalPlaces(lastStep.outputAmount || ''),
|
|
88
|
+
estimatedAmount: limitDecimalPlaces(
|
|
89
|
+
lastStep.expectedOutputAmountHumanReadable || ''
|
|
90
|
+
),
|
|
99
91
|
}}
|
|
100
92
|
/>
|
|
101
93
|
</div>
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { styled } from '../../theme';
|
|
3
3
|
import { Spacer } from '../Spacer';
|
|
4
|
+
import { Image } from '../common';
|
|
4
5
|
|
|
5
6
|
const TokenContainer = styled('div', {
|
|
6
7
|
display: 'flex',
|
|
7
8
|
alignItems: 'center',
|
|
9
|
+
width: '160px',
|
|
8
10
|
|
|
9
11
|
'& .amount': {
|
|
10
12
|
fontWeight: 'bold',
|
|
11
13
|
},
|
|
14
|
+
'& .estimated': {
|
|
15
|
+
color: '$neutrals600',
|
|
16
|
+
},
|
|
12
17
|
});
|
|
13
18
|
|
|
14
19
|
const TokenImage = styled('div', {
|
|
15
20
|
position: 'relative',
|
|
16
|
-
width: '$24',
|
|
17
|
-
height: '$24',
|
|
18
|
-
|
|
19
|
-
img: {
|
|
20
|
-
width: '100%',
|
|
21
|
-
display: 'block',
|
|
22
|
-
},
|
|
23
21
|
|
|
24
22
|
'.overlay': {
|
|
25
23
|
position: 'absolute',
|
|
@@ -29,6 +27,9 @@ const TokenImage = styled('div', {
|
|
|
29
27
|
height: '$16',
|
|
30
28
|
padding: '$2',
|
|
31
29
|
borderRadius: '50%',
|
|
30
|
+
display: 'flex',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
alignItems: 'center',
|
|
32
33
|
backgroundColor: '$background',
|
|
33
34
|
border: '1px solid $neutrals400',
|
|
34
35
|
},
|
|
@@ -45,24 +46,28 @@ interface PropTypes {
|
|
|
45
46
|
name: string;
|
|
46
47
|
};
|
|
47
48
|
amount: string;
|
|
49
|
+
estimatedAmount?: string;
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
export function Token(props: PropTypes) {
|
|
53
|
+
const {
|
|
54
|
+
data: { token, blockchain, amount, estimatedAmount },
|
|
55
|
+
} = props;
|
|
51
56
|
return (
|
|
52
57
|
<TokenContainer>
|
|
53
58
|
<TokenImage>
|
|
54
|
-
<
|
|
59
|
+
<Image src={token.logo} alt="" size={24} />
|
|
55
60
|
<div className="overlay">
|
|
56
|
-
<
|
|
57
|
-
src={props.data.blockchain.logo}
|
|
58
|
-
alt={props.data.blockchain.name}
|
|
59
|
-
/>
|
|
61
|
+
<Image src={blockchain.logo} alt={blockchain.name} size={12} />
|
|
60
62
|
</div>
|
|
61
63
|
</TokenImage>
|
|
62
64
|
<Spacer size={8} />
|
|
63
|
-
<span className="amount">{props.data.amount}</span>
|
|
65
|
+
{!!amount && <span className="amount">{props.data.amount}</span>}
|
|
66
|
+
{!amount && estimatedAmount && (
|
|
67
|
+
<span className="amount estimated">{props.data.estimatedAmount}</span>
|
|
68
|
+
)}
|
|
64
69
|
<Spacer size={4} />
|
|
65
|
-
{
|
|
70
|
+
{token.symbol}
|
|
66
71
|
</TokenContainer>
|
|
67
72
|
);
|
|
68
73
|
}
|
|
@@ -14,6 +14,7 @@ const InputContainer = styled('div', {
|
|
|
14
14
|
position: 'relative',
|
|
15
15
|
alignItems: 'center',
|
|
16
16
|
color: '$foreground',
|
|
17
|
+
overflowX: 'hidden',
|
|
17
18
|
transition: 'border-color ease .3s',
|
|
18
19
|
'&:focus-within': {
|
|
19
20
|
borderColor: '$success',
|
|
@@ -76,6 +77,13 @@ const Input = styled('input', {
|
|
|
76
77
|
'&:disabled': {
|
|
77
78
|
cursor: 'not-allowed',
|
|
78
79
|
},
|
|
80
|
+
'&::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
|
|
81
|
+
'-webkit-appearance': 'none',
|
|
82
|
+
margin: 0,
|
|
83
|
+
},
|
|
84
|
+
'&[type="number"]': {
|
|
85
|
+
'-moz-appearance': 'textfield',
|
|
86
|
+
},
|
|
79
87
|
});
|
|
80
88
|
const Label = styled('label', {
|
|
81
89
|
display: 'inline-block',
|
|
@@ -4,11 +4,10 @@ import { styled } from '../../theme';
|
|
|
4
4
|
import { Button } from '../Button';
|
|
5
5
|
import { Typography } from '../Typography';
|
|
6
6
|
import { TokenWithAmount } from './TokenList';
|
|
7
|
+
import { Image } from '../common';
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
maxHeight: '$32',
|
|
11
|
-
marginRight: '$16',
|
|
9
|
+
const TokenImageContainer = styled('div', {
|
|
10
|
+
paddingRight: '$16',
|
|
12
11
|
});
|
|
13
12
|
|
|
14
13
|
const TokenNameContainer = styled('div', {
|
|
@@ -49,7 +48,11 @@ export function TokenItem(props: PropTypes) {
|
|
|
49
48
|
align="start"
|
|
50
49
|
onClick={onClick.bind(null, token)}
|
|
51
50
|
type={selected ? 'primary' : undefined}
|
|
52
|
-
prefix={
|
|
51
|
+
prefix={
|
|
52
|
+
<TokenImageContainer>
|
|
53
|
+
<Image src={token.image} size={32} />
|
|
54
|
+
</TokenImageContainer>
|
|
55
|
+
}
|
|
53
56
|
suffix={
|
|
54
57
|
token.balance?.amount && (
|
|
55
58
|
<TokenAmountContainer>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, useEffect, useState } from 'react';
|
|
2
2
|
import { CommonProps } from 'react-window';
|
|
3
|
-
import { Token } from 'rango-sdk';
|
|
3
|
+
import { Asset, Token } from 'rango-sdk';
|
|
4
4
|
import { VirtualizedList } from '../VirtualizedList/VirtualizedList';
|
|
5
5
|
import { TokenItem } from './TokenItem';
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ export interface PropTypes {
|
|
|
18
18
|
searchedText: string;
|
|
19
19
|
onChange: (token: TokenWithAmount) => void;
|
|
20
20
|
multiSelect?: boolean;
|
|
21
|
-
selectedList?:
|
|
21
|
+
selectedList?: Asset[];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function TokenList(props: PropTypes) {
|
|
@@ -33,7 +33,6 @@ export function TokenList(props: PropTypes) {
|
|
|
33
33
|
const isSelected = (token: Token) => {
|
|
34
34
|
if (multiSelect && selectedList) {
|
|
35
35
|
return (
|
|
36
|
-
selectedList === 'all' ||
|
|
37
36
|
selectedList
|
|
38
37
|
.map((item) => item.symbol + item.address)
|
|
39
38
|
.indexOf(token.symbol + token.address) > -1
|