@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
@@ -1,20 +1,21 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
+ import { Divider } from '../../components';
2
3
  import { SecondaryPage } from '../../components/SecondaryPage';
3
4
  import { SwapDetail } from '../../components/SwapDetail';
4
5
  import { Typography } from '../../components/Typography';
5
6
  import { containsText } from '../../helper';
6
- import { groupingOfSwaps } from '../../helper/swaps';
7
7
  import { styled } from '../../theme';
8
8
  import { PendingSwap } from './types';
9
+ import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
9
10
 
10
- const BodyError = styled('div', {
11
- height: '100%',
12
- display: 'flex',
13
- justifyContent: 'center',
14
- alignItems: 'center',
11
+ const Group = styled('div', {
12
+ '.group-title': {
13
+ textTransform: 'uppercase',
14
+ },
15
15
  });
16
- const ErrorMsg = styled(Typography, {
17
- color: '$error',
16
+
17
+ const Container = styled('div', {
18
+ overflowY: 'auto',
18
19
  });
19
20
  const filteredHistory = (
20
21
  list: PendingSwap[],
@@ -32,39 +33,50 @@ const filteredHistory = (
32
33
  );
33
34
  });
34
35
  };
35
- const Group = styled('div', {
36
- marginBottom: '$24',
37
- paddingRight: '$8',
38
- maxHeight: '600px',
39
- });
40
- const GroupTitle = styled(Typography, {
41
- color: '$neutrals500',
42
- });
43
36
 
37
+ export type GroupBy = (list: PendingSwap[]) => {
38
+ title: string;
39
+ swaps: PendingSwap[];
40
+ }[];
44
41
  export interface PropTypes {
45
42
  list: PendingSwap[];
46
43
  onBack: () => void;
47
44
  onSwapClick: (requestId: string) => void;
45
+ groupBy?: GroupBy;
48
46
  }
49
47
  const SwapsGroup = (props: Omit<PropTypes, 'onBack'>) => {
50
- const { list, onSwapClick } = props;
51
- const swapsInGroup = groupingOfSwaps(list);
48
+ const { list, onSwapClick, groupBy } = props;
49
+ const groups = groupBy ? groupBy(list) : [{ title: 'History', swaps: list }];
52
50
 
53
51
  return (
54
52
  <>
55
- {swapsInGroup.map((group, index) => (
56
- <Group key={index}>
57
- <GroupTitle variant="body2">{group.title}</GroupTitle>
58
- {group.swaps.map((swap: PendingSwap, index: number) => (
59
- <SwapDetail
60
- key={index}
61
- swap={swap}
62
- status={swap.status}
63
- onClick={onSwapClick}
64
- />
65
- ))}
66
- </Group>
67
- ))}
53
+ {groups
54
+ .filter((group) => group.swaps.length > 0)
55
+ .map((group, index) => (
56
+ <>
57
+ <Group key={index}>
58
+ <Typography
59
+ variant="body2"
60
+ color="neutrals600"
61
+ className="group-title"
62
+ >
63
+ {group.title}
64
+ </Typography>
65
+ {group.swaps.map((swap: PendingSwap, index: number) => (
66
+ <>
67
+ <SwapDetail
68
+ key={index}
69
+ swap={swap}
70
+ status={swap.status}
71
+ onClick={onSwapClick}
72
+ />
73
+ <Divider size={12} />
74
+ </>
75
+ ))}
76
+ </Group>
77
+ <Divider size={24} />
78
+ </>
79
+ ))}
68
80
  </>
69
81
  );
70
82
  };
@@ -73,22 +85,29 @@ export function History({
73
85
  list = [],
74
86
  onBack,
75
87
  onSwapClick,
88
+ groupBy,
76
89
  }: PropsWithChildren<PropTypes>) {
77
90
  return (
78
91
  <SecondaryPage
79
92
  onBack={onBack}
80
93
  textField={true}
81
- textFieldPlaceholder="Search By Blockchain Or Token"
94
+ textFieldPlaceholder="Search By Blockchain Or Token Or Request ID"
82
95
  title="Swaps"
83
96
  >
84
97
  {(searchedFor) => {
85
98
  const filterSwaps = filteredHistory(list, searchedFor);
86
- return filterSwaps.length ? (
87
- <SwapsGroup list={filterSwaps} onSwapClick={onSwapClick} />
88
- ) : (
89
- <BodyError>
90
- <ErrorMsg variant="caption">Not Found</ErrorMsg>
91
- </BodyError>
99
+ return (
100
+ <Container>
101
+ {filterSwaps.length ? (
102
+ <SwapsGroup
103
+ list={filterSwaps}
104
+ onSwapClick={onSwapClick}
105
+ groupBy={groupBy}
106
+ />
107
+ ) : (
108
+ <NotFoundAlert catergory="Swap" />
109
+ )}
110
+ </Container>
92
111
  );
93
112
  }}
94
113
  </SecondaryPage>
@@ -1 +1 @@
1
- export { History } from './History';
1
+ export { History, GroupBy } from './History';
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import { RoutingResultType, TransactionType } from 'rango-sdk';
2
3
  import { PendingSwap } from './types';
3
4
 
@@ -1,20 +1,13 @@
1
1
  import {
2
2
  CosmosTransaction,
3
3
  EvmTransaction,
4
- SimulationResult,
5
4
  SolanaTransaction,
6
5
  SwapExplorerUrl,
7
6
  SwapperStatusStep,
8
7
  Transfer,
9
8
  } from 'rango-sdk';
10
- import {
11
- MessageSeverity,
12
- PendingSwapNetworkStatus,
13
- StepStatus,
14
- SwapSavedSettings,
15
- SwapStatus,
16
- WalletTypeAndAddress,
17
- } from '../../types/swaps';
9
+ import { PendingSwapNetworkStatus, StepStatus } from '../../types/swaps';
10
+ export { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
18
11
 
19
12
  export type PendingSwapStep = {
20
13
  id: number;
@@ -52,24 +45,3 @@ export type PendingSwapStep = {
52
45
  diagnosisUrl: string | null;
53
46
  internalSteps: SwapperStatusStep[] | null;
54
47
  };
55
-
56
- export type PendingSwap = {
57
- creationTime: string;
58
- finishTime: string | null;
59
- requestId: string;
60
- inputAmount: string;
61
- status: SwapStatus;
62
- isPaused: boolean;
63
- extraMessage: string | null;
64
- extraMessageSeverity: MessageSeverity | null;
65
- extraMessageErrorCode: string | null;
66
- extraMessageDetail: string | null | undefined;
67
- networkStatusExtraMessage: string | null;
68
- networkStatusExtraMessageDetail: string | null;
69
- lastNotificationTime: string | null;
70
- wallets: { [p: string]: WalletTypeAndAddress };
71
- settings: SwapSavedSettings;
72
- steps: PendingSwapStep[];
73
- simulationResult: SimulationResult;
74
- validateBalanceOrFee: boolean;
75
- };