@rango-dev/widget-embedded 0.23.1-next.8 → 0.24.0

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 (187) hide show
  1. package/dist/components/AppRouter.d.ts +1 -6
  2. package/dist/components/AppRouter.d.ts.map +1 -1
  3. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -283
  4. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  5. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  6. package/dist/components/HeaderButtons/HeaderButtons.d.ts.map +1 -1
  7. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +489 -1
  8. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  9. package/dist/components/HeaderButtons/InProgressTransactionBadge.d.ts +4 -0
  10. package/dist/components/HeaderButtons/InProgressTransactionBadge.d.ts.map +1 -0
  11. package/dist/components/HeaderButtons/RefreshButton.d.ts.map +1 -1
  12. package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
  13. package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -1
  14. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +1 -1
  15. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  16. package/dist/components/NoResult/NoResult.d.ts.map +1 -1
  17. package/dist/components/NoResult/NoResult.helpers.d.ts +8 -0
  18. package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -1
  19. package/dist/components/NoResult/NoResult.styles.d.ts +167 -1
  20. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  21. package/dist/components/NoResult/NoResult.types.d.ts +1 -0
  22. package/dist/components/NoResult/NoResult.types.d.ts.map +1 -1
  23. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  24. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +165 -0
  25. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  26. package/dist/components/Quote/Quote.d.ts.map +1 -1
  27. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  28. package/dist/components/Quote/Quote.types.d.ts +1 -0
  29. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  30. package/dist/components/Quote/QuoteTrigger.d.ts.map +1 -1
  31. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +1 -0
  32. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  33. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -1
  34. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +3 -1
  35. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  36. package/dist/components/Quotes/Quotes.d.ts.map +1 -1
  37. package/dist/components/Quotes/Quotes.types.d.ts +1 -0
  38. package/dist/components/Quotes/Quotes.types.d.ts.map +1 -1
  39. package/dist/components/Quotes/SelectStrategy.d.ts.map +1 -1
  40. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  41. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  42. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  43. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  44. package/dist/constants/index.d.ts +1 -1
  45. package/dist/constants/index.d.ts.map +1 -1
  46. package/dist/constants/languages.d.ts.map +1 -1
  47. package/dist/constants/quote.d.ts +1 -5
  48. package/dist/constants/quote.d.ts.map +1 -1
  49. package/dist/constants/searchFor.d.ts +7 -0
  50. package/dist/constants/searchFor.d.ts.map +1 -0
  51. package/dist/containers/App/App.d.ts.map +1 -1
  52. package/dist/containers/App/App.styles.d.ts.map +1 -1
  53. package/dist/containers/ExpandedQuotes/ExpandedQuotes.d.ts.map +1 -1
  54. package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts +3 -1
  55. package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -1
  56. package/dist/containers/Inputs/Inputs.d.ts.map +1 -1
  57. package/dist/containers/Inputs/Inputs.types.d.ts +1 -0
  58. package/dist/containers/Inputs/Inputs.types.d.ts.map +1 -1
  59. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  60. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +1 -0
  61. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  62. package/dist/containers/Settings/Lists.d.ts.map +1 -1
  63. package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
  64. package/dist/containers/Wallets/Wallets.types.d.ts +13 -2
  65. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -1
  66. package/dist/containers/Widget/Widget.d.ts.map +1 -1
  67. package/dist/hooks/useBootstrap/index.d.ts +2 -0
  68. package/dist/hooks/useBootstrap/index.d.ts.map +1 -0
  69. package/dist/hooks/useBootstrap/useBootstrap.d.ts +2 -0
  70. package/dist/hooks/useBootstrap/useBootstrap.d.ts.map +1 -0
  71. package/dist/hooks/useScreenDetect.d.ts +9 -0
  72. package/dist/hooks/useScreenDetect.d.ts.map +1 -0
  73. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  74. package/dist/hooks/useTheme.d.ts.map +1 -1
  75. package/dist/hooks/useWalletList.d.ts.map +1 -1
  76. package/dist/index.js +2 -2
  77. package/dist/index.js.map +4 -4
  78. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  79. package/dist/pages/Home.d.ts.map +1 -1
  80. package/dist/pages/LanguagePage.d.ts.map +1 -1
  81. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  82. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  83. package/dist/pages/SettingsPage.d.ts.map +1 -1
  84. package/dist/store/AppStore.d.ts +2 -2
  85. package/dist/store/app.d.ts +2 -2
  86. package/dist/store/slices/config.d.ts.map +1 -1
  87. package/dist/store/slices/data.d.ts +3 -1
  88. package/dist/store/slices/data.d.ts.map +1 -1
  89. package/dist/store/slices/settings.d.ts.map +1 -1
  90. package/dist/types/config.d.ts +9 -5
  91. package/dist/types/config.d.ts.map +1 -1
  92. package/dist/utils/colors.d.ts +5 -3
  93. package/dist/utils/colors.d.ts.map +1 -1
  94. package/dist/utils/common.d.ts +4 -0
  95. package/dist/utils/common.d.ts.map +1 -1
  96. package/dist/utils/configs.d.ts +2 -1
  97. package/dist/utils/configs.d.ts.map +1 -1
  98. package/dist/utils/meta.d.ts +1 -0
  99. package/dist/utils/meta.d.ts.map +1 -1
  100. package/dist/utils/swap.d.ts +2 -0
  101. package/dist/utils/swap.d.ts.map +1 -1
  102. package/dist/utils/ui.d.ts +5 -2
  103. package/dist/utils/ui.d.ts.map +1 -1
  104. package/dist/utils/wallets.d.ts +1 -1
  105. package/dist/utils/wallets.d.ts.map +1 -1
  106. package/package.json +8 -7
  107. package/src/components/AppRouter.tsx +1 -29
  108. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +6 -12
  109. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +7 -11
  110. package/src/components/ConfirmWalletsModal/WalletList.tsx +2 -2
  111. package/src/components/HeaderButtons/HeaderButtons.styles.ts +43 -2
  112. package/src/components/HeaderButtons/HeaderButtons.tsx +2 -0
  113. package/src/components/HeaderButtons/InProgressTransactionBadge.tsx +26 -0
  114. package/src/components/HeaderButtons/RefreshButton.tsx +2 -1
  115. package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +10 -2
  116. package/src/components/HeaderButtons/WalletButton.tsx +26 -6
  117. package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +1 -1
  118. package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +4 -4
  119. package/src/components/NoResult/NoResult.helpers.ts +13 -0
  120. package/src/components/NoResult/NoResult.styles.ts +19 -1
  121. package/src/components/NoResult/NoResult.tsx +27 -16
  122. package/src/components/NoResult/NoResult.types.ts +1 -0
  123. package/src/components/NotificationContent/NotificationContent.styles.ts +14 -1
  124. package/src/components/NotificationContent/NotificationContent.tsx +49 -39
  125. package/src/components/Quote/Quote.styles.ts +13 -14
  126. package/src/components/Quote/Quote.tsx +166 -145
  127. package/src/components/Quote/Quote.types.ts +1 -0
  128. package/src/components/Quote/QuoteTrigger.tsx +19 -14
  129. package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +10 -2
  130. package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +2 -2
  131. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +2 -2
  132. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +5 -4
  133. package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +7 -0
  134. package/src/components/QuoteSkeleton/StepSkeleton.tsx +1 -1
  135. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +1 -1
  136. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +3 -3
  137. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +1 -1
  138. package/src/components/Quotes/Quotes.tsx +33 -21
  139. package/src/components/Quotes/Quotes.types.ts +1 -0
  140. package/src/components/Quotes/SelectStrategy.tsx +27 -10
  141. package/src/components/Slippage/Slippage.tsx +11 -13
  142. package/src/components/SwapDetails/SwapDetails.tsx +3 -1
  143. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +5 -1
  144. package/src/components/TokenList/TokenList.tsx +9 -8
  145. package/src/constants/errors.ts +1 -1
  146. package/src/constants/index.ts +1 -1
  147. package/src/constants/languages.ts +27 -1
  148. package/src/constants/quote.ts +1 -24
  149. package/src/constants/searchFor.ts +6 -0
  150. package/src/containers/App/App.styles.ts +0 -4
  151. package/src/containers/App/App.tsx +4 -28
  152. package/src/containers/ExpandedQuotes/ExpandedQuotes.styles.ts +13 -0
  153. package/src/containers/ExpandedQuotes/ExpandedQuotes.tsx +5 -0
  154. package/src/containers/Inputs/Inputs.tsx +2 -3
  155. package/src/containers/Inputs/Inputs.types.ts +1 -0
  156. package/src/containers/QuoteInfo/QuoteInfo.tsx +2 -0
  157. package/src/containers/QuoteInfo/QuoteInfo.types.ts +1 -0
  158. package/src/containers/Settings/Lists.tsx +28 -13
  159. package/src/containers/Wallets/Wallets.tsx +27 -10
  160. package/src/containers/Wallets/Wallets.types.ts +13 -2
  161. package/src/containers/Widget/Widget.tsx +13 -13
  162. package/src/hooks/useBootstrap/index.ts +1 -0
  163. package/src/hooks/useBootstrap/useBootstrap.ts +72 -0
  164. package/src/hooks/useScreenDetect.ts +49 -0
  165. package/src/hooks/useSwapInput.ts +7 -2
  166. package/src/hooks/useTheme.ts +1 -8
  167. package/src/hooks/useWalletList.ts +12 -0
  168. package/src/pages/ConfirmSwapPage.tsx +14 -5
  169. package/src/pages/Home.tsx +29 -7
  170. package/src/pages/LanguagePage.tsx +14 -1
  171. package/src/pages/LiquiditySourcePage.tsx +4 -3
  172. package/src/pages/SelectSwapItemsPage.tsx +2 -7
  173. package/src/pages/SettingsPage.tsx +0 -1
  174. package/src/store/slices/config.ts +3 -2
  175. package/src/store/slices/data.ts +82 -34
  176. package/src/store/slices/settings.ts +10 -4
  177. package/src/types/config.ts +9 -5
  178. package/src/utils/colors.ts +106 -75
  179. package/src/utils/common.ts +181 -0
  180. package/src/utils/configs.ts +12 -1
  181. package/src/utils/meta.ts +21 -0
  182. package/src/utils/swap.ts +12 -5
  183. package/src/utils/ui.ts +7 -5
  184. package/src/utils/wallets.ts +5 -47
  185. package/dist/hooks/useMobileDetect.d.ts +0 -3
  186. package/dist/hooks/useMobileDetect.d.ts.map +0 -1
  187. package/src/hooks/useMobileDetect.ts +0 -21
@@ -0,0 +1,26 @@
1
+ import type { PendingSwap } from 'rango-types';
2
+
3
+ import { useManager } from '@rango-dev/queue-manager-react';
4
+ import { InProgressIcon } from '@rango-dev/ui';
5
+ import React from 'react';
6
+
7
+ import { getPendingSwaps } from '../../utils/queue';
8
+
9
+ import { InProgressTransactionBadgeContainer } from './HeaderButtons.styles';
10
+
11
+ const InProgressTransactionBadge = () => {
12
+ const { manager } = useManager();
13
+ const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
14
+
15
+ if (!list.find((swap) => swap.status === 'running')) {
16
+ return null;
17
+ }
18
+
19
+ return (
20
+ <InProgressTransactionBadgeContainer>
21
+ <InProgressIcon color="info" size={6} />
22
+ </InProgressTransactionBadgeContainer>
23
+ );
24
+ };
25
+
26
+ export default InProgressTransactionBadge;
@@ -63,13 +63,14 @@ function RefreshButton({ onClick }: { onClick: (() => void) | undefined }) {
63
63
  <HeaderButton
64
64
  variant="ghost"
65
65
  size="small"
66
+ style={{ paddingTop: 0, paddingBottom: 0 }}
66
67
  onClick={handleRefreshClick}
67
68
  disabled={!onClick}>
68
69
  <ProgressIcon
69
70
  onTransitionEnd={() => setIsRefetched(false)}
70
71
  isRefetched={isRefetched}>
71
72
  <RefreshProgressButton
72
- size={24}
73
+ size={22}
73
74
  color={!onClick ? 'gray' : 'black'}
74
75
  progress={(elapsedTime / MAX_ELAPSED_TIME) * MAX_PERCENTAGE}
75
76
  />
@@ -1,3 +1,4 @@
1
+ import { EventSeverity } from '@rango-dev/queue-manager-rango-preset';
1
2
  import { Typography } from '@rango-dev/ui';
2
3
  import React from 'react';
3
4
 
@@ -8,10 +9,17 @@ import { NotificationsBadgeContainer } from './HeaderButtons.styles';
8
9
  export function UnreadNotificationsBadge() {
9
10
  const { getUnreadNotifications } = useNotificationStore();
10
11
 
11
- const notificationsCount = getUnreadNotifications().length;
12
+ const notificationsList = getUnreadNotifications();
13
+
14
+ const notificationsCount = notificationsList.length;
15
+
16
+ const hasSeverNotification = !!notificationsList.find(
17
+ (notificationItem) =>
18
+ notificationItem.event.messageSeverity === EventSeverity.WARNING
19
+ );
12
20
 
13
21
  return notificationsCount ? (
14
- <NotificationsBadgeContainer>
22
+ <NotificationsBadgeContainer isSever={hasSeverNotification}>
15
23
  <Typography variant="body" size="xsmall" color="$background">
16
24
  {notificationsCount}
17
25
  </Typography>
@@ -1,17 +1,37 @@
1
1
  import type { PropTypes } from './HeaderButtons.types';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
- import { Tooltip, WalletIcon } from '@rango-dev/ui';
4
+ import { Image, Tooltip, WalletIcon } from '@rango-dev/ui';
5
5
  import React from 'react';
6
6
 
7
- import { ConnectedIcon, HeaderButton } from './HeaderButtons.styles';
7
+ import { useWalletList } from '../../hooks/useWalletList';
8
+
9
+ import {
10
+ ConnectedIcon,
11
+ HeaderButton,
12
+ rowStyles,
13
+ WalletImageContainer,
14
+ } from './HeaderButtons.styles';
8
15
 
9
16
  function WalletButton(props: PropTypes) {
17
+ const { list } = useWalletList({});
18
+ const connectedWallets = list.filter(
19
+ (wallet) => wallet.state === 'connected'
20
+ );
21
+ const content = !connectedWallets.length ? (
22
+ i18n.t('Connect Wallet')
23
+ ) : (
24
+ <div className={rowStyles()}>
25
+ {connectedWallets.map((wallet) => (
26
+ <WalletImageContainer key={wallet.title}>
27
+ <Image src={wallet.image} size={14} />
28
+ </WalletImageContainer>
29
+ ))}
30
+ </div>
31
+ );
32
+
10
33
  return (
11
- <Tooltip
12
- container={props.container}
13
- side="top"
14
- content={i18n.t('Connect Wallet')}>
34
+ <Tooltip container={props.container} side="bottom" content={content}>
15
35
  <HeaderButton variant="ghost" size="small" onClick={props.onClick}>
16
36
  {props.isConnected && <ConnectedIcon />}
17
37
  <WalletIcon size={18} color="black" />
@@ -1,5 +1,5 @@
1
1
  import { ListItem, styled } from '@rango-dev/ui';
2
2
 
3
- export const CustomeListItem = styled(ListItem, {
3
+ export const CustomListItem = styled(ListItem, {
4
4
  height: 61,
5
5
  });
@@ -3,16 +3,16 @@ import React from 'react';
3
3
 
4
4
  import { LiquiditySourceList } from '../SettingsContainer';
5
5
 
6
- import { CustomeListItem } from './LoadingLiquiditySourceList.styles';
6
+ import { CustomListItem } from './LoadingLiquiditySourceList.styles';
7
7
 
8
8
  const ITEM_SKELETON_COUNT = 30;
9
9
  export function LoadingLiquiditySourceList() {
10
10
  return (
11
11
  <LiquiditySourceList>
12
- {Array.from(Array(ITEM_SKELETON_COUNT), (e) => (
13
- <CustomeListItem
12
+ {Array.from(Array(ITEM_SKELETON_COUNT), (_, index) => (
13
+ <CustomListItem
14
14
  hasDivider
15
- key={e}
15
+ key={index}
16
16
  start={<Skeleton variant="circular" width={35} height={35} />}
17
17
  title={<Skeleton variant="text" size="large" width={90} />}
18
18
  end={<Checkbox checked={false} />}
@@ -9,6 +9,9 @@ import {
9
9
  type QuoteRequestFailed,
10
10
  } from '../../types';
11
11
 
12
+ const SMALL_NO_ROUTE__ICON_SIZE = 24;
13
+ const LARGE_NO_ROUTE_ICON_SIZE = 60;
14
+
12
15
  export function makeInfo(
13
16
  error: NoResultError | QuoteRequestFailed | null,
14
17
  disabledLiquiditySources: string[],
@@ -57,3 +60,13 @@ export function makeInfo(
57
60
  description: errorMessages().noResultError.description,
58
61
  };
59
62
  }
63
+
64
+ export enum NoRouteIconSize {
65
+ small = SMALL_NO_ROUTE__ICON_SIZE,
66
+ large = LARGE_NO_ROUTE_ICON_SIZE,
67
+ }
68
+
69
+ export enum NoRouteTitleSize {
70
+ small = 'small',
71
+ large = 'medium',
72
+ }
@@ -6,8 +6,26 @@ export const Container = styled('div', {
6
6
  alignItems: 'center',
7
7
  });
8
8
 
9
+ export const ErrorDescription = styled('div', {
10
+ variants: {
11
+ size: {
12
+ small: {},
13
+ large: {
14
+ maxWidth: '316px',
15
+ },
16
+ },
17
+ },
18
+ });
19
+
9
20
  export const Footer = styled('div', {
10
- width: '100%',
21
+ variants: {
22
+ size: {
23
+ small: {
24
+ width: '100%',
25
+ },
26
+ large: {},
27
+ },
28
+ },
11
29
  });
12
30
 
13
31
  export const PrefixIcon = styled('div', {
@@ -13,16 +13,24 @@ import React from 'react';
13
13
  import { errorMessages } from '../../constants/errors';
14
14
  import { useAppStore } from '../../store/AppStore';
15
15
 
16
- import { makeInfo } from './NoResult.helpers';
17
- import { Container, Footer, PrefixIcon } from './NoResult.styles';
16
+ import {
17
+ makeInfo,
18
+ NoRouteIconSize,
19
+ NoRouteTitleSize,
20
+ } from './NoResult.helpers';
21
+ import {
22
+ Container,
23
+ ErrorDescription,
24
+ Footer,
25
+ PrefixIcon,
26
+ } from './NoResult.styles';
18
27
 
19
28
  export function NoResult(props: PropTypes) {
20
- const { fetch, error } = props;
29
+ const { fetch, error, size = 'small' } = props;
21
30
  const disabledLiquiditySources = useAppStore().getDisabledLiquiditySources();
22
31
  const toggleAllLiquiditySources = useAppStore().toggleAllLiquiditySources;
23
32
 
24
33
  const swappers = useAppStore().swappers();
25
-
26
34
  const info = makeInfo(
27
35
  error,
28
36
  disabledLiquiditySources,
@@ -32,27 +40,30 @@ export function NoResult(props: PropTypes) {
32
40
 
33
41
  return (
34
42
  <Container>
35
- <NoRouteIcon size={24} color="gray" />
43
+ <NoRouteIcon size={NoRouteIconSize[size]} color="gray" />
36
44
  <Divider size={4} />
37
- <Typography variant="title" size="small">
45
+ <Typography variant="title" size={NoRouteTitleSize[size]}>
38
46
  {errorMessages().noResultError.title}
39
47
  </Typography>
48
+ {size === 'large' && <Divider size={4} />}
40
49
  {!!info.description && (
41
- <Typography
42
- variant="body"
43
- size="small"
44
- align="center"
45
- color="neutral700">
46
- {info.description}
47
- </Typography>
50
+ <ErrorDescription size={size}>
51
+ <Typography
52
+ variant="body"
53
+ size="small"
54
+ align="center"
55
+ color="neutral700">
56
+ {info.description}
57
+ </Typography>
58
+ </ErrorDescription>
48
59
  )}
49
- <Divider size={4} />
60
+ <Divider size={size === 'large' ? '24' : '4'} />
50
61
  {!!info.alert && (
51
- <Footer>
62
+ <Footer size={size}>
52
63
  <Alert
53
64
  type={info.alert.type}
54
65
  title={info.alert.text}
55
- titleAlign={'center'}
66
+ titleAlign={'left'}
56
67
  action={
57
68
  info.alert.action && (
58
69
  <Button
@@ -3,6 +3,7 @@ import type { NoResultError, QuoteRequestFailed } from '../../types';
3
3
  export interface PropTypes {
4
4
  fetch: () => void;
5
5
  error: NoResultError | QuoteRequestFailed | null;
6
+ size?: 'small' | 'large';
6
7
  }
7
8
 
8
9
  type AlertAction = {
@@ -1,4 +1,4 @@
1
- import { styled } from '@rango-dev/ui';
1
+ import { darkTheme, ListItemButton, styled } from '@rango-dev/ui';
2
2
 
3
3
  export const Container = styled('div', {
4
4
  padding: '$10',
@@ -17,6 +17,19 @@ export const List = styled('ul', {
17
17
  },
18
18
  });
19
19
 
20
+ export const ListItem = styled(ListItemButton, {
21
+ variants: {
22
+ actionRequired: {
23
+ true: {
24
+ backgroundColor: '$error300',
25
+ [`.${darkTheme} &`]: {
26
+ backgroundColor: '$error600',
27
+ },
28
+ },
29
+ },
30
+ },
31
+ });
32
+
20
33
  export const Images = styled('div', {
21
34
  display: 'flex',
22
35
  padding: 0,
@@ -5,7 +5,7 @@ import { EventSeverity } from '@rango-dev/queue-manager-rango-preset';
5
5
  import {
6
6
  ChainToken,
7
7
  ChevronRightIcon,
8
- ListItemButton,
8
+ Divider,
9
9
  Typography,
10
10
  } from '@rango-dev/ui';
11
11
  import React from 'react';
@@ -16,7 +16,12 @@ import { useAppStore } from '../../store/AppStore';
16
16
  import { useNotificationStore } from '../../store/notification';
17
17
  import { areTokensEqual } from '../../utils/wallets';
18
18
 
19
- import { Container, Images, List } from './NotificationContent.styles';
19
+ import {
20
+ Container,
21
+ Images,
22
+ List,
23
+ ListItem,
24
+ } from './NotificationContent.styles';
20
25
  import { NotificationNotFound } from './NotificationNotFound';
21
26
 
22
27
  const MAX_NOTIFICATIONS_DISPLAYED = 4;
@@ -41,7 +46,7 @@ export function NotificationContent() {
41
46
  <Container>
42
47
  {sortedNotification.length ? (
43
48
  <List>
44
- {sortedNotification.map((notificationItem) => {
49
+ {sortedNotification.map((notificationItem, index) => {
45
50
  const { route, requestId, event } = notificationItem;
46
51
  const fromToken = tokens.find((tokenItem) =>
47
52
  areTokensEqual(tokenItem, route.from)
@@ -60,42 +65,47 @@ export function NotificationContent() {
60
65
  );
61
66
 
62
67
  return (
63
- <ListItemButton
64
- key={requestId}
65
- onClick={() => handleOnClick(requestId)}
66
- title={
67
- <Typography
68
- variant="body"
69
- size="small"
70
- color={
71
- event.messageSeverity === EventSeverity.WARNING
72
- ? '$foreground'
73
- : '$neutral700'
74
- }>
75
- {i18n.t(event.message)}
76
- </Typography>
77
- }
78
- id={requestId}
79
- start={
80
- <Images>
81
- <div className="from-chain-token">
82
- <ChainToken
83
- tokenImage={fromToken ? fromToken.image : ''}
84
- chainImage={fromBlockchain ? fromBlockchain.logo : ''}
85
- size="small"
86
- />
87
- </div>
88
- <div className="to-chain-token">
89
- <ChainToken
90
- tokenImage={toToken ? toToken.image : ''}
91
- chainImage={toBlockchain ? toBlockchain.logo : ''}
92
- size="small"
93
- />
94
- </div>
95
- </Images>
96
- }
97
- end={<ChevronRightIcon size={12} color="gray" />}
98
- />
68
+ <React.Fragment key={requestId}>
69
+ {index > 0 && <Divider size={4} />}
70
+ <ListItem
71
+ onClick={() => handleOnClick(requestId)}
72
+ actionRequired={
73
+ event.messageSeverity === EventSeverity.WARNING
74
+ }
75
+ title={
76
+ <Typography
77
+ variant="body"
78
+ size="small"
79
+ color={
80
+ event.messageSeverity === EventSeverity.WARNING
81
+ ? '$foreground'
82
+ : '$neutral700'
83
+ }>
84
+ {i18n.t(event.message)}
85
+ </Typography>
86
+ }
87
+ id={requestId}
88
+ start={
89
+ <Images>
90
+ <div className="from-chain-token">
91
+ <ChainToken
92
+ tokenImage={fromToken ? fromToken.image : ''}
93
+ chainImage={fromBlockchain ? fromBlockchain.logo : ''}
94
+ size="small"
95
+ />
96
+ </div>
97
+ <div className="to-chain-token">
98
+ <ChainToken
99
+ tokenImage={toToken ? toToken.image : ''}
100
+ chainImage={toBlockchain ? toBlockchain.logo : ''}
101
+ size="small"
102
+ />
103
+ </div>
104
+ </Images>
105
+ }
106
+ end={<ChevronRightIcon size={12} color="gray" />}
107
+ />
108
+ </React.Fragment>
99
109
  );
100
110
  })}
101
111
  </List>
@@ -55,19 +55,6 @@ export const QuoteContainer = styled(Collapsible.Root, {
55
55
  backgroundColor: '$$color',
56
56
  },
57
57
  },
58
- {
59
- listItem: true,
60
- selected: false,
61
- css: {
62
- cursor: 'pointer',
63
- '&:hover': {
64
- backgroundColor: '$neutral300',
65
- [`.${darkTheme} &`]: {
66
- backgroundColor: '$neutral400',
67
- },
68
- },
69
- },
70
- },
71
58
  ],
72
59
  });
73
60
 
@@ -107,6 +94,18 @@ export const SummaryContainer = styled('div', {
107
94
  },
108
95
  backgroundColor: '$$color',
109
96
  '&:hover': {
97
+ '& .quote_container': {
98
+ '& button': {
99
+ backgroundColor: '$neutral500',
100
+ [`.${darkTheme} &`]: {
101
+ backgroundColor: '$neutral200',
102
+ },
103
+ },
104
+ backgroundColor: '$neutral500',
105
+ [`.${darkTheme} &`]: {
106
+ backgroundColor: '$neutral200',
107
+ },
108
+ },
110
109
  backgroundColor: '$neutral300',
111
110
  [`.${darkTheme} &`]: {
112
111
  backgroundColor: '$neutral400',
@@ -376,6 +375,6 @@ export const Line = styled('div', {
376
375
  borderTopColor: '$neutral',
377
376
  margin: '$5 0',
378
377
  [`.${darkTheme} &`]: {
379
- borderTopColor: '$neutral400',
378
+ borderTopColor: '$neutral800',
380
379
  },
381
380
  });