@rango-dev/ui 0.1.10-next.92 → 0.1.11-next.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/Icon/types.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/Modal/Modal.d.ts +0 -1
- package/dist/components/SelectableWalletList/mock.d.ts +1 -1
- package/dist/components/Settings/Settings.d.ts +2 -1
- package/dist/components/StepDetail/StepDetail.d.ts +3 -1
- package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
- package/dist/components/SwapDetail/Token.d.ts +17 -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 +4 -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/components/index.d.ts +2 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +14 -19
- 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 +5 -7
- package/dist/containers/History/SwapsGroup.d.ts +13 -0
- package/dist/containers/History/index.d.ts +1 -0
- 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 +3 -1
- package/dist/types/meta.d.ts +1 -0
- package/dist/ui.cjs.development.js +1137 -837
- 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 +1134 -839
- 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/BestRoute.tsx +2 -5
- package/src/components/BestRoute/mock.ts +10 -0
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +31 -34
- package/src/components/BlockchainsList/BlockchainsList.tsx +8 -6
- 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/Drawer/Drawer.tsx +1 -1
- 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/common.ts +10 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/Icon/types.tsx +1 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +81 -27
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +15 -10
- package/src/components/Modal/Modal.tsx +1 -6
- package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +7 -1
- package/src/components/SelectableWalletList/mock.ts +4 -3
- package/src/components/Settings/Settings.tsx +34 -14
- package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
- package/src/components/StepDetail/StepDetail.tsx +46 -12
- package/src/components/SwapContainer/SwapContainer.tsx +21 -17
- package/src/components/SwapDetail/SwapDetail.tsx +71 -117
- package/src/components/SwapDetail/Token.tsx +73 -0
- package/src/components/SwapDetail/mock.ts +1 -0
- package/src/components/TextField/TextField.tsx +9 -0
- package/src/components/TokenList/TokenItem.tsx +12 -6
- package/src/components/TokenList/TokenList.tsx +18 -21
- package/src/components/TokenSelector/TokenSelector.tsx +38 -25
- package/src/components/Typography/Typography.tsx +8 -0
- package/src/components/Wallet/Wallet.tsx +9 -6
- package/src/components/common/Image.tsx +27 -0
- package/src/components/common/index.ts +1 -0
- package/src/components/index.ts +2 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +111 -125
- package/src/containers/ConfirmSwap/mock.ts +79 -2
- package/src/containers/History/History.tsx +33 -57
- package/src/containers/History/SwapsGroup.tsx +59 -0
- package/src/containers/History/index.ts +1 -0
- package/src/containers/History/mock.ts +1 -0
- package/src/containers/History/types.tsx +2 -30
- package/src/containers/SwapHistory/SwapHistory.tsx +306 -177
- 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 +31 -2
- 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,11 +1,15 @@
|
|
|
1
1
|
import { CSSProperties } from '@stitches/react';
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { styled } from '../../theme';
|
|
4
|
-
import { LiquiditySource } from '../../types/meta';
|
|
4
|
+
import { LiquiditySource, LoadingStatus } from '../../types/meta';
|
|
5
5
|
import { Button } from '../Button/Button';
|
|
6
6
|
import { Spacer } from '../Spacer';
|
|
7
7
|
import { Switch } from '../Switch';
|
|
8
8
|
import { Typography } from '../Typography';
|
|
9
|
+
import { Spinner } from '../Spinner';
|
|
10
|
+
import { LoadingFailedAlert } from '../Alert/LoadingFailedAlert';
|
|
11
|
+
import { NotFoundAlert } from '../Alert/NotFoundAlert';
|
|
12
|
+
import { Image } from '../common';
|
|
9
13
|
|
|
10
14
|
const groupLiquiditySources = (
|
|
11
15
|
liquiditySources: LiquiditySource[]
|
|
@@ -19,34 +23,49 @@ const groupLiquiditySources = (
|
|
|
19
23
|
),
|
|
20
24
|
});
|
|
21
25
|
|
|
26
|
+
const MainContainer = styled('div', {
|
|
27
|
+
variants: {
|
|
28
|
+
loaded: {
|
|
29
|
+
true: {
|
|
30
|
+
overflowY: 'auto',
|
|
31
|
+
padding: '0 $4',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
22
37
|
const LiquiditySourceType = styled('div', {
|
|
23
38
|
position: 'sticky',
|
|
24
39
|
display: 'flex',
|
|
25
40
|
justifyContent: 'space-between',
|
|
26
41
|
alignItems: 'center',
|
|
27
42
|
top: '0',
|
|
28
|
-
marginTop: '$8',
|
|
29
|
-
marginBottom: '$8',
|
|
30
43
|
backgroundColor: '$background',
|
|
31
44
|
zIndex: '9999',
|
|
32
45
|
paddingTop: '$8',
|
|
33
46
|
paddingBottom: '$8',
|
|
34
47
|
});
|
|
35
48
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
const LiquidityImageContainer = styled('div', {
|
|
50
|
+
paddingRight: '$16',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const LoaderContainer = styled('div', {
|
|
54
|
+
display: 'flex',
|
|
55
|
+
justifyContent: 'center',
|
|
40
56
|
});
|
|
41
57
|
|
|
42
58
|
export interface PropTypes {
|
|
43
59
|
list: LiquiditySource[];
|
|
44
60
|
onChange: (liquiditySource: LiquiditySource) => void;
|
|
45
61
|
listContainerStyle?: CSSProperties;
|
|
62
|
+
loadingStatus: LoadingStatus;
|
|
63
|
+
searchedFor: string;
|
|
46
64
|
}
|
|
47
65
|
|
|
48
66
|
export function LiquiditySourceList(props: PropTypes) {
|
|
49
|
-
const { list, onChange, listContainerStyle } =
|
|
67
|
+
const { list, onChange, listContainerStyle, loadingStatus, searchedFor } =
|
|
68
|
+
props;
|
|
50
69
|
|
|
51
70
|
const [selected, setSelected] = useState(
|
|
52
71
|
list.filter((item) => item.selected)
|
|
@@ -79,7 +98,10 @@ export function LiquiditySourceList(props: PropTypes) {
|
|
|
79
98
|
const totalSelectedExchanges = exchanges.filter(isSelected).length;
|
|
80
99
|
|
|
81
100
|
return (
|
|
82
|
-
<
|
|
101
|
+
<MainContainer
|
|
102
|
+
style={listContainerStyle}
|
|
103
|
+
loaded={loadingStatus === 'success'}
|
|
104
|
+
>
|
|
83
105
|
<div>
|
|
84
106
|
<LiquiditySourceType>
|
|
85
107
|
<Typography variant="h5">Bridges</Typography>
|
|
@@ -90,14 +112,28 @@ export function LiquiditySourceList(props: PropTypes) {
|
|
|
90
112
|
</Typography>
|
|
91
113
|
</LiquiditySourceType>
|
|
92
114
|
<Spacer size={12} direction="vertical" />
|
|
93
|
-
{
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
115
|
+
{loadingStatus === 'loading' && (
|
|
116
|
+
<LoaderContainer>
|
|
117
|
+
<Spinner size={24} />
|
|
118
|
+
</LoaderContainer>
|
|
119
|
+
)}
|
|
120
|
+
{loadingStatus === 'failed' && <LoadingFailedAlert />}
|
|
121
|
+
{loadingStatus === 'success' && (
|
|
122
|
+
<>
|
|
123
|
+
{totalBridges ? (
|
|
124
|
+
bridges.map((liquiditySource, index) => (
|
|
125
|
+
<LiquiditySourceItem
|
|
126
|
+
liquiditySource={liquiditySource}
|
|
127
|
+
key={index}
|
|
128
|
+
selected={isSelected(liquiditySource)}
|
|
129
|
+
onChange={changeLiquiditySources}
|
|
130
|
+
/>
|
|
131
|
+
))
|
|
132
|
+
) : (
|
|
133
|
+
<NotFoundAlert catergory="Bridge" searchedFor={searchedFor} />
|
|
134
|
+
)}
|
|
135
|
+
</>
|
|
136
|
+
)}
|
|
101
137
|
</div>
|
|
102
138
|
<div>
|
|
103
139
|
<LiquiditySourceType>
|
|
@@ -109,16 +145,30 @@ export function LiquiditySourceList(props: PropTypes) {
|
|
|
109
145
|
</Typography>
|
|
110
146
|
</LiquiditySourceType>
|
|
111
147
|
<Spacer size={12} direction="vertical" />
|
|
112
|
-
{
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
148
|
+
{loadingStatus === 'loading' && (
|
|
149
|
+
<LoaderContainer>
|
|
150
|
+
<Spinner size={24} />
|
|
151
|
+
</LoaderContainer>
|
|
152
|
+
)}
|
|
153
|
+
{loadingStatus === 'failed' && <LoadingFailedAlert />}
|
|
154
|
+
{loadingStatus == 'success' && (
|
|
155
|
+
<>
|
|
156
|
+
{totalExchanges ? (
|
|
157
|
+
exchanges.map((liquiditySource, index) => (
|
|
158
|
+
<LiquiditySourceItem
|
|
159
|
+
liquiditySource={liquiditySource}
|
|
160
|
+
key={index}
|
|
161
|
+
selected={isSelected(liquiditySource)}
|
|
162
|
+
onChange={changeLiquiditySources}
|
|
163
|
+
/>
|
|
164
|
+
))
|
|
165
|
+
) : (
|
|
166
|
+
<NotFoundAlert catergory="Exchange" searchedFor={searchedFor} />
|
|
167
|
+
)}
|
|
168
|
+
</>
|
|
169
|
+
)}
|
|
120
170
|
</div>
|
|
121
|
-
</
|
|
171
|
+
</MainContainer>
|
|
122
172
|
);
|
|
123
173
|
}
|
|
124
174
|
|
|
@@ -135,7 +185,11 @@ const LiquiditySourceItem = ({
|
|
|
135
185
|
size="large"
|
|
136
186
|
align="start"
|
|
137
187
|
variant="outlined"
|
|
138
|
-
prefix={
|
|
188
|
+
prefix={
|
|
189
|
+
<LiquidityImageContainer>
|
|
190
|
+
<Image src={liquiditySource.logo} size={20} />
|
|
191
|
+
</LiquidityImageContainer>
|
|
192
|
+
}
|
|
139
193
|
suffix={<Switch checked={selected} />}
|
|
140
194
|
style={{ marginBottom: '12px' }}
|
|
141
195
|
onClick={onChange.bind(null, liquiditySource)}
|
|
@@ -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>
|
|
@@ -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
|
|
@@ -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,8 @@ 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';
|
|
6
|
+
import { Image } from '../common';
|
|
5
7
|
|
|
6
8
|
const Row = styled('div', {
|
|
7
9
|
display: 'flex',
|
|
@@ -69,6 +71,7 @@ const Container = styled('div', {
|
|
|
69
71
|
},
|
|
70
72
|
},
|
|
71
73
|
});
|
|
74
|
+
|
|
72
75
|
export interface PropTypes {
|
|
73
76
|
list: SelectableWallet[];
|
|
74
77
|
onChange: (w: SelectableWallet) => void;
|
|
@@ -100,8 +103,11 @@ export function SelectableWalletList({
|
|
|
100
103
|
onClick={onClick.bind(null, w)}
|
|
101
104
|
key={index}
|
|
102
105
|
>
|
|
103
|
-
<
|
|
106
|
+
<Image src={w.image} alt={w.walletType} size={24} />
|
|
104
107
|
<Typography variant="body2">{w.name}</Typography>
|
|
108
|
+
<Typography variant="caption">
|
|
109
|
+
{getConciseAddress(w.address)}
|
|
110
|
+
</Typography>
|
|
105
111
|
<Circle checked={checked}>
|
|
106
112
|
<SolidCircle checked={checked} />
|
|
107
113
|
</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',
|
|
@@ -26,13 +27,13 @@ const SlippageChipsContainer = styled('div', {
|
|
|
26
27
|
const LiquiditySourceContainer = styled(BaseContainer, {
|
|
27
28
|
display: 'flex',
|
|
28
29
|
justifyContent: 'space-between',
|
|
29
|
-
marginTop: '$
|
|
30
|
+
marginTop: '$16',
|
|
30
31
|
cursor: 'pointer',
|
|
31
32
|
});
|
|
32
33
|
const InfiniteContainer = styled(BaseContainer, {
|
|
33
34
|
display: 'flex',
|
|
34
35
|
justifyContent: 'space-between',
|
|
35
|
-
marginTop: '$
|
|
36
|
+
marginTop: '$16',
|
|
36
37
|
});
|
|
37
38
|
|
|
38
39
|
const StyledAngleRight = styled(AngleRightIcon, { marginLeft: '$8' });
|
|
@@ -44,8 +45,9 @@ const LiquiditySourceNumber = styled('div', {
|
|
|
44
45
|
});
|
|
45
46
|
|
|
46
47
|
const ThemesContainer = styled(BaseContainer, {
|
|
47
|
-
marginTop: '$
|
|
48
|
+
marginTop: '$16',
|
|
48
49
|
});
|
|
50
|
+
|
|
49
51
|
const Head = styled('div', {
|
|
50
52
|
display: 'flex',
|
|
51
53
|
justifyContent: 'space-between',
|
|
@@ -71,6 +73,7 @@ export interface PropTypes {
|
|
|
71
73
|
onBack: () => void;
|
|
72
74
|
infiniteApprove: boolean;
|
|
73
75
|
toggleInfiniteApprove: (infinite: boolean) => void;
|
|
76
|
+
loadingStatus: LoadingStatus;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
export function Settings(props: PropTypes) {
|
|
@@ -89,6 +92,7 @@ export function Settings(props: PropTypes) {
|
|
|
89
92
|
onThemeChange,
|
|
90
93
|
toggleInfiniteApprove,
|
|
91
94
|
infiniteApprove,
|
|
95
|
+
loadingStatus,
|
|
92
96
|
} = props;
|
|
93
97
|
|
|
94
98
|
const [selectedSlippage, setSelectedSlippage] = useState(
|
|
@@ -167,16 +171,32 @@ export function Settings(props: PropTypes) {
|
|
|
167
171
|
<Typography variant="body1">Infinite Approval</Typography>
|
|
168
172
|
<Switch checked={infiniteApprove} onChange={toggleInfiniteApprove} />
|
|
169
173
|
</InfiniteContainer>
|
|
170
|
-
<LiquiditySourceContainer
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
<LiquiditySourceContainer>
|
|
175
|
+
<Button
|
|
176
|
+
onClick={onLiquiditySourcesClick}
|
|
177
|
+
align="start"
|
|
178
|
+
variant="ghost"
|
|
179
|
+
loading={loadingStatus === 'loading'}
|
|
180
|
+
suffix={
|
|
181
|
+
<LiquiditySourceNumber>
|
|
182
|
+
{loadingStatus === 'success' && (
|
|
183
|
+
<Typography variant="body2" color="neutrals800">
|
|
184
|
+
{liquiditySources.length !== selectedLiquiditySources.length
|
|
185
|
+
? `${selectedLiquiditySources.length} / ${liquiditySources.length}`
|
|
186
|
+
: liquiditySources.length}
|
|
187
|
+
</Typography>
|
|
188
|
+
)}
|
|
189
|
+
{loadingStatus === 'failed' && (
|
|
190
|
+
<Typography variant="body2" color="$error500">
|
|
191
|
+
Loading failed
|
|
192
|
+
</Typography>
|
|
193
|
+
)}
|
|
194
|
+
<StyledAngleRight />
|
|
195
|
+
</LiquiditySourceNumber>
|
|
196
|
+
}
|
|
197
|
+
>
|
|
198
|
+
<Typography variant="body1">Liquidity Sources</Typography>
|
|
199
|
+
</Button>
|
|
180
200
|
</LiquiditySourceContainer>
|
|
181
201
|
</>
|
|
182
202
|
);
|
|
@@ -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', {
|
|
@@ -69,6 +75,8 @@ const Detail = styled('div', {
|
|
|
69
75
|
});
|
|
70
76
|
const SubTitle = styled(Typography, {
|
|
71
77
|
color: '$neutrals600',
|
|
78
|
+
display: 'block',
|
|
79
|
+
paddingLeft: '$8',
|
|
72
80
|
});
|
|
73
81
|
export interface PropTypes {
|
|
74
82
|
logo: string;
|
|
@@ -76,19 +84,24 @@ export interface PropTypes {
|
|
|
76
84
|
amount: string;
|
|
77
85
|
symbol: string;
|
|
78
86
|
blockchain: string;
|
|
87
|
+
estimatedAmount?: string;
|
|
79
88
|
direction?: 'horizontal' | 'vertical';
|
|
89
|
+
success?: boolean;
|
|
80
90
|
}
|
|
81
91
|
|
|
82
|
-
export function StepDetail({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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;
|
|
90
103
|
return (
|
|
91
|
-
<StepContainer direction={direction}>
|
|
104
|
+
<StepContainer direction={direction} success={success}>
|
|
92
105
|
<StepLogoContainer direction={direction}>
|
|
93
106
|
<Logo src={logo} alt={symbol} />
|
|
94
107
|
<ChainLogo>
|
|
@@ -96,10 +109,31 @@ export function StepDetail({
|
|
|
96
109
|
</ChainLogo>
|
|
97
110
|
</StepLogoContainer>
|
|
98
111
|
<Detail pl={direction === 'horizontal'}>
|
|
99
|
-
|
|
100
|
-
|
|
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}
|
|
101
135
|
</Typography>
|
|
102
|
-
<SubTitle noWrap variant="caption" color="neutrals800">
|
|
136
|
+
<SubTitle noWrap variant="caption" color="$neutrals800">
|
|
103
137
|
on {blockchain}
|
|
104
138
|
</SubTitle>
|
|
105
139
|
</Detail>
|
|
@@ -3,36 +3,40 @@ 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
|
-
display: 'flex',
|
|
14
|
-
flexDirection: 'column',
|
|
15
|
-
alignItems: 'end',
|
|
12
|
+
minWidth: '375px',
|
|
13
|
+
maxWidth: '512px',
|
|
16
14
|
padding: '$16',
|
|
17
15
|
boxSizing: 'border-box',
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
backgroundColor: '$background',
|
|
17
|
+
variants: {
|
|
18
|
+
fixedHeight: {
|
|
19
|
+
true: {
|
|
20
|
+
height: '595px',
|
|
21
|
+
maxHeight: '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;
|
|
32
|
-
|
|
36
|
+
const { children, style, fixedHeight = true } = props;
|
|
33
37
|
return (
|
|
34
|
-
<MainContainer style={style} id="swap-box">
|
|
35
|
-
|
|
38
|
+
<MainContainer style={style} id="swap-box" fixedHeight={fixedHeight}>
|
|
39
|
+
{children}
|
|
36
40
|
</MainContainer>
|
|
37
41
|
);
|
|
38
42
|
}
|