@rango-dev/widget-embedded 0.22.4-next.6 → 0.22.4-next.7
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.
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +3 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +2 -2
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +15 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +3 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
- package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +4 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.d.ts +4 -0
- package/dist/components/HeaderButtons/HeaderButtons.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +5 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +3 -2
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
- package/dist/components/HeaderButtons/index.d.ts +1 -1
- package/dist/components/HeaderButtons/index.d.ts.map +1 -1
- package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts +6 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts +3 -0
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +1 -0
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/Layout/PageContainer.d.ts +1 -0
- package/dist/components/Layout/PageContainer.d.ts.map +1 -1
- package/dist/components/Layout/ScrollableArea.d.ts +1 -0
- package/dist/components/Layout/ScrollableArea.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +14 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.styles.d.ts +3 -0
- package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +4 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +1136 -25
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +12 -7
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts +5 -0
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +2 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
- package/dist/components/Quote/QuoteTrigger .d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +4 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +20 -10
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +1 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +5 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts +1 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +3 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +5 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +13 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/index.d.ts +1 -1
- package/dist/components/SwapDetailsModal/index.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +17 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +4 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
- package/dist/constants/navigationRoutes.d.ts +1 -0
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/quote.d.ts +5 -1
- package/dist/constants/quote.d.ts.map +1 -1
- package/dist/containers/App/App.styles.d.ts +1 -0
- package/dist/containers/App/App.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +3 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +6 -3
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +5 -4
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
- package/dist/hooks/useFetch.d.ts +12 -0
- package/dist/hooks/useFetch.d.ts.map +1 -0
- package/dist/hooks/useFetchAllQuotes.d.ts +4 -0
- package/dist/hooks/useFetchAllQuotes.d.ts.map +1 -0
- package/dist/hooks/useFetchConfirmQuote.d.ts +4 -0
- package/dist/hooks/useFetchConfirmQuote.d.ts.map +1 -0
- package/dist/hooks/useSwapInput.d.ts +5 -5
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/Routes.d.ts +3 -0
- package/dist/pages/Routes.d.ts.map +1 -0
- package/dist/store/quote.d.ts +32 -10
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +0 -2
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/quote.d.ts +19 -1
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/utils/quote.d.ts +12 -9
- package/dist/utils/quote.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +18 -18
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +3 -3
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AppRoutes.tsx +5 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +3 -3
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +21 -18
- package/src/components/HeaderButtons/{HomeButtons.tsx → HeaderButtons.tsx} +39 -26
- package/src/components/HeaderButtons/HeaderButtons.types.ts +3 -2
- package/src/components/HeaderButtons/index.ts +1 -1
- package/src/components/Layout/Layout.tsx +13 -1
- package/src/components/Layout/Layout.types.ts +1 -0
- package/src/components/Quote/Quote.styles.ts +133 -38
- package/src/components/Quote/Quote.tsx +68 -13
- package/src/components/Quote/Quote.types.ts +13 -7
- package/src/components/Quote/QuoteCostDetails.tsx +9 -4
- package/src/components/Quote/QuoteTrigger .tsx +7 -3
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +2 -2
- package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +1 -1
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +10 -12
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +28 -9
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +1 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +19 -19
- package/src/components/SwapDetails/SwapDetails.tsx +1 -1
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +1 -1
- package/src/components/SwapDetailsModal/index.ts +1 -1
- package/src/constants/navigationRoutes.ts +1 -0
- package/src/constants/quote.ts +17 -1
- package/src/containers/QuoteInfo/QuoteInfo.tsx +32 -7
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +6 -3
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +36 -20
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +76 -78
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
- package/src/hooks/useFetch.ts +48 -0
- package/src/hooks/useFetchAllQuotes.ts +21 -0
- package/src/hooks/useFetchConfirmQuote.ts +21 -0
- package/src/hooks/useSwapInput.ts +59 -31
- package/src/pages/ConfirmSwapPage.tsx +12 -9
- package/src/pages/Home.tsx +25 -15
- package/src/pages/Routes.tsx +131 -0
- package/src/store/quote.ts +60 -22
- package/src/store/wallets.ts +0 -2
- package/src/types/quote.ts +27 -1
- package/src/utils/quote.ts +129 -67
- package/src/utils/swap.ts +37 -77
- package/src/utils/wallets.ts +10 -9
- package/dist/components/HeaderButtons/HomeButtons.d.ts +0 -4
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +0 -1
- package/dist/hooks/useFetchQuote.d.ts +0 -9
- package/dist/hooks/useFetchQuote.d.ts.map +0 -1
- package/src/hooks/useFetchQuote.ts +0 -38
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HeaderButtonsPropTypes } from './HeaderButtons.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
4
|
import {
|
|
@@ -19,23 +19,32 @@ import { HeaderButton } from './HeaderButtons.styles';
|
|
|
19
19
|
import { RefreshButton } from './RefreshButton';
|
|
20
20
|
import { UnreadNotificationsBadge } from './UnreadNotificationsBadge';
|
|
21
21
|
|
|
22
|
-
export function
|
|
23
|
-
const {
|
|
22
|
+
export function HeaderButtons(props: HeaderButtonsPropTypes) {
|
|
23
|
+
const {
|
|
24
|
+
onClickRefresh,
|
|
25
|
+
onClickHistory,
|
|
26
|
+
onClickSettings,
|
|
27
|
+
hidden = [],
|
|
28
|
+
} = props;
|
|
24
29
|
|
|
25
30
|
const {
|
|
26
31
|
config: { features },
|
|
27
32
|
} = useAppStore();
|
|
28
33
|
|
|
29
|
-
const isNotificationsHidden =
|
|
34
|
+
const isNotificationsHidden =
|
|
35
|
+
isFeatureHidden('notification', features) ||
|
|
36
|
+
hidden.includes('notifications');
|
|
30
37
|
|
|
31
38
|
return (
|
|
32
39
|
<>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
{!hidden.includes('refresh') && (
|
|
41
|
+
<Tooltip
|
|
42
|
+
container={getContainer()}
|
|
43
|
+
side="top"
|
|
44
|
+
content={i18n.t('Refresh')}>
|
|
45
|
+
<RefreshButton onClick={onClickRefresh} />
|
|
46
|
+
</Tooltip>
|
|
47
|
+
)}
|
|
39
48
|
|
|
40
49
|
{!isNotificationsHidden && (
|
|
41
50
|
<Popover
|
|
@@ -57,22 +66,26 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
|
|
|
57
66
|
</div>
|
|
58
67
|
</Popover>
|
|
59
68
|
)}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
{!hidden.includes('settings') && (
|
|
70
|
+
<Tooltip
|
|
71
|
+
container={getContainer()}
|
|
72
|
+
side="top"
|
|
73
|
+
content={i18n.t('Settings')}>
|
|
74
|
+
<HeaderButton size="small" variant="ghost" onClick={onClickSettings}>
|
|
75
|
+
<SettingsIcon size={18} color="black" />
|
|
76
|
+
</HeaderButton>
|
|
77
|
+
</Tooltip>
|
|
78
|
+
)}
|
|
79
|
+
{!hidden.includes('history') && (
|
|
80
|
+
<Tooltip
|
|
81
|
+
container={getContainer()}
|
|
82
|
+
side="top"
|
|
83
|
+
content={i18n.t('Transactions History')}>
|
|
84
|
+
<HeaderButton size="small" variant="ghost" onClick={onClickHistory}>
|
|
85
|
+
<TransactionIcon size={18} color="black" />
|
|
86
|
+
</HeaderButton>
|
|
87
|
+
</Tooltip>
|
|
88
|
+
)}
|
|
76
89
|
</>
|
|
77
90
|
);
|
|
78
91
|
}
|
|
@@ -3,8 +3,9 @@ export interface PropTypes {
|
|
|
3
3
|
isConnected?: boolean;
|
|
4
4
|
container?: HTMLElement;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface HeaderButtonsPropTypes {
|
|
7
|
+
onClickSettings?: () => void;
|
|
7
8
|
onClickRefresh?: () => void;
|
|
8
9
|
onClickHistory?: () => void;
|
|
9
|
-
|
|
10
|
+
hidden?: ('settings' | 'refresh' | 'history' | 'notifications')[];
|
|
10
11
|
}
|
|
@@ -101,7 +101,19 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
101
101
|
className={activeTheme()}
|
|
102
102
|
ref={containerRef}>
|
|
103
103
|
<Header
|
|
104
|
-
prefix={
|
|
104
|
+
prefix={
|
|
105
|
+
<>
|
|
106
|
+
{showBackButton && (
|
|
107
|
+
<BackButton
|
|
108
|
+
onClick={() => {
|
|
109
|
+
navigateBack();
|
|
110
|
+
// As an example, used in routes page to add a custom logic when navigating back to the home page.
|
|
111
|
+
header.onBack && header.onBack();
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
</>
|
|
116
|
+
}
|
|
105
117
|
title={header.title}
|
|
106
118
|
suffix={
|
|
107
119
|
<>
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
css,
|
|
5
|
+
darkTheme,
|
|
6
|
+
Image,
|
|
7
|
+
styled,
|
|
8
|
+
Typography,
|
|
9
|
+
} from '@rango-dev/ui';
|
|
3
10
|
|
|
4
11
|
import { CollapsibleContent } from '../CustomCollapsible/CustomCollapsible.styles';
|
|
5
12
|
|
|
@@ -13,31 +20,64 @@ export const QuoteContainer = styled(Collapsible.Root, {
|
|
|
13
20
|
overflowY: 'hidden',
|
|
14
21
|
width: '100%',
|
|
15
22
|
borderRadius: '$xm',
|
|
16
|
-
cursor: 'default',
|
|
17
23
|
variants: {
|
|
18
|
-
|
|
19
|
-
true: {
|
|
20
|
-
|
|
24
|
+
selected: {
|
|
25
|
+
true: {},
|
|
26
|
+
false: {
|
|
27
|
+
$$color: '$colors$neutral400',
|
|
21
28
|
[`.${darkTheme} &`]: {
|
|
22
|
-
$$color: '$colors$
|
|
29
|
+
$$color: '$colors$neutral200',
|
|
23
30
|
},
|
|
24
31
|
backgroundColor: '$$color',
|
|
25
32
|
},
|
|
26
|
-
|
|
33
|
+
},
|
|
34
|
+
listItem: {
|
|
35
|
+
true: {
|
|
27
36
|
$$color: '$colors$neutral400',
|
|
28
37
|
[`.${darkTheme} &`]: {
|
|
29
38
|
$$color: '$colors$neutral200',
|
|
30
39
|
},
|
|
31
40
|
backgroundColor: '$$color',
|
|
32
41
|
},
|
|
42
|
+
false: {},
|
|
33
43
|
},
|
|
34
44
|
},
|
|
45
|
+
|
|
46
|
+
compoundVariants: [
|
|
47
|
+
{
|
|
48
|
+
listItem: false,
|
|
49
|
+
selected: true,
|
|
50
|
+
css: {
|
|
51
|
+
$$color: '$colors$info300',
|
|
52
|
+
[`.${darkTheme} &`]: {
|
|
53
|
+
$$color: '$colors$secondary800',
|
|
54
|
+
},
|
|
55
|
+
backgroundColor: '$$color',
|
|
56
|
+
},
|
|
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
|
+
],
|
|
35
72
|
});
|
|
36
73
|
|
|
37
74
|
export const stepsDetailsStyles = css({
|
|
38
75
|
padding: '$10 $15',
|
|
39
76
|
});
|
|
40
|
-
|
|
77
|
+
export const AllRoutesButton = styled(Button, {
|
|
78
|
+
backgroundColor: 'transparent',
|
|
79
|
+
border: '1px solid $secondary',
|
|
80
|
+
});
|
|
41
81
|
export const SummaryContainer = styled('div', {
|
|
42
82
|
borderRadius: '$xm',
|
|
43
83
|
display: 'flex',
|
|
@@ -45,35 +85,35 @@ export const SummaryContainer = styled('div', {
|
|
|
45
85
|
alignItems: 'start',
|
|
46
86
|
justifyContent: 'space-between',
|
|
47
87
|
color: '$foreground',
|
|
48
|
-
cursor: 'pointer',
|
|
49
88
|
boxSizing: 'border-box',
|
|
50
89
|
position: 'relative',
|
|
51
90
|
variants: {
|
|
52
|
-
|
|
53
|
-
true: {
|
|
54
|
-
|
|
91
|
+
selected: {
|
|
92
|
+
true: {},
|
|
93
|
+
false: {
|
|
94
|
+
$$color: '$colors$neutral200',
|
|
55
95
|
[`.${darkTheme} &`]: {
|
|
56
|
-
$$color: '$colors$
|
|
96
|
+
$$color: '$colors$neutral500',
|
|
57
97
|
},
|
|
58
98
|
backgroundColor: '$$color',
|
|
59
|
-
'&:hover': {
|
|
60
|
-
backgroundColor: '$$color',
|
|
61
|
-
},
|
|
62
99
|
},
|
|
63
|
-
|
|
100
|
+
},
|
|
101
|
+
basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
|
|
102
|
+
listItem: {
|
|
103
|
+
true: {
|
|
64
104
|
$$color: '$colors$neutral200',
|
|
65
105
|
[`.${darkTheme} &`]: {
|
|
66
106
|
$$color: '$colors$neutral500',
|
|
67
107
|
},
|
|
68
108
|
backgroundColor: '$$color',
|
|
69
109
|
'&:hover': {
|
|
70
|
-
backgroundColor: '
|
|
110
|
+
backgroundColor: '$neutral300',
|
|
111
|
+
[`.${darkTheme} &`]: {
|
|
112
|
+
backgroundColor: '$neutral400',
|
|
113
|
+
},
|
|
71
114
|
},
|
|
115
|
+
cursor: 'pointer',
|
|
72
116
|
},
|
|
73
|
-
},
|
|
74
|
-
basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
|
|
75
|
-
listItem: {
|
|
76
|
-
true: {},
|
|
77
117
|
false: {},
|
|
78
118
|
},
|
|
79
119
|
},
|
|
@@ -81,27 +121,35 @@ export const SummaryContainer = styled('div', {
|
|
|
81
121
|
compoundVariants: [
|
|
82
122
|
{
|
|
83
123
|
listItem: true,
|
|
84
|
-
|
|
124
|
+
selected: true,
|
|
125
|
+
css: {
|
|
126
|
+
border: '1px solid $secondary',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
listItem: false,
|
|
131
|
+
selected: true,
|
|
85
132
|
css: {
|
|
133
|
+
$$color: '$colors$info100',
|
|
134
|
+
[`.${darkTheme} &`]: {
|
|
135
|
+
$$color: '$colors$secondary600',
|
|
136
|
+
},
|
|
137
|
+
backgroundColor: '$$color',
|
|
86
138
|
'&:hover': {
|
|
87
|
-
$$color: '$colors$secondary200',
|
|
88
|
-
[`.${darkTheme} &`]: {
|
|
89
|
-
$$color: '$colors$secondary700',
|
|
90
|
-
},
|
|
91
139
|
backgroundColor: '$$color',
|
|
92
140
|
},
|
|
93
141
|
},
|
|
94
142
|
},
|
|
95
143
|
{
|
|
96
144
|
listItem: true,
|
|
97
|
-
|
|
145
|
+
selected: false,
|
|
98
146
|
css: {
|
|
147
|
+
cursor: 'pointer',
|
|
99
148
|
'&:hover': {
|
|
100
|
-
|
|
149
|
+
backgroundColor: '$neutral300',
|
|
101
150
|
[`.${darkTheme} &`]: {
|
|
102
|
-
|
|
151
|
+
backgroundColor: '$neutral400',
|
|
103
152
|
},
|
|
104
|
-
backgroundColor: '$$color',
|
|
105
153
|
},
|
|
106
154
|
},
|
|
107
155
|
},
|
|
@@ -111,7 +159,15 @@ export const SummaryContainer = styled('div', {
|
|
|
111
159
|
export const summaryStyles = css({
|
|
112
160
|
width: '100%',
|
|
113
161
|
padding: '$15 $15 $10 $15',
|
|
114
|
-
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const summaryHeaderStyles = css({
|
|
165
|
+
display: 'flex',
|
|
166
|
+
flexDirection: 'row',
|
|
167
|
+
justifyContent: 'space-between',
|
|
168
|
+
alignItems: 'center',
|
|
169
|
+
paddingBottom: '$10',
|
|
170
|
+
position: 'relative',
|
|
115
171
|
});
|
|
116
172
|
|
|
117
173
|
export const rowStyles = css({
|
|
@@ -124,7 +180,6 @@ export const rowStyles = css({
|
|
|
124
180
|
},
|
|
125
181
|
});
|
|
126
182
|
export const basicInfoStyles = css({
|
|
127
|
-
paddingTop: '$10',
|
|
128
183
|
display: 'flex',
|
|
129
184
|
alignItems: 'center',
|
|
130
185
|
'.usd-value': {
|
|
@@ -163,23 +218,41 @@ export const Trigger = styled(Collapsible.Trigger, {
|
|
|
163
218
|
},
|
|
164
219
|
},
|
|
165
220
|
},
|
|
166
|
-
|
|
167
|
-
true: {
|
|
168
|
-
|
|
221
|
+
selected: {
|
|
222
|
+
true: {},
|
|
223
|
+
false: {
|
|
224
|
+
$$color: '$colors$neutral400',
|
|
169
225
|
[`.${darkTheme} &`]: {
|
|
170
|
-
$$color: '$colors$
|
|
226
|
+
$$color: '$colors$neutral200',
|
|
171
227
|
},
|
|
172
228
|
backgroundColor: '$$color',
|
|
173
229
|
},
|
|
174
|
-
|
|
230
|
+
},
|
|
231
|
+
listItem: {
|
|
232
|
+
true: {
|
|
175
233
|
$$color: '$colors$neutral400',
|
|
176
234
|
[`.${darkTheme} &`]: {
|
|
177
235
|
$$color: '$colors$neutral200',
|
|
178
236
|
},
|
|
179
237
|
backgroundColor: '$$color',
|
|
180
238
|
},
|
|
239
|
+
false: {},
|
|
181
240
|
},
|
|
182
241
|
},
|
|
242
|
+
|
|
243
|
+
compoundVariants: [
|
|
244
|
+
{
|
|
245
|
+
listItem: false,
|
|
246
|
+
selected: true,
|
|
247
|
+
css: {
|
|
248
|
+
$$color: '$colors$info300',
|
|
249
|
+
[`.${darkTheme} &`]: {
|
|
250
|
+
$$color: '$colors$secondary800',
|
|
251
|
+
},
|
|
252
|
+
backgroundColor: '$$color',
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
],
|
|
183
256
|
'.blockchains_section': {
|
|
184
257
|
display: 'none',
|
|
185
258
|
},
|
|
@@ -291,3 +364,25 @@ export const MoreStep = styled('div', {
|
|
|
291
364
|
},
|
|
292
365
|
},
|
|
293
366
|
});
|
|
367
|
+
|
|
368
|
+
export const Tag = styled('div', {
|
|
369
|
+
backgroundColor: '$neutral400',
|
|
370
|
+
borderRadius: '$xs',
|
|
371
|
+
padding: '$2 $5',
|
|
372
|
+
fontSize: '$10',
|
|
373
|
+
fontWeight: 400,
|
|
374
|
+
});
|
|
375
|
+
export const TagContainer = styled('div', {
|
|
376
|
+
display: 'flex',
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
export const Line = styled('div', {
|
|
380
|
+
width: '100%',
|
|
381
|
+
borderTopWidth: '1px',
|
|
382
|
+
borderTopStyle: 'solid',
|
|
383
|
+
borderTopColor: '$neutral',
|
|
384
|
+
margin: '$5 0',
|
|
385
|
+
[`.${darkTheme} &`]: {
|
|
386
|
+
borderTopColor: '$neutral400',
|
|
387
|
+
},
|
|
388
|
+
});
|
|
@@ -35,19 +35,29 @@ import {
|
|
|
35
35
|
getSwapperDisplayName,
|
|
36
36
|
} from '../../utils/meta';
|
|
37
37
|
import { formatTooltipNumbers, numberToString } from '../../utils/numbers';
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
getPriceImpact,
|
|
40
|
+
getPriceImpactLevel,
|
|
41
|
+
getRouteTagColor,
|
|
42
|
+
sortTags,
|
|
43
|
+
} from '../../utils/quote';
|
|
39
44
|
|
|
40
45
|
import {
|
|
46
|
+
AllRoutesButton,
|
|
41
47
|
BasicInfoOutput,
|
|
42
48
|
basicInfoStyles,
|
|
43
49
|
ContainerInfoOutput,
|
|
44
50
|
Content,
|
|
45
51
|
FrameIcon,
|
|
46
52
|
HorizontalSeparator,
|
|
53
|
+
Line,
|
|
47
54
|
QuoteContainer,
|
|
48
55
|
stepsDetailsStyles,
|
|
49
56
|
SummaryContainer,
|
|
57
|
+
summaryHeaderStyles,
|
|
50
58
|
summaryStyles,
|
|
59
|
+
Tag,
|
|
60
|
+
TagContainer,
|
|
51
61
|
} from './Quote.styles';
|
|
52
62
|
import { QuoteCostDetails } from './QuoteCostDetails';
|
|
53
63
|
import { QuoteSummary } from './QuoteSummary';
|
|
@@ -61,11 +71,12 @@ export function Quote(props: QuoteProps) {
|
|
|
61
71
|
error,
|
|
62
72
|
warning,
|
|
63
73
|
type,
|
|
64
|
-
|
|
74
|
+
selected = false,
|
|
75
|
+
tagHidden = true,
|
|
76
|
+
onClickAllRoutes,
|
|
65
77
|
} = props;
|
|
66
78
|
const blockchains = useAppStore().blockchains();
|
|
67
79
|
const swappers = useAppStore().swappers();
|
|
68
|
-
|
|
69
80
|
const [expanded, setExpanded] = useState(props.expanded);
|
|
70
81
|
const quoteRef = useRef<HTMLButtonElement | null>(null);
|
|
71
82
|
const roundedInput = numberToString(
|
|
@@ -184,6 +195,7 @@ export function Quote(props: QuoteProps) {
|
|
|
184
195
|
stepHasError || stepHasWarning ? (
|
|
185
196
|
<FooterStepAlarm>
|
|
186
197
|
<Alert
|
|
198
|
+
variant="alarm"
|
|
187
199
|
type={stepHasError ? 'error' : 'warning'}
|
|
188
200
|
title={
|
|
189
201
|
error?.type === QuoteErrorType.BRIDGE_LIMIT
|
|
@@ -258,18 +270,59 @@ export function Quote(props: QuoteProps) {
|
|
|
258
270
|
};
|
|
259
271
|
});
|
|
260
272
|
};
|
|
261
|
-
const steps = getQuoteSteps(quote
|
|
273
|
+
const steps = getQuoteSteps(quote?.swaps ?? []);
|
|
274
|
+
|
|
262
275
|
const numberOfSteps = steps.length;
|
|
263
|
-
const
|
|
276
|
+
const container = getContainer();
|
|
277
|
+
const sortedQuoteTags = sortTags(props.quote.tags || []);
|
|
278
|
+
const showAllRoutesButton = !!onClickAllRoutes;
|
|
264
279
|
|
|
265
280
|
return (
|
|
266
281
|
<>
|
|
267
282
|
<SummaryContainer
|
|
268
|
-
|
|
283
|
+
selected={selected}
|
|
269
284
|
listItem={type === 'list-item'}
|
|
270
285
|
basic={type === 'basic'}>
|
|
271
286
|
<div className={summaryStyles()}>
|
|
272
|
-
|
|
287
|
+
{!tagHidden && sortedQuoteTags.length ? (
|
|
288
|
+
<>
|
|
289
|
+
<TagContainer>
|
|
290
|
+
{sortedQuoteTags.map((tag, index) => {
|
|
291
|
+
const key = `${tag.value}_${index}`;
|
|
292
|
+
return (
|
|
293
|
+
<>
|
|
294
|
+
<Tag
|
|
295
|
+
style={{ color: getRouteTagColor(tag.value) }}
|
|
296
|
+
key={key}>
|
|
297
|
+
{tag.label}
|
|
298
|
+
</Tag>
|
|
299
|
+
<Divider size={4} direction="horizontal" />
|
|
300
|
+
</>
|
|
301
|
+
);
|
|
302
|
+
})}
|
|
303
|
+
</TagContainer>
|
|
304
|
+
<Line />
|
|
305
|
+
{!showAllRoutesButton && <Divider size={4} />}
|
|
306
|
+
</>
|
|
307
|
+
) : null}
|
|
308
|
+
<div id="portal-root" className={summaryHeaderStyles()}>
|
|
309
|
+
<QuoteCostDetails steps={numberOfSteps} quote={quote} />
|
|
310
|
+
|
|
311
|
+
{showAllRoutesButton && (
|
|
312
|
+
<AllRoutesButton
|
|
313
|
+
onClick={(e) => {
|
|
314
|
+
e.stopPropagation();
|
|
315
|
+
onClickAllRoutes();
|
|
316
|
+
}}
|
|
317
|
+
size="xxsmall"
|
|
318
|
+
type="secondary"
|
|
319
|
+
variant="default">
|
|
320
|
+
<Typography color="secondary" variant="label" size="medium">
|
|
321
|
+
{i18n.t('See All Routes')}
|
|
322
|
+
</Typography>
|
|
323
|
+
</AllRoutesButton>
|
|
324
|
+
)}
|
|
325
|
+
</div>
|
|
273
326
|
{type === 'basic' && (
|
|
274
327
|
<div className={basicInfoStyles()}>
|
|
275
328
|
<FrameIcon>
|
|
@@ -281,7 +334,7 @@ export function Quote(props: QuoteProps) {
|
|
|
281
334
|
</BasicInfoOutput>
|
|
282
335
|
<Tooltip
|
|
283
336
|
content={formatTooltipNumbers(output.value)}
|
|
284
|
-
container={
|
|
337
|
+
container={container}
|
|
285
338
|
open={!output.value ? false : undefined}>
|
|
286
339
|
<BasicInfoOutput size="small" variant="body">
|
|
287
340
|
|
|
@@ -293,7 +346,7 @@ export function Quote(props: QuoteProps) {
|
|
|
293
346
|
</ContainerInfoOutput>
|
|
294
347
|
<Tooltip
|
|
295
348
|
content={formatTooltipNumbers(output.usdValue)}
|
|
296
|
-
container={
|
|
349
|
+
container={container}
|
|
297
350
|
style={{
|
|
298
351
|
display: 'flex',
|
|
299
352
|
}}>
|
|
@@ -309,9 +362,9 @@ export function Quote(props: QuoteProps) {
|
|
|
309
362
|
)}
|
|
310
363
|
{type === 'list-item' && (
|
|
311
364
|
<TokenAmount
|
|
365
|
+
tooltipContainer={container}
|
|
312
366
|
type="output"
|
|
313
367
|
direction="vertical"
|
|
314
|
-
tooltipContainer={tooltipContainer}
|
|
315
368
|
price={{
|
|
316
369
|
value: roundedOutput,
|
|
317
370
|
usdValue: roundedOutputUsdValue,
|
|
@@ -340,12 +393,14 @@ export function Quote(props: QuoteProps) {
|
|
|
340
393
|
)}
|
|
341
394
|
</div>
|
|
342
395
|
<QuoteContainer
|
|
343
|
-
|
|
396
|
+
selected={selected}
|
|
397
|
+
listItem={type === 'list-item'}
|
|
344
398
|
open={expanded}
|
|
345
399
|
onOpenChange={setExpanded}>
|
|
346
400
|
<QuoteTrigger
|
|
401
|
+
type={type}
|
|
347
402
|
quoteRef={quoteRef}
|
|
348
|
-
|
|
403
|
+
selected={selected}
|
|
349
404
|
setExpanded={setExpanded}
|
|
350
405
|
expanded={expanded}
|
|
351
406
|
steps={steps}
|
|
@@ -359,10 +414,10 @@ export function Quote(props: QuoteProps) {
|
|
|
359
414
|
<StepDetails
|
|
360
415
|
type="quote-details"
|
|
361
416
|
key={key}
|
|
417
|
+
tooltipContainer={container}
|
|
362
418
|
step={step}
|
|
363
419
|
hasSeparator={index !== steps.length - 1}
|
|
364
420
|
state={step.state}
|
|
365
|
-
tooltipContainer={tooltipContainer}
|
|
366
421
|
/>
|
|
367
422
|
);
|
|
368
423
|
})}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import type { QuoteError, QuoteWarning } from '../../types';
|
|
1
|
+
import type { QuoteError, QuoteWarning, SelectedQuote } from '../../types';
|
|
2
2
|
import type { Step } from '@rango-dev/ui';
|
|
3
|
-
import type { BestRouteResponse } from 'rango-sdk';
|
|
4
3
|
import type { ReactNode } from 'react';
|
|
5
4
|
|
|
6
5
|
export type QuoteProps = {
|
|
7
6
|
type: 'basic' | 'list-item' | 'swap-preview';
|
|
8
7
|
error: QuoteError | null;
|
|
9
8
|
warning: QuoteWarning | null;
|
|
10
|
-
|
|
11
|
-
tag?: ReactNode;
|
|
12
|
-
quote: BestRouteResponse;
|
|
9
|
+
quote: SelectedQuote;
|
|
13
10
|
input: { value: string; usdValue: string };
|
|
14
11
|
output: { value: string; usdValue?: string };
|
|
15
12
|
expanded?: boolean;
|
|
13
|
+
tagHidden?: boolean;
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
onClickAllRoutes?: () => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type optionProps = {
|
|
19
|
+
value: string;
|
|
20
|
+
label: string;
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
export type QuoteTriggerProps = {
|
|
24
|
+
type: QuoteProps['type'];
|
|
19
25
|
quoteRef: React.MutableRefObject<HTMLButtonElement | null>;
|
|
20
|
-
|
|
26
|
+
selected: boolean;
|
|
21
27
|
setExpanded: React.Dispatch<React.SetStateAction<boolean | undefined>>;
|
|
22
28
|
steps: Step[];
|
|
23
29
|
expanded?: boolean;
|
|
@@ -32,6 +38,6 @@ export type QuoteTriggerImagesProps = {
|
|
|
32
38
|
};
|
|
33
39
|
|
|
34
40
|
export type QuoteCostDetailsProps = {
|
|
35
|
-
quote:
|
|
41
|
+
quote: SelectedQuote | null;
|
|
36
42
|
steps: number;
|
|
37
43
|
};
|
|
@@ -72,8 +72,8 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
72
72
|
const [openCollapse, setOpenCollapse] = useState<boolean>(false);
|
|
73
73
|
const { steps, quote } = props;
|
|
74
74
|
const tokens = useAppStore().tokens();
|
|
75
|
-
const totalTime = secondsToString(totalArrivalTime(quote
|
|
76
|
-
const swaps = quote
|
|
75
|
+
const totalTime = secondsToString(totalArrivalTime(quote?.swaps));
|
|
76
|
+
const swaps = quote?.swaps ?? [];
|
|
77
77
|
const container = getContainer();
|
|
78
78
|
|
|
79
79
|
const totalFee = getTotalFeeInUsd(swaps, tokens);
|
|
@@ -83,7 +83,10 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
83
83
|
return (
|
|
84
84
|
<>
|
|
85
85
|
<QuoteCost
|
|
86
|
-
onClickFee={() =>
|
|
86
|
+
onClickFee={(e) => {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
setOpen(!open);
|
|
89
|
+
}}
|
|
87
90
|
fee={numberToString(
|
|
88
91
|
totalFee,
|
|
89
92
|
GAS_FEE_MIN_DECIMALS,
|
|
@@ -110,7 +113,9 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
110
113
|
</IconButton>
|
|
111
114
|
</ModalHeader>
|
|
112
115
|
}
|
|
113
|
-
onClose={() =>
|
|
116
|
+
onClose={() => {
|
|
117
|
+
setOpen(false);
|
|
118
|
+
}}>
|
|
114
119
|
<ModalContainer>
|
|
115
120
|
<Typography variant="title" size="small">
|
|
116
121
|
{i18n.t('Details')}
|