@rango-dev/widget-embedded 0.20.1-next.20 → 0.20.1-next.22

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 (119) hide show
  1. package/dist/components/AppRouter.d.ts.map +1 -1
  2. package/dist/components/AppRoutes.d.ts.map +1 -1
  3. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +161 -1
  4. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  5. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +0 -1
  6. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  7. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  8. package/dist/components/Layout/Layout.d.ts +2 -3
  9. package/dist/components/Layout/Layout.d.ts.map +1 -1
  10. package/dist/components/Layout/Layout.helpers.d.ts +2 -0
  11. package/dist/components/Layout/Layout.helpers.d.ts.map +1 -0
  12. package/dist/components/Layout/Layout.styles.d.ts +2 -4
  13. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  14. package/dist/components/Layout/Layout.types.d.ts +6 -3
  15. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  16. package/dist/components/Layout/PageContainer.d.ts +166 -0
  17. package/dist/components/Layout/PageContainer.d.ts.map +1 -0
  18. package/dist/components/Layout/ScrollableArea.d.ts +164 -0
  19. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -0
  20. package/dist/components/Layout/index.d.ts +2 -0
  21. package/dist/components/Layout/index.d.ts.map +1 -1
  22. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  23. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  24. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +0 -161
  25. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  26. package/dist/components/SettingsContainer/index.d.ts +1 -1
  27. package/dist/components/SettingsContainer/index.d.ts.map +1 -1
  28. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  29. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  30. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +161 -1
  31. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  32. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  33. package/dist/constants/searchParams.d.ts +6 -6
  34. package/dist/constants/searchParams.d.ts.map +1 -1
  35. package/dist/containers/App/App.styles.d.ts.map +1 -1
  36. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +1 -1
  37. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  38. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -324
  39. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  40. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -7
  41. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  42. package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
  43. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  44. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  45. package/dist/hooks/useSyncUrlAndStore/index.d.ts +2 -0
  46. package/dist/hooks/useSyncUrlAndStore/index.d.ts.map +1 -0
  47. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts +2 -0
  48. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -0
  49. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.d.ts +4 -0
  50. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.d.ts.map +1 -0
  51. package/dist/index.js +2 -2
  52. package/dist/index.js.map +4 -4
  53. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  54. package/dist/pages/HistoryPage.d.ts.map +1 -1
  55. package/dist/pages/Home.d.ts.map +1 -1
  56. package/dist/pages/LanguagePage.d.ts.map +1 -1
  57. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  58. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  59. package/dist/pages/SettingsPage.d.ts.map +1 -1
  60. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  61. package/dist/pages/ThemePage.d.ts.map +1 -1
  62. package/dist/pages/WalletsPage.d.ts.map +1 -1
  63. package/dist/utils/quote.d.ts +0 -1
  64. package/dist/utils/quote.d.ts.map +1 -1
  65. package/dist/utils/ui.d.ts +2 -0
  66. package/dist/utils/ui.d.ts.map +1 -1
  67. package/package.json +3 -3
  68. package/src/components/AppRouter.tsx +1 -8
  69. package/src/components/AppRoutes.tsx +11 -0
  70. package/src/components/BlockchainList/BlockchainList.styles.ts +4 -3
  71. package/src/components/BlockchainList/BlockchainList.tsx +1 -1
  72. package/src/components/HeaderButtons/HeaderButtons.types.ts +0 -1
  73. package/src/components/HeaderButtons/HomeButtons.tsx +1 -2
  74. package/src/components/Layout/Layout.helpers.ts +16 -0
  75. package/src/components/Layout/Layout.styles.ts +17 -31
  76. package/src/components/Layout/Layout.tsx +24 -27
  77. package/src/components/Layout/Layout.types.ts +9 -8
  78. package/src/components/Layout/PageContainer.tsx +24 -0
  79. package/src/components/Layout/ScrollableArea.tsx +11 -0
  80. package/src/components/Layout/index.ts +2 -0
  81. package/src/components/NotificationContent/NotificationContent.tsx +0 -3
  82. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +0 -1
  83. package/src/components/SettingsContainer/SettingsContainer.style.ts +0 -5
  84. package/src/components/SettingsContainer/index.ts +0 -1
  85. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -1
  86. package/src/components/SwapDetails/SwapDetails.styles.ts +5 -6
  87. package/src/components/SwapDetails/SwapDetails.tsx +3 -5
  88. package/src/components/TokenList/TokenList.styles.ts +2 -0
  89. package/src/components/TokenList/TokenList.tsx +1 -1
  90. package/src/constants/searchParams.ts +6 -6
  91. package/src/containers/App/App.styles.ts +2 -0
  92. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  93. package/src/containers/QuoteInfo/QuoteInfo.tsx +30 -77
  94. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -7
  95. package/src/containers/Wallets/Wallets.tsx +0 -2
  96. package/src/hooks/useSwapInput.ts +6 -1
  97. package/src/hooks/useSyncStoresWithConfig.ts +3 -17
  98. package/src/hooks/useSyncUrlAndStore/index.ts +1 -0
  99. package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.ts +35 -0
  100. package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +135 -0
  101. package/src/pages/ConfirmSwapPage.tsx +52 -47
  102. package/src/pages/HistoryPage.tsx +5 -17
  103. package/src/pages/Home.tsx +44 -43
  104. package/src/pages/LanguagePage.tsx +3 -4
  105. package/src/pages/LiquiditySourcePage.tsx +3 -4
  106. package/src/pages/SelectBlockchainPage.tsx +38 -38
  107. package/src/pages/SelectSwapItemsPage.tsx +40 -38
  108. package/src/pages/SettingsPage.tsx +3 -4
  109. package/src/pages/SwapDetailsPage.tsx +21 -7
  110. package/src/pages/ThemePage.tsx +3 -4
  111. package/src/pages/WalletsPage.tsx +12 -13
  112. package/src/utils/quote.ts +0 -27
  113. package/src/utils/ui.ts +20 -0
  114. package/dist/components/UpdateUrl.d.ts +0 -2
  115. package/dist/components/UpdateUrl.d.ts.map +0 -1
  116. package/dist/store/ui.d.ts +0 -22
  117. package/dist/store/ui.d.ts.map +0 -1
  118. package/src/components/UpdateUrl.tsx +0 -158
  119. package/src/store/ui.ts +0 -21
@@ -6,23 +6,14 @@ import { Divider, NotFound, styled } from '@rango-dev/ui';
6
6
  import React, { useState } from 'react';
7
7
  import { useNavigate } from 'react-router-dom';
8
8
 
9
- import { Layout } from '../components/Layout';
9
+ import { Layout, PageContainer } from '../components/Layout';
10
10
  import { SearchInput } from '../components/SearchInput';
11
11
  import { SwapsGroup } from '../components/SwapsGroup';
12
12
  import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
13
- import { useUiStore } from '../store/ui';
14
13
  import { groupSwapsByDate } from '../utils/date';
15
14
  import { containsText } from '../utils/numbers';
16
15
  import { getPendingSwaps } from '../utils/queue';
17
16
 
18
- const Container = styled('div', {
19
- display: 'flex',
20
- flexDirection: 'column',
21
- alignItems: 'flex-start',
22
- height: '100%',
23
- gap: 15,
24
- });
25
-
26
17
  const SwapsGroupContainer = styled('div', {
27
18
  overflowY: 'visible',
28
19
  width: '100%',
@@ -46,7 +37,6 @@ const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
46
37
  };
47
38
 
48
39
  export function HistoryPage() {
49
- const setSelectedSwap = useUiStore.use.setSelectedSwap();
50
40
  const navigate = useNavigate();
51
41
  const { manager, state } = useManager();
52
42
  const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
@@ -76,7 +66,7 @@ export function HistoryPage() {
76
66
  header={{
77
67
  title: i18n.t('History'),
78
68
  }}>
79
- <Container>
69
+ <PageContainer>
80
70
  <SearchInput
81
71
  setValue={setSearchedFor}
82
72
  fullWidth
@@ -86,6 +76,7 @@ export function HistoryPage() {
86
76
  onChange={searchHandler}
87
77
  value={searchedFor}
88
78
  />
79
+ <Divider size="16" />
89
80
  <SwapsGroupContainer>
90
81
  {isEmpty && (
91
82
  <NotFoundContainer>
@@ -101,16 +92,13 @@ export function HistoryPage() {
101
92
  {!isEmpty && (
102
93
  <SwapsGroup
103
94
  list={filteredList}
104
- onSwapClick={(requestId) => {
105
- setSelectedSwap(requestId);
106
- navigate(requestId);
107
- }}
95
+ onSwapClick={navigate}
108
96
  groupBy={groupSwapsByDate}
109
97
  isLoading={loading}
110
98
  />
111
99
  )}
112
100
  </SwapsGroupContainer>
113
- </Container>
101
+ </PageContainer>
114
102
  </Layout>
115
103
  );
116
104
  }
@@ -1,10 +1,11 @@
1
1
  import { i18n } from '@lingui/core';
2
- import { Button, styled, SwapInput, WarningIcon } from '@rango-dev/ui';
3
- import React, { useEffect, useRef, useState } from 'react';
2
+ import { Button, Divider, styled, SwapInput, WarningIcon } from '@rango-dev/ui';
3
+ import React, { useEffect, useState } from 'react';
4
4
  import { useNavigate } from 'react-router-dom';
5
5
 
6
6
  import { HomeButtons } from '../components/HeaderButtons';
7
- import { Layout } from '../components/Layout';
7
+ import { Layout, PageContainer } from '../components/Layout';
8
+ import { QuoteWarningsAndErrors } from '../components/QuoteWarningsAndErrors';
8
9
  import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
9
10
  import { errorMessages } from '../constants/errors';
10
11
  import { navigationRoutes } from '../constants/navigationRoutes';
@@ -20,7 +21,6 @@ import { QuoteInfo } from '../containers/QuoteInfo';
20
21
  import { useSwapInput } from '../hooks/useSwapInput';
21
22
  import { useAppStore } from '../store/AppStore';
22
23
  import { useQuoteStore } from '../store/quote';
23
- import { useUiStore } from '../store/ui';
24
24
  import { useWalletsStore } from '../store/wallets';
25
25
  import { getContainer } from '../utils/common';
26
26
  import { formatTooltipNumbers, numberToString } from '../utils/numbers';
@@ -28,15 +28,6 @@ import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
28
28
  import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
29
29
  import { formatBalance, isFetchingBalance } from '../utils/wallets';
30
30
 
31
- const Container = styled('div', {
32
- display: 'flex',
33
- flexDirection: 'column',
34
- overflowY: 'visible',
35
- '& .quote__container': {
36
- paddingTop: '$2',
37
- },
38
- });
39
-
40
31
  const FromContainer = styled('div', {
41
32
  position: 'relative',
42
33
  });
@@ -51,7 +42,7 @@ export function Home() {
51
42
  const navigate = useNavigate();
52
43
  const {
53
44
  fetch: fetchQuote,
54
- loading: fetchingQuote,
45
+ loading,
55
46
  error: quoteError,
56
47
  warning: quoteWarning,
57
48
  } = useSwapInput();
@@ -73,9 +64,7 @@ export function Home() {
73
64
  const fetchMetaStatus = useAppStore().fetchStatus;
74
65
 
75
66
  const { connectedWallets, getBalanceFor } = useWalletsStore();
76
- const setCurrentPage = useUiStore.use.setCurrentPage();
77
67
  const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
78
- const layoutRef = useRef<HTMLDivElement>(null);
79
68
  const fetchingBalance =
80
69
  !!fromBlockchain &&
81
70
  isFetchingBalance(connectedWallets, fromBlockchain.name);
@@ -96,7 +85,7 @@ export function Home() {
96
85
 
97
86
  const swapButtonState = getSwapButtonState({
98
87
  fetchMetaStatus,
99
- fetchingQuote,
88
+ fetchingQuote: loading,
100
89
  inputAmount,
101
90
  quote,
102
91
  anyWalletConnected: connectedWallets.length > 0,
@@ -115,10 +104,15 @@ export function Home() {
115
104
  ? numberToString(fromTokenBalance?.amount, fromTokenBalance?.decimals)
116
105
  : '0';
117
106
 
107
+ const fetchingQuote =
108
+ fetchMetaStatus === 'success' &&
109
+ !!inputAmount &&
110
+ !!fromToken &&
111
+ !!toToken &&
112
+ loading;
113
+
118
114
  useEffect(() => {
119
- setCurrentPage(navigationRoutes.home);
120
115
  resetQuoteWallets();
121
- return setCurrentPage.bind(null, '');
122
116
  }, []);
123
117
 
124
118
  const percentageChange =
@@ -128,8 +122,7 @@ export function Home() {
128
122
 
129
123
  return (
130
124
  <Layout
131
- ref={layoutRef}
132
- fixedHeight={false}
125
+ height="auto"
133
126
  hasLogo
134
127
  footer={
135
128
  <Button
@@ -160,7 +153,6 @@ export function Home() {
160
153
  title: i18n.t('Swap'),
161
154
  suffix: (
162
155
  <HomeButtons
163
- layoutRef={layoutRef.current}
164
156
  onClickRefresh={
165
157
  (!!quote || quoteError) && !showQuoteWarningModal
166
158
  ? fetchQuote
@@ -171,7 +163,7 @@ export function Home() {
171
163
  />
172
164
  ),
173
165
  }}>
174
- <Container>
166
+ <PageContainer>
175
167
  <InputsContainer>
176
168
  <FromContainer>
177
169
  <SwapInput
@@ -262,26 +254,35 @@ export function Home() {
262
254
  tooltipContainer={getContainer()}
263
255
  />
264
256
  </InputsContainer>
265
- <div className="quote__container">
266
- <QuoteInfo
267
- quote={quote}
268
- loading={fetchingQuote}
269
- error={quoteError}
270
- warning={quoteWarning}
271
- type="basic"
272
- refetchQuote={fetchQuote}
273
- showWarningModal={showQuoteWarningModal}
274
- onOpenWarningModal={() => setShowQuoteWarningModal(true)}
275
- onCloseWarningModal={() => setShowQuoteWarningModal(false)}
276
- onConfirmWarningModal={() => {
277
- setShowQuoteWarningModal(false);
278
- setQuoteWarningsConfirmed(true);
279
- navigate(navigationRoutes.confirmSwap);
280
- }}
281
- onChangeSettings={() => navigate(navigationRoutes.settings)}
282
- />
283
- </div>
284
- </Container>
257
+ <Divider size="2" />
258
+ <QuoteInfo
259
+ quote={quote}
260
+ loading={fetchingQuote}
261
+ error={quoteError}
262
+ warning={quoteWarning}
263
+ type="basic"
264
+ />
265
+ {quoteWarning || quoteError ? (
266
+ <>
267
+ <Divider size="10" />
268
+ <QuoteWarningsAndErrors
269
+ warning={quoteWarning}
270
+ error={quoteError}
271
+ loading={fetchingQuote}
272
+ refetchQuote={fetchQuote}
273
+ showWarningModal={showQuoteWarningModal}
274
+ onOpenWarningModal={() => setShowQuoteWarningModal(true)}
275
+ onCloseWarningModal={() => setShowQuoteWarningModal(false)}
276
+ onConfirmWarningModal={() => {
277
+ setShowQuoteWarningModal(false);
278
+ setQuoteWarningsConfirmed(true);
279
+ navigate(navigationRoutes.confirmSwap);
280
+ }}
281
+ onChangeSettings={() => navigate(navigationRoutes.settings)}
282
+ />
283
+ </>
284
+ ) : null}
285
+ </PageContainer>
285
286
  </Layout>
286
287
  );
287
288
  }
@@ -8,8 +8,7 @@ import {
8
8
  } from '@rango-dev/ui';
9
9
  import React from 'react';
10
10
 
11
- import { Layout } from '../components/Layout';
12
- import { SettingsContainer } from '../components/SettingsContainer';
11
+ import { Layout, PageContainer } from '../components/Layout';
13
12
  import { useLanguage } from '../hooks/useLanguage';
14
13
 
15
14
  export function LanguagePage() {
@@ -36,7 +35,7 @@ export function LanguagePage() {
36
35
  header={{
37
36
  title: i18n.t('Language'),
38
37
  }}>
39
- <SettingsContainer>
38
+ <PageContainer>
40
39
  <RadioRoot value={activeLanguage}>
41
40
  <List
42
41
  type={
@@ -49,7 +48,7 @@ export function LanguagePage() {
49
48
  items={languageList}
50
49
  />
51
50
  </RadioRoot>
52
- </SettingsContainer>
51
+ </PageContainer>
53
52
  </Layout>
54
53
  );
55
54
  }
@@ -14,14 +14,13 @@ import {
14
14
  } from '@rango-dev/ui';
15
15
  import React, { useState } from 'react';
16
16
 
17
- import { Layout } from '../components/Layout';
17
+ import { Layout, PageContainer } from '../components/Layout';
18
18
  import { LoadingLiquiditySourceList } from '../components/LoadingLiquiditySourceList';
19
19
  import { SearchInput } from '../components/SearchInput';
20
20
  import {
21
21
  LiquiditySourceList,
22
22
  LiquiditySourceSuffix,
23
23
  NotFoundContainer,
24
- SettingsContainer,
25
24
  } from '../components/SettingsContainer';
26
25
  import { useAppStore } from '../store/AppStore';
27
26
  import { containsText } from '../utils/numbers';
@@ -109,7 +108,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
109
108
  </LiquiditySourceSuffix>
110
109
  ),
111
110
  }}>
112
- <SettingsContainer>
111
+ <PageContainer view>
113
112
  <SearchInput
114
113
  value={searchedFor}
115
114
  setValue={setSearchedFor}
@@ -148,7 +147,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
148
147
  </LiquiditySourceList>
149
148
  )
150
149
  )}
151
- </SettingsContainer>
150
+ </PageContainer>
152
151
  </Layout>
153
152
  );
154
153
  }
@@ -7,7 +7,7 @@ import {
7
7
  import React, { useState } from 'react';
8
8
 
9
9
  import { BlockchainList } from '../components/BlockchainList';
10
- import { Layout } from '../components/Layout';
10
+ import { Layout, PageContainer } from '../components/Layout';
11
11
  import { SearchInput } from '../components/SearchInput';
12
12
  import { useNavigateBack } from '../hooks/useNavigateBack';
13
13
  import { useAppStore } from '../store/AppStore';
@@ -39,45 +39,45 @@ export function SelectBlockchainPage(props: PropTypes) {
39
39
  header={{
40
40
  title: i18n.t(`Select Blockchain`),
41
41
  }}>
42
- <Divider size={12} />
42
+ <PageContainer view>
43
+ {showCategory && (
44
+ <>
45
+ <SelectableCategoryList
46
+ setCategory={setBlockchainCategory}
47
+ category={blockchainCategory}
48
+ blockchains={blockchains}
49
+ isLoading={fetchStatus === 'loading'}
50
+ />
51
+ <Divider size={24} />
52
+ </>
53
+ )}
43
54
 
44
- {showCategory && (
45
- <>
46
- <SelectableCategoryList
47
- setCategory={setBlockchainCategory}
48
- category={blockchainCategory}
49
- blockchains={blockchains}
50
- isLoading={fetchStatus === 'loading'}
51
- />
52
- <Divider size={24} />
53
- </>
54
- )}
55
+ <SearchInput
56
+ value={searchedFor}
57
+ autoFocus
58
+ placeholder={i18n.t('Search Blockchain')}
59
+ color="light"
60
+ variant="contained"
61
+ size="large"
62
+ setValue={() => setSearchedFor('')}
63
+ onChange={(event) => setSearchedFor(event.target.value)}
64
+ />
65
+ <Divider size={16} />
55
66
 
56
- <SearchInput
57
- value={searchedFor}
58
- autoFocus
59
- placeholder={i18n.t('Search Blockchain')}
60
- color="light"
61
- variant="contained"
62
- size="large"
63
- setValue={() => setSearchedFor('')}
64
- onChange={(event) => setSearchedFor(event.target.value)}
65
- />
66
- <Divider size={16} />
67
-
68
- <BlockchainList
69
- list={blockchains}
70
- searchedFor={searchedFor}
71
- blockchainCategory={blockchainCategory}
72
- onChange={(blockchain) => {
73
- if (type === 'source') {
74
- setFromBlockchain(blockchain);
75
- } else {
76
- setToBlockchain(blockchain);
77
- }
78
- navigateBack();
79
- }}
80
- />
67
+ <BlockchainList
68
+ list={blockchains}
69
+ searchedFor={searchedFor}
70
+ blockchainCategory={blockchainCategory}
71
+ onChange={(blockchain) => {
72
+ if (type === 'source') {
73
+ setFromBlockchain(blockchain);
74
+ } else {
75
+ setToBlockchain(blockchain);
76
+ }
77
+ navigateBack();
78
+ }}
79
+ />
80
+ </PageContainer>
81
81
  </Layout>
82
82
  );
83
83
  }
@@ -6,7 +6,7 @@ import React, { useState } from 'react';
6
6
  import { useNavigate } from 'react-router-dom';
7
7
 
8
8
  import { BlockchainsSection } from '../components/BlockchainsSection';
9
- import { Layout } from '../components/Layout';
9
+ import { Layout, PageContainer } from '../components/Layout';
10
10
  import { SearchInput } from '../components/SearchInput';
11
11
  import { TokenList } from '../components/TokenList/TokenList';
12
12
  import { navigationRoutes } from '../constants/navigationRoutes';
@@ -78,45 +78,47 @@ export function SelectSwapItemsPage(props: PropTypes) {
78
78
  header={{
79
79
  title: i18n.t('Swap {type}', { type: types[type] }),
80
80
  }}>
81
- <BlockchainsSection
82
- blockchains={blockchains}
83
- type={type == 'source' ? 'from' : 'to'}
84
- blockchain={type === 'source' ? fromBlockchain : toBlockchain}
85
- onMoreClick={() => navigate(navigationRoutes.blockchains)}
86
- onChange={(blockchain) => {
87
- updateBlockchain(blockchain);
88
- }}
89
- />
90
- <Divider size={24} />
91
- <SearchInput
92
- value={searchedFor}
93
- autoFocus
94
- placeholder={i18n.t('Search Token')}
95
- color="light"
96
- variant="contained"
97
- size="large"
98
- setValue={() => setSearchedFor('')}
99
- onChange={(event) => setSearchedFor(event.target.value)}
100
- />
101
- <Divider size={16} />
102
- <TokenList
103
- list={tokensList}
104
- selectedBlockchain={selectedBlockchainName}
105
- searchedFor={searchedFor}
106
- type={type}
107
- onChange={(token) => {
108
- updateToken(token);
81
+ <PageContainer>
82
+ <BlockchainsSection
83
+ blockchains={blockchains}
84
+ type={type == 'source' ? 'from' : 'to'}
85
+ blockchain={type === 'source' ? fromBlockchain : toBlockchain}
86
+ onMoreClick={() => navigate(navigationRoutes.blockchains)}
87
+ onChange={(blockchain) => {
88
+ updateBlockchain(blockchain);
89
+ }}
90
+ />
91
+ <Divider size={24} />
92
+ <SearchInput
93
+ value={searchedFor}
94
+ autoFocus
95
+ placeholder={i18n.t('Search Token')}
96
+ color="light"
97
+ variant="contained"
98
+ size="large"
99
+ setValue={() => setSearchedFor('')}
100
+ onChange={(event) => setSearchedFor(event.target.value)}
101
+ />
102
+ <Divider size={16} />
103
+ <TokenList
104
+ list={tokensList}
105
+ selectedBlockchain={selectedBlockchainName}
106
+ searchedFor={searchedFor}
107
+ type={type}
108
+ onChange={(token) => {
109
+ updateToken(token);
109
110
 
110
- const tokenBlockchain = blockchains.find(
111
- (chain) => token.blockchain === chain.name
112
- );
113
- if (tokenBlockchain) {
114
- updateBlockchain(tokenBlockchain);
115
- }
111
+ const tokenBlockchain = blockchains.find(
112
+ (chain) => token.blockchain === chain.name
113
+ );
114
+ if (tokenBlockchain) {
115
+ updateBlockchain(tokenBlockchain);
116
+ }
116
117
 
117
- navigateBack();
118
- }}
119
- />
118
+ navigateBack();
119
+ }}
120
+ />
121
+ </PageContainer>
120
122
  </Layout>
121
123
  );
122
124
  }
@@ -13,8 +13,7 @@ import {
13
13
  import React from 'react';
14
14
  import { useNavigate } from 'react-router-dom';
15
15
 
16
- import { Layout } from '../components/Layout';
17
- import { SettingsContainer } from '../components/SettingsContainer';
16
+ import { Layout, PageContainer } from '../components/Layout';
18
17
  import { Slippage } from '../components/Slippage';
19
18
  import { SlippageTooltipContainer as TooltipContainer } from '../components/Slippage/Slippage.styles';
20
19
  import { navigationRoutes } from '../constants/navigationRoutes';
@@ -183,7 +182,7 @@ export function SettingsPage() {
183
182
  header={{
184
183
  title: i18n.t('Settings'),
185
184
  }}>
186
- <SettingsContainer>
185
+ <PageContainer>
187
186
  <Slippage />
188
187
  <List
189
188
  type={
@@ -191,7 +190,7 @@ export function SettingsPage() {
191
190
  }
192
191
  items={settingItems}
193
192
  />
194
- </SettingsContainer>
193
+ </PageContainer>
195
194
  </Layout>
196
195
  );
197
196
  }
@@ -1,27 +1,41 @@
1
+ import { i18n } from '@lingui/core';
1
2
  import { cancelSwap } from '@rango-dev/queue-manager-rango-preset';
2
3
  import { useManager } from '@rango-dev/queue-manager-react';
4
+ import { Alert } from '@rango-dev/ui';
3
5
  import React from 'react';
6
+ import { useParams } from 'react-router-dom';
4
7
 
5
8
  import { SwapDetails } from '../components/SwapDetails';
6
9
  import { SwapDetailsPlaceholder } from '../components/SwapDetails/SwapDetails.Placeholder';
7
10
  import { useNavigateBack } from '../hooks/useNavigateBack';
8
11
  import { useAppStore } from '../store/AppStore';
9
- import { useUiStore } from '../store/ui';
10
12
  import { getPendingSwaps } from '../utils/queue';
11
13
 
12
14
  export function SwapDetailsPage() {
13
15
  const { manager, state } = useManager();
14
16
  const loading = !state.loadedFromPersistor;
15
17
  const pendingSwaps = getPendingSwaps(manager);
16
- const requestId = useUiStore.use.selectedSwapRequestId();
18
+ const { requestId } = useParams<{ requestId: string }>();
17
19
  const navigateBack = useNavigateBack();
18
20
  const { fetchStatus: fetchMetaStatus } = useAppStore();
19
21
 
22
+ if (!requestId) {
23
+ return (
24
+ <Alert
25
+ containerStyles={{ margin: '20px' }}
26
+ type="error"
27
+ title={i18n.t(
28
+ 'The request ID is necessary to display the swap details.'
29
+ )}
30
+ />
31
+ );
32
+ }
33
+
20
34
  const showSkeleton = loading || fetchMetaStatus === 'loading';
21
35
 
22
- const selectedSwap = pendingSwaps.find(
23
- ({ swap }) => swap.requestId === requestId
24
- );
36
+ const selectedSwap = requestId
37
+ ? pendingSwaps.find(({ swap }) => swap.requestId === requestId)
38
+ : undefined;
25
39
 
26
40
  const onCancel = () => {
27
41
  if (selectedSwap?.id) {
@@ -47,7 +61,7 @@ export function SwapDetailsPage() {
47
61
  if (!swap || showSkeleton) {
48
62
  return (
49
63
  <SwapDetailsPlaceholder
50
- requestId={requestId || ''}
64
+ requestId={requestId}
51
65
  showSkeleton={showSkeleton}
52
66
  />
53
67
  );
@@ -56,7 +70,7 @@ export function SwapDetailsPage() {
56
70
  return (
57
71
  <SwapDetails
58
72
  swap={swap}
59
- requestId={requestId || ''}
73
+ requestId={requestId}
60
74
  onCancel={onCancel}
61
75
  onDelete={onDelete}
62
76
  />
@@ -11,8 +11,7 @@ import {
11
11
  } from '@rango-dev/ui';
12
12
  import React from 'react';
13
13
 
14
- import { Layout } from '../components/Layout';
15
- import { SettingsContainer } from '../components/SettingsContainer';
14
+ import { Layout, PageContainer } from '../components/Layout';
16
15
  import { useAppStore } from '../store/AppStore';
17
16
 
18
17
  type Theme = 'dark' | 'light' | 'auto';
@@ -70,7 +69,7 @@ export function ThemePage() {
70
69
  header={{
71
70
  title: i18n.t('Theme'),
72
71
  }}>
73
- <SettingsContainer>
72
+ <PageContainer>
74
73
  <RadioRoot
75
74
  onValueChange={(value) => setTheme(value as Theme)}
76
75
  value={theme}>
@@ -85,7 +84,7 @@ export function ThemePage() {
85
84
  items={themesList}
86
85
  />
87
86
  </RadioRoot>
88
- </SettingsContainer>
87
+ </PageContainer>
89
88
  </Layout>
90
89
  );
91
90
  }
@@ -2,9 +2,9 @@ import type { WalletType } from '@rango-dev/wallets-shared';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
  import { styled, Typography, Wallet, WalletState } from '@rango-dev/ui';
5
- import React, { Fragment, useState } from 'react';
5
+ import React, { useState } from 'react';
6
6
 
7
- import { Layout } from '../components/Layout';
7
+ import { Layout, PageContainer } from '../components/Layout';
8
8
  import { WalletModal } from '../components/WalletModal';
9
9
  import { useWalletList } from '../hooks/useWalletList';
10
10
  import { useAppStore } from '../store/AppStore';
@@ -20,7 +20,7 @@ const ListContainer = styled('div', {
20
20
  height: '100%',
21
21
  });
22
22
 
23
- const Container = styled('div', {
23
+ const Container = styled(PageContainer, {
24
24
  textAlign: 'center',
25
25
  });
26
26
 
@@ -71,16 +71,15 @@ export function WalletsPage() {
71
71
  {list.map((wallet, index) => {
72
72
  const key = `wallet-${index}-${wallet.type}`;
73
73
  return (
74
- <Fragment key={key}>
75
- <Wallet
76
- {...wallet}
77
- container={getContainer()}
78
- onClick={(type) => {
79
- void handleClick(type);
80
- }}
81
- isLoading={fetchMetaStatus === 'loading'}
82
- />
83
- </Fragment>
74
+ <Wallet
75
+ key={key}
76
+ {...wallet}
77
+ container={getContainer()}
78
+ onClick={(type) => {
79
+ void handleClick(type);
80
+ }}
81
+ isLoading={fetchMetaStatus === 'loading'}
82
+ />
84
83
  );
85
84
  })}
86
85
  <WalletModal