@rango-dev/widget-embedded 0.17.1-next.32 → 0.17.1-next.34
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/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +315 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +158 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/index.d.ts +0 -1
- package/dist/components/Quote/index.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.styles.d.ts +314 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +1571 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +6 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +786 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +4 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/index.d.ts +4 -0
- package/dist/components/QuoteSkeleton/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +158 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +158 -1
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +1 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +2 -2
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +2 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +19 -10
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +20 -7
- package/src/components/ConfirmWalletsModal/WalletList.tsx +3 -3
- package/src/components/Layout/Layout.styles.ts +2 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +2 -1
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +25 -40
- package/src/components/Quote/Quote.styles.ts +9 -2
- package/src/components/Quote/Quote.tsx +3 -5
- package/src/components/Quote/index.ts +0 -1
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +42 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +30 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +57 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +76 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +6 -0
- package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +33 -0
- package/src/components/QuoteSkeleton/StepSkeleton.tsx +44 -0
- package/src/components/QuoteSkeleton/StepSkeleton.types.ts +1 -0
- package/src/components/QuoteSkeleton/index.ts +3 -0
- package/src/components/Slippage/Slippage.styles.ts +15 -5
- package/src/components/Slippage/Slippage.tsx +8 -5
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +0 -1
- package/src/components/TokenList/TokenList.styles.ts +17 -2
- package/src/components/TokenList/TokenList.tsx +7 -3
- package/src/components/TokenList/TokenList.types.ts +1 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +2 -1
- package/src/pages/Home.tsx +5 -1
- package/src/pages/SelectSwapItemsPage.tsx +8 -4
- package/src/pages/SettingsPage.tsx +4 -3
- package/src/pages/WalletsPage.tsx +5 -4
- package/src/store/slices/config.ts +1 -0
- package/src/store/slices/data.ts +10 -6
- package/src/types/config.ts +3 -3
- package/src/utils/wallets.ts +60 -23
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +0 -4
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +0 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +0 -4
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +0 -48
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +0 -3
- package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
- package/src/components/Quote/QuoteSkeleton.tsx +0 -108
- /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.d.ts +0 -0
- /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.d.ts +0 -0
- /package/src/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.ts +0 -0
package/src/utils/wallets.ts
CHANGED
|
@@ -380,35 +380,64 @@ export function formatBalance(balance: Balance | null): Balance | null {
|
|
|
380
380
|
return formattedBalance;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
|
|
383
|
+
function sortTokensByBalance(
|
|
384
|
+
token1Balance: Balance | null,
|
|
385
|
+
token2Balance: Balance | null
|
|
386
|
+
): number {
|
|
387
|
+
if (token1Balance?.usdValue && token2Balance?.usdValue) {
|
|
388
|
+
return (
|
|
389
|
+
parseFloat(token2Balance.usdValue) - parseFloat(token1Balance.usdValue)
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (!token1Balance?.usdValue && token2Balance?.usdValue) {
|
|
394
|
+
return 1;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (token1Balance?.usdValue && !token2Balance?.usdValue) {
|
|
398
|
+
return -1;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (!token1Balance?.usdValue && !token2Balance?.usdValue) {
|
|
402
|
+
return (
|
|
403
|
+
parseFloat(token2Balance?.amount || '0') -
|
|
404
|
+
parseFloat(token1Balance?.amount || '0')
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return 0;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function sortTokensByPinnedToken(
|
|
412
|
+
token1: Token,
|
|
413
|
+
token2: Token,
|
|
414
|
+
isTokenPinned: (token: Token) => boolean
|
|
415
|
+
): number {
|
|
416
|
+
const isToken1Pinned = isTokenPinned(token1);
|
|
417
|
+
const isToken2Pinned = isTokenPinned(token2);
|
|
418
|
+
|
|
419
|
+
if (isToken1Pinned === isToken2Pinned) {
|
|
420
|
+
return 0;
|
|
421
|
+
}
|
|
422
|
+
if (isToken1Pinned) {
|
|
423
|
+
return -1;
|
|
424
|
+
}
|
|
425
|
+
return 1;
|
|
426
|
+
}
|
|
427
|
+
export function sortTokens(
|
|
384
428
|
tokens: Token[],
|
|
385
|
-
getBalanceFor: (token: Token) => Balance | null
|
|
429
|
+
getBalanceFor: (token: Token) => Balance | null,
|
|
430
|
+
isTokenPinned: (token: Token) => boolean
|
|
386
431
|
) {
|
|
387
432
|
tokens.sort((token1, token2) => {
|
|
388
433
|
const token1Balance = getBalanceFor(token1);
|
|
389
434
|
const token2Balance = getBalanceFor(token2);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
parseFloat(token2Balance.usdValue) - parseFloat(token1Balance.usdValue)
|
|
393
|
-
);
|
|
394
|
-
}
|
|
435
|
+
// Check pinned tokens
|
|
436
|
+
const isTokenPin = sortTokensByPinnedToken(token1, token2, isTokenPinned);
|
|
395
437
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (token1Balance?.usdValue && !token2Balance?.usdValue) {
|
|
401
|
-
return -1;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
if (!token1Balance?.usdValue && !token2Balance?.usdValue) {
|
|
405
|
-
return (
|
|
406
|
-
parseFloat(token2Balance?.amount || '0') -
|
|
407
|
-
parseFloat(token1Balance?.amount || '0')
|
|
408
|
-
);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
return 0;
|
|
438
|
+
return isTokenPin !== 0
|
|
439
|
+
? isTokenPin
|
|
440
|
+
: sortTokensByBalance(token1Balance, token2Balance);
|
|
412
441
|
});
|
|
413
442
|
|
|
414
443
|
return tokens;
|
|
@@ -514,3 +543,11 @@ export function makeTokensBalance(connectedWallets: ConnectedWallet[]) {
|
|
|
514
543
|
return balances;
|
|
515
544
|
}, {});
|
|
516
545
|
}
|
|
546
|
+
|
|
547
|
+
export const isFetchingBalance = (
|
|
548
|
+
connectedWallets: ConnectedWallet[],
|
|
549
|
+
blockchain: string
|
|
550
|
+
) =>
|
|
551
|
+
!!connectedWallets.find(
|
|
552
|
+
(wallet) => wallet.chain === blockchain && wallet.loading
|
|
553
|
+
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingSwapDetailStep.d.ts","sourceRoot":"","sources":["../../../src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,sBAAsB,qBAiClE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingSwapDetails.types.d.ts","sourceRoot":"","sources":["../../../src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteSkeleton.d.ts","sourceRoot":"","sources":["../../../src/components/Quote/QuoteSkeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAmC1B,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,qBAqE7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteSkeleton.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Quote/QuoteSkeleton.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DA4FpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAaxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteSkeleton.types.d.ts","sourceRoot":"","sources":["../../../src/components/Quote/QuoteSkeleton.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,cAAc,CAAC;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { StepSkeletonPropsTypes } from './LoadingSwapDetails.types';
|
|
2
|
-
|
|
3
|
-
import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
extraInfoStyles,
|
|
8
|
-
StepContainer,
|
|
9
|
-
stepIconStyles,
|
|
10
|
-
stepInfoStyles,
|
|
11
|
-
stepTitleStyles,
|
|
12
|
-
stepTokensStyles,
|
|
13
|
-
} from './LoadingSwapDetails.styles';
|
|
14
|
-
|
|
15
|
-
export function LoadingSwapDetailStep(props: StepSkeletonPropsTypes) {
|
|
16
|
-
const { extraInfo } = props;
|
|
17
|
-
return (
|
|
18
|
-
<StepContainer>
|
|
19
|
-
<div className={stepTitleStyles()}>
|
|
20
|
-
<Skeleton height={28} width={28} variant="circular" />
|
|
21
|
-
<Divider direction="horizontal" size={8} />
|
|
22
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
23
|
-
</div>
|
|
24
|
-
<div className={stepTokensStyles()}>
|
|
25
|
-
<Divider direction="horizontal" size={20} />
|
|
26
|
-
<div className={stepInfoStyles()}>
|
|
27
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
28
|
-
<Divider direction="horizontal" size={8} />
|
|
29
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
30
|
-
</div>
|
|
31
|
-
<div className={stepIconStyles()}>
|
|
32
|
-
<NextIcon color="gray" size={16} />
|
|
33
|
-
</div>
|
|
34
|
-
<div className={stepInfoStyles()}>
|
|
35
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
36
|
-
<Divider direction="horizontal" size={8} />
|
|
37
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
{extraInfo && (
|
|
41
|
-
<div className={extraInfoStyles()}>
|
|
42
|
-
<Divider direction="horizontal" size={20} />
|
|
43
|
-
<Skeleton height={22} width={297} variant="rectangular" />
|
|
44
|
-
</div>
|
|
45
|
-
)}
|
|
46
|
-
</StepContainer>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
|
-
|
|
3
|
-
export const Container = styled('div', {
|
|
4
|
-
$$color: '$colors$neutral100',
|
|
5
|
-
[`.${darkTheme} &`]: {
|
|
6
|
-
$$color: '$colors$neutral300',
|
|
7
|
-
},
|
|
8
|
-
backgroundColor: '$$color',
|
|
9
|
-
borderBottomLeftRadius: '$xm',
|
|
10
|
-
borderBottomRightRadius: '$xm',
|
|
11
|
-
padding: '$15 ',
|
|
12
|
-
'& .cost-and-tag': {
|
|
13
|
-
display: 'flex',
|
|
14
|
-
justifyContent: 'space-between',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
height: '22px',
|
|
17
|
-
},
|
|
18
|
-
variants: {
|
|
19
|
-
rounded: {
|
|
20
|
-
true: {
|
|
21
|
-
borderRadius: '$xm',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
'& .cost': {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
},
|
|
28
|
-
'& .basic-summary': {
|
|
29
|
-
padding: '$15 $0 14px $0',
|
|
30
|
-
},
|
|
31
|
-
'& .output': {
|
|
32
|
-
padding: '$6 $0 $15 $0',
|
|
33
|
-
display: 'flex',
|
|
34
|
-
flexDirection: 'column',
|
|
35
|
-
},
|
|
36
|
-
'& .output__token-info': {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
justifyContent: 'start',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
paddingBottom: '$5',
|
|
41
|
-
},
|
|
42
|
-
'& .quote-summary': {
|
|
43
|
-
display: 'flex',
|
|
44
|
-
justifyContent: 'space-between',
|
|
45
|
-
alignItems: 'end',
|
|
46
|
-
},
|
|
47
|
-
'& .quote-summary__separator': {
|
|
48
|
-
height: '$28',
|
|
49
|
-
marginLeft: '13px',
|
|
50
|
-
borderLeft: '1px solid $neutral700',
|
|
51
|
-
},
|
|
52
|
-
'& .token-amount': {
|
|
53
|
-
display: 'flex',
|
|
54
|
-
justifyContent: 'space-between',
|
|
55
|
-
},
|
|
56
|
-
'& .token-amount__label': {
|
|
57
|
-
display: 'flex',
|
|
58
|
-
flexDirection: 'column',
|
|
59
|
-
alignItems: 'start',
|
|
60
|
-
},
|
|
61
|
-
'& .chains': {
|
|
62
|
-
paddingTop: '$2',
|
|
63
|
-
},
|
|
64
|
-
'& .swap-preview': {
|
|
65
|
-
padding: '$15 $0 $15 $0',
|
|
66
|
-
},
|
|
67
|
-
'& .steps': {
|
|
68
|
-
paddingLeft: '$8',
|
|
69
|
-
},
|
|
70
|
-
'& .step__title': {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
},
|
|
74
|
-
'& .step__content': {
|
|
75
|
-
display: 'flex',
|
|
76
|
-
alignItems: 'start',
|
|
77
|
-
},
|
|
78
|
-
'& .step__tokens': {
|
|
79
|
-
paddingTop: '$5',
|
|
80
|
-
paddingBottom: '$10',
|
|
81
|
-
display: 'flex',
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
},
|
|
84
|
-
'& .step__token-info': {
|
|
85
|
-
display: 'flex',
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
},
|
|
88
|
-
'& .step__icon-container': {
|
|
89
|
-
margin: '$0 $2',
|
|
90
|
-
padding: '$4',
|
|
91
|
-
display: 'flex',
|
|
92
|
-
justifyContent: 'center',
|
|
93
|
-
alignItems: 'center',
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
export const StepSeparator = styled('div', {
|
|
98
|
-
borderLeft: '1px dashed black',
|
|
99
|
-
minHeight: ' 64px',
|
|
100
|
-
margin: '0px 11.5px',
|
|
101
|
-
alignSelf: 'stretch',
|
|
102
|
-
variants: {
|
|
103
|
-
hideSeparator: {
|
|
104
|
-
true: {
|
|
105
|
-
minHeight: 'unset',
|
|
106
|
-
height: '0',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
});
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { PropTypes } from './QuoteSkeleton.types';
|
|
2
|
-
|
|
3
|
-
import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import { Container, StepSeparator } from './QuoteSkeleton.styles';
|
|
7
|
-
|
|
8
|
-
function StepSkeleton(props: { separator?: boolean }) {
|
|
9
|
-
const { separator = true } = props;
|
|
10
|
-
return (
|
|
11
|
-
<>
|
|
12
|
-
<div className="step__title">
|
|
13
|
-
<Skeleton height={22} width={22} variant="circular" />
|
|
14
|
-
<Divider direction="horizontal" size={8} />
|
|
15
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
16
|
-
</div>
|
|
17
|
-
<div className="step__content">
|
|
18
|
-
<StepSeparator hideSeparator={!separator} />
|
|
19
|
-
<div className="step__tokens">
|
|
20
|
-
<div className="step__token-info">
|
|
21
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
22
|
-
<Divider direction="horizontal" size={8} />
|
|
23
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
24
|
-
</div>
|
|
25
|
-
<div className="step__icon-container">
|
|
26
|
-
<NextIcon color="gray" size={16} />
|
|
27
|
-
</div>
|
|
28
|
-
<div className="step__token-info">
|
|
29
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
30
|
-
<Divider direction="horizontal" size={8} />
|
|
31
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function QuoteSkeleton(props: PropTypes) {
|
|
40
|
-
const { type, expanded, tag = false } = props;
|
|
41
|
-
const quoteSummary = (
|
|
42
|
-
<div className="quote-summary">
|
|
43
|
-
<div className="token-amount">
|
|
44
|
-
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
45
|
-
<Divider size={8} direction="horizontal" />
|
|
46
|
-
<div className="token-amount__label">
|
|
47
|
-
<Skeleton height={10} width={60} variant="rounded" />
|
|
48
|
-
<Divider size={4} />
|
|
49
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
<Skeleton height={12} width={64} variant="rounded" />
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<Container rounded={type !== 'basic'}>
|
|
58
|
-
<div className="cost-and-tag">
|
|
59
|
-
<div className="cost">
|
|
60
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
61
|
-
<Divider size={4} direction="horizontal" />
|
|
62
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
63
|
-
<Divider size={4} direction="horizontal" />
|
|
64
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
65
|
-
</div>
|
|
66
|
-
{tag && <Skeleton height={22} width={100} variant="rounded" />}
|
|
67
|
-
</div>
|
|
68
|
-
{type === 'basic' && (
|
|
69
|
-
<div className="basic-summary">
|
|
70
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
71
|
-
</div>
|
|
72
|
-
)}
|
|
73
|
-
{type === 'list-item' && (
|
|
74
|
-
<div className="output">
|
|
75
|
-
<div className="output__token-info">
|
|
76
|
-
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
77
|
-
<Divider direction="horizontal" size={4} />
|
|
78
|
-
<Skeleton height={15} width={150} variant="rounded" />
|
|
79
|
-
</div>
|
|
80
|
-
<Divider size={4} />
|
|
81
|
-
<Skeleton height={10} width={184} variant="rounded" />
|
|
82
|
-
</div>
|
|
83
|
-
)}
|
|
84
|
-
{type === 'swap-preview' && (
|
|
85
|
-
<>
|
|
86
|
-
<Divider size={4} />
|
|
87
|
-
<div className="swap-preview">
|
|
88
|
-
{quoteSummary}
|
|
89
|
-
<div className="quote-summary__separator" />
|
|
90
|
-
{quoteSummary}
|
|
91
|
-
</div>
|
|
92
|
-
</>
|
|
93
|
-
)}
|
|
94
|
-
<div className="chains">
|
|
95
|
-
<Skeleton height={15} width={321} variant="rounded" />
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
{expanded && (
|
|
99
|
-
<div className="steps">
|
|
100
|
-
<Divider size={20} />
|
|
101
|
-
<StepSkeleton />
|
|
102
|
-
<StepSkeleton />
|
|
103
|
-
<StepSkeleton separator={false} />
|
|
104
|
-
</div>
|
|
105
|
-
)}
|
|
106
|
-
</Container>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|