@rango-dev/ui 0.1.10-next.91 → 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/Alert.d.ts +3 -2
- 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 +3 -3
- 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/ChevronRightIcon.d.ts +3 -0
- package/dist/components/Icon/DisconnectIcon.d.ts +3 -0
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/Icon/types.d.ts +1 -1
- 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/Spacer/Spacer.d.ts +1 -1
- package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
- package/dist/components/SwapDetail/Token.d.ts +16 -0
- package/dist/components/TextField/TextField.stories.d.ts +1 -1
- package/dist/components/TokenSelector/TokenSelector.d.ts +3 -0
- package/dist/components/Typography/Typography.d.ts +3 -2
- 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 +1455 -1033
- 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 +1463 -1046
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Alert/Alert.tsx +63 -39
- 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 +28 -19
- package/src/components/BestRoute/mock.ts +10 -0
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -21
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/Button.tsx +36 -23
- package/src/components/Chip/Chip.tsx +7 -4
- 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/ChevronRightIcon.tsx +29 -0
- package/src/components/Icon/DisconnectIcon.tsx +31 -0
- package/src/components/Icon/HistoryIcon.tsx +12 -18
- package/src/components/Icon/RetryIcon.tsx +13 -13
- package/src/components/Icon/SettingIcon.tsx +6 -14
- package/src/components/Icon/index.ts +3 -0
- package/src/components/Icon/types.tsx +1 -1
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +104 -30
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +16 -11
- package/src/components/Radio/Radio.tsx +5 -4
- package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -1
- package/src/components/SelectableWalletList/mock.ts +4 -3
- package/src/components/Settings/Settings.tsx +47 -12
- package/src/components/Spacer/Spacer.tsx +31 -1
- package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
- package/src/components/StepDetail/StepDetail.tsx +19 -7
- package/src/components/SwapContainer/SwapContainer.tsx +22 -17
- 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/Switch/Switch.tsx +7 -5
- package/src/components/TextField/TextField.tsx +3 -1
- 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/Typography/Typography.stories.tsx +4 -0
- package/src/components/Typography/Typography.tsx +20 -9
- package/src/components/Wallet/State.tsx +2 -3
- package/src/components/Wallet/Wallet.tsx +33 -6
- package/src/components/index.ts +2 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +103 -119
- 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/theme.ts +4 -2
- package/src/types/meta.ts +2 -0
- package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +0 -18
- 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 -118
- package/src/containers/ConfirmWallets/index.ts +0 -1
- package/src/containers/ConfirmWallets/mock.ts +0 -222
- package/src/helper/swaps.ts +0 -23
|
@@ -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
|
+
}
|
|
@@ -9,14 +9,16 @@ const StyledSwitchRoot = styled(RadixSwitch.Root, {
|
|
|
9
9
|
borderStyle: 'solid',
|
|
10
10
|
width: '42px',
|
|
11
11
|
height: '22px',
|
|
12
|
-
backgroundColor: '$
|
|
13
|
-
borderColor: '$
|
|
12
|
+
backgroundColor: '$neutrals600',
|
|
13
|
+
borderColor: '$neutrals600',
|
|
14
14
|
borderRadius: '99999px',
|
|
15
15
|
position: 'relative',
|
|
16
16
|
padding: '0',
|
|
17
17
|
cursor: 'pointer',
|
|
18
|
+
|
|
18
19
|
'&[data-state="checked"]': {
|
|
19
|
-
backgroundColor: '$
|
|
20
|
+
backgroundColor: '$success',
|
|
21
|
+
borderColor: '$success',
|
|
20
22
|
},
|
|
21
23
|
'-webkit-tap-highlight-color': 'rgba(0, 0, 0, 0)',
|
|
22
24
|
});
|
|
@@ -28,13 +30,13 @@ const StyledSwitchThumb = styled(RadixSwitch.Thumb, {
|
|
|
28
30
|
display: 'block',
|
|
29
31
|
width: '18px',
|
|
30
32
|
height: '18px',
|
|
31
|
-
backgroundColor: '$
|
|
33
|
+
backgroundColor: '$white',
|
|
32
34
|
transition: ' transform 300ms',
|
|
33
35
|
borderRadius: '999999px',
|
|
34
36
|
willChange: 'transform',
|
|
37
|
+
|
|
35
38
|
'&[data-state="checked"]': {
|
|
36
39
|
transform: 'translateX(20px)',
|
|
37
|
-
backgroundColor: '$primary',
|
|
38
40
|
},
|
|
39
41
|
});
|
|
40
42
|
|
|
@@ -4,6 +4,7 @@ import { styled } from '../../theme';
|
|
|
4
4
|
|
|
5
5
|
const InputContainer = styled('div', {
|
|
6
6
|
backgroundColor: '$background',
|
|
7
|
+
padding: '1px',
|
|
7
8
|
boxSizing: 'border-box',
|
|
8
9
|
border: '1px solid $neutrals400',
|
|
9
10
|
borderRadius: '$5',
|
|
@@ -15,7 +16,8 @@ const InputContainer = styled('div', {
|
|
|
15
16
|
color: '$foreground',
|
|
16
17
|
transition: 'border-color ease .3s',
|
|
17
18
|
'&:focus-within': {
|
|
18
|
-
borderColor: '$
|
|
19
|
+
borderColor: '$success',
|
|
20
|
+
outline: '1px solid $success',
|
|
19
21
|
},
|
|
20
22
|
variants: {
|
|
21
23
|
size: {
|
|
@@ -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>
|
|
@@ -53,7 +53,7 @@ export function TokenList(props: PropTypes) {
|
|
|
53
53
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
setTokens(list.slice(0, PAGE_SIZE));
|
|
56
|
-
}, [searchedText]);
|
|
56
|
+
}, [searchedText, list]);
|
|
57
57
|
|
|
58
58
|
useEffect(() => {
|
|
59
59
|
setHasNextPage(list.length > tokens.length);
|
|
@@ -76,22 +76,20 @@ export function TokenList(props: PropTypes) {
|
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/>
|
|
95
|
-
</div>
|
|
79
|
+
<VirtualizedList
|
|
80
|
+
Item={({ index, style }) => (
|
|
81
|
+
<TokenItem
|
|
82
|
+
token={tokens[index]}
|
|
83
|
+
style={style}
|
|
84
|
+
onClick={changeSelected}
|
|
85
|
+
selected={isSelected(tokens[index])}
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
hasNextPage={hasNextPage}
|
|
89
|
+
itemCount={tokens.length}
|
|
90
|
+
loadNextPage={loadNextPage}
|
|
91
|
+
innerElementType={innerElementType}
|
|
92
|
+
size={56}
|
|
93
|
+
/>
|
|
96
94
|
);
|
|
97
95
|
}
|
|
@@ -3,7 +3,23 @@ import { containsText } from '../../helper';
|
|
|
3
3
|
import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
|
|
4
4
|
import { TokenList } from '../TokenList';
|
|
5
5
|
import { TokenWithAmount } from '../TokenList/TokenList';
|
|
6
|
+
import { LoadingStatus } from '../../types/meta';
|
|
7
|
+
import { Spinner } from '../Spinner';
|
|
8
|
+
import { LoadingFailedAlert } from '../Alert/LoadingFailedAlert';
|
|
9
|
+
import { NotFoundAlert } from '../Alert/NotFoundAlert';
|
|
10
|
+
import { styled } from '../../theme';
|
|
6
11
|
|
|
12
|
+
const Container = styled('div', {
|
|
13
|
+
flex: '1',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const LoaderContainer = styled('div', {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
width: '100%',
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: '50%',
|
|
22
|
+
});
|
|
7
23
|
export interface PropTypes {
|
|
8
24
|
list: TokenWithAmount[];
|
|
9
25
|
type?: 'Source' | 'Destination';
|
|
@@ -13,6 +29,7 @@ export interface PropTypes {
|
|
|
13
29
|
multiSelect?: boolean;
|
|
14
30
|
onBack?: () => void;
|
|
15
31
|
selectedList?: TokenWithAmount[] | 'all';
|
|
32
|
+
loadingStatus: LoadingStatus;
|
|
16
33
|
}
|
|
17
34
|
|
|
18
35
|
const filterTokens = (list: TokenWithAmount[], searchedFor: string) =>
|
|
@@ -33,6 +50,7 @@ export function TokenSelector(props: PropTypes) {
|
|
|
33
50
|
multiSelect,
|
|
34
51
|
selectedList,
|
|
35
52
|
onBack,
|
|
53
|
+
loadingStatus,
|
|
36
54
|
} = props;
|
|
37
55
|
|
|
38
56
|
return (
|
|
@@ -43,16 +61,35 @@ export function TokenSelector(props: PropTypes) {
|
|
|
43
61
|
hasHeader={hasHeader}
|
|
44
62
|
onBack={onBack}
|
|
45
63
|
>
|
|
46
|
-
{(searchedFor) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
{(searchedFor) => {
|
|
65
|
+
const filteredTokens = filterTokens(list, searchedFor);
|
|
66
|
+
return (
|
|
67
|
+
<Container>
|
|
68
|
+
{loadingStatus === 'loading' && (
|
|
69
|
+
<LoaderContainer>
|
|
70
|
+
<Spinner size={24} />
|
|
71
|
+
</LoaderContainer>
|
|
72
|
+
)}
|
|
73
|
+
{loadingStatus === 'failed' && <LoadingFailedAlert />}
|
|
74
|
+
{loadingStatus === 'success' && (
|
|
75
|
+
<>
|
|
76
|
+
{filteredTokens.length ? (
|
|
77
|
+
<TokenList
|
|
78
|
+
searchedText={searchedFor}
|
|
79
|
+
list={filteredTokens}
|
|
80
|
+
selected={selected}
|
|
81
|
+
selectedList={selectedList}
|
|
82
|
+
multiSelect={multiSelect}
|
|
83
|
+
onChange={onChange}
|
|
84
|
+
/>
|
|
85
|
+
) : (
|
|
86
|
+
<NotFoundAlert catergory="Token" searchedFor={searchedFor} />
|
|
87
|
+
)}
|
|
88
|
+
</>
|
|
89
|
+
)}
|
|
90
|
+
</Container>
|
|
91
|
+
);
|
|
92
|
+
}}
|
|
56
93
|
</SecondaryPage>
|
|
57
94
|
);
|
|
58
95
|
}
|
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
options: [
|
|
14
14
|
'body1',
|
|
15
15
|
'body2',
|
|
16
|
+
'body3',
|
|
16
17
|
'h1',
|
|
17
18
|
'h2',
|
|
18
19
|
'h3',
|
|
@@ -61,6 +62,9 @@ export const Main = (props: PropTypes) => (
|
|
|
61
62
|
<Typography {...props} variant="body2">
|
|
62
63
|
Body 2
|
|
63
64
|
</Typography>
|
|
65
|
+
<Typography {...props} variant="body3">
|
|
66
|
+
Body 3
|
|
67
|
+
</Typography>
|
|
64
68
|
<Typography {...props} variant="caption">
|
|
65
69
|
Caption
|
|
66
70
|
</Typography>
|
|
@@ -4,7 +4,6 @@ import { styled } from '../../theme';
|
|
|
4
4
|
|
|
5
5
|
const TypographyContainer = styled('span', {
|
|
6
6
|
margin: 0,
|
|
7
|
-
color: '$foreground',
|
|
8
7
|
display: 'inline-block',
|
|
9
8
|
variants: {
|
|
10
9
|
variant: {
|
|
@@ -51,12 +50,6 @@ const TypographyContainer = styled('span', {
|
|
|
51
50
|
h5: {
|
|
52
51
|
fontSize: '$16',
|
|
53
52
|
fontWeight: '$600',
|
|
54
|
-
'@md': {
|
|
55
|
-
fontSize: '$18',
|
|
56
|
-
},
|
|
57
|
-
'@lg': {
|
|
58
|
-
fontSize: '$20',
|
|
59
|
-
},
|
|
60
53
|
},
|
|
61
54
|
h6: {
|
|
62
55
|
fontSize: '$14',
|
|
@@ -85,6 +78,10 @@ const TypographyContainer = styled('span', {
|
|
|
85
78
|
fontSize: '$16',
|
|
86
79
|
},
|
|
87
80
|
},
|
|
81
|
+
body3: {
|
|
82
|
+
fontSize: '$12',
|
|
83
|
+
fontWeight: '$400',
|
|
84
|
+
},
|
|
88
85
|
caption: {
|
|
89
86
|
fontSize: '$10',
|
|
90
87
|
fontWeight: '$400',
|
|
@@ -178,6 +175,7 @@ export interface PropTypes {
|
|
|
178
175
|
| 'h6'
|
|
179
176
|
| 'body1'
|
|
180
177
|
| 'body2'
|
|
178
|
+
| 'body3'
|
|
181
179
|
| 'caption';
|
|
182
180
|
align?: 'center' | 'left' | 'right';
|
|
183
181
|
noWrap?: boolean;
|
|
@@ -187,16 +185,29 @@ export interface PropTypes {
|
|
|
187
185
|
mr?: 2 | 4 | 8 | 12;
|
|
188
186
|
className?: string;
|
|
189
187
|
style?: CSSProperties;
|
|
190
|
-
|
|
188
|
+
color?: string;
|
|
191
189
|
}
|
|
192
190
|
|
|
193
191
|
export function Typography({
|
|
194
192
|
children,
|
|
195
193
|
className,
|
|
194
|
+
color,
|
|
196
195
|
...props
|
|
197
196
|
}: PropsWithChildren<PropTypes>) {
|
|
197
|
+
const customCss = color
|
|
198
|
+
? {
|
|
199
|
+
color: color.startsWith('$') ? color : `$${color}`,
|
|
200
|
+
}
|
|
201
|
+
: {
|
|
202
|
+
color: '$foreground',
|
|
203
|
+
};
|
|
204
|
+
|
|
198
205
|
return (
|
|
199
|
-
<TypographyContainer
|
|
206
|
+
<TypographyContainer
|
|
207
|
+
className={`_typography _text ${className || ''}`}
|
|
208
|
+
css={customCss}
|
|
209
|
+
{...props}
|
|
210
|
+
>
|
|
200
211
|
{children}
|
|
201
212
|
</TypographyContainer>
|
|
202
213
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import { styled } from '../../theme';
|
|
3
|
-
import {
|
|
4
|
-
import { DownloadIcon } from '../Icon';
|
|
3
|
+
import { DisconnectIcon, DownloadIcon } from '../Icon';
|
|
5
4
|
import { Spinner } from '../Spinner';
|
|
6
5
|
import { WalletState } from '../../types/wallet';
|
|
7
6
|
import { InstallObjects, detectInstallLink } from '@rango-dev/wallets-shared';
|
|
@@ -28,7 +27,7 @@ export const State = ({
|
|
|
28
27
|
</a>
|
|
29
28
|
)}
|
|
30
29
|
{walletState === WalletState.CONNECTING && <Spinner />}
|
|
31
|
-
{walletState === WalletState.CONNECTED && <
|
|
30
|
+
{walletState === WalletState.CONNECTED && <DisconnectIcon />}
|
|
32
31
|
</StateIconContainer>
|
|
33
32
|
)}
|
|
34
33
|
</Fragment>
|
|
@@ -12,6 +12,25 @@ const WalletImage = styled('img', {
|
|
|
12
12
|
height: '$24',
|
|
13
13
|
marginRight: '$12',
|
|
14
14
|
});
|
|
15
|
+
const Text = styled('div', {
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const ExtendedButton = styled(Button, {
|
|
21
|
+
variants: {
|
|
22
|
+
type: {
|
|
23
|
+
primary: {
|
|
24
|
+
outline: '1px solid $primary',
|
|
25
|
+
borderColor: '$primary',
|
|
26
|
+
|
|
27
|
+
'&:hover': {
|
|
28
|
+
borderColor: '$primary',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
15
34
|
|
|
16
35
|
export type PropTypes = WalletInfo & {
|
|
17
36
|
onClick: (walletType: WalletType) => void;
|
|
@@ -19,10 +38,11 @@ export type PropTypes = WalletInfo & {
|
|
|
19
38
|
|
|
20
39
|
export function Wallet(props: PropTypes) {
|
|
21
40
|
const { name, type, image, state, onClick, installLink } = props;
|
|
41
|
+
|
|
22
42
|
return (
|
|
23
|
-
<
|
|
43
|
+
<ExtendedButton
|
|
24
44
|
type={state === WalletState.CONNECTED ? 'primary' : undefined}
|
|
25
|
-
disabled={
|
|
45
|
+
disabled={state == WalletState.CONNECTING}
|
|
26
46
|
onClick={() => {
|
|
27
47
|
if (state === WalletState.NOT_INSTALLED) {
|
|
28
48
|
window.open(detectInstallLink(installLink), '_blank');
|
|
@@ -34,9 +54,16 @@ export function Wallet(props: PropTypes) {
|
|
|
34
54
|
prefix={<WalletImage src={image} />}
|
|
35
55
|
suffix={<State walletState={state} installLink={installLink} />}
|
|
36
56
|
>
|
|
37
|
-
<
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
<Text>
|
|
58
|
+
<Typography variant="h5" noWrap={false}>
|
|
59
|
+
{name}
|
|
60
|
+
</Typography>
|
|
61
|
+
{state === WalletState.CONNECTED ? (
|
|
62
|
+
<Typography variant="caption" noWrap={false} color="primary">
|
|
63
|
+
Connected
|
|
64
|
+
</Typography>
|
|
65
|
+
) : null}
|
|
66
|
+
</Text>
|
|
67
|
+
</ExtendedButton>
|
|
41
68
|
);
|
|
42
69
|
}
|