@rango-dev/widget-embedded 0.20.1-next.2 → 0.20.1-next.21

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 (227) hide show
  1. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +169 -1
  2. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  3. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +4 -0
  4. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  5. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +514 -1088
  6. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  8. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +12 -0
  9. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
  10. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts +5 -0
  11. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -0
  12. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +654 -0
  13. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -0
  14. package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts +10 -0
  15. package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts.map +1 -0
  16. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +179 -0
  17. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  18. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +0 -2
  19. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  20. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  21. package/dist/components/HeaderButtons/RefreshButton.d.ts +6 -0
  22. package/dist/components/HeaderButtons/RefreshButton.d.ts.map +1 -0
  23. package/dist/components/Layout/Layout.d.ts +2 -3
  24. package/dist/components/Layout/Layout.d.ts.map +1 -1
  25. package/dist/components/Layout/Layout.helpers.d.ts +2 -0
  26. package/dist/components/Layout/Layout.helpers.d.ts.map +1 -0
  27. package/dist/components/Layout/Layout.styles.d.ts +14 -4
  28. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  29. package/dist/components/Layout/Layout.types.d.ts +6 -3
  30. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  31. package/dist/components/Layout/PageContainer.d.ts +166 -0
  32. package/dist/components/Layout/PageContainer.d.ts.map +1 -0
  33. package/dist/components/Layout/ScrollableArea.d.ts +164 -0
  34. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -0
  35. package/dist/components/Layout/index.d.ts +2 -0
  36. package/dist/components/Layout/index.d.ts.map +1 -1
  37. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +4 -0
  38. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  39. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +56 -0
  40. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
  41. package/dist/components/NoResult/NoResult.styles.d.ts +12 -0
  42. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  43. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  44. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +16 -0
  45. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  46. package/dist/components/Quote/Quote.d.ts.map +1 -1
  47. package/dist/components/Quote/Quote.styles.d.ts +386 -2
  48. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  49. package/dist/components/Quote/Quote.types.d.ts +19 -0
  50. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  51. package/dist/components/Quote/QuoteCostDetails.d.ts +4 -0
  52. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -0
  53. package/dist/components/Quote/QuoteCostDetails.styles.d.ts +806 -0
  54. package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -0
  55. package/dist/components/Quote/QuoteSummary.d.ts.map +1 -1
  56. package/dist/components/Quote/QuoteSummary.styles.d.ts +8 -0
  57. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
  58. package/dist/components/Quote/QuoteTrigger .d.ts +4 -0
  59. package/dist/components/Quote/QuoteTrigger .d.ts.map +1 -0
  60. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +16 -0
  61. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  62. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +40 -0
  63. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
  64. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +20 -0
  65. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  66. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +16 -0
  67. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  68. package/dist/components/SearchInput/SearchInput.styles.d.ts +4 -0
  69. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  70. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +11 -156
  71. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  72. package/dist/components/SettingsContainer/index.d.ts +1 -1
  73. package/dist/components/SettingsContainer/index.d.ts.map +1 -1
  74. package/dist/components/Slippage/Slippage.styles.d.ts +20 -0
  75. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  76. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  77. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  78. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
  79. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  80. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +523 -1
  81. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  82. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -1
  83. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +4 -0
  84. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
  85. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
  86. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
  87. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +4 -0
  88. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
  89. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  90. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +20 -0
  91. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  92. package/dist/components/TokenList/TokenList.styles.d.ts +68 -0
  93. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  94. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +16 -0
  95. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
  96. package/dist/components/WidgetEvents.d.ts.map +1 -1
  97. package/dist/constants/index.d.ts +1 -0
  98. package/dist/constants/index.d.ts.map +1 -1
  99. package/dist/constants/quote.d.ts +12 -0
  100. package/dist/constants/quote.d.ts.map +1 -0
  101. package/dist/containers/App/App.d.ts.map +1 -1
  102. package/dist/containers/App/App.styles.d.ts +4 -0
  103. package/dist/containers/App/App.styles.d.ts.map +1 -1
  104. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +1 -1
  105. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  106. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +10 -314
  107. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  108. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -7
  109. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  110. package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
  111. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -1
  112. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +5 -0
  113. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -1
  114. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
  115. package/dist/hooks/useLanguage.d.ts +2 -1
  116. package/dist/hooks/useLanguage.d.ts.map +1 -1
  117. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
  118. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  119. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  120. package/dist/index.d.ts +6 -6
  121. package/dist/index.d.ts.map +1 -1
  122. package/dist/index.js +2 -1
  123. package/dist/index.js.map +4 -4
  124. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  125. package/dist/pages/HistoryPage.d.ts.map +1 -1
  126. package/dist/pages/Home.d.ts.map +1 -1
  127. package/dist/pages/LanguagePage.d.ts.map +1 -1
  128. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  129. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  130. package/dist/pages/SettingsPage.d.ts.map +1 -1
  131. package/dist/pages/ThemePage.d.ts.map +1 -1
  132. package/dist/pages/WalletsPage.d.ts.map +1 -1
  133. package/dist/store/AppStore.d.ts +2 -2
  134. package/dist/store/app.d.ts +2 -2
  135. package/dist/store/slices/data.d.ts.map +1 -1
  136. package/dist/store/slices/settings.d.ts +2 -2
  137. package/dist/store/slices/settings.d.ts.map +1 -1
  138. package/dist/types/config.d.ts +16 -3
  139. package/dist/types/config.d.ts.map +1 -1
  140. package/dist/types/notification.d.ts +1 -2
  141. package/dist/types/notification.d.ts.map +1 -1
  142. package/dist/utils/configs.d.ts +8 -0
  143. package/dist/utils/configs.d.ts.map +1 -1
  144. package/dist/utils/date.d.ts.map +1 -1
  145. package/dist/utils/quote.d.ts +5 -1
  146. package/dist/utils/quote.d.ts.map +1 -1
  147. package/dist/utils/settings.d.ts +1 -1
  148. package/dist/utils/swap.d.ts +5 -1
  149. package/dist/utils/swap.d.ts.map +1 -1
  150. package/dist/utils/ui.d.ts +2 -0
  151. package/dist/utils/ui.d.ts.map +1 -1
  152. package/package.json +6 -6
  153. package/src/components/BlockchainList/BlockchainList.styles.ts +4 -3
  154. package/src/components/BlockchainList/BlockchainList.tsx +1 -1
  155. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +27 -96
  156. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +25 -40
  157. package/src/components/CustomCollapsible/CustomCollapsible.styles.ts +75 -0
  158. package/src/components/CustomCollapsible/CustomCollapsible.tsx +55 -0
  159. package/src/components/CustomCollapsible/CustomCollapsible.types.ts +10 -0
  160. package/src/components/HeaderButtons/HeaderButtons.styles.ts +16 -1
  161. package/src/components/HeaderButtons/HeaderButtons.types.ts +0 -2
  162. package/src/components/HeaderButtons/HomeButtons.tsx +19 -33
  163. package/src/components/HeaderButtons/RefreshButton.tsx +81 -0
  164. package/src/components/Layout/Layout.helpers.ts +16 -0
  165. package/src/components/Layout/Layout.styles.ts +17 -31
  166. package/src/components/Layout/Layout.tsx +23 -21
  167. package/src/components/Layout/Layout.types.ts +9 -8
  168. package/src/components/Layout/PageContainer.tsx +24 -0
  169. package/src/components/Layout/ScrollableArea.tsx +11 -0
  170. package/src/components/Layout/index.ts +2 -0
  171. package/src/components/NotificationContent/NotificationContent.tsx +10 -1
  172. package/src/components/Quote/Quote.styles.ts +44 -5
  173. package/src/components/Quote/Quote.tsx +10 -77
  174. package/src/components/Quote/Quote.types.ts +22 -0
  175. package/src/components/Quote/QuoteCostDetails.styles.ts +50 -0
  176. package/src/components/Quote/QuoteCostDetails.tsx +218 -0
  177. package/src/components/Quote/QuoteSummary.tsx +3 -2
  178. package/src/components/Quote/QuoteTrigger .tsx +215 -0
  179. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +0 -1
  180. package/src/components/SettingsContainer/SettingsContainer.style.ts +0 -5
  181. package/src/components/SettingsContainer/index.ts +0 -1
  182. package/src/components/Slippage/Slippage.tsx +5 -5
  183. package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
  184. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +12 -13
  185. package/src/components/SwapDetails/SwapDetails.helpers.tsx +43 -3
  186. package/src/components/SwapDetails/SwapDetails.styles.ts +18 -6
  187. package/src/components/SwapDetails/SwapDetails.tsx +13 -5
  188. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +13 -7
  189. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +2 -0
  190. package/src/components/SwapsGroup/SwapsGroup.tsx +18 -7
  191. package/src/components/TokenList/TokenList.styles.ts +2 -0
  192. package/src/components/TokenList/TokenList.tsx +1 -1
  193. package/src/components/WidgetEvents.tsx +2 -14
  194. package/src/constants/index.ts +1 -0
  195. package/src/constants/quote.ts +23 -0
  196. package/src/containers/App/App.styles.ts +2 -0
  197. package/src/containers/App/App.tsx +1 -4
  198. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  199. package/src/containers/QuoteInfo/QuoteInfo.tsx +30 -77
  200. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -7
  201. package/src/containers/Wallets/Wallets.tsx +11 -2
  202. package/src/containers/WidgetInfo/WidgetInfo.tsx +8 -0
  203. package/src/containers/WidgetInfo/WidgetInfo.types.ts +5 -0
  204. package/src/containers/WidgetProvider/WidgetProvider.tsx +2 -1
  205. package/src/hooks/useLanguage.ts +6 -4
  206. package/src/hooks/useSwapInput.ts +6 -2
  207. package/src/hooks/useSyncStoresWithConfig.ts +17 -34
  208. package/src/index.ts +4 -2
  209. package/src/pages/ConfirmSwapPage.tsx +59 -50
  210. package/src/pages/HistoryPage.tsx +4 -11
  211. package/src/pages/Home.tsx +40 -38
  212. package/src/pages/LanguagePage.tsx +3 -4
  213. package/src/pages/LiquiditySourcePage.tsx +8 -6
  214. package/src/pages/SelectBlockchainPage.tsx +41 -41
  215. package/src/pages/SelectSwapItemsPage.tsx +45 -39
  216. package/src/pages/SettingsPage.tsx +3 -4
  217. package/src/pages/ThemePage.tsx +3 -4
  218. package/src/pages/WalletsPage.tsx +12 -13
  219. package/src/store/slices/data.ts +5 -7
  220. package/src/store/slices/settings.ts +3 -3
  221. package/src/types/config.ts +16 -3
  222. package/src/types/notification.ts +0 -7
  223. package/src/utils/configs.ts +41 -0
  224. package/src/utils/date.ts +5 -4
  225. package/src/utils/quote.ts +18 -1
  226. package/src/utils/swap.ts +35 -0
  227. package/src/utils/ui.ts +20 -0
@@ -12,7 +12,6 @@ import {
12
12
  css,
13
13
  Divider,
14
14
  IconButton,
15
- RefreshIcon,
16
15
  SettingsIcon,
17
16
  styled,
18
17
  Tooltip,
@@ -26,7 +25,9 @@ import { useNavigate } from 'react-router-dom';
26
25
  import { getRequiredWallets } from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
27
26
  import { ConfirmWalletsModal } from '../components/ConfirmWalletsModal/ConfirmWalletsModal';
28
27
  import { HeaderButton } from '../components/HeaderButtons/HeaderButtons.styles';
29
- import { Layout } from '../components/Layout';
28
+ import { RefreshButton } from '../components/HeaderButtons/RefreshButton';
29
+ import { Layout, PageContainer } from '../components/Layout';
30
+ import { QuoteWarningsAndErrors } from '../components/QuoteWarningsAndErrors';
30
31
  import { navigationRoutes } from '../constants/navigationRoutes';
31
32
  import { getQuoteUpdateWarningMessage } from '../constants/warnings';
32
33
  import { QuoteInfo } from '../containers/QuoteInfo';
@@ -37,15 +38,7 @@ import { useUiStore } from '../store/ui';
37
38
  import { useWalletsStore } from '../store/wallets';
38
39
  import { QuoteWarningType } from '../types';
39
40
  import { getContainer } from '../utils/common';
40
-
41
- const Container = styled('div', {
42
- position: 'relative',
43
- width: '100%',
44
-
45
- '& .quote-update__alert': {
46
- paddingTop: '$10',
47
- },
48
- });
41
+ import { joinList } from '../utils/ui';
49
42
 
50
43
  const Buttons = styled('div', {
51
44
  width: '100%',
@@ -263,6 +256,45 @@ export function ConfirmSwapPage() {
263
256
  }
264
257
  }, []);
265
258
 
259
+ const quoteWarning = confirmSwapResult.warnings?.quote ?? null;
260
+ const quoteError = confirmSwapResult.error;
261
+ const alerts = [];
262
+ if (dbErrorMessage) {
263
+ alerts.push(<Alert type="error" variant="alarm" title={dbErrorMessage} />);
264
+ }
265
+
266
+ if (confirmSwapResult.warnings?.quoteUpdate) {
267
+ alerts.push(
268
+ <Alert
269
+ variant="alarm"
270
+ type="warning"
271
+ title={
272
+ confirmSwapResult.warnings.quoteUpdate &&
273
+ getQuoteUpdateWarningMessage(confirmSwapResult.warnings.quoteUpdate)
274
+ }
275
+ />
276
+ );
277
+ }
278
+
279
+ if (quoteWarning || quoteError) {
280
+ alerts.push(
281
+ <QuoteWarningsAndErrors
282
+ warning={quoteWarning}
283
+ error={quoteError}
284
+ loading={fetchingConfirmationQuote}
285
+ refetchQuote={onRefresh}
286
+ showWarningModal={showQuoteWarningModal}
287
+ onOpenWarningModal={() => setShowQuoteWarningModal(true)}
288
+ onCloseWarningModal={() => setShowQuoteWarningModal(false)}
289
+ onConfirmWarningModal={async () => {
290
+ setShowQuoteWarningModal(false);
291
+ await addNewSwap();
292
+ }}
293
+ onChangeSettings={() => navigate(navigationRoutes.settings)}
294
+ />
295
+ );
296
+ }
297
+
266
298
  return (
267
299
  <Layout
268
300
  header={{
@@ -319,60 +351,37 @@ export function ConfirmSwapPage() {
319
351
  />
320
352
  )}
321
353
 
322
- <Container>
354
+ <PageContainer>
323
355
  <div className={descriptionStyles()}>
324
356
  <Typography variant="title" size="small">
325
357
  {i18n.t('You get')}
326
358
  </Typography>
327
- <Button
328
- style={{ padding: '0' }}
329
- variant="ghost"
330
- disabled={fetchingConfirmationQuote}
331
- onClick={onRefresh}>
332
- <div className={iconStyles()}>
333
- <RefreshIcon size={16} />
334
- </div>
335
- </Button>
336
- </div>
337
- {dbErrorMessage && (
338
- <>
339
- <Alert type="error" variant="alarm" title={dbErrorMessage} />
340
- <Divider size={12} />
341
- </>
342
- )}
343
- {confirmSwapResult.warnings?.quoteUpdate && (
344
- <div className="quote-update__alert">
345
- <Alert
346
- variant="alarm"
347
- type="warning"
348
- title={
349
- confirmSwapResult.warnings.quoteUpdate &&
350
- getQuoteUpdateWarningMessage(
351
- confirmSwapResult.warnings.quoteUpdate
352
- )
359
+ <div className={iconStyles()}>
360
+ <RefreshButton
361
+ onClick={
362
+ !fetchingConfirmationQuote &&
363
+ !showWallets &&
364
+ !showQuoteWarningModal
365
+ ? onRefresh
366
+ : undefined
353
367
  }
354
368
  />
355
369
  </div>
356
- )}
370
+ </div>
371
+ <Divider size="12" />
372
+
373
+ {joinList(alerts, <Divider size={10} />)}
374
+ {alerts.length > 0 ? <Divider size={10} /> : null}
375
+
357
376
  <QuoteInfo
358
377
  quote={quote}
359
378
  type="swap-preview"
360
379
  expanded={true}
361
- alertPosition="top"
362
380
  error={confirmSwapResult.error}
363
381
  loading={fetchingConfirmationQuote}
364
382
  warning={confirmSwapResult.warnings?.quote ?? null}
365
- refetchQuote={onRefresh}
366
- showWarningModal={showQuoteWarningModal}
367
- onOpenWarningModal={() => setShowQuoteWarningModal(true)}
368
- onCloseWarningModal={() => setShowQuoteWarningModal(false)}
369
- onConfirmWarningModal={async () => {
370
- setShowQuoteWarningModal(false);
371
- await addNewSwap();
372
- }}
373
- onChangeSettings={() => navigate('../' + navigationRoutes.settings)}
374
383
  />
375
- </Container>
384
+ </PageContainer>
376
385
  </Layout>
377
386
  );
378
387
  }
@@ -6,7 +6,7 @@ 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';
@@ -15,14 +15,6 @@ import { groupSwapsByDate } from '../utils/date';
15
15
  import { containsText } from '../utils/numbers';
16
16
  import { getPendingSwaps } from '../utils/queue';
17
17
 
18
- const Container = styled('div', {
19
- display: 'flex',
20
- flexDirection: 'column',
21
- alignItems: 'flex-start',
22
- height: '100%',
23
- gap: 15,
24
- });
25
-
26
18
  const SwapsGroupContainer = styled('div', {
27
19
  overflowY: 'visible',
28
20
  width: '100%',
@@ -76,7 +68,7 @@ export function HistoryPage() {
76
68
  header={{
77
69
  title: i18n.t('History'),
78
70
  }}>
79
- <Container>
71
+ <PageContainer>
80
72
  <SearchInput
81
73
  setValue={setSearchedFor}
82
74
  fullWidth
@@ -86,6 +78,7 @@ export function HistoryPage() {
86
78
  onChange={searchHandler}
87
79
  value={searchedFor}
88
80
  />
81
+ <Divider size="16" />
89
82
  <SwapsGroupContainer>
90
83
  {isEmpty && (
91
84
  <NotFoundContainer>
@@ -110,7 +103,7 @@ export function HistoryPage() {
110
103
  />
111
104
  )}
112
105
  </SwapsGroupContainer>
113
- </Container>
106
+ </PageContainer>
114
107
  </Layout>
115
108
  );
116
109
  }
@@ -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';
@@ -28,15 +29,6 @@ import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
28
29
  import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
29
30
  import { formatBalance, isFetchingBalance } from '../utils/wallets';
30
31
 
31
- const Container = styled('div', {
32
- display: 'flex',
33
- flexDirection: 'column',
34
- overflowY: 'visible',
35
- '& .quote__container': {
36
- paddingTop: '$2',
37
- },
38
- });
39
-
40
32
  const FromContainer = styled('div', {
41
33
  position: 'relative',
42
34
  });
@@ -75,7 +67,6 @@ export function Home() {
75
67
  const { connectedWallets, getBalanceFor } = useWalletsStore();
76
68
  const setCurrentPage = useUiStore.use.setCurrentPage();
77
69
  const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
78
- const layoutRef = useRef<HTMLDivElement>(null);
79
70
  const fetchingBalance =
80
71
  !!fromBlockchain &&
81
72
  isFetchingBalance(connectedWallets, fromBlockchain.name);
@@ -128,8 +119,7 @@ export function Home() {
128
119
 
129
120
  return (
130
121
  <Layout
131
- ref={layoutRef}
132
- fixedHeight={false}
122
+ height="auto"
133
123
  hasLogo
134
124
  footer={
135
125
  <Button
@@ -160,14 +150,17 @@ export function Home() {
160
150
  title: i18n.t('Swap'),
161
151
  suffix: (
162
152
  <HomeButtons
163
- layoutRef={layoutRef.current}
164
- onClickRefresh={!!quote || quoteError ? fetchQuote : undefined}
153
+ onClickRefresh={
154
+ (!!quote || quoteError) && !showQuoteWarningModal
155
+ ? fetchQuote
156
+ : undefined
157
+ }
165
158
  onClickHistory={() => navigate(navigationRoutes.swaps)}
166
159
  onClickSettings={() => navigate(navigationRoutes.settings)}
167
160
  />
168
161
  ),
169
162
  }}>
170
- <Container>
163
+ <PageContainer>
171
164
  <InputsContainer>
172
165
  <FromContainer>
173
166
  <SwapInput
@@ -258,26 +251,35 @@ export function Home() {
258
251
  tooltipContainer={getContainer()}
259
252
  />
260
253
  </InputsContainer>
261
- <div className="quote__container">
262
- <QuoteInfo
263
- quote={quote}
264
- loading={fetchingQuote}
265
- error={quoteError}
266
- warning={quoteWarning}
267
- type="basic"
268
- refetchQuote={fetchQuote}
269
- showWarningModal={showQuoteWarningModal}
270
- onOpenWarningModal={() => setShowQuoteWarningModal(true)}
271
- onCloseWarningModal={() => setShowQuoteWarningModal(false)}
272
- onConfirmWarningModal={() => {
273
- setShowQuoteWarningModal(false);
274
- setQuoteWarningsConfirmed(true);
275
- navigate(navigationRoutes.confirmSwap);
276
- }}
277
- onChangeSettings={() => navigate(navigationRoutes.settings)}
278
- />
279
- </div>
280
- </Container>
254
+ <Divider size="2" />
255
+ <QuoteInfo
256
+ quote={quote}
257
+ loading={fetchingQuote}
258
+ error={quoteError}
259
+ warning={quoteWarning}
260
+ type="basic"
261
+ />
262
+ {quoteWarning || quoteError ? (
263
+ <>
264
+ <Divider size="10" />
265
+ <QuoteWarningsAndErrors
266
+ warning={quoteWarning}
267
+ error={quoteError}
268
+ loading={fetchingQuote}
269
+ refetchQuote={fetchQuote}
270
+ showWarningModal={showQuoteWarningModal}
271
+ onOpenWarningModal={() => setShowQuoteWarningModal(true)}
272
+ onCloseWarningModal={() => setShowQuoteWarningModal(false)}
273
+ onConfirmWarningModal={() => {
274
+ setShowQuoteWarningModal(false);
275
+ setQuoteWarningsConfirmed(true);
276
+ navigate(navigationRoutes.confirmSwap);
277
+ }}
278
+ onChangeSettings={() => navigate(navigationRoutes.settings)}
279
+ />
280
+ </>
281
+ ) : null}
282
+ </PageContainer>
281
283
  </Layout>
282
284
  );
283
285
  }
@@ -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';
@@ -40,6 +39,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
40
39
  const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
41
40
  getUniqueSwappersGroups(swappers, disabledLiquiditySources);
42
41
 
42
+ const types = { Exchanges: i18n.t('Exchanges'), Bridges: i18n.t('Bridges') };
43
43
  const validTypes: Array<LiquiditySourceType> = [];
44
44
  if (sourceType === 'Exchanges') {
45
45
  validTypes.push('DEX');
@@ -103,19 +103,21 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
103
103
  suffix: (
104
104
  <LiquiditySourceSuffix>
105
105
  <Button variant="ghost" size="xsmall" onClick={toggleAllSources}>
106
- {i18n.t(hasSelectAll ? 'Deselect all' : 'Select all')}
106
+ {hasSelectAll ? i18n.t('Deselect all') : i18n.t('Select all')}
107
107
  </Button>
108
108
  </LiquiditySourceSuffix>
109
109
  ),
110
110
  }}>
111
- <SettingsContainer>
111
+ <PageContainer view>
112
112
  <SearchInput
113
113
  value={searchedFor}
114
114
  setValue={setSearchedFor}
115
115
  fullWidth
116
116
  color="light"
117
117
  variant="contained"
118
- placeholder={i18n.t('Search {sourceType}', { sourceType })}
118
+ placeholder={i18n.t('Search {sourceType}', {
119
+ sourceType: types[sourceType],
120
+ })}
119
121
  onChange={searchHandler}
120
122
  />
121
123
  {fetchStatus === 'loading' && <LoadingLiquiditySourceList />}
@@ -145,7 +147,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
145
147
  </LiquiditySourceList>
146
148
  )
147
149
  )}
148
- </SettingsContainer>
150
+ </PageContainer>
149
151
  </Layout>
150
152
  );
151
153
  }
@@ -2,12 +2,12 @@ import { i18n } from '@lingui/core';
2
2
  import {
3
3
  Divider,
4
4
  getCountCategories,
5
- SelectableCategoryList
5
+ SelectableCategoryList,
6
6
  } from '@rango-dev/ui';
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';
@@ -27,7 +27,7 @@ export function SelectBlockchainPage(props: PropTypes) {
27
27
  const fetchStatus = useAppStore().fetchStatus;
28
28
 
29
29
  const blockchains = useAppStore().blockchains({
30
- type: type
30
+ type,
31
31
  });
32
32
 
33
33
  const countActiveCategories = getCountCategories(blockchains);
@@ -37,47 +37,47 @@ export function SelectBlockchainPage(props: PropTypes) {
37
37
  return (
38
38
  <Layout
39
39
  header={{
40
- title: i18n.t(`Select Blockchain`)
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';
@@ -68,51 +68,57 @@ export function SelectSwapItemsPage(props: PropTypes) {
68
68
  setToToken({ token, meta: { blockchains, tokens } });
69
69
  }
70
70
  };
71
+ const types = {
72
+ source: i18n.t('Source'),
73
+ destination: i18n.t('Destination'),
74
+ };
71
75
 
72
76
  return (
73
77
  <Layout
74
78
  header={{
75
- title: i18n.t('Swap {type}', { type }),
79
+ title: i18n.t('Swap {type}', { type: types[type] }),
76
80
  }}>
77
- <BlockchainsSection
78
- blockchains={blockchains}
79
- type={type == 'source' ? 'from' : 'to'}
80
- blockchain={type === 'source' ? fromBlockchain : toBlockchain}
81
- onMoreClick={() => navigate(navigationRoutes.blockchains)}
82
- onChange={(blockchain) => {
83
- updateBlockchain(blockchain);
84
- }}
85
- />
86
- <Divider size={24} />
87
- <SearchInput
88
- value={searchedFor}
89
- autoFocus
90
- placeholder={i18n.t('Search Token')}
91
- color="light"
92
- variant="contained"
93
- size="large"
94
- setValue={() => setSearchedFor('')}
95
- onChange={(event) => setSearchedFor(event.target.value)}
96
- />
97
- <Divider size={16} />
98
- <TokenList
99
- list={tokensList}
100
- selectedBlockchain={selectedBlockchainName}
101
- searchedFor={searchedFor}
102
- type={type}
103
- onChange={(token) => {
104
- 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);
105
110
 
106
- const tokenBlockchain = blockchains.find(
107
- (chain) => token.blockchain === chain.name
108
- );
109
- if (tokenBlockchain) {
110
- updateBlockchain(tokenBlockchain);
111
- }
111
+ const tokenBlockchain = blockchains.find(
112
+ (chain) => token.blockchain === chain.name
113
+ );
114
+ if (tokenBlockchain) {
115
+ updateBlockchain(tokenBlockchain);
116
+ }
112
117
 
113
- navigateBack();
114
- }}
115
- />
118
+ navigateBack();
119
+ }}
120
+ />
121
+ </PageContainer>
116
122
  </Layout>
117
123
  );
118
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
  }