@rango-dev/ui 0.1.10-next.92 → 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.
Files changed (93) hide show
  1. package/README.md +1 -181
  2. package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
  3. package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
  4. package/dist/components/Alert/index.d.ts +1 -0
  5. package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +1 -1
  6. package/dist/components/Button/Button.d.ts +1 -1
  7. package/dist/components/Divider/Divider.d.ts +6 -0
  8. package/dist/components/Divider/index.d.ts +1 -0
  9. package/dist/components/Header/Header.d.ts +9 -0
  10. package/dist/components/Header/index.d.ts +1 -0
  11. package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
  12. package/dist/components/Icon/index.d.ts +1 -0
  13. package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +3 -1
  14. package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +2 -1
  15. package/dist/components/SelectableWalletList/mock.d.ts +1 -1
  16. package/dist/components/Settings/Settings.d.ts +2 -1
  17. package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
  18. package/dist/components/SwapDetail/Token.d.ts +16 -0
  19. package/dist/components/TokenSelector/TokenSelector.d.ts +3 -0
  20. package/dist/components/index.d.ts +2 -0
  21. package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +10 -17
  22. package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +1 -0
  23. package/dist/containers/ConfirmSwap/mock.d.ts +3 -0
  24. package/dist/containers/History/History.d.ts +6 -1
  25. package/dist/containers/History/index.d.ts +1 -1
  26. package/dist/containers/History/types.d.ts +3 -24
  27. package/dist/containers/SwapHistory/SwapHistory.d.ts +16 -3
  28. package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
  29. package/dist/containers/index.d.ts +0 -1
  30. package/dist/helper/index.d.ts +1 -0
  31. package/dist/types/meta.d.ts +1 -0
  32. package/dist/ui.cjs.development.js +1062 -838
  33. package/dist/ui.cjs.development.js.map +1 -1
  34. package/dist/ui.cjs.production.min.js +1 -1
  35. package/dist/ui.cjs.production.min.js.map +1 -1
  36. package/dist/ui.esm.js +1061 -840
  37. package/dist/ui.esm.js.map +1 -1
  38. package/package.json +3 -2
  39. package/src/components/Alert/Alert.tsx +33 -12
  40. package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
  41. package/src/components/Alert/NotFoundAlert.tsx +19 -0
  42. package/src/components/Alert/index.ts +1 -0
  43. package/src/components/BestRoute/mock.ts +10 -0
  44. package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -19
  45. package/src/components/Button/Button.tsx +2 -1
  46. package/src/components/ConnectWalletsModal/mockData.ts +16 -0
  47. package/src/components/Divider/Divider.tsx +41 -0
  48. package/src/components/Divider/index.ts +1 -0
  49. package/src/components/Header/Header.tsx +39 -0
  50. package/src/components/Header/index.ts +1 -0
  51. package/src/components/Icon/ArrowRightIcon.tsx +31 -0
  52. package/src/components/Icon/index.ts +1 -0
  53. package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +72 -22
  54. package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +15 -10
  55. package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
  56. package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -0
  57. package/src/components/SelectableWalletList/mock.ts +4 -3
  58. package/src/components/Settings/Settings.tsx +30 -11
  59. package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
  60. package/src/components/StepDetail/StepDetail.tsx +1 -0
  61. package/src/components/SwapContainer/SwapContainer.tsx +21 -16
  62. package/src/components/SwapDetail/SwapDetail.tsx +77 -115
  63. package/src/components/SwapDetail/Token.tsx +68 -0
  64. package/src/components/SwapDetail/mock.ts +1 -0
  65. package/src/components/TextField/TextField.tsx +1 -0
  66. package/src/components/TokenList/TokenItem.tsx +4 -1
  67. package/src/components/TokenList/TokenList.tsx +16 -18
  68. package/src/components/TokenSelector/TokenSelector.tsx +47 -10
  69. package/src/components/Wallet/Wallet.tsx +1 -1
  70. package/src/components/index.ts +2 -0
  71. package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
  72. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +103 -117
  73. package/src/containers/ConfirmSwap/mock.ts +79 -2
  74. package/src/containers/History/History.tsx +57 -38
  75. package/src/containers/History/index.ts +1 -1
  76. package/src/containers/History/mock.ts +1 -0
  77. package/src/containers/History/types.tsx +2 -30
  78. package/src/containers/SwapHistory/SwapHistory.tsx +309 -165
  79. package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
  80. package/src/containers/SwapHistory/mock.ts +1 -0
  81. package/src/containers/index.ts +0 -1
  82. package/src/helper/index.ts +14 -0
  83. package/src/types/meta.ts +2 -0
  84. package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +0 -16
  85. package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +0 -6
  86. package/dist/containers/ConfirmWallets/index.d.ts +0 -1
  87. package/dist/containers/ConfirmWallets/mock.d.ts +0 -5
  88. package/dist/helper/swaps.d.ts +0 -5
  89. package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +0 -26
  90. package/src/containers/ConfirmWallets/ConfirmWallets.tsx +0 -143
  91. package/src/containers/ConfirmWallets/index.ts +0 -1
  92. package/src/containers/ConfirmWallets/mock.ts +0 -222
  93. package/src/helper/swaps.ts +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/ui",
3
- "version": "0.1.10-next.92",
3
+ "version": "0.1.10",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -20,6 +20,7 @@
20
20
  "build-storybook": "build-storybook"
21
21
  },
22
22
  "peerDependencies": {
23
+ "@rango-dev/queue-manager-rango-preset": "*",
23
24
  "react": ">=16"
24
25
  },
25
26
  "husky": {
@@ -75,7 +76,7 @@
75
76
  "@rango-dev/wallets-shared": "^0.1.11-next.78",
76
77
  "@stitches/react": "^1.2.8",
77
78
  "@types/react-color": "^3.0.6",
78
- "rango-sdk": "^0.1.19",
79
+ "rango-sdk": "^0.1.20",
79
80
  "react-color": "^2.19.3",
80
81
  "react-virtualized-auto-sizer": "^1.0.7",
81
82
  "react-window": "^1.8.8",
@@ -22,14 +22,13 @@ const MainContainer = styled('div', {
22
22
  '&.hasIcon .footer': {
23
23
  paddingLeft: '$32',
24
24
  },
25
-
26
25
  variants: {
27
26
  type: {
28
27
  primary: {
29
28
  color: '$primary200',
30
29
  },
31
30
  secondary: {
32
- color: '$secondary',
31
+ color: '$foreground',
33
32
  },
34
33
  success: {
35
34
  color: '$success300',
@@ -62,18 +61,40 @@ export function Alert(props: PropsWithChildren<PropTypes>) {
62
61
  <div className="main">
63
62
  {showIcon && (
64
63
  <>
65
- {type === 'success' && <CheckCircleIcon color={type} size={24} />}
66
- {type === 'warning' && <WarningIcon color={type} size={24} />}
67
- {type === 'error' && <InfoCircleIcon color={type} size={24} />}
68
- <Spacer size={8} />
64
+ <div
65
+ style={{
66
+ width: '32px',
67
+ display: 'flex',
68
+ justifyContent: 'center',
69
+ alignItems: 'center',
70
+ }}
71
+ >
72
+ {type === 'success' && <CheckCircleIcon color={type} size={24} />}
73
+ {type === 'warning' && <WarningIcon color={type} size={24} />}
74
+ {type === 'error' && <InfoCircleIcon color={type} size={24} />}
75
+ <Spacer size={8} />
76
+ </div>
69
77
  </>
70
78
  )}
71
- {title && (
72
- <Typography variant="h6" color={type}>
73
- {title}
74
- </Typography>
75
- )}
76
- {children}
79
+ <div
80
+ style={{
81
+ display: 'flex',
82
+ justifyContent: 'center',
83
+ alignItems: 'start',
84
+ flexDirection: 'column',
85
+ width: '100%',
86
+ }}
87
+ >
88
+ {title && (
89
+ <>
90
+ <Typography className="title" variant="h6" color={type}>
91
+ {title}
92
+ </Typography>
93
+ {!!children && <Spacer size={8} direction="vertical" />}
94
+ </>
95
+ )}
96
+ {children}
97
+ </div>
77
98
  </div>
78
99
  {props.footer ? <div className="footer">{props.footer}</div> : null}
79
100
  </MainContainer>
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Alert } from './Alert';
3
+
4
+ export function LoadingFailedAlert() {
5
+ return (
6
+ <Alert
7
+ type="error"
8
+ title=" Error connecting server, please reload the app and try again."
9
+ />
10
+ );
11
+ }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { Alert } from './Alert';
3
+
4
+ interface PropTypes {
5
+ catergory: string;
6
+ searchedFor?: string;
7
+ }
8
+
9
+ export function NotFoundAlert(props: PropTypes) {
10
+ const { catergory, searchedFor } = props;
11
+ return (
12
+ <Alert
13
+ type="secondary"
14
+ title={`${catergory} ${
15
+ searchedFor ? "'" + searchedFor + "'" : ''
16
+ } not found.`}
17
+ />
18
+ );
19
+ }
@@ -1 +1,2 @@
1
1
  export { Alert } from './Alert';
2
+ export { LoadingFailedAlert } from './LoadingFailedAlert';
@@ -1,6 +1,8 @@
1
1
  import { RoutingResultType } from 'rango-sdk';
2
2
  import { BestRouteType } from '../../types/swaps';
3
3
 
4
+ // TODO: I used `internalSwaps: []` to fix ts error. fix it by using real data.
5
+
4
6
  export const bestRoute: BestRouteType = {
5
7
  from: { blockchain: 'BSC', symbol: 'BNB', address: null },
6
8
  to: { blockchain: 'AVAX_CCHAIN', symbol: 'AVAX', address: null },
@@ -11,6 +13,8 @@ export const bestRoute: BestRouteType = {
11
13
  outputAmount: '5.685715974132648891',
12
14
  swaps: [
13
15
  {
16
+ // TODO: fix this and use real data
17
+ internalSwaps: [],
14
18
  swapperId: 'AnySwap Aggregator',
15
19
  swapperType: 'AGGREGATOR',
16
20
  swapperLogo: 'https://api.rango.exchange/swappers/multichain.png',
@@ -63,6 +67,7 @@ export const bestRoute: BestRouteType = {
63
67
  includesDestinationTx: false,
64
68
  },
65
69
  {
70
+ internalSwaps: [],
66
71
  swapperId: 'PangolinSwap',
67
72
  swapperLogo: 'https://api.rango.exchange/swappers/pangolin.png',
68
73
  swapperType: 'DEX',
@@ -164,6 +169,7 @@ export const bestRouteExample2: BestRouteType = {
164
169
  outputAmount: '30.983906',
165
170
  swaps: [
166
171
  {
172
+ internalSwaps: [],
167
173
  maxRequiredSign: 1,
168
174
  warnings: [],
169
175
  swapperId: 'ParaSwap Bsc',
@@ -263,6 +269,7 @@ export const bestRouteExample2: BestRouteType = {
263
269
  includesDestinationTx: false,
264
270
  },
265
271
  {
272
+ internalSwaps: [],
266
273
  maxRequiredSign: 1,
267
274
  warnings: [],
268
275
  swapperId: 'Satellite',
@@ -310,6 +317,7 @@ export const bestRouteExample2: BestRouteType = {
310
317
  includesDestinationTx: false,
311
318
  },
312
319
  {
320
+ internalSwaps: [],
313
321
  maxRequiredSign: 1,
314
322
  warnings: [],
315
323
  swapperId: 'Osmosis',
@@ -403,6 +411,7 @@ export const bestRouteExample2: BestRouteType = {
403
411
  includesDestinationTx: false,
404
412
  },
405
413
  {
414
+ internalSwaps: [],
406
415
  maxRequiredSign: 1,
407
416
  warnings: [],
408
417
  swapperId: 'Osmosis',
@@ -486,6 +495,7 @@ export const bestRouteExample3: BestRouteType = {
486
495
  outputAmount: '5.685715974132648891',
487
496
  swaps: [
488
497
  {
498
+ internalSwaps: [],
489
499
  maxRequiredSign: 1,
490
500
  warnings: [],
491
501
  swapperId: 'AnySwap Aggregator',
@@ -2,18 +2,17 @@ import React from 'react';
2
2
  import { BlockchainMeta } from 'rango-sdk';
3
3
  import { BlockchainsList } from '../BlockchainsList';
4
4
  import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
5
- import { Alert } from '../Alert';
6
5
  import { Spinner } from '../Spinner';
7
6
  import { styled } from '../../theme';
8
7
  import { CSSProperties } from '@stitches/react';
9
8
  import { containsText } from '../../helper';
10
- import { Typography } from '../Typography';
9
+ import { LoadingStatus } from '../../types/meta';
10
+ import { LoadingFailedAlert } from '../Alert/LoadingFailedAlert';
11
+ import { NotFoundAlert } from '../Alert/NotFoundAlert';
12
+ import { LoaderContainer } from '../TokenSelector/TokenSelector';
11
13
 
12
14
  const ListContainer = styled('div', {
13
- height: '450px',
14
- display: 'flex',
15
- justifyContent: 'center',
16
- alignItems: 'center',
15
+ overflowY: 'auto',
17
16
  });
18
17
 
19
18
  const filterBlockchains = (list: BlockchainMeta[], searchedFor: string) =>
@@ -23,8 +22,6 @@ const filterBlockchains = (list: BlockchainMeta[], searchedFor: string) =>
23
22
  containsText(blockchain.displayName, searchedFor)
24
23
  );
25
24
 
26
- export type LoadingStatus = 'loading' | 'success' | 'failed';
27
-
28
25
  export interface PropTypes {
29
26
  type?: 'Source' | 'Destination';
30
27
  list: BlockchainMeta[];
@@ -65,20 +62,14 @@ export function BlockchainSelector(props: PropTypes) {
65
62
  return (
66
63
  <ListContainer style={listContainerStyle} key="1">
67
64
  {loadingStatus === 'loading' && (
68
- <div>
65
+ <LoaderContainer>
69
66
  <Spinner size={24} />
70
- </div>
71
- )}
72
- {loadingStatus === 'failed' && (
73
- <Alert type="error">
74
- <Typography variant="body2">
75
- Error connecting server, please reload the app and try again
76
- </Typography>
77
- </Alert>
67
+ </LoaderContainer>
78
68
  )}
69
+ {loadingStatus === 'failed' && <LoadingFailedAlert />}
79
70
  {loadingStatus === 'success' && (
80
71
  <>
81
- {filteredBlockchains.length > 0 ? (
72
+ {filteredBlockchains.length ? (
82
73
  <BlockchainsList
83
74
  list={filteredBlockchains}
84
75
  selected={selected}
@@ -87,7 +78,10 @@ export function BlockchainSelector(props: PropTypes) {
87
78
  onChange={onChange}
88
79
  />
89
80
  ) : (
90
- <Alert>{`${searchedFor} not found`}</Alert>
81
+ <NotFoundAlert
82
+ catergory="Blockchain"
83
+ searchedFor={searchedFor}
84
+ />
91
85
  )}
92
86
  </>
93
87
  )}
@@ -33,6 +33,7 @@ const ButtonContainer = styled('button', {
33
33
  },
34
34
  size: {
35
35
  compact: {},
36
+ free: {},
36
37
  small: {
37
38
  height: '$32',
38
39
  },
@@ -375,7 +376,7 @@ const Content = styled('div', {
375
376
  export interface PropTypes
376
377
  extends Omit<HTMLAttributes<HTMLButtonElement>, 'prefix'> {
377
378
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
378
- size?: 'small' | 'medium' | 'large' | 'compact';
379
+ size?: 'small' | 'medium' | 'large' | 'compact' | 'free';
379
380
  variant?: 'contained' | 'outlined' | 'ghost';
380
381
  type?: 'primary' | 'error' | 'warning' | 'success';
381
382
  prefix?: React.ReactNode;
@@ -8,6 +8,7 @@ export const walletsInfo: WalletInfo[] = [
8
8
  state: WalletState.DISCONNECTED,
9
9
  installLink: '',
10
10
  type: WalletType.COINBASE,
11
+ showOnMobile: true,
11
12
  },
12
13
  {
13
14
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -15,6 +16,7 @@ export const walletsInfo: WalletInfo[] = [
15
16
  state: WalletState.CONNECTED,
16
17
  installLink: '',
17
18
  type: WalletType.COINBASE,
19
+ showOnMobile: true,
18
20
  },
19
21
  {
20
22
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -22,12 +24,14 @@ export const walletsInfo: WalletInfo[] = [
22
24
  state: WalletState.CONNECTING,
23
25
  installLink: '',
24
26
  type: WalletType.COINBASE,
27
+ showOnMobile: true,
25
28
  },
26
29
  {
27
30
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
28
31
  name: 'Coinbase',
29
32
  state: WalletState.NOT_INSTALLED,
30
33
  type: WalletType.COINBASE,
34
+ showOnMobile: true,
31
35
  installLink:
32
36
  'https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad?hl=en',
33
37
  },
@@ -37,6 +41,7 @@ export const walletsInfo: WalletInfo[] = [
37
41
  state: WalletState.DISCONNECTED,
38
42
  installLink: '',
39
43
  type: WalletType.COINBASE,
44
+ showOnMobile: true,
40
45
  },
41
46
  {
42
47
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -44,6 +49,7 @@ export const walletsInfo: WalletInfo[] = [
44
49
  state: WalletState.CONNECTED,
45
50
  installLink: '',
46
51
  type: WalletType.COINBASE,
52
+ showOnMobile: true,
47
53
  },
48
54
  {
49
55
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -51,6 +57,7 @@ export const walletsInfo: WalletInfo[] = [
51
57
  state: WalletState.DISCONNECTED,
52
58
  installLink: '',
53
59
  type: WalletType.COINBASE,
60
+ showOnMobile: true,
54
61
  },
55
62
  {
56
63
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -58,6 +65,7 @@ export const walletsInfo: WalletInfo[] = [
58
65
  state: WalletState.DISCONNECTED,
59
66
  installLink: '',
60
67
  type: WalletType.COINBASE,
68
+ showOnMobile: true,
61
69
  },
62
70
  {
63
71
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -65,6 +73,7 @@ export const walletsInfo: WalletInfo[] = [
65
73
  state: WalletState.DISCONNECTED,
66
74
  installLink: '',
67
75
  type: WalletType.COINBASE,
76
+ showOnMobile: true,
68
77
  },
69
78
  {
70
79
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -72,6 +81,7 @@ export const walletsInfo: WalletInfo[] = [
72
81
  state: WalletState.DISCONNECTED,
73
82
  installLink: '',
74
83
  type: WalletType.COINBASE,
84
+ showOnMobile: true,
75
85
  },
76
86
  {
77
87
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -79,6 +89,7 @@ export const walletsInfo: WalletInfo[] = [
79
89
  state: WalletState.DISCONNECTED,
80
90
  installLink: '',
81
91
  type: WalletType.COINBASE,
92
+ showOnMobile: true,
82
93
  },
83
94
  {
84
95
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -86,6 +97,7 @@ export const walletsInfo: WalletInfo[] = [
86
97
  state: WalletState.DISCONNECTED,
87
98
  installLink: '',
88
99
  type: WalletType.COINBASE,
100
+ showOnMobile: true,
89
101
  },
90
102
  {
91
103
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -93,6 +105,7 @@ export const walletsInfo: WalletInfo[] = [
93
105
  state: WalletState.DISCONNECTED,
94
106
  installLink: '',
95
107
  type: WalletType.COINBASE,
108
+ showOnMobile: true,
96
109
  },
97
110
  {
98
111
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -100,6 +113,7 @@ export const walletsInfo: WalletInfo[] = [
100
113
  state: WalletState.DISCONNECTED,
101
114
  installLink: '',
102
115
  type: WalletType.COINBASE,
116
+ showOnMobile: true,
103
117
  },
104
118
  {
105
119
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -107,6 +121,7 @@ export const walletsInfo: WalletInfo[] = [
107
121
  state: WalletState.DISCONNECTED,
108
122
  installLink: '',
109
123
  type: WalletType.COINBASE,
124
+ showOnMobile: true,
110
125
  },
111
126
  {
112
127
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -114,5 +129,6 @@ export const walletsInfo: WalletInfo[] = [
114
129
  state: WalletState.DISCONNECTED,
115
130
  installLink: '',
116
131
  type: WalletType.COINBASE,
132
+ showOnMobile: true,
117
133
  },
118
134
  ];
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { styled } from '../../theme';
3
+
4
+ const DividerContainer = styled('div', {
5
+ variants: {
6
+ size: {
7
+ 4: {
8
+ height: '$4',
9
+ },
10
+ 8: {
11
+ height: '$8',
12
+ },
13
+ 12: {
14
+ height: '$12',
15
+ },
16
+ 16: {
17
+ height: '$16',
18
+ },
19
+ 18: {
20
+ height: '$18',
21
+ },
22
+ 20: {
23
+ height: '$20',
24
+ },
25
+ 24: {
26
+ height: '$24',
27
+ },
28
+ 32: {
29
+ height: '$32',
30
+ },
31
+ },
32
+ },
33
+ });
34
+ export interface PropTypes {
35
+ size?: 4 | 8 | 12 | 16 | 18 | 20 | 24 | 32;
36
+ direction?: 'vertical' | 'horizontal';
37
+ }
38
+
39
+ export function Divider({ size = 12 }: PropTypes) {
40
+ return <DividerContainer size={size} />;
41
+ }
@@ -0,0 +1 @@
1
+ export { Divider } from './Divider';
@@ -0,0 +1,39 @@
1
+ import { styled } from '../../theme';
2
+ import React, { PropsWithChildren } from 'react';
3
+ import { AngleLeftIcon } from '../Icon';
4
+ import { Typography } from '../Typography';
5
+ import { Button } from '../Button';
6
+
7
+ const HeaderContainer = styled('div', {
8
+ display: 'flex',
9
+ justifyContent: 'space-between',
10
+ alignItems: 'center',
11
+ padding: '$8 0',
12
+ position: 'relative',
13
+ });
14
+
15
+ const BackButton = styled(Button, {
16
+ padding: '$8',
17
+ });
18
+
19
+ interface PropTypes {
20
+ onBack?: () => void;
21
+ prefix?: React.ReactNode;
22
+ suffix?: React.ReactNode;
23
+ title: string;
24
+ }
25
+
26
+ export function Header(props: PropsWithChildren<PropTypes>) {
27
+ return (
28
+ <HeaderContainer>
29
+ {props.onBack ? (
30
+ <BackButton variant="ghost" size="small" onClick={props.onBack}>
31
+ <AngleLeftIcon size={24} />
32
+ </BackButton>
33
+ ) : null}
34
+ {props.prefix}
35
+ <Typography variant="h4">{props.title}</Typography>
36
+ {props.suffix || <div></div>}
37
+ </HeaderContainer>
38
+ );
39
+ }
@@ -0,0 +1 @@
1
+ export { Header } from './Header';
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import { IconProps } from './types';
3
+ import { SvgWithStrokeColor } from './common';
4
+
5
+ export const ArrowRightIcon: React.FC<IconProps> = ({
6
+ size = 16,
7
+ color,
8
+ ...props
9
+ }) => {
10
+ return (
11
+ <SvgWithStrokeColor
12
+ width={size}
13
+ height={size}
14
+ viewBox="0 0 24 24"
15
+ color={color}
16
+ fill="none"
17
+ stroke="currentColor"
18
+ stroke-width="2"
19
+ stroke-linecap="round"
20
+ stroke-linejoin="round"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ className="_icon"
23
+ {...props}
24
+ >
25
+ <line x1="5" y1="12" x2="19" y2="12"></line>
26
+ <polyline points="12 5 19 12 12 19"></polyline>
27
+ </SvgWithStrokeColor>
28
+ );
29
+ };
30
+
31
+ ArrowRightIcon.toString = () => '._icon';
@@ -24,6 +24,7 @@ export { AngleDownIcon } from './AngleDownIcon';
24
24
  export { AngleLeftIcon } from './AngleLeftIcon';
25
25
  export { DownloadIcon } from './DownloadIcon';
26
26
  export { ChevronRightIcon } from './ChevronRightIcon';
27
+ export { ArrowRightIcon } from './ArrowRightIcon';
27
28
 
28
29
  export { RetryRightIcon } from './RetryRightIcon';
29
30
  export { RetryLeftIcon } from './RetryLeftIcon';
@@ -1,11 +1,14 @@
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';
9
12
 
10
13
  const groupLiquiditySources = (
11
14
  liquiditySources: LiquiditySource[]
@@ -19,14 +22,22 @@ const groupLiquiditySources = (
19
22
  ),
20
23
  });
21
24
 
25
+ const MainContainer = styled('div', {
26
+ variants: {
27
+ loaded: {
28
+ true: {
29
+ overflowY: 'auto',
30
+ },
31
+ },
32
+ },
33
+ });
34
+
22
35
  const LiquiditySourceType = styled('div', {
23
36
  position: 'sticky',
24
37
  display: 'flex',
25
38
  justifyContent: 'space-between',
26
39
  alignItems: 'center',
27
40
  top: '0',
28
- marginTop: '$8',
29
- marginBottom: '$8',
30
41
  backgroundColor: '$background',
31
42
  zIndex: '9999',
32
43
  paddingTop: '$8',
@@ -39,14 +50,22 @@ const LiquidityImage = styled('img', {
39
50
  marginRight: '$16',
40
51
  });
41
52
 
53
+ const LoaderContainer = styled('div', {
54
+ display: 'flex',
55
+ justifyContent: 'center',
56
+ });
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 } = props;
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
- <div style={{ height: '450px', ...listContainerStyle }}>
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
- {bridges.map((liquiditySource, index) => (
94
- <LiquiditySourceItem
95
- liquiditySource={liquiditySource}
96
- key={index}
97
- selected={isSelected(liquiditySource)}
98
- onChange={changeLiquiditySources}
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
- {exchanges.map((liquiditySource, index) => (
113
- <LiquiditySourceItem
114
- liquiditySource={liquiditySource}
115
- key={index}
116
- selected={isSelected(liquiditySource)}
117
- onChange={changeLiquiditySources}
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
- </div>
171
+ </MainContainer>
122
172
  );
123
173
  }
124
174