@lifi/widget 3.19.0-beta.0 → 3.19.0-beta.2
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/CHANGELOG.md +22 -0
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.js +2 -3
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.js +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.js.map +1 -1
- package/dist/esm/components/AppContainer.js +1 -1
- package/dist/esm/components/AppContainer.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.js +9 -9
- package/dist/esm/components/Avatar/Avatar.style.js.map +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.js +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.js.map +1 -1
- package/dist/esm/components/ButtonTertiary.js +5 -6
- package/dist/esm/components/ButtonTertiary.js.map +1 -1
- package/dist/esm/components/Card/Card.js +18 -18
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardButton.style.js +1 -1
- package/dist/esm/components/Card/CardButton.style.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.js +2 -2
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Card/CardIconButton.js +2 -3
- package/dist/esm/components/Card/CardIconButton.js.map +1 -1
- package/dist/esm/components/Card/CardLabel.js +15 -21
- package/dist/esm/components/Card/CardLabel.js.map +1 -1
- package/dist/esm/components/Card/CardTitle.js +2 -2
- package/dist/esm/components/Card/CardTitle.js.map +1 -1
- package/dist/esm/components/Card/InputCard.d.ts +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.style.js +2 -2
- package/dist/esm/components/ContractComponent/NFT/NFT.style.js.map +1 -1
- package/dist/esm/components/Dialog.js +3 -3
- package/dist/esm/components/Dialog.js.map +1 -1
- package/dist/esm/components/Header/Header.style.js +15 -7
- package/dist/esm/components/Header/Header.style.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.style.js +18 -7
- package/dist/esm/components/Header/SettingsButton.style.js.map +1 -1
- package/dist/esm/components/Header/WalletMenu.style.js +4 -4
- package/dist/esm/components/Header/WalletMenu.style.js.map +1 -1
- package/dist/esm/components/IconTypography.js +4 -4
- package/dist/esm/components/IconTypography.js.map +1 -1
- package/dist/esm/components/ListItemButton.js +2 -4
- package/dist/esm/components/ListItemButton.js.map +1 -1
- package/dist/esm/components/Menu.js +3 -3
- package/dist/esm/components/Menu.js.map +1 -1
- package/dist/esm/components/Messages/AlertMessage.style.js +18 -12
- package/dist/esm/components/Messages/AlertMessage.style.js.map +1 -1
- package/dist/esm/components/Messages/GasRefuelMessage.style.js +7 -7
- package/dist/esm/components/Messages/GasRefuelMessage.style.js.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.style.js +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.style.js.map +1 -1
- package/dist/esm/components/ProgressToNextUpdate.js +6 -6
- package/dist/esm/components/ProgressToNextUpdate.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.style.js +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.style.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardSkeleton.js +1 -1
- package/dist/esm/components/RouteCard/RouteCardSkeleton.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.js +2 -2
- package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.style.js +1 -1
- package/dist/esm/components/Search/SearchInput.style.js.map +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.js +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.js.map +1 -1
- package/dist/esm/components/Select.js +4 -4
- package/dist/esm/components/Select.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js +8 -7
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWallet.style.js +2 -2
- package/dist/esm/components/SendToWallet/SendToWallet.style.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.js +3 -3
- package/dist/esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js +2 -2
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
- package/dist/esm/components/Step/CircularProgress.js +1 -2
- package/dist/esm/components/Step/CircularProgress.js.map +1 -1
- package/dist/esm/components/Step/CircularProgress.style.js +11 -10
- package/dist/esm/components/Step/CircularProgress.style.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.style.js +10 -10
- package/dist/esm/components/StepActions/StepActions.style.js.map +1 -1
- package/dist/esm/components/Switch.js +10 -16
- package/dist/esm/components/Switch.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.style.js +10 -16
- package/dist/esm/components/Tabs/Tabs.style.js.map +1 -1
- package/dist/esm/components/TextFitter/TextFitter.js +1 -1
- package/dist/esm/components/TextFitter/TextFitter.js.map +1 -1
- package/dist/esm/components/Token/Token.js +5 -2
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/Token/Token.style.js +6 -6
- package/dist/esm/components/Token/Token.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.js +5 -1
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.style.js +2 -3
- package/dist/esm/components/TokenList/TokenList.style.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.style.js +1 -1
- package/dist/esm/components/TokenRate/TokenRate.style.js.map +1 -1
- package/dist/esm/components/TransactionDetails.js +4 -1
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/hooks/useRoutes.js +2 -1
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/i18n/en.json +2 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js +9 -10
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/ResetSettingsButton.style.js +2 -3
- package/dist/esm/pages/SettingsPage/ResetSettingsButton.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +18 -14
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/ThemeSettings.js +6 -6
- package/dist/esm/pages/SettingsPage/ThemeSettings.js.map +1 -1
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistorySkeleton.js +2 -2
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistorySkeleton.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js +3 -2
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.style.js +19 -7
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.style.js.map +1 -1
- package/dist/esm/providers/ThemeProvider/ThemeProvider.js +7 -22
- package/dist/esm/providers/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +1 -2
- package/dist/esm/stores/settings/useSettingsStore.js +2 -7
- package/dist/esm/stores/settings/useSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/utils/getStateValues.js +0 -1
- package/dist/esm/stores/settings/utils/getStateValues.js.map +1 -1
- package/dist/esm/themes/createTheme.d.ts +1 -2
- package/dist/esm/themes/createTheme.js +108 -67
- package/dist/esm/themes/createTheme.js.map +1 -1
- package/dist/esm/themes/jumper.js +1 -1
- package/dist/esm/themes/jumper.js.map +1 -1
- package/dist/esm/themes/watermelonLight.js +1 -1
- package/dist/esm/themes/watermelonLight.js.map +1 -1
- package/dist/esm/types/widget.d.ts +21 -4
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/percentFormatter.js +5 -1
- package/dist/esm/utils/percentFormatter.js.map +1 -1
- package/package.json +2 -2
- package/package.json.tmp +1 -1
- package/src/components/ActiveTransactions/ActiveTransactions.style.ts +2 -3
- package/src/components/AmountInput/AmountInputAdornment.style.tsx +1 -1
- package/src/components/AppContainer.tsx +1 -1
- package/src/components/Avatar/Avatar.style.tsx +9 -9
- package/src/components/Avatar/SmallAvatar.tsx +1 -1
- package/src/components/ButtonTertiary.tsx +5 -6
- package/src/components/Card/Card.tsx +18 -18
- package/src/components/Card/CardButton.style.tsx +1 -1
- package/src/components/Card/CardHeader.tsx +2 -2
- package/src/components/Card/CardIconButton.tsx +2 -3
- package/src/components/Card/CardLabel.tsx +15 -59
- package/src/components/Card/CardTitle.tsx +2 -2
- package/src/components/ContractComponent/NFT/NFT.style.ts +2 -2
- package/src/components/Dialog.tsx +3 -3
- package/src/components/Header/Header.style.ts +15 -7
- package/src/components/Header/SettingsButton.style.tsx +17 -10
- package/src/components/Header/WalletMenu.style.tsx +4 -4
- package/src/components/IconTypography.ts +4 -4
- package/src/components/ListItemButton.tsx +2 -4
- package/src/components/Menu.tsx +3 -3
- package/src/components/Messages/AlertMessage.style.tsx +18 -16
- package/src/components/Messages/GasRefuelMessage.style.ts +7 -7
- package/src/components/PoweredBy/PoweredBy.style.ts +1 -1
- package/src/components/ProgressToNextUpdate.tsx +6 -6
- package/src/components/ReverseTokensButton/ReverseTokensButton.style.tsx +1 -1
- package/src/components/RouteCard/RouteCardSkeleton.tsx +1 -1
- package/src/components/Routes/RoutesExpanded.style.ts +2 -2
- package/src/components/Search/SearchInput.style.tsx +1 -1
- package/src/components/Search/SearchNotFound.style.tsx +1 -1
- package/src/components/Select.tsx +4 -4
- package/src/components/SelectTokenButton/SelectTokenButton.style.tsx +7 -9
- package/src/components/SendToWallet/SendToWallet.style.tsx +2 -2
- package/src/components/Skeleton/WidgetSkeleton.style.tsx +2 -2
- package/src/components/Skeleton/WidgetSkeleton.tsx +9 -6
- package/src/components/Step/CircularProgress.style.tsx +11 -11
- package/src/components/Step/CircularProgress.tsx +1 -2
- package/src/components/StepActions/StepActions.style.tsx +9 -10
- package/src/components/Switch.tsx +10 -21
- package/src/components/Tabs/Tabs.style.tsx +9 -16
- package/src/components/TextFitter/TextFitter.tsx +1 -1
- package/src/components/Token/Token.style.tsx +6 -6
- package/src/components/Token/Token.tsx +5 -2
- package/src/components/TokenList/TokenList.style.tsx +2 -3
- package/src/components/TokenList/TokenList.tsx +5 -1
- package/src/components/TokenRate/TokenRate.style.ts +1 -1
- package/src/components/TransactionDetails.tsx +4 -1
- package/src/config/version.ts +1 -1
- package/src/hooks/useRoutes.ts +2 -1
- package/src/i18n/en.json +2 -1
- package/src/pages/SendToWallet/SendToWalletPage.style.tsx +9 -10
- package/src/pages/SettingsPage/ResetSettingsButton.style.tsx +2 -3
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.style.tsx +17 -15
- package/src/pages/SettingsPage/ThemeSettings.tsx +7 -6
- package/src/pages/TransactionHistoryPage/TransactionHistorySkeleton.tsx +2 -2
- package/src/pages/TransactionPage/StatusBottomSheet.style.tsx +19 -7
- package/src/pages/TransactionPage/StatusBottomSheet.tsx +5 -0
- package/src/providers/ThemeProvider/ThemeProvider.tsx +20 -27
- package/src/stores/settings/types.ts +1 -2
- package/src/stores/settings/useSettingsStore.ts +2 -7
- package/src/stores/settings/utils/getStateValues.ts +0 -1
- package/src/themes/createTheme.ts +124 -91
- package/src/themes/jumper.ts +1 -1
- package/src/themes/types.ts +1 -0
- package/src/themes/watermelonLight.ts +1 -1
- package/src/types/widget.ts +25 -3
- package/src/utils/percentFormatter.ts +8 -1
- package/dist/esm/stores/settings/useAppearance.d.ts +0 -2
- package/dist/esm/stores/settings/useAppearance.js +0 -11
- package/dist/esm/stores/settings/useAppearance.js.map +0 -1
- package/dist/esm/utils/colors.d.ts +0 -15
- package/dist/esm/utils/colors.js +0 -35
- package/dist/esm/utils/colors.js.map +0 -1
- package/src/stores/settings/useAppearance.ts +0 -15
- package/src/utils/colors.ts +0 -53
|
@@ -159,7 +159,10 @@ export const TokenBase: FC<TokenProps & BoxProps> = ({
|
|
|
159
159
|
enableImpactTokenTooltip ? (
|
|
160
160
|
<Tooltip title={t('tooltip.priceImpact')} sx={{ cursor: 'help' }}>
|
|
161
161
|
<TextSecondary>
|
|
162
|
-
{t('format.percent', {
|
|
162
|
+
{t('format.percent', {
|
|
163
|
+
value: priceImpact,
|
|
164
|
+
usePlusSign: true,
|
|
165
|
+
})}
|
|
163
166
|
</TextSecondary>
|
|
164
167
|
</Tooltip>
|
|
165
168
|
) : (
|
|
@@ -168,7 +171,7 @@ export const TokenBase: FC<TokenProps & BoxProps> = ({
|
|
|
168
171
|
maximumFractionDigits: 9,
|
|
169
172
|
})}
|
|
170
173
|
>
|
|
171
|
-
{t('format.percent', { value: priceImpact })}
|
|
174
|
+
{t('format.percent', { value: priceImpact, usePlusSign: true })}
|
|
172
175
|
</TextSecondary>
|
|
173
176
|
)
|
|
174
177
|
) : null}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IconButtonProps, LinkProps } from '@mui/material'
|
|
2
2
|
import { IconButton as MuiIconButton, styled } from '@mui/material'
|
|
3
|
-
import { getContrastAlphaColor } from '../../utils/colors.js'
|
|
4
3
|
import { ListItem as ListItemBase } from '../ListItem/ListItem.js'
|
|
5
4
|
|
|
6
5
|
export const ListItem = styled(ListItemBase)(() => ({
|
|
@@ -19,9 +18,9 @@ export const IconButton = styled(MuiIconButton)<IconButtonProps & LinkProps>(
|
|
|
19
18
|
color: 'inherit',
|
|
20
19
|
backgroundColor: 'unset',
|
|
21
20
|
minWidth: 'unset',
|
|
22
|
-
borderRadius: theme.shape.borderRadiusTertiary,
|
|
21
|
+
borderRadius: theme.vars.shape.borderRadiusTertiary,
|
|
23
22
|
'&:hover': {
|
|
24
|
-
backgroundColor:
|
|
23
|
+
backgroundColor: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.04)`,
|
|
25
24
|
},
|
|
26
25
|
svg: {
|
|
27
26
|
fontSize: 14,
|
|
@@ -53,7 +53,11 @@ export const TokenList: FC<TokenListProps> = ({
|
|
|
53
53
|
.filter(
|
|
54
54
|
(token) =>
|
|
55
55
|
token.name?.toUpperCase().includes(searchFilter) ||
|
|
56
|
-
token.symbol
|
|
56
|
+
token.symbol
|
|
57
|
+
.toUpperCase()
|
|
58
|
+
// Replace ₮ with T for USD₮0
|
|
59
|
+
.replaceAll('₮', 'T')
|
|
60
|
+
.includes(searchFilter) ||
|
|
57
61
|
token.address.toUpperCase().includes(searchFilter)
|
|
58
62
|
)
|
|
59
63
|
.sort(filteredTokensComparator(searchFilter))
|
|
@@ -230,7 +230,10 @@ export const TransactionDetails: React.FC<TransactionDetailsProps> = ({
|
|
|
230
230
|
variant="body2"
|
|
231
231
|
sx={{ fontWeight: 600, cursor: 'help' }}
|
|
232
232
|
>
|
|
233
|
-
{t('format.percent', {
|
|
233
|
+
{t('format.percent', {
|
|
234
|
+
value: priceImpact,
|
|
235
|
+
usePlusSign: true,
|
|
236
|
+
})}
|
|
234
237
|
</Typography>
|
|
235
238
|
</Tooltip>
|
|
236
239
|
</Box>
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '3.19.0-beta.
|
|
2
|
+
export const version = '3.19.0-beta.2'
|
package/src/hooks/useRoutes.ts
CHANGED
|
@@ -420,11 +420,12 @@ export const useRoutes = ({ observableRoute }: RoutesProps = {}) => {
|
|
|
420
420
|
const initialRoutes = routesResult?.routes ?? []
|
|
421
421
|
|
|
422
422
|
if (shouldUseRelayerQuote && initialRoutes.length) {
|
|
423
|
-
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
424
423
|
setIntermediateRoutes(queryKey, initialRoutes)
|
|
424
|
+
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
425
425
|
// Return early if we're only using main routes
|
|
426
426
|
} else if (shouldUseMainRoutes) {
|
|
427
427
|
// If we don't need relayer quote, return the initial routes
|
|
428
|
+
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
428
429
|
return initialRoutes
|
|
429
430
|
}
|
|
430
431
|
|
package/src/i18n/en.json
CHANGED
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"startSwapping": "Start swapping",
|
|
48
48
|
"swap": "Swap",
|
|
49
49
|
"swapReview": "Review swap",
|
|
50
|
+
"system": "System",
|
|
50
51
|
"tryAgain": "Try again",
|
|
51
52
|
"viewCoverage": "View coverage",
|
|
52
53
|
"viewOnExplorer": "View on explorer"
|
|
@@ -308,7 +309,7 @@
|
|
|
308
309
|
"searchExchanges": "Search by exchange name"
|
|
309
310
|
},
|
|
310
311
|
"settings": {
|
|
311
|
-
"
|
|
312
|
+
"appearance": "Appearance",
|
|
312
313
|
"enabledBridges": "Bridges",
|
|
313
314
|
"enabledExchanges": "Exchanges",
|
|
314
315
|
"gasPrice": {
|
|
@@ -13,7 +13,6 @@ import { InputCard } from '../../components/Card/InputCard.js'
|
|
|
13
13
|
import { Input } from '../../components/Input.js'
|
|
14
14
|
import type { PageContainerProps } from '../../components/PageContainer.js'
|
|
15
15
|
import { PageContainer } from '../../components/PageContainer.js'
|
|
16
|
-
import { getContrastAlphaColor } from '../../utils/colors.js'
|
|
17
16
|
|
|
18
17
|
export const AddressInput = styled(Input)(({ theme }) => ({
|
|
19
18
|
padding: 0,
|
|
@@ -87,12 +86,12 @@ export const IconContainer = styled(Box)(({ theme }) => ({
|
|
|
87
86
|
alignItems: 'center',
|
|
88
87
|
width: 80,
|
|
89
88
|
height: 80,
|
|
90
|
-
color: theme.palette.grey[300],
|
|
91
|
-
background: theme.palette.grey[800],
|
|
92
89
|
borderRadius: '50%',
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
color: theme.vars.palette.grey[700],
|
|
91
|
+
background: theme.vars.palette.grey[200],
|
|
92
|
+
...theme.applyStyles('dark', {
|
|
93
|
+
color: theme.vars.palette.grey[300],
|
|
94
|
+
background: theme.vars.palette.grey[800],
|
|
96
95
|
}),
|
|
97
96
|
}))
|
|
98
97
|
|
|
@@ -119,7 +118,7 @@ export const BookmarksListContainer = styled(ListContainer)(({ theme }) => ({
|
|
|
119
118
|
: { minHeight: 440 }),
|
|
120
119
|
}))
|
|
121
120
|
export const BookmarkButtonContainer = styled(Box)(({ theme }) => ({
|
|
122
|
-
background: theme.palette.background.default,
|
|
121
|
+
background: theme.vars.palette.background.default,
|
|
123
122
|
display: 'flex',
|
|
124
123
|
flexDirection: 'column',
|
|
125
124
|
bottom: 0,
|
|
@@ -141,10 +140,10 @@ export const EmptyContainer = styled(Box)(({ theme }) => ({
|
|
|
141
140
|
export const ValidationAlert = styled(Alert)(({ theme }) => ({
|
|
142
141
|
backgroundColor: 'transparent',
|
|
143
142
|
padding: 0,
|
|
144
|
-
color: theme.palette.text.primary,
|
|
143
|
+
color: theme.vars.palette.text.primary,
|
|
145
144
|
[`.${alertClasses.icon}`]: {
|
|
146
145
|
padding: 0,
|
|
147
|
-
color: theme.palette.error.main,
|
|
146
|
+
color: theme.vars.palette.error.main,
|
|
148
147
|
},
|
|
149
148
|
[`.${alertClasses.message}`]: { padding: theme.spacing(0.25, 0, 0, 0) },
|
|
150
149
|
}))
|
|
@@ -154,6 +153,6 @@ export const OptionsMenuButton = styled(IconButton)(({ theme }) => ({
|
|
|
154
153
|
top: theme.spacing(1.75),
|
|
155
154
|
right: theme.spacing(2),
|
|
156
155
|
'&:hover': {
|
|
157
|
-
backgroundColor:
|
|
156
|
+
backgroundColor: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.04)`,
|
|
158
157
|
},
|
|
159
158
|
}))
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Box, styled } from '@mui/material'
|
|
2
|
-
import { getContrastAlphaColor } from '../../utils/colors.js'
|
|
3
2
|
|
|
4
3
|
export const ResetButtonContainer = styled(Box)(({ theme }) => ({
|
|
5
|
-
background:
|
|
4
|
+
background: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.04)`,
|
|
6
5
|
borderRadius: '16px',
|
|
7
6
|
padding: '16px',
|
|
8
7
|
svg: {
|
|
9
|
-
fill:
|
|
8
|
+
fill: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.04)`,
|
|
10
9
|
},
|
|
11
10
|
}))
|
|
@@ -3,30 +3,30 @@ import {
|
|
|
3
3
|
Box,
|
|
4
4
|
ButtonBase,
|
|
5
5
|
InputBase,
|
|
6
|
-
alpha,
|
|
7
6
|
inputBaseClasses,
|
|
8
7
|
styled,
|
|
9
8
|
} from '@mui/material'
|
|
10
9
|
|
|
11
10
|
export const SettingsFieldSet = styled(Box)(({ theme }) => ({
|
|
12
11
|
display: 'flex',
|
|
13
|
-
|
|
14
|
-
borderRadius: theme.shape.borderRadius,
|
|
12
|
+
borderRadius: theme.vars.shape.borderRadius,
|
|
15
13
|
padding: theme.spacing(0.5),
|
|
16
14
|
gap: theme.spacing(0.5),
|
|
17
15
|
height: '3.5rem',
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
backgroundColor: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.04)`,
|
|
17
|
+
...theme.applyStyles('dark', {
|
|
18
|
+
backgroundColor: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.08)`,
|
|
20
19
|
}),
|
|
21
20
|
}))
|
|
22
21
|
|
|
23
22
|
const slippageControlSelected = (theme: Theme) => ({
|
|
24
|
-
backgroundColor:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
backgroundColor: theme.vars.palette.background.paper,
|
|
24
|
+
boxShadow: `0px 2px 4px rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.04)`,
|
|
25
|
+
...theme.applyStyles('dark', {
|
|
26
|
+
backgroundColor: `rgba(${theme.vars.palette.common.backgroundChannel} / 0.56)`,
|
|
27
|
+
boxShadow: `0px 2px 4px rgba(${theme.vars.palette.common.backgroundChannel} / 0.04)`,
|
|
28
|
+
}),
|
|
29
|
+
borderRadius: `calc(${theme.vars.shape.borderRadius} - 4px)`,
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
interface SlippageDefaultProps {
|
|
@@ -35,10 +35,11 @@ interface SlippageDefaultProps {
|
|
|
35
35
|
|
|
36
36
|
export const SlippageDefaultButton = styled(ButtonBase)<SlippageDefaultProps>(
|
|
37
37
|
({ theme, selected }) => {
|
|
38
|
+
const slippageControlSelectedStyles = slippageControlSelected(theme)
|
|
38
39
|
const selectedStyle = selected
|
|
39
40
|
? {
|
|
40
41
|
'&:not(:focus)': {
|
|
41
|
-
...
|
|
42
|
+
...slippageControlSelectedStyles,
|
|
42
43
|
},
|
|
43
44
|
}
|
|
44
45
|
: {}
|
|
@@ -49,7 +50,7 @@ export const SlippageDefaultButton = styled(ButtonBase)<SlippageDefaultProps>(
|
|
|
49
50
|
fontSize: '1rem',
|
|
50
51
|
fontWeight: 700,
|
|
51
52
|
'&:focus': {
|
|
52
|
-
...
|
|
53
|
+
...slippageControlSelectedStyles,
|
|
53
54
|
},
|
|
54
55
|
...selectedStyle,
|
|
55
56
|
}
|
|
@@ -58,10 +59,11 @@ export const SlippageDefaultButton = styled(ButtonBase)<SlippageDefaultProps>(
|
|
|
58
59
|
|
|
59
60
|
export const SlippageCustomInput = styled(InputBase)<SlippageDefaultProps>(
|
|
60
61
|
({ theme, selected }) => {
|
|
62
|
+
const slippageControlSelectedStyles = slippageControlSelected(theme)
|
|
61
63
|
const selectedStyle = selected
|
|
62
64
|
? {
|
|
63
65
|
'&:not(:focus)': {
|
|
64
|
-
...
|
|
66
|
+
...slippageControlSelectedStyles,
|
|
65
67
|
},
|
|
66
68
|
}
|
|
67
69
|
: {}
|
|
@@ -80,7 +82,7 @@ export const SlippageCustomInput = styled(InputBase)<SlippageDefaultProps>(
|
|
|
80
82
|
opacity: 1,
|
|
81
83
|
},
|
|
82
84
|
'&:focus': {
|
|
83
|
-
...
|
|
85
|
+
...slippageControlSelectedStyles,
|
|
84
86
|
},
|
|
85
87
|
...selectedStyle,
|
|
86
88
|
},
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import BrightnessAuto from '@mui/icons-material/BrightnessAuto'
|
|
2
2
|
import LightMode from '@mui/icons-material/LightMode'
|
|
3
3
|
import Nightlight from '@mui/icons-material/Nightlight'
|
|
4
|
-
import { Tooltip } from '@mui/material'
|
|
4
|
+
import { Tooltip, useColorScheme } from '@mui/material'
|
|
5
5
|
import { useTranslation } from 'react-i18next'
|
|
6
6
|
import { CardValue } from '../../components/Card/CardButton.style.js'
|
|
7
7
|
import { CardTabs, Tab } from '../../components/Tabs/Tabs.style.js'
|
|
8
8
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
9
|
-
import { useAppearance } from '../../stores/settings/useAppearance.js'
|
|
10
9
|
import type { Appearance } from '../../types/widget.js'
|
|
11
10
|
import { HiddenUI } from '../../types/widget.js'
|
|
12
11
|
import { SettingCardExpandable } from './SettingsCard/SettingCardExpandable.js'
|
|
@@ -14,7 +13,7 @@ import { SettingCardExpandable } from './SettingsCard/SettingCardExpandable.js'
|
|
|
14
13
|
const themeIcons = {
|
|
15
14
|
light: LightMode,
|
|
16
15
|
dark: Nightlight,
|
|
17
|
-
|
|
16
|
+
system: BrightnessAuto,
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
interface ThemeTabProps {
|
|
@@ -38,27 +37,29 @@ const ThemeTab: React.FC<ThemeTabProps> = ({
|
|
|
38
37
|
|
|
39
38
|
export const ThemeSettings: React.FC = () => {
|
|
40
39
|
const { t } = useTranslation()
|
|
41
|
-
const
|
|
40
|
+
const { mode, setMode } = useColorScheme()
|
|
42
41
|
const { hiddenUI } = useWidgetConfig()
|
|
43
42
|
|
|
44
43
|
if (hiddenUI?.includes(HiddenUI.Appearance)) {
|
|
45
44
|
return null
|
|
46
45
|
}
|
|
47
46
|
|
|
47
|
+
const appearance = mode ?? 'system'
|
|
48
|
+
|
|
48
49
|
const ThemeIcon = themeIcons[appearance]
|
|
49
50
|
|
|
50
51
|
const handleThemeChange = (
|
|
51
52
|
_: React.SyntheticEvent,
|
|
52
53
|
appearance: Appearance
|
|
53
54
|
) => {
|
|
54
|
-
|
|
55
|
+
setMode(appearance)
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
return (
|
|
58
59
|
<SettingCardExpandable
|
|
59
60
|
value={<CardValue>{t(`button.${appearance}`)} </CardValue>}
|
|
60
61
|
icon={<ThemeIcon />}
|
|
61
|
-
title={t('settings.
|
|
62
|
+
title={t('settings.appearance')}
|
|
62
63
|
>
|
|
63
64
|
<CardTabs
|
|
64
65
|
value={appearance}
|
|
@@ -24,7 +24,7 @@ export const TransactionHistoryItemSkeleton = () => {
|
|
|
24
24
|
width={96}
|
|
25
25
|
height={16}
|
|
26
26
|
sx={(theme) => ({
|
|
27
|
-
borderRadius:
|
|
27
|
+
borderRadius: theme.vars.shape.borderRadius,
|
|
28
28
|
})}
|
|
29
29
|
/>
|
|
30
30
|
<Skeleton
|
|
@@ -32,7 +32,7 @@ export const TransactionHistoryItemSkeleton = () => {
|
|
|
32
32
|
width={64}
|
|
33
33
|
height={16}
|
|
34
34
|
sx={(theme) => ({
|
|
35
|
-
borderRadius:
|
|
35
|
+
borderRadius: theme.vars.shape.borderRadius,
|
|
36
36
|
})}
|
|
37
37
|
/>
|
|
38
38
|
</Box>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Theme } from '@mui/material'
|
|
2
|
-
import { Box,
|
|
2
|
+
import { Box, styled } from '@mui/material'
|
|
3
3
|
import { RouteExecutionStatus } from '../../stores/routes/types.js'
|
|
4
4
|
|
|
5
5
|
type StatusColor = RouteExecutionStatus | 'warning'
|
|
@@ -7,19 +7,31 @@ type StatusColor = RouteExecutionStatus | 'warning'
|
|
|
7
7
|
const getStatusColor = (status: StatusColor, theme: Theme) => {
|
|
8
8
|
switch (status) {
|
|
9
9
|
case RouteExecutionStatus.Done:
|
|
10
|
-
return {
|
|
10
|
+
return {
|
|
11
|
+
color: theme.vars.palette.success.mainChannel,
|
|
12
|
+
alpha: 0.12,
|
|
13
|
+
darken: 0,
|
|
14
|
+
}
|
|
11
15
|
case RouteExecutionStatus.Failed:
|
|
12
|
-
return {
|
|
16
|
+
return {
|
|
17
|
+
color: theme.vars.palette.error.mainChannel,
|
|
18
|
+
alpha: 0.12,
|
|
19
|
+
darken: 0,
|
|
20
|
+
}
|
|
13
21
|
case RouteExecutionStatus.Done | RouteExecutionStatus.Partial:
|
|
14
22
|
case RouteExecutionStatus.Done | RouteExecutionStatus.Refunded:
|
|
15
23
|
case 'warning':
|
|
16
24
|
return {
|
|
17
|
-
color: theme.palette.warning.
|
|
25
|
+
color: theme.vars.palette.warning.mainChannel,
|
|
18
26
|
alpha: 0.48,
|
|
19
27
|
darken: theme.palette.mode === 'light' ? 0.32 : 0,
|
|
20
28
|
}
|
|
21
29
|
default:
|
|
22
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
color: theme.vars.palette.primary.mainChannel,
|
|
32
|
+
alpha: 0.12,
|
|
33
|
+
darken: 0,
|
|
34
|
+
}
|
|
23
35
|
}
|
|
24
36
|
}
|
|
25
37
|
|
|
@@ -38,7 +50,7 @@ export const IconCircle = styled(Box, {
|
|
|
38
50
|
darken: darkenValue,
|
|
39
51
|
} = getStatusColor(status, theme)
|
|
40
52
|
return {
|
|
41
|
-
backgroundColor:
|
|
53
|
+
backgroundColor: `rgba(${color} / ${alphaValue})`,
|
|
42
54
|
borderRadius: '50%',
|
|
43
55
|
width: 64,
|
|
44
56
|
height: 64,
|
|
@@ -46,7 +58,7 @@ export const IconCircle = styled(Box, {
|
|
|
46
58
|
position: 'relative',
|
|
47
59
|
placeItems: 'center',
|
|
48
60
|
'& > svg': {
|
|
49
|
-
color:
|
|
61
|
+
color: `color-mix(in srgb, rgb(${color}) ${(1 - darkenValue) * 100}%, black)`,
|
|
50
62
|
width: 32,
|
|
51
63
|
height: 32,
|
|
52
64
|
},
|
|
@@ -81,6 +81,7 @@ export const StatusBottomSheetContent: React.FC<
|
|
|
81
81
|
subvariantOptions,
|
|
82
82
|
contractSecondaryComponent,
|
|
83
83
|
contractCompactComponent,
|
|
84
|
+
feeConfig,
|
|
84
85
|
} = useWidgetConfig()
|
|
85
86
|
const { getChainById } = useAvailableChains()
|
|
86
87
|
|
|
@@ -246,6 +247,9 @@ export const StatusBottomSheetContent: React.FC<
|
|
|
246
247
|
hasEnumFlag(status, RouteExecutionStatus.Done) &&
|
|
247
248
|
(contractCompactComponent || contractSecondaryComponent)
|
|
248
249
|
|
|
250
|
+
const VcComponent =
|
|
251
|
+
status === RouteExecutionStatus.Done ? feeConfig?._vcComponent : undefined
|
|
252
|
+
|
|
249
253
|
return (
|
|
250
254
|
<Box
|
|
251
255
|
ref={ref}
|
|
@@ -314,6 +318,7 @@ export const StatusBottomSheetContent: React.FC<
|
|
|
314
318
|
{secondaryMessage}
|
|
315
319
|
</Typography>
|
|
316
320
|
) : null}
|
|
321
|
+
{VcComponent ? <VcComponent route={route} /> : null}
|
|
317
322
|
<Box sx={{ display: 'flex', marginTop: 2, gap: 1.5 }}>
|
|
318
323
|
{hasEnumFlag(status, RouteExecutionStatus.Done) ? (
|
|
319
324
|
<Button variant="text" onClick={handleSeeDetails} fullWidth>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
ThemeProvider as MuiThemeProvider,
|
|
3
|
+
useColorScheme,
|
|
4
|
+
} from '@mui/material'
|
|
5
|
+
import { useEffect, useMemo } from 'react'
|
|
5
6
|
import { createTheme } from '../../themes/createTheme.js'
|
|
6
7
|
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
7
8
|
|
|
@@ -9,34 +10,26 @@ export const ThemeProvider: React.FC<React.PropsWithChildren> = ({
|
|
|
9
10
|
children,
|
|
10
11
|
}) => {
|
|
11
12
|
const { appearance: colorSchemeMode, theme: themeConfig } = useWidgetConfig()
|
|
12
|
-
const
|
|
13
|
-
const [appearance, setAppearance] = useAppearance()
|
|
14
|
-
const [mode, setMode] = useState<PaletteMode>(
|
|
15
|
-
(colorSchemeMode ?? appearance === 'auto')
|
|
16
|
-
? prefersDarkMode
|
|
17
|
-
? 'dark'
|
|
18
|
-
: 'light'
|
|
19
|
-
: appearance
|
|
20
|
-
)
|
|
13
|
+
const { setMode } = useColorScheme()
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
if (appearance === 'auto') {
|
|
24
|
-
setMode(prefersDarkMode ? 'dark' : 'light')
|
|
25
|
-
} else {
|
|
26
|
-
setMode(appearance)
|
|
27
|
-
}
|
|
28
|
-
}, [appearance, prefersDarkMode])
|
|
29
|
-
|
|
30
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: setAppearance is stable
|
|
15
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: setMode is stable
|
|
31
16
|
useEffect(() => {
|
|
32
17
|
if (colorSchemeMode) {
|
|
33
|
-
|
|
18
|
+
setMode(colorSchemeMode)
|
|
34
19
|
}
|
|
35
20
|
}, [colorSchemeMode])
|
|
36
21
|
|
|
37
|
-
const theme = useMemo(
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
const theme = useMemo(() => createTheme(themeConfig), [themeConfig])
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<MuiThemeProvider
|
|
26
|
+
theme={theme}
|
|
27
|
+
defaultMode={colorSchemeMode ?? 'system'}
|
|
28
|
+
modeStorageKey="li.fi-widget-mode"
|
|
29
|
+
colorSchemeStorageKey="li.fi-widget-color-scheme"
|
|
30
|
+
disableTransitionOnChange
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</MuiThemeProvider>
|
|
40
34
|
)
|
|
41
|
-
return <MuiThemeProvider theme={theme}>{children}</MuiThemeProvider>
|
|
42
35
|
}
|
|
@@ -2,7 +2,7 @@ import type { Order } from '@lifi/sdk'
|
|
|
2
2
|
import type { PropsWithChildren } from 'react'
|
|
3
3
|
import type { StoreApi } from 'zustand'
|
|
4
4
|
import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional'
|
|
5
|
-
import type {
|
|
5
|
+
import type { SplitSubvariant } from '../../types/widget.js'
|
|
6
6
|
|
|
7
7
|
export type ValueSetter<S> = <K extends keyof S>(
|
|
8
8
|
key: K,
|
|
@@ -19,7 +19,6 @@ export const SettingsToolTypes = ['Bridges', 'Exchanges'] as const
|
|
|
19
19
|
export type SettingsToolType = (typeof SettingsToolTypes)[number]
|
|
20
20
|
|
|
21
21
|
export interface SettingsProps {
|
|
22
|
-
appearance: Appearance
|
|
23
22
|
gasPrice?: string
|
|
24
23
|
language?: string
|
|
25
24
|
routePriority?: Order
|
|
@@ -17,7 +17,6 @@ export const defaultConfigurableSettings: Pick<
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const defaultSettings: SettingsProps = {
|
|
20
|
-
appearance: 'auto',
|
|
21
20
|
gasPrice: 'normal',
|
|
22
21
|
enabledAutoRefuel: true,
|
|
23
22
|
disabledBridges: [],
|
|
@@ -126,9 +125,8 @@ export const useSettingsStore = createWithEqualityFn<SettingsState>(
|
|
|
126
125
|
}
|
|
127
126
|
}),
|
|
128
127
|
reset: (bridges, exchanges) => {
|
|
129
|
-
const { appearance, ...restDefaultSettings } = defaultSettings
|
|
130
128
|
set(() => ({
|
|
131
|
-
...
|
|
129
|
+
...defaultSettings,
|
|
132
130
|
...defaultConfigurableSettings,
|
|
133
131
|
}))
|
|
134
132
|
get().initializeTools('Bridges', bridges, true)
|
|
@@ -138,7 +136,7 @@ export const useSettingsStore = createWithEqualityFn<SettingsState>(
|
|
|
138
136
|
}),
|
|
139
137
|
{
|
|
140
138
|
name: 'li.fi-widget-settings',
|
|
141
|
-
version:
|
|
139
|
+
version: 5,
|
|
142
140
|
partialize: (state) => {
|
|
143
141
|
const {
|
|
144
142
|
disabledBridges,
|
|
@@ -165,9 +163,6 @@ export const useSettingsStore = createWithEqualityFn<SettingsState>(
|
|
|
165
163
|
return state
|
|
166
164
|
},
|
|
167
165
|
migrate: (persistedState: any, version) => {
|
|
168
|
-
if (version === 0 && persistedState.appearance === 'system') {
|
|
169
|
-
persistedState.appearance = defaultSettings.appearance
|
|
170
|
-
}
|
|
171
166
|
if (version === 1) {
|
|
172
167
|
persistedState.slippage = defaultConfigurableSettings.slippage
|
|
173
168
|
}
|