@lifi/widget 1.17.2 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +6 -86
- package/AppDrawer.js +3 -2
- package/AppRoutes.d.ts +2 -0
- package/AppRoutes.js +85 -0
- package/cjs/App.js +5 -85
- package/cjs/AppDrawer.js +2 -1
- package/cjs/AppRoutes.d.ts +2 -0
- package/cjs/AppRoutes.js +89 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
- package/cjs/components/AppContainer.d.ts +4 -5
- package/cjs/components/AppContainer.js +30 -29
- package/cjs/components/Card/Card.d.ts +1 -0
- package/cjs/components/Card/Card.js +13 -9
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/cjs/components/ChainSelect/ChainSelect.js +3 -3
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -0
- package/cjs/components/ChainSelect/ChainSelect.style.js +2 -2
- package/cjs/components/ChainSelect/useChainSelect.js +2 -2
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
- package/cjs/components/Header/Header.d.ts +2 -1
- package/cjs/components/Header/Header.js +3 -2
- package/cjs/components/Header/Header.style.js +3 -2
- package/cjs/components/Header/NavigationHeader.js +4 -1
- package/cjs/components/Header/WalletHeader.js +1 -1
- package/cjs/components/PoweredBy/PoweredBy.js +7 -0
- package/cjs/components/SendToWallet/SendToWallet.js +6 -10
- package/cjs/components/SendToWallet/SendToWalletButton.d.ts +2 -0
- package/cjs/components/SendToWallet/SendToWalletButton.js +24 -0
- package/cjs/components/SendToWallet/index.d.ts +1 -0
- package/cjs/components/SendToWallet/index.js +1 -0
- package/cjs/components/SendToWallet/store.d.ts +4 -0
- package/cjs/components/SendToWallet/store.js +13 -0
- package/cjs/components/SendToWallet/types.d.ts +6 -0
- package/cjs/{stores/route → components/SendToWallet}/types.js +0 -0
- package/cjs/components/Step/CircularProgress.d.ts +1 -0
- package/cjs/components/StepActions/StepActions.style.js +1 -1
- package/cjs/components/SwapButton/ButtonTooltip.d.ts +1 -0
- package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
- package/cjs/components/SwapButton/SwapButton.js +4 -4
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -15
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +16 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
- package/cjs/components/SwapRouteCard/types.d.ts +6 -2
- package/cjs/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
- package/cjs/components/SwapRoutes/SwapRoutes.js +51 -0
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
- package/cjs/components/SwapRoutes/SwapRoutes.style.js +47 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +38 -0
- package/cjs/components/SwapRoutes/index.d.ts +2 -0
- package/cjs/components/SwapRoutes/index.js +18 -0
- package/cjs/components/Token/Token.d.ts +2 -1
- package/cjs/components/Token/Token.js +10 -6
- package/cjs/components/Token/Token.style.js +2 -0
- package/cjs/config/theme.js +20 -24
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChains.js +2 -2
- package/cjs/hooks/useNavigateBack.js +13 -6
- package/cjs/hooks/useRouteExecution.js +4 -4
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/MainPage/MainPage.js +4 -2
- package/cjs/pages/MainPage/MainSwapButton.js +4 -4
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -3
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
- package/cjs/pages/SwapPage/SwapPage.js +5 -1
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
- package/cjs/stores/index.d.ts +2 -1
- package/cjs/stores/index.js +2 -1
- package/cjs/stores/{route → routes}/index.d.ts +2 -1
- package/cjs/stores/{route → routes}/index.js +2 -1
- package/cjs/stores/{route → routes}/types.d.ts +4 -0
- package/cjs/stores/routes/types.js +2 -0
- package/cjs/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
- package/cjs/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
- package/cjs/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
- package/cjs/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +2 -2
- package/cjs/stores/routes/useSelectedRouteStore.d.ts +4 -0
- package/cjs/stores/routes/useSelectedRouteStore.js +12 -0
- package/cjs/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
- package/cjs/stores/{route → routes}/useSetExecutableRoute.js +2 -2
- package/cjs/stores/{route → routes}/useSwapHistory.d.ts +0 -0
- package/cjs/stores/{route → routes}/useSwapHistory.js +2 -2
- package/cjs/stores/{route → routes}/utils.d.ts +0 -0
- package/cjs/stores/{route → routes}/utils.js +0 -0
- package/cjs/stores/settings/useSettingsStore.js +1 -1
- package/cjs/types/widget.d.ts +2 -0
- package/cjs/utils/colors.d.ts +1 -1
- package/cjs/utils/navigationRoutes.js +12 -12
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
- package/components/AppContainer.d.ts +4 -5
- package/components/AppContainer.js +29 -28
- package/components/Card/Card.d.ts +1 -0
- package/components/Card/Card.js +13 -9
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/ChainSelect/ChainSelect.js +1 -1
- package/components/ChainSelect/ChainSelect.style.d.ts +1 -0
- package/components/ChainSelect/ChainSelect.style.js +2 -2
- package/components/ChainSelect/useChainSelect.js +1 -1
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
- package/components/Header/Header.d.ts +2 -1
- package/components/Header/Header.js +1 -1
- package/components/Header/Header.style.js +4 -3
- package/components/Header/NavigationHeader.js +4 -1
- package/components/Header/WalletHeader.js +2 -2
- package/components/PoweredBy/PoweredBy.js +7 -0
- package/components/SendToWallet/SendToWallet.js +8 -11
- package/components/SendToWallet/SendToWalletButton.d.ts +2 -0
- package/components/SendToWallet/SendToWalletButton.js +20 -0
- package/components/SendToWallet/index.d.ts +1 -0
- package/components/SendToWallet/index.js +1 -0
- package/components/SendToWallet/store.d.ts +4 -0
- package/components/SendToWallet/store.js +10 -0
- package/components/SendToWallet/types.d.ts +6 -0
- package/{stores/route → components/SendToWallet}/types.js +0 -0
- package/components/Step/CircularProgress.d.ts +1 -0
- package/components/StepActions/StepActions.style.js +1 -1
- package/components/SwapButton/ButtonTooltip.d.ts +1 -0
- package/components/SwapButton/SwapButton.d.ts +1 -1
- package/components/SwapButton/SwapButton.js +4 -3
- package/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
- package/components/SwapRouteCard/SwapRouteCard.js +19 -16
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
- package/components/SwapRouteCard/SwapRouteCard.style.js +17 -4
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
- package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
- package/components/SwapRouteCard/types.d.ts +6 -2
- package/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
- package/components/SwapRoutes/SwapRoutes.js +47 -0
- package/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
- package/components/SwapRoutes/SwapRoutes.style.js +44 -0
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
- package/components/SwapRoutes/SwapRoutesExpanded.js +34 -0
- package/components/SwapRoutes/index.d.ts +2 -0
- package/components/SwapRoutes/index.js +2 -0
- package/components/Token/Token.d.ts +2 -1
- package/components/Token/Token.js +11 -7
- package/components/Token/Token.style.js +2 -0
- package/config/theme.js +20 -24
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChains.js +1 -1
- package/hooks/useNavigateBack.js +13 -6
- package/hooks/useRouteExecution.js +5 -5
- package/package.json +11 -11
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/MainPage/MainPage.js +4 -2
- package/pages/MainPage/MainSwapButton.js +4 -3
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/pages/SelectTokenPage/SelectTokenPage.js +4 -3
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
- package/pages/SwapPage/SwapPage.js +5 -1
- package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/providers/WalletProvider/WalletProvider.js +1 -1
- package/stores/index.d.ts +2 -1
- package/stores/index.js +2 -1
- package/stores/{route → routes}/index.d.ts +2 -1
- package/stores/{route → routes}/index.js +2 -1
- package/stores/{route → routes}/types.d.ts +4 -0
- package/stores/routes/types.js +1 -0
- package/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
- package/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
- package/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
- package/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +1 -1
- package/stores/routes/useSelectedRouteStore.d.ts +4 -0
- package/stores/routes/useSelectedRouteStore.js +9 -0
- package/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
- package/stores/routes/useSetExecutableRoute.js +4 -0
- package/stores/{route → routes}/useSwapHistory.d.ts +0 -0
- package/stores/{route → routes}/useSwapHistory.js +2 -2
- package/stores/{route → routes}/utils.d.ts +0 -0
- package/stores/{route → routes}/utils.js +0 -0
- package/stores/settings/useSettingsStore.js +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +2 -0
- package/utils/colors.d.ts +1 -1
- package/utils/navigationRoutes.js +12 -12
- package/cjs/pages/MainPage/SwapRoutes.js +0 -43
- package/cjs/pages/MainPage/SwapRoutes.style.d.ts +0 -11
- package/cjs/pages/MainPage/SwapRoutes.style.js +0 -16
- package/pages/MainPage/SwapRoutes.js +0 -39
- package/pages/MainPage/SwapRoutes.style.d.ts +0 -11
- package/pages/MainPage/SwapRoutes.style.js +0 -13
- package/stores/route/useSetExecutableRoute.js +0 -4
|
@@ -14,7 +14,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
14
14
|
const wallet_management_1 = require("@lifi/wallet-management");
|
|
15
15
|
const react_1 = require("react");
|
|
16
16
|
const react_hook_form_1 = require("react-hook-form");
|
|
17
|
-
const
|
|
17
|
+
const stores_1 = require("../../stores");
|
|
18
18
|
const SwapFormProvider_1 = require("../SwapFormProvider");
|
|
19
19
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
20
20
|
const stub = () => {
|
|
@@ -112,7 +112,7 @@ const WalletProvider = ({ children }) => {
|
|
|
112
112
|
const { isDirty: isToChainDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.ToChain, methods.formState);
|
|
113
113
|
const { isDirty: isFromTokenDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.FromToken, methods.formState);
|
|
114
114
|
const { isDirty: isToTokenDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.ToToken, methods.formState);
|
|
115
|
-
const { chainOrder, setChain } =
|
|
115
|
+
const { chainOrder, setChain } = stores_1.useChainOrderStore.getState();
|
|
116
116
|
// Users can switch chains in the wallet.
|
|
117
117
|
// If we don't have a chain in the ordered chain list we should add it.
|
|
118
118
|
setChain(account.chainId);
|
package/cjs/stores/index.d.ts
CHANGED
package/cjs/stores/index.js
CHANGED
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./chains"), exports);
|
|
18
|
+
__exportStar(require("./routes"), exports);
|
|
18
19
|
__exportStar(require("./settings"), exports);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export * from './useExecutingRoutesIds';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './useRouteExecutionStore';
|
|
4
|
+
export * from './useSelectedRouteStore';
|
|
4
5
|
export * from './useSetExecutableRoute';
|
|
5
6
|
export * from './useSwapHistory';
|
|
6
7
|
export * from './utils';
|
|
@@ -16,7 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
18
|
__exportStar(require("./useExecutingRoutesIds"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./useRouteExecutionStore"), exports);
|
|
20
|
+
__exportStar(require("./useSelectedRouteStore"), exports);
|
|
20
21
|
__exportStar(require("./useSetExecutableRoute"), exports);
|
|
21
22
|
__exportStar(require("./useSwapHistory"), exports);
|
|
22
23
|
__exportStar(require("./utils"), exports);
|
|
File without changes
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useExecutingRoutesIds = void 0;
|
|
4
4
|
const shallow_1 = require("zustand/shallow");
|
|
5
|
-
const
|
|
5
|
+
const useRouteExecutionStore_1 = require("./useRouteExecutionStore");
|
|
6
6
|
const useExecutingRoutesIds = (address) => {
|
|
7
|
-
return (0,
|
|
7
|
+
return (0, useRouteExecutionStore_1.useRouteExecutionStore)((state) => Object.values(state.routes)
|
|
8
8
|
.filter((item) => item.route.fromAddress === address &&
|
|
9
9
|
(item.status === 'loading' || item.status === 'error'))
|
|
10
10
|
.sort((a, b) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteExecutionStore } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const useRouteExecutionStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<RouteExecutionStore>, "persist"> & {
|
|
3
3
|
persist: {
|
|
4
4
|
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<RouteExecutionStore, {
|
|
5
5
|
routes: Partial<Record<string, import("./types").RouteExecution>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useRouteExecutionStore = void 0;
|
|
4
4
|
const zustand_1 = require("zustand");
|
|
5
5
|
const middleware_1 = require("zustand/middleware");
|
|
6
6
|
const immer_1 = require("zustand/middleware/immer");
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
|
-
exports.
|
|
8
|
+
exports.useRouteExecutionStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, immer_1.immer)((set) => ({
|
|
9
9
|
routes: {},
|
|
10
10
|
setExecutableRoute: (route) => set((state) => {
|
|
11
11
|
if (!state.routes[route.id]) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SelectedRouteStore } from './types';
|
|
2
|
+
export declare const useSelectedRouteStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SelectedRouteStore>, "setState"> & {
|
|
3
|
+
setState(nextStateOrUpdater: SelectedRouteStore | Partial<SelectedRouteStore> | ((state: import("immer/dist/internal").WritableDraft<SelectedRouteStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSelectedRouteStore = void 0;
|
|
4
|
+
const zustand_1 = require("zustand");
|
|
5
|
+
const immer_1 = require("zustand/middleware/immer");
|
|
6
|
+
exports.useSelectedRouteStore = (0, zustand_1.default)()((0, immer_1.immer)((set) => ({
|
|
7
|
+
setSelectedRoute: (route) => {
|
|
8
|
+
set((state) => {
|
|
9
|
+
state.selectedRoute = route;
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
})));
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSetExecutableRoute = void 0;
|
|
4
|
-
const
|
|
4
|
+
const useRouteExecutionStore_1 = require("./useRouteExecutionStore");
|
|
5
5
|
const useSetExecutableRoute = () => {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, useRouteExecutionStore_1.useRouteExecutionStore)((state) => state.setExecutableRoute);
|
|
7
7
|
};
|
|
8
8
|
exports.useSetExecutableRoute = useSetExecutableRoute;
|
|
File without changes
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSwapHistory = void 0;
|
|
4
4
|
const shallow_1 = require("zustand/shallow");
|
|
5
|
-
const
|
|
5
|
+
const useRouteExecutionStore_1 = require("./useRouteExecutionStore");
|
|
6
6
|
const useSwapHistory = (address) => {
|
|
7
|
-
return (0,
|
|
7
|
+
return (0, useRouteExecutionStore_1.useRouteExecutionStore)((state) => Object.values(state.routes)
|
|
8
8
|
.filter((item) => (item === null || item === void 0 ? void 0 : item.route.fromAddress) === address && (item === null || item === void 0 ? void 0 : item.status) === 'success')
|
|
9
9
|
.sort((a, b) => {
|
|
10
10
|
var _a, _b, _c, _d;
|
|
File without changes
|
|
File without changes
|
|
@@ -19,7 +19,7 @@ const immer_1 = require("zustand/middleware/immer");
|
|
|
19
19
|
const types_1 = require("./types");
|
|
20
20
|
exports.useSettingsStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, immer_1.immer)((set) => ({
|
|
21
21
|
advancedPreferences: false,
|
|
22
|
-
showDestinationWallet:
|
|
22
|
+
showDestinationWallet: true,
|
|
23
23
|
appearance: 'auto',
|
|
24
24
|
gasPrice: 'normal',
|
|
25
25
|
routePriority: 'RECOMMENDED',
|
package/cjs/types/widget.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { PaletteMode, PaletteOptions, Shape } from '@mui/material';
|
|
|
3
3
|
import type { TypographyOptions } from '@mui/material/styles/createTypography';
|
|
4
4
|
import type { Signer } from 'ethers';
|
|
5
5
|
import type { CSSProperties } from 'react';
|
|
6
|
+
export declare type WidgetVariant = 'default' | 'expandable' | 'drawer';
|
|
6
7
|
export declare type Appearance = PaletteMode | 'auto';
|
|
7
8
|
export declare type ThemeConfig = {
|
|
8
9
|
palette?: Pick<PaletteOptions, 'primary' | 'secondary'>;
|
|
@@ -34,6 +35,7 @@ export interface WidgetConfig {
|
|
|
34
35
|
/** @deprecated Use tokens.featured instead */
|
|
35
36
|
featuredTokens?: Token[];
|
|
36
37
|
integrator?: string;
|
|
38
|
+
variant?: WidgetVariant;
|
|
37
39
|
walletManagement?: WidgetWalletManagement;
|
|
38
40
|
sdkConfig?: ConfigUpdate;
|
|
39
41
|
bridges?: {
|
package/cjs/utils/colors.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Theme } from '@mui/material';
|
|
2
2
|
export declare const getContrastAlphaColor: (theme: Theme, alpha: string | number) => string;
|
|
3
|
-
export declare const getContrastTextColor: (theme: Theme, background?: string) => "#
|
|
3
|
+
export declare const getContrastTextColor: (theme: Theme, background?: string) => "#fff" | "#000";
|
|
@@ -17,26 +17,26 @@ exports.navigationRoutes = {
|
|
|
17
17
|
};
|
|
18
18
|
exports.navigationRoutesValues = Object.values(exports.navigationRoutes);
|
|
19
19
|
exports.stickyHeaderRoutes = [
|
|
20
|
-
exports.navigationRoutes.
|
|
20
|
+
exports.navigationRoutes.activeSwaps,
|
|
21
21
|
exports.navigationRoutes.fromChain,
|
|
22
|
-
exports.navigationRoutes.
|
|
22
|
+
exports.navigationRoutes.selectWallet,
|
|
23
23
|
exports.navigationRoutes.settings,
|
|
24
|
-
exports.navigationRoutes.
|
|
24
|
+
exports.navigationRoutes.swapDetails,
|
|
25
25
|
exports.navigationRoutes.swapExecution,
|
|
26
26
|
exports.navigationRoutes.swapHistory,
|
|
27
|
-
exports.navigationRoutes.
|
|
28
|
-
exports.navigationRoutes.
|
|
27
|
+
exports.navigationRoutes.swapRoutes,
|
|
28
|
+
exports.navigationRoutes.toChain,
|
|
29
29
|
];
|
|
30
30
|
exports.backButtonRoutes = [
|
|
31
|
+
exports.navigationRoutes.activeSwaps,
|
|
32
|
+
exports.navigationRoutes.fromChain,
|
|
33
|
+
exports.navigationRoutes.fromToken,
|
|
31
34
|
exports.navigationRoutes.selectWallet,
|
|
32
35
|
exports.navigationRoutes.settings,
|
|
36
|
+
exports.navigationRoutes.swapDetails,
|
|
37
|
+
exports.navigationRoutes.swapExecution,
|
|
33
38
|
exports.navigationRoutes.swapHistory,
|
|
34
|
-
exports.navigationRoutes.activeSwaps,
|
|
35
|
-
exports.navigationRoutes.fromToken,
|
|
36
|
-
exports.navigationRoutes.toToken,
|
|
37
|
-
exports.navigationRoutes.fromChain,
|
|
38
|
-
exports.navigationRoutes.toChain,
|
|
39
39
|
exports.navigationRoutes.swapRoutes,
|
|
40
|
-
exports.navigationRoutes.
|
|
41
|
-
exports.navigationRoutes.
|
|
40
|
+
exports.navigationRoutes.toChain,
|
|
41
|
+
exports.navigationRoutes.toToken,
|
|
42
42
|
];
|
|
@@ -8,6 +8,7 @@ export declare const ProgressCard: import("@emotion/styled").StyledComponent<imp
|
|
|
8
8
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
9
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
10
|
variant?: ("default" | "error" | "selected") | undefined;
|
|
11
|
+
selectionColor?: "primary" | "secondary" | undefined;
|
|
11
12
|
dense?: boolean | undefined;
|
|
12
13
|
indented?: boolean | undefined;
|
|
13
14
|
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { PropsWithChildren
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
export declare const maxHeight = 680;
|
|
2
3
|
export declare const FlexContainer: import("@emotion/styled").StyledComponent<{
|
|
3
4
|
children?: import("react").ReactNode;
|
|
4
5
|
classes?: Partial<import("@mui/material").ContainerClasses> | undefined;
|
|
@@ -7,9 +8,7 @@ export declare const FlexContainer: import("@emotion/styled").StyledComponent<{
|
|
|
7
8
|
maxWidth?: false | import("@mui/material").Breakpoint | undefined;
|
|
8
9
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
10
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
-
ref?: RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
12
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "maxWidth" | "fixed" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
12
13
|
export declare const AppContainer: React.FC<PropsWithChildren<{}>>;
|
|
13
|
-
export declare const
|
|
14
|
-
elementRef: RefObject<HTMLElement>;
|
|
15
|
-
}>;
|
|
14
|
+
export declare const AppExpandedContainer: React.FC<PropsWithChildren<{}>>;
|
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Container, ScopedCssBaseline } from '@mui/material';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
import { useLayoutEffect, useRef } from 'react';
|
|
5
|
-
import { useLocation } from 'react-router-dom';
|
|
6
4
|
import { useWidgetConfig } from '../providers';
|
|
7
5
|
import { ElementId } from '../utils';
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
export const maxHeight = 680;
|
|
7
|
+
const ExpandedContainer = styled(Box, {
|
|
8
|
+
shouldForwardProp: (prop) => prop !== 'variant',
|
|
9
|
+
})(({ variant }) => ({
|
|
10
10
|
display: 'flex',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
alignItems: 'start',
|
|
11
13
|
flex: 1,
|
|
12
|
-
|
|
13
|
-
overflowX: 'clip',
|
|
14
|
-
marginRight: 0,
|
|
15
|
-
width: '100%',
|
|
14
|
+
height: variant === 'drawer' ? 'none' : maxHeight,
|
|
16
15
|
}));
|
|
17
|
-
const RelativeContainer = styled(Box
|
|
16
|
+
const RelativeContainer = styled(Box, {
|
|
17
|
+
shouldForwardProp: (prop) => prop !== 'variant',
|
|
18
|
+
})(({ theme, variant }) => ({
|
|
18
19
|
position: 'relative',
|
|
19
20
|
width: '100%',
|
|
20
21
|
minWidth: 375,
|
|
21
22
|
maxWidth: 392,
|
|
23
|
+
maxHeight: variant === 'drawer' ? 'none' : maxHeight,
|
|
22
24
|
background: theme.palette.background.default,
|
|
23
25
|
overflow: 'auto',
|
|
24
26
|
flex: 1,
|
|
25
27
|
boxSizing: 'border-box',
|
|
26
28
|
zIndex: 0,
|
|
27
29
|
}));
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
+
const CssBaselineContainer = styled(ScopedCssBaseline, {
|
|
31
|
+
shouldForwardProp: (prop) => prop !== 'variant',
|
|
32
|
+
})(({ variant }) => ({
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flex: 1,
|
|
35
|
+
flexDirection: 'column',
|
|
36
|
+
overflowX: 'clip',
|
|
37
|
+
margin: 0,
|
|
38
|
+
width: '100%',
|
|
39
|
+
maxHeight: variant === 'drawer' ? 'none' : maxHeight,
|
|
30
40
|
overflowY: 'auto',
|
|
31
41
|
height: '100%',
|
|
32
|
-
|
|
33
|
-
display: 'flex',
|
|
34
|
-
});
|
|
42
|
+
}));
|
|
35
43
|
export const FlexContainer = styled(Container)({
|
|
36
44
|
display: 'flex',
|
|
37
|
-
flexBasis: 'auto',
|
|
38
45
|
flexDirection: 'column',
|
|
39
|
-
|
|
40
|
-
flexGrow: 1,
|
|
46
|
+
flex: 1,
|
|
41
47
|
});
|
|
42
48
|
export const AppContainer = ({ children }) => {
|
|
43
|
-
const ref = useRef(null);
|
|
44
|
-
const { containerStyle } = useWidgetConfig();
|
|
45
|
-
return (
|
|
49
|
+
// const ref = useRef<HTMLDivElement>(null);
|
|
50
|
+
const { containerStyle, variant } = useWidgetConfig();
|
|
51
|
+
return (_jsx(RelativeContainer, Object.assign({ sx: containerStyle, variant: variant }, { children: _jsx(CssBaselineContainer, Object.assign({ id: ElementId.ScrollableContainer, variant: variant, enableColorScheme: true }, { children: _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: children })) })) })));
|
|
46
52
|
};
|
|
47
|
-
export const
|
|
48
|
-
|
|
49
|
-
useLayoutEffect(() => {
|
|
50
|
-
var _a;
|
|
51
|
-
(_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
|
|
52
|
-
}, [elementRef, pathname]);
|
|
53
|
-
return null;
|
|
53
|
+
export const AppExpandedContainer = ({ children, }) => {
|
|
54
|
+
return _jsx(ExpandedContainer, { children: children });
|
|
54
55
|
};
|
|
@@ -10,6 +10,7 @@ export declare const Card: import("@emotion/styled").StyledComponent<import("@mu
|
|
|
10
10
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
11
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
12
12
|
variant?: CardVariant | undefined;
|
|
13
|
+
selectionColor?: "primary" | "secondary" | undefined;
|
|
13
14
|
dense?: boolean | undefined;
|
|
14
15
|
indented?: boolean | undefined;
|
|
15
16
|
onClick?: MouseEventHandler<HTMLDivElement> | undefined;
|
package/components/Card/Card.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { Box } from '@mui/material';
|
|
2
2
|
import { alpha, darken, lighten, styled } from '@mui/material/styles';
|
|
3
|
-
const getBackgroundColor = (theme, variant) => variant === 'selected'
|
|
4
|
-
?
|
|
5
|
-
?
|
|
6
|
-
|
|
3
|
+
const getBackgroundColor = (theme, variant, selectionColor) => variant === 'selected'
|
|
4
|
+
? selectionColor === 'primary'
|
|
5
|
+
? theme.palette.mode === 'light'
|
|
6
|
+
? alpha(theme.palette.primary.main, 0.04)
|
|
7
|
+
: alpha(theme.palette.primary.main, 0.42)
|
|
8
|
+
: alpha(theme.palette.secondary.main, 0.08)
|
|
7
9
|
: theme.palette.background.paper;
|
|
8
10
|
export const Card = styled(Box, {
|
|
9
|
-
shouldForwardProp: (prop) => !['dense', 'variant', 'indented'].includes(prop),
|
|
10
|
-
})(({ theme, variant, dense, indented, onClick }) => {
|
|
11
|
-
const backgroundColor = getBackgroundColor(theme, variant);
|
|
11
|
+
shouldForwardProp: (prop) => !['dense', 'variant', 'indented', 'selectionColor'].includes(prop),
|
|
12
|
+
})(({ theme, variant, selectionColor = 'primary', dense, indented, onClick, }) => {
|
|
13
|
+
const backgroundColor = getBackgroundColor(theme, variant, selectionColor);
|
|
12
14
|
return {
|
|
13
15
|
backgroundColor,
|
|
14
16
|
border: `1px solid`,
|
|
15
17
|
borderColor: variant === 'error'
|
|
16
18
|
? theme.palette.error.main
|
|
17
19
|
: variant === 'selected'
|
|
18
|
-
?
|
|
20
|
+
? selectionColor === 'primary'
|
|
21
|
+
? theme.palette.primary.main
|
|
22
|
+
: alpha(theme.palette.secondary.main, 0.48)
|
|
19
23
|
: theme.palette.mode === 'light'
|
|
20
24
|
? theme.palette.grey[300]
|
|
21
25
|
: theme.palette.grey[800],
|
|
@@ -32,7 +36,7 @@ export const Card = styled(Box, {
|
|
|
32
36
|
? theme.palette.mode === 'light'
|
|
33
37
|
? darken(backgroundColor, 0.02)
|
|
34
38
|
: lighten(backgroundColor, 0.02)
|
|
35
|
-
:
|
|
39
|
+
: backgroundColor,
|
|
36
40
|
},
|
|
37
41
|
transition: theme.transitions.create(['background-color'], {
|
|
38
42
|
duration: theme.transitions.duration.enteringScreen,
|
|
@@ -3,7 +3,7 @@ import { Avatar, Box, Skeleton, Typography } from '@mui/material';
|
|
|
3
3
|
import { useWatch } from 'react-hook-form';
|
|
4
4
|
import { useNavigate } from 'react-router-dom';
|
|
5
5
|
import { SwapFormKeyHelper } from '../../providers';
|
|
6
|
-
import { maxChainToOrder } from '../../stores
|
|
6
|
+
import { maxChainToOrder } from '../../stores';
|
|
7
7
|
import { navigationRoutes } from '../../utils';
|
|
8
8
|
import { ChainCard, ChainContainer } from './ChainSelect.style';
|
|
9
9
|
import { useChainSelect } from './useChainSelect';
|
|
@@ -8,6 +8,7 @@ export declare const ChainCard: import("@emotion/styled").StyledComponent<import
|
|
|
8
8
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
9
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
10
|
variant?: ("default" | "error" | "selected") | undefined;
|
|
11
|
+
selectionColor?: "primary" | "secondary" | undefined;
|
|
11
12
|
dense?: boolean | undefined;
|
|
12
13
|
indented?: boolean | undefined;
|
|
13
14
|
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
@@ -4,12 +4,12 @@ import { Card } from '../../components/Card';
|
|
|
4
4
|
export const ChainCard = styled(Card)({
|
|
5
5
|
display: 'grid',
|
|
6
6
|
placeItems: 'center',
|
|
7
|
-
minWidth:
|
|
7
|
+
minWidth: 52,
|
|
8
8
|
height: 56,
|
|
9
9
|
});
|
|
10
10
|
export const ChainContainer = styled(Box)(({ theme }) => ({
|
|
11
11
|
display: 'grid',
|
|
12
|
-
gridTemplateColumns: 'repeat(auto-fit, minmax(
|
|
12
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(52px, 1fr))',
|
|
13
13
|
gridAutoRows: '56px',
|
|
14
14
|
justifyContent: 'space-between',
|
|
15
15
|
gap: theme.spacing(1.5),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useFormContext } from 'react-hook-form';
|
|
2
2
|
import { useChains } from '../../hooks';
|
|
3
3
|
import { SwapFormKey, SwapFormKeyHelper } from '../../providers';
|
|
4
|
-
import { useChainOrder } from '../../stores
|
|
4
|
+
import { useChainOrder } from '../../stores';
|
|
5
5
|
export const useChainSelect = (formType) => {
|
|
6
6
|
const { setValue } = useFormContext();
|
|
7
7
|
const { chains, isLoading } = useChains();
|
|
@@ -14,12 +14,14 @@ import { WarningAmber as WarningIcon } from '@mui/icons-material';
|
|
|
14
14
|
import { Box, Typography } from '@mui/material';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { useGasSufficiency } from '../../hooks';
|
|
17
|
+
import { useSelectedRouteStore } from '../../stores';
|
|
17
18
|
import { CardTitle } from '../Card';
|
|
18
19
|
import { MessageCard } from './GasSufficiencyMessage.style';
|
|
19
20
|
export const GasSufficiencyMessage = (_a) => {
|
|
20
21
|
var { route } = _a, props = __rest(_a, ["route"]);
|
|
21
22
|
const { t } = useTranslation();
|
|
22
|
-
const
|
|
23
|
+
const selectedRoute = useSelectedRouteStore((state) => state.selectedRoute);
|
|
24
|
+
const { insufficientFunds, insufficientGas } = useGasSufficiency(route !== null && route !== void 0 ? route : selectedRoute);
|
|
23
25
|
if (!insufficientFunds && !(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)) {
|
|
24
26
|
return null;
|
|
25
27
|
}
|
|
@@ -31,7 +33,9 @@ export const GasSufficiencyMessage = (_a) => {
|
|
|
31
33
|
: null }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pt: 1 }, { children: t(`swap.warning.message.insufficientGas`) }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)
|
|
32
34
|
? insufficientGas.map((item, index) => {
|
|
33
35
|
var _a, _b;
|
|
34
|
-
return (_jsx(Typography
|
|
36
|
+
return (_jsx(Typography
|
|
37
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
38
|
+
, Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
|
|
35
39
|
amount: (_a = item.insufficientAmount) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
36
40
|
tokenSymbol: item.token.symbol,
|
|
37
41
|
chainName: (_b = item.chain) === null || _b === void 0 ? void 0 : _b.name,
|
|
@@ -5,7 +5,7 @@ import { ElementId, stickyHeaderRoutes } from '../../utils';
|
|
|
5
5
|
import { Container } from './Header.style';
|
|
6
6
|
import { NavigationHeader } from './NavigationHeader';
|
|
7
7
|
import { WalletHeader } from './WalletHeader';
|
|
8
|
-
const HeaderContainer = ({ children }) => {
|
|
8
|
+
export const HeaderContainer = ({ children }) => {
|
|
9
9
|
const { pathname } = useLocation();
|
|
10
10
|
return (_jsx(Container, Object.assign({ id: ElementId.Header, sticky: stickyHeaderRoutes.some((route) => pathname.includes(route)) }, { children: children })));
|
|
11
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppBar, Box } from '@mui/material';
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
3
3
|
export const HeaderAppBar = styled(AppBar)(({ theme }) => ({
|
|
4
|
-
backgroundColor:
|
|
4
|
+
backgroundColor: 'transparent',
|
|
5
5
|
color: theme.palette.text.primary,
|
|
6
6
|
flexDirection: 'row',
|
|
7
7
|
alignItems: 'center',
|
|
@@ -16,7 +16,8 @@ export const HeaderAppBar = styled(AppBar)(({ theme }) => ({
|
|
|
16
16
|
export const Container = styled(Box, {
|
|
17
17
|
shouldForwardProp: (prop) => prop !== 'sticky',
|
|
18
18
|
})(({ theme, sticky }) => ({
|
|
19
|
-
backgroundColor: theme.palette.background.default,
|
|
19
|
+
backgroundColor: alpha(theme.palette.background.default, 0.84),
|
|
20
|
+
backdropFilter: 'blur(12px)',
|
|
20
21
|
position: sticky ? 'sticky' : 'relative',
|
|
21
22
|
top: 0,
|
|
22
23
|
zIndex: 1200,
|
|
@@ -14,7 +14,10 @@ export const NavigationHeader = () => {
|
|
|
14
14
|
const { account } = useWallet();
|
|
15
15
|
const { element } = useHeaderActionStore();
|
|
16
16
|
const { pathname } = useLocation();
|
|
17
|
-
const
|
|
17
|
+
const cleanedPathname = pathname.endsWith('/')
|
|
18
|
+
? pathname.slice(0, -1)
|
|
19
|
+
: pathname;
|
|
20
|
+
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
|
|
18
21
|
const hasPath = navigationRoutesValues.includes(path);
|
|
19
22
|
const handleHeaderTitle = () => {
|
|
20
23
|
switch (path) {
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
-
import {
|
|
11
|
+
import { Logout as LogoutIcon, WalletOutlined as WalletOutlinedIcon, } from '@mui/icons-material';
|
|
12
12
|
import { Box, IconButton, Typography } from '@mui/material';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
@@ -39,5 +39,5 @@ const ConnectButton = () => {
|
|
|
39
39
|
}
|
|
40
40
|
navigate(navigationRoutes.selectWallet);
|
|
41
41
|
});
|
|
42
|
-
return (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined }, { children: _jsx(
|
|
42
|
+
return (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined }, { children: _jsx(WalletOutlinedIcon, {}) })));
|
|
43
43
|
};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Tooltip, Typography } from '@mui/material';
|
|
3
|
+
import { useLocation } from 'react-router-dom';
|
|
3
4
|
import { version } from '../../config/version';
|
|
5
|
+
import { navigationRoutes } from '../../utils';
|
|
4
6
|
import { LiFiLogo } from '../LiFiLogo';
|
|
5
7
|
import { Link } from './PoweredBy.style';
|
|
6
8
|
export const PoweredBy = () => {
|
|
9
|
+
const { pathname } = useLocation();
|
|
10
|
+
if (pathname.includes(navigationRoutes.fromToken) ||
|
|
11
|
+
pathname.includes(navigationRoutes.toToken)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
7
14
|
return (_jsx(Box, Object.assign({ px: 3, pt: 2, pb: 2, sx: {
|
|
8
15
|
display: 'flex',
|
|
9
16
|
alignItems: 'flex-end',
|