@rango-dev/ui 0.1.10 → 0.1.11-next.2
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/Modal/Modal.d.ts +0 -1
- package/dist/components/TokenList/TokenList.d.ts +2 -2
- package/dist/components/TokenSelector/TokenSelector.d.ts +1 -3
- package/dist/ui.cjs.development.js +30 -42
- 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 +30 -42
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Modal/Modal.tsx +1 -6
- package/src/components/SwapDetail/SwapDetail.tsx +1 -1
- package/src/components/TokenList/TokenList.tsx +2 -3
- package/src/components/TokenSelector/TokenSelector.tsx +23 -47
- package/src/containers/SwapHistory/SwapHistory.tsx +8 -4
package/package.json
CHANGED
|
@@ -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,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
|
|
@@ -9,27 +9,21 @@ import { LoadingFailedAlert } from '../Alert/LoadingFailedAlert';
|
|
|
9
9
|
import { NotFoundAlert } from '../Alert/NotFoundAlert';
|
|
10
10
|
import { styled } from '../../theme';
|
|
11
11
|
|
|
12
|
-
const Container = styled('div', {
|
|
13
|
-
flex: '1',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
12
|
export const LoaderContainer = styled('div', {
|
|
17
13
|
display: 'flex',
|
|
18
14
|
justifyContent: 'center',
|
|
19
15
|
width: '100%',
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
paddingTop: '5%',
|
|
17
|
+
flex: 1,
|
|
22
18
|
});
|
|
23
19
|
export interface PropTypes {
|
|
24
20
|
list: TokenWithAmount[];
|
|
25
21
|
type?: 'Source' | 'Destination';
|
|
26
22
|
selected: TokenWithAmount | null;
|
|
27
23
|
onChange: (token: TokenWithAmount) => void;
|
|
28
|
-
hasHeader?: boolean;
|
|
29
|
-
multiSelect?: boolean;
|
|
30
24
|
onBack?: () => void;
|
|
31
|
-
selectedList?: TokenWithAmount[] | 'all';
|
|
32
25
|
loadingStatus: LoadingStatus;
|
|
26
|
+
hasHeader?: boolean;
|
|
33
27
|
}
|
|
34
28
|
|
|
35
29
|
const filterTokens = (list: TokenWithAmount[], searchedFor: string) =>
|
|
@@ -41,53 +35,35 @@ const filterTokens = (list: TokenWithAmount[], searchedFor: string) =>
|
|
|
41
35
|
);
|
|
42
36
|
|
|
43
37
|
export function TokenSelector(props: PropTypes) {
|
|
44
|
-
const {
|
|
45
|
-
|
|
46
|
-
type,
|
|
47
|
-
selected,
|
|
48
|
-
onChange,
|
|
49
|
-
hasHeader,
|
|
50
|
-
multiSelect,
|
|
51
|
-
selectedList,
|
|
52
|
-
onBack,
|
|
53
|
-
loadingStatus,
|
|
54
|
-
} = props;
|
|
38
|
+
const { list, type, selected, hasHeader, onChange, onBack, loadingStatus } =
|
|
39
|
+
props;
|
|
55
40
|
|
|
56
41
|
return (
|
|
57
42
|
<SecondaryPage
|
|
58
43
|
textField={true}
|
|
59
|
-
textFieldPlaceholder="Search Blockchain By Name"
|
|
60
|
-
title={`Select ${type} Token`}
|
|
61
44
|
hasHeader={hasHeader}
|
|
45
|
+
title={`Select ${type} Token`}
|
|
62
46
|
onBack={onBack}
|
|
47
|
+
textFieldPlaceholder="Search Token By Name"
|
|
63
48
|
>
|
|
64
49
|
{(searchedFor) => {
|
|
65
50
|
const filteredTokens = filterTokens(list, searchedFor);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
multiSelect={multiSelect}
|
|
83
|
-
onChange={onChange}
|
|
84
|
-
/>
|
|
85
|
-
) : (
|
|
86
|
-
<NotFoundAlert catergory="Token" searchedFor={searchedFor} />
|
|
87
|
-
)}
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
</Container>
|
|
51
|
+
|
|
52
|
+
return loadingStatus === 'loading' ? (
|
|
53
|
+
<LoaderContainer>
|
|
54
|
+
<Spinner size={24} />
|
|
55
|
+
</LoaderContainer>
|
|
56
|
+
) : loadingStatus === 'failed' ? (
|
|
57
|
+
<LoadingFailedAlert />
|
|
58
|
+
) : filteredTokens.length ? (
|
|
59
|
+
<TokenList
|
|
60
|
+
searchedText={searchedFor}
|
|
61
|
+
list={filteredTokens}
|
|
62
|
+
selected={selected}
|
|
63
|
+
onChange={onChange}
|
|
64
|
+
/>
|
|
65
|
+
) : (
|
|
66
|
+
<NotFoundAlert catergory="Token" searchedFor={searchedFor} />
|
|
91
67
|
);
|
|
92
68
|
}}
|
|
93
69
|
</SecondaryPage>
|
|
@@ -290,7 +290,7 @@ export function SwapHistory(props: PropTypes) {
|
|
|
290
290
|
logo={step.fromLogo}
|
|
291
291
|
symbol={step.fromSymbol}
|
|
292
292
|
// @ts-ignore
|
|
293
|
-
chainLogo={step.fromBlockchainLogo}
|
|
293
|
+
chainLogo={step.fromBlockchainLogo || ''}
|
|
294
294
|
blockchain={step.fromBlockchain}
|
|
295
295
|
amount={pendingSwap.inputAmount}
|
|
296
296
|
/>
|
|
@@ -300,8 +300,10 @@ export function SwapHistory(props: PropTypes) {
|
|
|
300
300
|
<Line />
|
|
301
301
|
<SwapperContainer>
|
|
302
302
|
<SwapperLogo
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
src={
|
|
304
|
+
// @ts-ignore
|
|
305
|
+
step.swapperLogo || ''
|
|
306
|
+
}
|
|
305
307
|
alt={step.swapperId}
|
|
306
308
|
/>
|
|
307
309
|
<div>
|
|
@@ -319,6 +321,7 @@ export function SwapHistory(props: PropTypes) {
|
|
|
319
321
|
$
|
|
320
322
|
{
|
|
321
323
|
// @ts-ignore
|
|
324
|
+
|
|
322
325
|
step.feeInUsd
|
|
323
326
|
}{' '}
|
|
324
327
|
estimated gas fee
|
|
@@ -377,7 +380,8 @@ export function SwapHistory(props: PropTypes) {
|
|
|
377
380
|
logo={step.toLogo}
|
|
378
381
|
symbol={step.toSymbol}
|
|
379
382
|
// @ts-ignore
|
|
380
|
-
|
|
383
|
+
|
|
384
|
+
chainLogo={step.toBlockchainLogo || ''}
|
|
381
385
|
blockchain={step.toBlockchain}
|
|
382
386
|
amount={step.outputAmount || ''}
|
|
383
387
|
/>
|