@lifi/widget 3.0.0-alpha.37 → 3.0.0-alpha.39
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/_esm/components/AppContainer.d.ts +5 -0
- package/_esm/components/AppContainer.js +1 -1
- package/_esm/components/AppContainer.js.map +1 -1
- package/_esm/components/Card/InputCard.js +1 -1
- package/_esm/components/Card/InputCard.js.map +1 -1
- package/_esm/components/ChainSelect/ChainSelect.js +8 -9
- package/_esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/_esm/components/Header/Header.style.d.ts +0 -3
- package/_esm/components/Header/Header.style.js +1 -7
- package/_esm/components/Header/Header.style.js.map +1 -1
- package/_esm/components/Header/NavigationHeader.js +1 -66
- package/_esm/components/Header/NavigationHeader.js.map +1 -1
- package/_esm/components/Header/NavigationTabs.js +3 -3
- package/_esm/components/Header/NavigationTabs.js.map +1 -1
- package/_esm/components/Skeleton/WidgetSkeleton.d.ts +2 -0
- package/_esm/components/Skeleton/WidgetSkeleton.js +29 -0
- package/_esm/components/Skeleton/WidgetSkeleton.js.map +1 -0
- package/_esm/components/Skeleton/WidgetSkeleton.style.d.ts +31 -0
- package/_esm/components/Skeleton/WidgetSkeleton.style.js +55 -0
- package/_esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -0
- package/_esm/components/Tabs/Tabs.style.d.ts +3 -0
- package/_esm/components/Tabs/Tabs.style.js +17 -9
- package/_esm/components/Tabs/Tabs.style.js.map +1 -1
- package/_esm/config/version.d.ts +1 -1
- package/_esm/config/version.js +1 -1
- package/_esm/hooks/useAddressValidation.d.ts +1 -1
- package/_esm/hooks/useAddressValidation.js.map +1 -1
- package/_esm/hooks/useHeader.d.ts +2 -0
- package/_esm/hooks/useHeader.js +16 -0
- package/_esm/hooks/useHeader.js.map +1 -0
- package/_esm/hooks/useProcessMessage.js +4 -0
- package/_esm/hooks/useProcessMessage.js.map +1 -1
- package/_esm/hooks/useToken.js +1 -1
- package/_esm/hooks/useToken.js.map +1 -1
- package/_esm/i18n/en.json +4 -2
- package/_esm/index.d.ts +1 -0
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +4 -10
- package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js.map +1 -1
- package/_esm/pages/LanguagesPage.js +3 -1
- package/_esm/pages/LanguagesPage.js.map +1 -1
- package/_esm/pages/MainPage/MainPage.js +9 -0
- package/_esm/pages/MainPage/MainPage.js.map +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js +6 -8
- package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/_esm/pages/SelectChainPage/SelectChainPage.js +4 -0
- package/_esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/_esm/pages/SelectEnabledToolsPage.js +5 -8
- package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/_esm/pages/SelectTokenPage/SelectTokenPage.js +11 -0
- package/_esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js +2 -0
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -1
- package/_esm/pages/SendToWallet/BookmarksPage.js +2 -0
- package/_esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/_esm/pages/SendToWallet/ConnectedWalletsPage.js +2 -0
- package/_esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
- package/_esm/pages/SendToWallet/RecentWalletsPage.js +2 -0
- package/_esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js +2 -0
- package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js +2 -0
- package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/_esm/pages/SettingsPage/GasPriceSettings.js +2 -2
- package/_esm/pages/SettingsPage/GasPriceSettings.js.map +1 -1
- package/_esm/pages/SettingsPage/RoutePrioritySettings.js +2 -2
- package/_esm/pages/SettingsPage/RoutePrioritySettings.js.map +1 -1
- package/_esm/pages/SettingsPage/SettingsPage.js +4 -0
- package/_esm/pages/SettingsPage/SettingsPage.js.map +1 -1
- package/_esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +8 -5
- package/_esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js.map +1 -1
- package/_esm/pages/SettingsPage/ThemeSettings.js +2 -2
- package/_esm/pages/SettingsPage/ThemeSettings.js.map +1 -1
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +5 -0
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/_esm/pages/TransactionHistoryPage/TransactionHistoryPage.js +4 -0
- package/_esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
- package/_esm/pages/TransactionPage/StatusBottomSheet.js +4 -3
- package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/_esm/pages/TransactionPage/StatusBottomSheet.style.d.ts +3 -0
- package/_esm/pages/TransactionPage/StatusBottomSheet.style.js +7 -0
- package/_esm/pages/TransactionPage/StatusBottomSheet.style.js.map +1 -1
- package/_esm/pages/TransactionPage/TransactionPage.js +16 -11
- package/_esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/_esm/stores/chains/createChainOrderStore.d.ts +2 -1
- package/_esm/stores/chains/createChainOrderStore.js +6 -5
- package/_esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/_esm/stores/header/useHeaderStore.js.map +1 -1
- package/_esm/themes/azureLight.js +12 -0
- package/_esm/themes/azureLight.js.map +1 -1
- package/_esm/themes/createTheme.js +28 -2
- package/_esm/themes/createTheme.js.map +1 -1
- package/_esm/themes/watermelonLight.js.map +1 -1
- package/_esm/types/widget.d.ts +1 -1
- package/_esm/types/widget.js.map +1 -1
- package/_esm/utils/colors.d.ts +0 -1
- package/_esm/utils/colors.js +0 -3
- package/_esm/utils/colors.js.map +1 -1
- package/components/AppContainer.tsx +1 -1
- package/components/Card/InputCard.tsx +1 -1
- package/components/ChainSelect/ChainSelect.tsx +35 -32
- package/components/Header/Header.style.ts +0 -9
- package/components/Header/NavigationHeader.tsx +1 -67
- package/components/Header/NavigationTabs.tsx +4 -4
- package/components/Skeleton/WidgetSkeleton.style.tsx +63 -0
- package/components/Skeleton/WidgetSkeleton.tsx +136 -0
- package/components/Tabs/Tabs.style.tsx +20 -9
- package/config/version.ts +1 -1
- package/hooks/useAddressValidation.ts +2 -1
- package/hooks/useHeader.ts +18 -0
- package/hooks/useProcessMessage.ts +4 -0
- package/hooks/useToken.ts +1 -1
- package/i18n/en.json +4 -2
- package/index.ts +1 -0
- package/package.json +30 -18
- package/pages/ActiveTransactionsPage/ActiveTransactionsPage.tsx +11 -10
- package/pages/LanguagesPage.tsx +3 -1
- package/pages/MainPage/MainPage.tsx +11 -0
- package/pages/RoutesPage/RoutesPage.tsx +21 -18
- package/pages/SelectChainPage/SelectChainPage.tsx +5 -0
- package/pages/SelectEnabledToolsPage.tsx +17 -15
- package/pages/SelectTokenPage/SelectTokenPage.tsx +14 -0
- package/pages/SelectWalletPage/SelectWalletPage.tsx +3 -0
- package/pages/SendToWallet/BookmarksPage.tsx +3 -0
- package/pages/SendToWallet/ConnectedWalletsPage.tsx +2 -0
- package/pages/SendToWallet/RecentWalletsPage.tsx +3 -0
- package/pages/SendToWallet/SendToConfiguredWalletPage.tsx +3 -0
- package/pages/SendToWallet/SendToWalletPage.tsx +3 -0
- package/pages/SettingsPage/GasPriceSettings.tsx +3 -3
- package/pages/SettingsPage/RoutePrioritySettings.tsx +3 -3
- package/pages/SettingsPage/SettingsPage.tsx +5 -0
- package/pages/SettingsPage/SlippageSettings/SlippageSettings.style.tsx +10 -8
- package/pages/SettingsPage/ThemeSettings.tsx +3 -3
- package/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +7 -0
- package/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +5 -0
- package/pages/TransactionPage/StatusBottomSheet.style.tsx +8 -0
- package/pages/TransactionPage/StatusBottomSheet.tsx +18 -3
- package/pages/TransactionPage/TransactionPage.tsx +20 -14
- package/stores/chains/createChainOrderStore.ts +6 -5
- package/stores/header/useHeaderStore.tsx +0 -1
- package/themes/azureLight.ts +12 -0
- package/themes/createTheme.ts +36 -1
- package/themes/watermelonLight.ts +0 -2
- package/types/widget.ts +1 -0
- package/utils/colors.ts +0 -5
|
@@ -15,6 +15,7 @@ import { Menu } from '../../components/Menu.js';
|
|
|
15
15
|
import type { Account } from '../../hooks/useAccount.js';
|
|
16
16
|
import { useAccount } from '../../hooks/useAccount.js';
|
|
17
17
|
import { useChains } from '../../hooks/useChains.js';
|
|
18
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
18
19
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
19
20
|
import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js';
|
|
20
21
|
import { useFieldActions } from '../../stores/form/useFieldActions.js';
|
|
@@ -42,6 +43,7 @@ export const ConnectedWalletsPage = () => {
|
|
|
42
43
|
const moreMenuId = useId();
|
|
43
44
|
const open = Boolean(moreMenuAnchorEl);
|
|
44
45
|
|
|
46
|
+
useHeader(t('sendToWallet.connectedWallets'));
|
|
45
47
|
const handleWalletSelected = (account: Account) => {
|
|
46
48
|
setFieldValue('toAddress', account.address!, {
|
|
47
49
|
isTouched: true,
|
|
@@ -16,6 +16,7 @@ import { ListItem } from '../../components/ListItem/ListItem.js';
|
|
|
16
16
|
import { ListItemButton } from '../../components/ListItem/ListItemButton.js';
|
|
17
17
|
import { Menu } from '../../components/Menu.js';
|
|
18
18
|
import { useChains } from '../../hooks/useChains.js';
|
|
19
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
19
20
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
20
21
|
import type { Bookmark } from '../../stores/bookmarks/types.js';
|
|
21
22
|
import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js';
|
|
@@ -53,6 +54,8 @@ export const RecentWalletsPage = () => {
|
|
|
53
54
|
const [moreMenuAnchorEl, setMenuAnchorEl] = useState<HTMLElement | null>();
|
|
54
55
|
const open = Boolean(moreMenuAnchorEl);
|
|
55
56
|
|
|
57
|
+
useHeader(t(`header.recentWallets`));
|
|
58
|
+
|
|
56
59
|
const handleRecentSelected = (recentWallet: Bookmark) => {
|
|
57
60
|
addRecentWallet(recentWallet);
|
|
58
61
|
setFieldValue('toAddress', recentWallet.address, {
|
|
@@ -12,6 +12,7 @@ import { ListItem } from '../../components/ListItem/ListItem.js';
|
|
|
12
12
|
import { ListItemButton } from '../../components/ListItem/ListItemButton.js';
|
|
13
13
|
import { Menu } from '../../components/Menu.js';
|
|
14
14
|
import { useChains } from '../../hooks/useChains.js';
|
|
15
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
15
16
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
16
17
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
17
18
|
import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js';
|
|
@@ -39,6 +40,8 @@ export const SendToConfiguredWalletPage = () => {
|
|
|
39
40
|
const [moreMenuAnchorEl, setMenuAnchorEl] = useState<HTMLElement | null>();
|
|
40
41
|
const open = Boolean(moreMenuAnchorEl);
|
|
41
42
|
|
|
43
|
+
useHeader(t(`header.sendToWallet`));
|
|
44
|
+
|
|
42
45
|
const handleCuratedSelected = (toAddress: ToAddress) => {
|
|
43
46
|
setSelectedBookmark(toAddress);
|
|
44
47
|
setFieldValue('toAddress', toAddress.address, { isTouched: true });
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useAddressValidation,
|
|
14
14
|
} from '../../hooks/useAddressValidation.js';
|
|
15
15
|
import { useChain } from '../../hooks/useChain.js';
|
|
16
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
16
17
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
17
18
|
import type { Bookmark } from '../../stores/bookmarks/types.js';
|
|
18
19
|
import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js';
|
|
@@ -59,6 +60,8 @@ export const SendToWalletPage = () => {
|
|
|
59
60
|
const [isDoneButtonLoading, setIsDoneButtonLoading] = useState(false);
|
|
60
61
|
const [isBookmarkButtonLoading, setIsBookmarkButtonLoading] = useState(false);
|
|
61
62
|
|
|
63
|
+
useHeader(t(`header.sendToWallet`));
|
|
64
|
+
|
|
62
65
|
const handleInputChange = (e: ChangeEvent) => {
|
|
63
66
|
if (errorMessage) {
|
|
64
67
|
setErrorMessage('');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EvStation } from '@mui/icons-material';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import {
|
|
3
|
+
import { CardTabs, Tab } from '../../components/Tabs/Tabs.style.js';
|
|
4
4
|
import { useSettingMonitor } from '../../hooks/useSettingMonitor.js';
|
|
5
5
|
import { useSettings } from '../../stores/settings/useSettings.js';
|
|
6
6
|
import { useSettingsStore } from '../../stores/settings/useSettingsStore.js';
|
|
@@ -27,7 +27,7 @@ export const GasPriceSettings: React.FC = () => {
|
|
|
27
27
|
icon={<EvStation />}
|
|
28
28
|
title={t(`settings.gasPrice.title`)}
|
|
29
29
|
>
|
|
30
|
-
<
|
|
30
|
+
<CardTabs
|
|
31
31
|
value={gasPrice}
|
|
32
32
|
aria-label="tabs"
|
|
33
33
|
indicatorColor="primary"
|
|
@@ -41,7 +41,7 @@ export const GasPriceSettings: React.FC = () => {
|
|
|
41
41
|
disableRipple
|
|
42
42
|
/>
|
|
43
43
|
<Tab label={t(`settings.gasPrice.fast`)} value="fast" disableRipple />
|
|
44
|
-
</
|
|
44
|
+
</CardTabs>
|
|
45
45
|
</SettingCardExpandable>
|
|
46
46
|
);
|
|
47
47
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Order } from '@lifi/sdk';
|
|
2
2
|
import { Route } from '@mui/icons-material';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import {
|
|
4
|
+
import { CardTabs, Tab } from '../../components/Tabs/Tabs.style.js';
|
|
5
5
|
import { useSettingMonitor } from '../../hooks/useSettingMonitor.js';
|
|
6
6
|
import { useSettings } from '../../stores/settings/useSettings.js';
|
|
7
7
|
import { useSettingsStore } from '../../stores/settings/useSettingsStore.js';
|
|
@@ -34,7 +34,7 @@ export const RoutePrioritySettings: React.FC = () => {
|
|
|
34
34
|
icon={<Route />}
|
|
35
35
|
title={t(`settings.routePriority`)}
|
|
36
36
|
>
|
|
37
|
-
<
|
|
37
|
+
<CardTabs
|
|
38
38
|
value={currentRoutePriority}
|
|
39
39
|
aria-label="tabs"
|
|
40
40
|
indicatorColor="primary"
|
|
@@ -52,7 +52,7 @@ export const RoutePrioritySettings: React.FC = () => {
|
|
|
52
52
|
/>
|
|
53
53
|
);
|
|
54
54
|
})}
|
|
55
|
-
</
|
|
55
|
+
</CardTabs>
|
|
56
56
|
</SettingCardExpandable>
|
|
57
57
|
);
|
|
58
58
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
1
2
|
import { PageContainer } from '../../components/PageContainer.js';
|
|
3
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
2
4
|
import { BridgeAndExchangeSettings } from './BridgeAndExchangeSettings.js';
|
|
3
5
|
import { GasPriceSettings } from './GasPriceSettings.js';
|
|
4
6
|
import { LanguageSetting } from './LanguageSetting.js';
|
|
@@ -10,6 +12,9 @@ import { SlippageSettings } from './SlippageSettings/SlippageSettings.js';
|
|
|
10
12
|
import { ThemeSettings } from './ThemeSettings.js';
|
|
11
13
|
|
|
12
14
|
export const SettingsPage = () => {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
useHeader(t(`header.settings`));
|
|
17
|
+
|
|
13
18
|
return (
|
|
14
19
|
<PageContainer bottomGutters>
|
|
15
20
|
<SettingsList>
|
|
@@ -7,23 +7,25 @@ import {
|
|
|
7
7
|
inputBaseClasses,
|
|
8
8
|
styled,
|
|
9
9
|
} from '@mui/material';
|
|
10
|
-
import { getCardFieldsetBackgroundColor } from '../../../utils/colors.js';
|
|
11
10
|
|
|
12
11
|
export const SettingsFieldSet = styled(Box)(({ theme }) => ({
|
|
13
12
|
display: 'flex',
|
|
14
|
-
backgroundColor:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
backgroundColor:
|
|
14
|
+
theme.palette.mode === 'light'
|
|
15
|
+
? alpha(theme.palette.common.black, 0.04)
|
|
16
|
+
: alpha(theme.palette.common.white, 0.08),
|
|
17
|
+
borderRadius: theme.shape.borderRadius,
|
|
19
18
|
padding: theme.spacing(0.5),
|
|
20
19
|
gap: theme.spacing(0.5),
|
|
21
20
|
height: '3.5rem',
|
|
22
21
|
}));
|
|
23
22
|
|
|
24
23
|
const slippageControlSelected = (theme: Theme) => ({
|
|
25
|
-
backgroundColor:
|
|
26
|
-
|
|
24
|
+
backgroundColor:
|
|
25
|
+
theme.palette.mode === 'light'
|
|
26
|
+
? theme.palette.background.paper
|
|
27
|
+
: alpha(theme.palette.common.black, 0.56),
|
|
28
|
+
borderRadius: theme.shape.borderRadius - 4,
|
|
27
29
|
boxShadow: `0px 2px 4px ${alpha(theme.palette.common.black, 0.04)}`,
|
|
28
30
|
});
|
|
29
31
|
|
|
@@ -2,7 +2,7 @@ import { BrightnessAuto, LightMode, Nightlight } from '@mui/icons-material';
|
|
|
2
2
|
import { Tooltip } from '@mui/material';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { CardValue } from '../../components/Card/CardButton.style.js';
|
|
5
|
-
import {
|
|
5
|
+
import { CardTabs, Tab } from '../../components/Tabs/Tabs.style.js';
|
|
6
6
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
7
7
|
import { useAppearance } from '../../stores/settings/useAppearance.js';
|
|
8
8
|
import type { Appearance } from '../../types/widget.js';
|
|
@@ -58,7 +58,7 @@ export const ThemeSettings: React.FC = () => {
|
|
|
58
58
|
icon={<ThemeIcon />}
|
|
59
59
|
title={t('settings.theme')}
|
|
60
60
|
>
|
|
61
|
-
<
|
|
61
|
+
<CardTabs
|
|
62
62
|
value={appearance}
|
|
63
63
|
aria-label="tabs"
|
|
64
64
|
indicatorColor="primary"
|
|
@@ -77,7 +77,7 @@ export const ThemeSettings: React.FC = () => {
|
|
|
77
77
|
/>
|
|
78
78
|
);
|
|
79
79
|
})}
|
|
80
|
-
</
|
|
80
|
+
</CardTabs>
|
|
81
81
|
</SettingCardExpandable>
|
|
82
82
|
);
|
|
83
83
|
};
|
|
@@ -10,6 +10,7 @@ import { ContractComponent } from '../../components/ContractComponent/ContractCo
|
|
|
10
10
|
import { Insurance } from '../../components/Insurance/Insurance.js';
|
|
11
11
|
import { PageContainer } from '../../components/PageContainer.js';
|
|
12
12
|
import { getStepList } from '../../components/Step/StepList.js';
|
|
13
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
13
14
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js';
|
|
14
15
|
import { useTools } from '../../hooks/useTools.js';
|
|
15
16
|
import { useTransactionDetails } from '../../hooks/useTransactionDetails.js';
|
|
@@ -36,6 +37,12 @@ export const TransactionDetailsPage: React.FC = () => {
|
|
|
36
37
|
state?.transactionHash,
|
|
37
38
|
);
|
|
38
39
|
|
|
40
|
+
const title =
|
|
41
|
+
subvariant === 'custom'
|
|
42
|
+
? t(`header.purchaseDetails`)
|
|
43
|
+
: t(`header.transactionDetails`);
|
|
44
|
+
useHeader(title);
|
|
45
|
+
|
|
39
46
|
const routeExecution = useMemo(() => {
|
|
40
47
|
if (storedRouteExecution) {
|
|
41
48
|
return storedRouteExecution;
|
|
@@ -2,7 +2,9 @@ import type { FullStatusData } from '@lifi/sdk';
|
|
|
2
2
|
import { List } from '@mui/material';
|
|
3
3
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
import { useRef } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
5
6
|
import { PageContainer } from '../../components/PageContainer.js';
|
|
7
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
6
8
|
import { useTransactionHistory } from '../../hooks/useTransactionHistory.js';
|
|
7
9
|
import { TransactionHistoryEmpty } from './TransactionHistoryEmpty.js';
|
|
8
10
|
import { TransactionHistoryItem } from './TransactionHistoryItem.js';
|
|
@@ -14,6 +16,9 @@ export const TransactionHistoryPage: React.FC = () => {
|
|
|
14
16
|
const parentRef = useRef<HTMLDivElement | null>(null);
|
|
15
17
|
const { data: transactions, isLoading } = useTransactionHistory();
|
|
16
18
|
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
useHeader(t(`header.transactionHistory`));
|
|
21
|
+
|
|
17
22
|
const { getVirtualItems, getTotalSize } = useVirtualizer({
|
|
18
23
|
count: transactions.length,
|
|
19
24
|
overscan: 10,
|
|
@@ -52,3 +52,11 @@ export const IconCircle = styled(Box, {
|
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
});
|
|
55
|
+
|
|
56
|
+
export const MessageSkeletonContainer = styled(Box)(({ theme }) => ({
|
|
57
|
+
display: 'flex',
|
|
58
|
+
flexDirection: 'column',
|
|
59
|
+
height: 64,
|
|
60
|
+
gap: theme.spacing(0.5),
|
|
61
|
+
paddingTop: theme.spacing(1),
|
|
62
|
+
}));
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
InfoRounded,
|
|
5
5
|
WarningRounded,
|
|
6
6
|
} from '@mui/icons-material';
|
|
7
|
-
import { Box, Button, Typography } from '@mui/material';
|
|
7
|
+
import { Box, Button, Skeleton, Typography } from '@mui/material';
|
|
8
8
|
import { useQueryClient } from '@tanstack/react-query';
|
|
9
9
|
import { useCallback, useEffect, useRef } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
@@ -27,12 +27,23 @@ import { hasEnumFlag } from '../../utils/enum.js';
|
|
|
27
27
|
import { formatTokenAmount } from '../../utils/format.js';
|
|
28
28
|
import { navigationRoutes } from '../../utils/navigationRoutes.js';
|
|
29
29
|
import { shortenAddress } from '../../utils/wallet.js';
|
|
30
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
CenterContainer,
|
|
32
|
+
IconCircle,
|
|
33
|
+
MessageSkeletonContainer,
|
|
34
|
+
} from './StatusBottomSheet.style.js';
|
|
31
35
|
|
|
32
36
|
interface StatusBottomSheetContentProps extends RouteExecution {
|
|
33
37
|
onClose(): void;
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
const MessageSkeleton = () => (
|
|
41
|
+
<MessageSkeletonContainer>
|
|
42
|
+
<Skeleton height={24} variant="text" width="92%" />
|
|
43
|
+
<Skeleton height={24} variant="text" width="56%" />
|
|
44
|
+
</MessageSkeletonContainer>
|
|
45
|
+
);
|
|
46
|
+
|
|
36
47
|
export const StatusBottomSheet: React.FC<RouteExecution> = ({
|
|
37
48
|
status,
|
|
38
49
|
route,
|
|
@@ -270,7 +281,11 @@ export const StatusBottomSheetContent: React.FC<
|
|
|
270
281
|
</CenterContainer>
|
|
271
282
|
)}
|
|
272
283
|
{!showContractComponent ? (
|
|
273
|
-
|
|
284
|
+
primaryMessage ? (
|
|
285
|
+
<Typography py={1}>{primaryMessage}</Typography>
|
|
286
|
+
) : (
|
|
287
|
+
<MessageSkeleton />
|
|
288
|
+
)
|
|
274
289
|
) : null}
|
|
275
290
|
{secondaryMessage ? (
|
|
276
291
|
<Typography py={1}>{secondaryMessage}</Typography>
|
|
@@ -10,12 +10,12 @@ import { GasMessage } from '../../components/GasMessage/GasMessage.js';
|
|
|
10
10
|
import { Insurance } from '../../components/Insurance/Insurance.js';
|
|
11
11
|
import { PageContainer } from '../../components/PageContainer.js';
|
|
12
12
|
import { getStepList } from '../../components/Step/StepList.js';
|
|
13
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
13
14
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js';
|
|
14
15
|
import { useRouteExecution } from '../../hooks/useRouteExecution.js';
|
|
15
16
|
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js';
|
|
16
17
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
17
18
|
import { useFieldActions } from '../../stores/form/useFieldActions.js';
|
|
18
|
-
import { useHeaderStoreContext } from '../../stores/header/useHeaderStore.js';
|
|
19
19
|
import { RouteExecutionStatus } from '../../stores/routes/types.js';
|
|
20
20
|
import { WidgetEvent } from '../../types/events.js';
|
|
21
21
|
import { formatTokenAmount } from '../../utils/format.js';
|
|
@@ -40,7 +40,6 @@ export const TransactionPage: React.FC = () => {
|
|
|
40
40
|
const { subvariant, insurance, contractSecondaryComponent } =
|
|
41
41
|
useWidgetConfig();
|
|
42
42
|
const { state }: any = useLocation();
|
|
43
|
-
const headerStoreContext = useHeaderStoreContext();
|
|
44
43
|
const stateRouteId = state?.routeId;
|
|
45
44
|
const [routeId, setRouteId] = useState<string>(stateRouteId);
|
|
46
45
|
|
|
@@ -60,19 +59,26 @@ export const TransactionPage: React.FC = () => {
|
|
|
60
59
|
onAcceptExchangeRateUpdate,
|
|
61
60
|
});
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
const getHeaderTitle = () => {
|
|
63
|
+
if (subvariant === 'custom') {
|
|
64
|
+
return t(`header.purchase`);
|
|
65
|
+
} else {
|
|
66
|
+
if (route) {
|
|
67
|
+
const transactionType =
|
|
68
|
+
route.fromChainId === route.toChainId ? 'Swap' : 'Bridge';
|
|
69
|
+
|
|
70
|
+
return status === RouteExecutionStatus.Idle
|
|
71
|
+
? t(`button.review${transactionType}`)
|
|
72
|
+
: t(`header.${transactionType.toLowerCase() as 'swap' | 'bridge'}`);
|
|
73
|
+
}
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
|
|
76
|
+
return t(`header.exchange`);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const title = getHeaderTitle();
|
|
80
|
+
|
|
81
|
+
useHeader(title);
|
|
76
82
|
|
|
77
83
|
useEffect(() => {
|
|
78
84
|
if (status === RouteExecutionStatus.Idle) {
|
|
@@ -4,7 +4,8 @@ import { createWithEqualityFn } from 'zustand/traditional';
|
|
|
4
4
|
import type { PersistStoreProps } from '../types.js';
|
|
5
5
|
import type { ChainOrderState } from './types.js';
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const maxChainsToOrder = 9;
|
|
8
|
+
export const maxChainsToShow = 10;
|
|
8
9
|
const defaultChainState = {
|
|
9
10
|
from: [],
|
|
10
11
|
to: [],
|
|
@@ -24,7 +25,7 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
24
25
|
const chainsToAdd = chainIds.filter(
|
|
25
26
|
(chainId) => !chainOrder.includes(chainId),
|
|
26
27
|
);
|
|
27
|
-
if (chainOrder.length ===
|
|
28
|
+
if (chainOrder.length === maxChainsToOrder || !chainsToAdd.length) {
|
|
28
29
|
return {
|
|
29
30
|
availableChains: {
|
|
30
31
|
...state.availableChains,
|
|
@@ -36,7 +37,7 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
36
37
|
},
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
|
-
const chainsToAddLength =
|
|
40
|
+
const chainsToAddLength = maxChainsToOrder - chainOrder.length;
|
|
40
41
|
for (let index = 0; index < chainsToAddLength; index++) {
|
|
41
42
|
chainOrder.push(chainsToAdd[index]);
|
|
42
43
|
}
|
|
@@ -64,7 +65,7 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
64
65
|
set((state: ChainOrderState) => {
|
|
65
66
|
const chainOrder = state.chainOrder[type].slice();
|
|
66
67
|
chainOrder.unshift(chainId);
|
|
67
|
-
if (chainOrder.length >
|
|
68
|
+
if (chainOrder.length > maxChainsToOrder) {
|
|
68
69
|
chainOrder.pop();
|
|
69
70
|
}
|
|
70
71
|
return {
|
|
@@ -78,7 +79,7 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
78
79
|
}),
|
|
79
80
|
{
|
|
80
81
|
name: `${namePrefix || 'li.fi'}-widget-chains-order`,
|
|
81
|
-
version:
|
|
82
|
+
version: 2,
|
|
82
83
|
partialize: (state) => ({ chainOrder: state.chainOrder }),
|
|
83
84
|
},
|
|
84
85
|
) as StateCreator<ChainOrderState, [], [], ChainOrderState>,
|
|
@@ -34,7 +34,6 @@ export function useHeaderStore<T>(selector: (state: HeaderState) => T): T {
|
|
|
34
34
|
const useStore = useHeaderStoreContext();
|
|
35
35
|
return useStore(selector);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
37
|
export const createHeaderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
39
38
|
createWithEqualityFn<HeaderState>(
|
|
40
39
|
(set, get) => ({
|
package/themes/azureLight.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tabsClasses } from '@mui/material';
|
|
1
2
|
import type { WidgetTheme } from '../types/widget.js';
|
|
2
3
|
|
|
3
4
|
export const azureLightTheme: WidgetTheme = {
|
|
@@ -42,5 +43,16 @@ export const azureLightTheme: WidgetTheme = {
|
|
|
42
43
|
MuiCard: {
|
|
43
44
|
defaultProps: { variant: 'filled' },
|
|
44
45
|
},
|
|
46
|
+
// Used only for 'split' subvariant and can be safely removed if not used
|
|
47
|
+
MuiTabs: {
|
|
48
|
+
styleOverrides: {
|
|
49
|
+
root: {
|
|
50
|
+
backgroundColor: '#f8f8fa',
|
|
51
|
+
[`.${tabsClasses.indicator}`]: {
|
|
52
|
+
backgroundColor: '#ffffff',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
45
57
|
},
|
|
46
58
|
};
|
package/themes/createTheme.ts
CHANGED
|
@@ -15,12 +15,13 @@ import {
|
|
|
15
15
|
getContrastRatio,
|
|
16
16
|
keyframes,
|
|
17
17
|
lighten,
|
|
18
|
+
tabsClasses,
|
|
18
19
|
touchRippleClasses,
|
|
19
20
|
} from '@mui/material';
|
|
20
21
|
import type { WidgetTheme } from '../types/widget.js';
|
|
22
|
+
import { palette, paletteDark, paletteLight } from './palettes.js';
|
|
21
23
|
import type {} from './types.js';
|
|
22
24
|
import { getStyleOverrides } from './utils.js';
|
|
23
|
-
import { palette, paletteLight, paletteDark } from './palettes.js';
|
|
24
25
|
|
|
25
26
|
const shape: Shape = {
|
|
26
27
|
borderRadius: 12,
|
|
@@ -365,6 +366,40 @@ export const createTheme = (
|
|
|
365
366
|
}),
|
|
366
367
|
},
|
|
367
368
|
},
|
|
369
|
+
MuiTabs: {
|
|
370
|
+
...widgetTheme.components?.MuiTabs,
|
|
371
|
+
styleOverrides: {
|
|
372
|
+
...widgetTheme.components?.MuiTabs?.styleOverrides,
|
|
373
|
+
root: ({ theme, ownerState }) => {
|
|
374
|
+
const rootStyleOverrides = getStyleOverrides(
|
|
375
|
+
'MuiTabs',
|
|
376
|
+
'root',
|
|
377
|
+
widgetTheme,
|
|
378
|
+
ownerState,
|
|
379
|
+
);
|
|
380
|
+
return {
|
|
381
|
+
backgroundColor:
|
|
382
|
+
theme.palette.mode === 'light'
|
|
383
|
+
? alpha(theme.palette.common.black, 0.04)
|
|
384
|
+
: alpha(theme.palette.common.white, 0.08),
|
|
385
|
+
borderRadius: theme.shape.borderRadius,
|
|
386
|
+
...rootStyleOverrides,
|
|
387
|
+
[`.${tabsClasses.indicator}`]: {
|
|
388
|
+
backgroundColor:
|
|
389
|
+
theme.palette.mode === 'light'
|
|
390
|
+
? theme.palette.background.paper
|
|
391
|
+
: alpha(theme.palette.common.black, 0.56),
|
|
392
|
+
borderRadius:
|
|
393
|
+
theme.shape.borderRadius > 0
|
|
394
|
+
? theme.shape.borderRadius - 4
|
|
395
|
+
: theme.shape.borderRadius,
|
|
396
|
+
boxShadow: `0px 2px 4px ${alpha(theme.palette.common.black, 0.04)}`,
|
|
397
|
+
...rootStyleOverrides?.[`.${tabsClasses.indicator}`],
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
},
|
|
368
403
|
},
|
|
369
404
|
});
|
|
370
405
|
};
|
package/types/widget.ts
CHANGED
package/utils/colors.ts
CHANGED
|
@@ -16,11 +16,6 @@ export const getInfoBackgroundColor = (theme: Theme) =>
|
|
|
16
16
|
? alpha(theme.palette.info.main, 0.12)
|
|
17
17
|
: alpha(theme.palette.info.main, 0.16);
|
|
18
18
|
|
|
19
|
-
export const getCardFieldsetBackgroundColor = (theme: Theme) =>
|
|
20
|
-
theme.palette.mode === 'light'
|
|
21
|
-
? alpha(theme.palette.common.black, 0.04)
|
|
22
|
-
: theme.palette.grey[800];
|
|
23
|
-
|
|
24
19
|
/**
|
|
25
20
|
* https://github.com/mui/material-ui/blob/next/packages/mui-system/src/colorManipulator/colorManipulator.js
|
|
26
21
|
* Blend a transparent overlay color with a background color, resulting in a single
|