@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
|
@@ -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;
|
|
@@ -7,12 +7,12 @@ const Card_1 = require("../../components/Card");
|
|
|
7
7
|
exports.ChainCard = (0, styles_1.styled)(Card_1.Card)({
|
|
8
8
|
display: 'grid',
|
|
9
9
|
placeItems: 'center',
|
|
10
|
-
minWidth:
|
|
10
|
+
minWidth: 52,
|
|
11
11
|
height: 56,
|
|
12
12
|
});
|
|
13
13
|
exports.ChainContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
14
14
|
display: 'grid',
|
|
15
|
-
gridTemplateColumns: 'repeat(auto-fit, minmax(
|
|
15
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(52px, 1fr))',
|
|
16
16
|
gridAutoRows: '56px',
|
|
17
17
|
justifyContent: 'space-between',
|
|
18
18
|
gap: theme.spacing(1.5),
|
|
@@ -4,11 +4,11 @@ exports.useChainSelect = void 0;
|
|
|
4
4
|
const react_hook_form_1 = require("react-hook-form");
|
|
5
5
|
const hooks_1 = require("../../hooks");
|
|
6
6
|
const providers_1 = require("../../providers");
|
|
7
|
-
const
|
|
7
|
+
const stores_1 = require("../../stores");
|
|
8
8
|
const useChainSelect = (formType) => {
|
|
9
9
|
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
10
10
|
const { chains, isLoading } = (0, hooks_1.useChains)();
|
|
11
|
-
const [chainOrder, setChainOrder] = (0,
|
|
11
|
+
const [chainOrder, setChainOrder] = (0, stores_1.useChainOrder)();
|
|
12
12
|
const chainKey = providers_1.SwapFormKeyHelper.getChainKey(formType);
|
|
13
13
|
const getChains = () => {
|
|
14
14
|
if (!chains) {
|
|
@@ -17,12 +17,14 @@ const icons_material_1 = require("@mui/icons-material");
|
|
|
17
17
|
const material_1 = require("@mui/material");
|
|
18
18
|
const react_i18next_1 = require("react-i18next");
|
|
19
19
|
const hooks_1 = require("../../hooks");
|
|
20
|
+
const stores_1 = require("../../stores");
|
|
20
21
|
const Card_1 = require("../Card");
|
|
21
22
|
const GasSufficiencyMessage_style_1 = require("./GasSufficiencyMessage.style");
|
|
22
23
|
const GasSufficiencyMessage = (_a) => {
|
|
23
24
|
var { route } = _a, props = __rest(_a, ["route"]);
|
|
24
25
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
25
|
-
const
|
|
26
|
+
const selectedRoute = (0, stores_1.useSelectedRouteStore)((state) => state.selectedRoute);
|
|
27
|
+
const { insufficientFunds, insufficientGas } = (0, hooks_1.useGasSufficiency)(route !== null && route !== void 0 ? route : selectedRoute);
|
|
26
28
|
if (!insufficientFunds && !(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)) {
|
|
27
29
|
return null;
|
|
28
30
|
}
|
|
@@ -34,7 +36,9 @@ const GasSufficiencyMessage = (_a) => {
|
|
|
34
36
|
: null }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? ((0, jsx_runtime_1.jsx)(material_1.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)
|
|
35
37
|
? insufficientGas.map((item, index) => {
|
|
36
38
|
var _a, _b;
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Typography
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Typography
|
|
40
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
41
|
+
, Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
|
|
38
42
|
amount: (_a = item.insufficientAmount) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
39
43
|
tokenSymbol: item.token.symbol,
|
|
40
44
|
chainName: (_b = item.chain) === null || _b === void 0 ? void 0 : _b.name,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Header = void 0;
|
|
3
|
+
exports.Header = exports.HeaderContainer = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_router_dom_1 = require("react-router-dom");
|
|
6
6
|
const providers_1 = require("../../providers");
|
|
@@ -12,8 +12,9 @@ const HeaderContainer = ({ children }) => {
|
|
|
12
12
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
13
13
|
return ((0, jsx_runtime_1.jsx)(Header_style_1.Container, Object.assign({ id: utils_1.ElementId.Header, sticky: utils_1.stickyHeaderRoutes.some((route) => pathname.includes(route)) }, { children: children })));
|
|
14
14
|
};
|
|
15
|
+
exports.HeaderContainer = HeaderContainer;
|
|
15
16
|
const Header = () => {
|
|
16
17
|
const { walletManagement } = (0, providers_1.useWidgetConfig)();
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)(HeaderContainer, { children: [!walletManagement ? (0, jsx_runtime_1.jsx)(WalletHeader_1.WalletHeader, {}) : null, (0, jsx_runtime_1.jsx)(NavigationHeader_1.NavigationHeader, {})] }));
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(exports.HeaderContainer, { children: [!walletManagement ? (0, jsx_runtime_1.jsx)(WalletHeader_1.WalletHeader, {}) : null, (0, jsx_runtime_1.jsx)(NavigationHeader_1.NavigationHeader, {})] }));
|
|
18
19
|
};
|
|
19
20
|
exports.Header = Header;
|
|
@@ -4,7 +4,7 @@ exports.Container = exports.HeaderAppBar = void 0;
|
|
|
4
4
|
const material_1 = require("@mui/material");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
6
|
exports.HeaderAppBar = (0, styles_1.styled)(material_1.AppBar)(({ theme }) => ({
|
|
7
|
-
backgroundColor:
|
|
7
|
+
backgroundColor: 'transparent',
|
|
8
8
|
color: theme.palette.text.primary,
|
|
9
9
|
flexDirection: 'row',
|
|
10
10
|
alignItems: 'center',
|
|
@@ -19,7 +19,8 @@ exports.HeaderAppBar = (0, styles_1.styled)(material_1.AppBar)(({ theme }) => ({
|
|
|
19
19
|
exports.Container = (0, styles_1.styled)(material_1.Box, {
|
|
20
20
|
shouldForwardProp: (prop) => prop !== 'sticky',
|
|
21
21
|
})(({ theme, sticky }) => ({
|
|
22
|
-
backgroundColor: theme.palette.background.default,
|
|
22
|
+
backgroundColor: (0, styles_1.alpha)(theme.palette.background.default, 0.84),
|
|
23
|
+
backdropFilter: 'blur(12px)',
|
|
23
24
|
position: sticky ? 'sticky' : 'relative',
|
|
24
25
|
top: 0,
|
|
25
26
|
zIndex: 1200,
|
|
@@ -17,7 +17,10 @@ const NavigationHeader = () => {
|
|
|
17
17
|
const { account } = (0, providers_1.useWallet)();
|
|
18
18
|
const { element } = (0, useHeaderActionStore_1.useHeaderActionStore)();
|
|
19
19
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
20
|
-
const
|
|
20
|
+
const cleanedPathname = pathname.endsWith('/')
|
|
21
|
+
? pathname.slice(0, -1)
|
|
22
|
+
: pathname;
|
|
23
|
+
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
|
|
21
24
|
const hasPath = utils_1.navigationRoutesValues.includes(path);
|
|
22
25
|
const handleHeaderTitle = () => {
|
|
23
26
|
switch (path) {
|
|
@@ -43,5 +43,5 @@ const ConnectButton = () => {
|
|
|
43
43
|
}
|
|
44
44
|
navigate(utils_1.navigationRoutes.selectWallet);
|
|
45
45
|
});
|
|
46
|
-
return ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.WalletOutlined, {}) })));
|
|
47
47
|
};
|
|
@@ -3,10 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PoweredBy = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
6
7
|
const version_1 = require("../../config/version");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
7
9
|
const LiFiLogo_1 = require("../LiFiLogo");
|
|
8
10
|
const PoweredBy_style_1 = require("./PoweredBy.style");
|
|
9
11
|
const PoweredBy = () => {
|
|
12
|
+
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
13
|
+
if (pathname.includes(utils_1.navigationRoutes.fromToken) ||
|
|
14
|
+
pathname.includes(utils_1.navigationRoutes.toToken)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
10
17
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ px: 3, pt: 2, pb: 2, sx: {
|
|
11
18
|
display: 'flex',
|
|
12
19
|
alignItems: 'flex-end',
|
|
@@ -17,22 +17,19 @@ const react_1 = require("react");
|
|
|
17
17
|
const react_hook_form_1 = require("react-hook-form");
|
|
18
18
|
const react_i18next_1 = require("react-i18next");
|
|
19
19
|
const providers_1 = require("../../providers");
|
|
20
|
-
const stores_1 = require("../../stores");
|
|
21
20
|
const Card_1 = require("../Card");
|
|
22
21
|
const SendToWallet_style_1 = require("./SendToWallet.style");
|
|
23
|
-
const
|
|
22
|
+
const store_1 = require("./store");
|
|
23
|
+
exports.SendToWallet = (0, react_1.forwardRef)((props, ref) => {
|
|
24
24
|
var _a;
|
|
25
25
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
26
|
-
const
|
|
26
|
+
const showSendToWallet = (0, store_1.useSendToWalletStore)((state) => state.showSendToWallet);
|
|
27
27
|
const { account, provider } = (0, providers_1.useWallet)();
|
|
28
28
|
const { register, trigger, formState: { errors }, } = (0, react_hook_form_1.useFormContext)();
|
|
29
29
|
(0, react_1.useEffect)(() => {
|
|
30
30
|
trigger(providers_1.SwapFormKey.ToAddress);
|
|
31
31
|
}, [account.chainId, trigger]);
|
|
32
|
-
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const { onChange, onBlur, name, ref } = register(providers_1.SwapFormKey.ToAddress, {
|
|
32
|
+
const { onChange, onBlur, name, ref: inputRef, } = register(providers_1.SwapFormKey.ToAddress, {
|
|
36
33
|
validate: (value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
34
|
try {
|
|
38
35
|
if (!value) {
|
|
@@ -48,6 +45,5 @@ const SendToWallet = (props) => {
|
|
|
48
45
|
}),
|
|
49
46
|
onBlur: () => trigger(providers_1.SwapFormKey.ToAddress),
|
|
50
47
|
});
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.sendToWallet') }), (0, jsx_runtime_1.jsxs)(SendToWallet_style_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_style_1.Input, { ref:
|
|
52
|
-
};
|
|
53
|
-
exports.SendToWallet = SendToWallet;
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: showSendToWallet }, { children: (0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { ref: ref }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.sendToWallet') }), (0, jsx_runtime_1.jsxs)(SendToWallet_style_1.FormControl, Object.assign({ fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' } }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_style_1.Input, { ref: inputRef, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns') }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, Object.assign({ error: !!errors.toAddress }, { children: (_a = errors.toAddress) === null || _a === void 0 ? void 0 : _a.message }))] }))] })) })));
|
|
49
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SendToWalletButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_i18next_1 = require("react-i18next");
|
|
8
|
+
const providers_1 = require("../../providers");
|
|
9
|
+
const stores_1 = require("../../stores");
|
|
10
|
+
const store_1 = require("./store");
|
|
11
|
+
const SendToWalletButton = () => {
|
|
12
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
13
|
+
const { account } = (0, providers_1.useWallet)();
|
|
14
|
+
const { showDestinationWallet } = (0, stores_1.useSettings)(['showDestinationWallet']);
|
|
15
|
+
const { showSendToWallet, toggleSendToWallet } = (0, store_1.useSendToWalletStore)();
|
|
16
|
+
if (!showDestinationWallet || !account.isActive) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay: 500, enterNextDelay: 500, arrow: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: showSendToWallet ? 'contained' : 'text', onClick: toggleSendToWallet, sx: {
|
|
20
|
+
minWidth: 48,
|
|
21
|
+
marginLeft: 1,
|
|
22
|
+
} }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.WalletOutlined, {}) })) })));
|
|
23
|
+
};
|
|
24
|
+
exports.SendToWalletButton = SendToWalletButton;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SendToWalletStore } from './types';
|
|
2
|
+
export declare const useSendToWalletStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SendToWalletStore>, "setState"> & {
|
|
3
|
+
setState(nextStateOrUpdater: SendToWalletStore | Partial<SendToWalletStore> | ((state: import("immer/dist/internal").WritableDraft<SendToWalletStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSendToWalletStore = void 0;
|
|
4
|
+
const zustand_1 = require("zustand");
|
|
5
|
+
const immer_1 = require("zustand/middleware/immer");
|
|
6
|
+
exports.useSendToWalletStore = (0, zustand_1.default)()((0, immer_1.immer)((set) => ({
|
|
7
|
+
showSendToWallet: false,
|
|
8
|
+
toggleSendToWallet: () => {
|
|
9
|
+
set((state) => {
|
|
10
|
+
state.showSendToWallet = !state.showSendToWallet;
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
})));
|
|
File without changes
|
|
@@ -54,6 +54,6 @@ exports.StepContent = (0, styles_1.styled)(material_1.StepContent, {
|
|
|
54
54
|
},
|
|
55
55
|
}));
|
|
56
56
|
exports.StepAvatar = (0, styles_1.styled)(material_1.Avatar)(({ theme, variant }) => ({
|
|
57
|
-
color:
|
|
57
|
+
color: theme.palette.text.primary,
|
|
58
58
|
backgroundColor: 'transparent',
|
|
59
59
|
}));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { SwapButtonProps } from './types';
|
|
3
|
-
export declare const SwapButton:
|
|
3
|
+
export declare const SwapButton: import("react").ForwardRefExoticComponent<SwapButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -12,12 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.SwapButton = void 0;
|
|
13
13
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
14
|
const material_1 = require("@mui/material");
|
|
15
|
+
const react_1 = require("react");
|
|
15
16
|
const react_i18next_1 = require("react-i18next");
|
|
16
17
|
const react_router_dom_1 = require("react-router-dom");
|
|
17
18
|
const hooks_1 = require("../../hooks");
|
|
18
19
|
const providers_1 = require("../../providers");
|
|
19
20
|
const utils_1 = require("../../utils");
|
|
20
|
-
|
|
21
|
+
exports.SwapButton = (0, react_1.forwardRef)(({ onClick, currentRoute, text, disable }, ref) => {
|
|
21
22
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
22
23
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
23
24
|
const config = (0, providers_1.useWidgetConfig)();
|
|
@@ -45,6 +46,5 @@ const SwapButton = ({ onClick, currentRoute, text, disable, }) => {
|
|
|
45
46
|
}
|
|
46
47
|
return t(`button.connectWallet`);
|
|
47
48
|
};
|
|
48
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick, disabled: insufficientFunds || !!(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) || disable, fullWidth: true }, { children: getButtonText() })));
|
|
49
|
-
};
|
|
50
|
-
exports.SwapButton = SwapButton;
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick, disabled: insufficientFunds || !!(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) || disable, fullWidth: true, ref: ref }, { children: getButtonText() })));
|
|
50
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { BoxProps } from '@mui/material';
|
|
3
|
-
import type { SwapRouteCardProps } from './types';
|
|
3
|
+
import type { SwapRouteCardEssentialsProps, SwapRouteCardProps } from './types';
|
|
4
4
|
export declare const SwapRouteCard: React.FC<SwapRouteCardProps & BoxProps>;
|
|
5
|
+
export declare const SwapRouteCardEssentials: React.FC<SwapRouteCardEssentialsProps>;
|
|
@@ -11,33 +11,37 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.SwapRouteCard = void 0;
|
|
14
|
+
exports.SwapRouteCardEssentials = exports.SwapRouteCard = void 0;
|
|
15
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
16
17
|
const material_1 = require("@mui/material");
|
|
18
|
+
const react_1 = require("react");
|
|
17
19
|
const react_i18next_1 = require("react-i18next");
|
|
18
20
|
const Card_1 = require("../Card");
|
|
19
21
|
const StepActions_1 = require("../StepActions");
|
|
20
22
|
const Token_1 = require("../Token");
|
|
21
23
|
const SwapRouteCard_style_1 = require("./SwapRouteCard.style");
|
|
22
24
|
const SwapRouteCard = (_a) => {
|
|
23
|
-
var _b
|
|
24
|
-
var { route, active,
|
|
25
|
+
var _b;
|
|
26
|
+
var { route, active, variant = 'default' } = _a, other = __rest(_a, ["route", "active", "variant"]);
|
|
25
27
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
28
|
+
const [expanded, setExpanded] = (0, react_1.useState)(variant === 'default');
|
|
26
29
|
const alternativeTag = t(`swap.tags.ALTERNATIVE`);
|
|
27
30
|
const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
|
|
28
31
|
? t(`swap.tags.${route.tags[0]}`)
|
|
29
32
|
: alternativeTag;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
? route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mb: 2 }, step.id)))
|
|
36
|
-
: null, (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
justifyContent: 'space-between',
|
|
39
|
-
} }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "500", lineHeight: 1, pt: 0.25 }, { children: t(`swap.currency`, { value: (_c = route.gasCostUSD) !== null && _c !== void 0 ? _c : 0 }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, color: "text.secondary", lineHeight: 1, mt: 0.5 }, { children: t(`swap.gas`) }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "500", display: "flex", justifyContent: "flex-end", lineHeight: 1, pt: 0.25 }, { children: ["~", (route.steps
|
|
40
|
-
.map((step) => step.estimate.executionDuration)
|
|
41
|
-
.reduce((duration, x) => duration + x) / 60).toFixed(0)] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, color: "text.secondary", textAlign: "end", lineHeight: 1, mt: 0.5 }, { children: t(`swap.minutes`) }))] })] }))] })));
|
|
33
|
+
const handleExpand = (e) => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
setExpanded((expanded) => !expanded);
|
|
36
|
+
};
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'extended' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'extended' ? route.steps[0] : undefined }), variant === 'extended' ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: expanded ? (0, jsx_runtime_1.jsx)(icons_material_1.ExpandLess, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.ExpandMore, {}) }))) : null] })), (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ mountOnEnter: true, unmountOnExit: true, in: expanded }, { children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'extended' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
|
|
42
38
|
};
|
|
43
39
|
exports.SwapRouteCard = SwapRouteCard;
|
|
40
|
+
const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
41
|
+
var _a;
|
|
42
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", pr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.EvStationOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`swap.currency`, { value: (_a = route.gasCostUSD) !== null && _a !== void 0 ? _a : 0 }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", pr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.AccessTime, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: `${(route.steps
|
|
44
|
+
.map((step) => step.estimate.executionDuration)
|
|
45
|
+
.reduce((duration, x) => duration + x) / 60).toFixed(0)}m` }))] })), !dense ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.LayersOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: route.steps.length }))] }))) : null] })));
|
|
46
|
+
};
|
|
47
|
+
exports.SwapRouteCardEssentials = SwapRouteCardEssentials;
|
|
@@ -14,3 +14,33 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
|
|
|
14
14
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("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") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
15
15
|
active?: boolean | undefined;
|
|
16
16
|
}, {}, {}>;
|
|
17
|
+
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
18
|
+
children?: import("react").ReactNode;
|
|
19
|
+
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
20
|
+
color?: "inherit" | "default" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
disableFocusRipple?: boolean | undefined;
|
|
23
|
+
edge?: false | "end" | "start" | undefined;
|
|
24
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
25
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
26
|
+
} & Omit<{
|
|
27
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
28
|
+
centerRipple?: boolean | undefined;
|
|
29
|
+
children?: import("react").ReactNode;
|
|
30
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
31
|
+
disabled?: boolean | undefined;
|
|
32
|
+
disableRipple?: boolean | undefined;
|
|
33
|
+
disableTouchRipple?: boolean | undefined;
|
|
34
|
+
focusRipple?: boolean | undefined;
|
|
35
|
+
focusVisibleClassName?: string | undefined;
|
|
36
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
37
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
38
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
39
|
+
tabIndex?: number | undefined;
|
|
40
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
41
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
42
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
43
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
44
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "size" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
45
|
+
active?: boolean | undefined;
|
|
46
|
+
}, {}, {}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Label = void 0;
|
|
3
|
+
exports.IconButton = exports.Label = void 0;
|
|
4
4
|
const material_1 = require("@mui/material");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
@@ -12,8 +12,8 @@ exports.Label = (0, styles_1.styled)(material_1.Typography, {
|
|
|
12
12
|
borderColor: active
|
|
13
13
|
? theme.palette.secondary.main
|
|
14
14
|
: theme.palette.mode === 'light'
|
|
15
|
-
? theme.palette.grey[
|
|
16
|
-
: theme.palette.grey[
|
|
15
|
+
? theme.palette.grey[300]
|
|
16
|
+
: theme.palette.grey[700],
|
|
17
17
|
borderRadius: theme.shape.borderRadiusSecondary,
|
|
18
18
|
color: active
|
|
19
19
|
? (0, utils_1.getContrastTextColor)(theme, theme.palette.secondary.main)
|
|
@@ -28,3 +28,16 @@ exports.Label = (0, styles_1.styled)(material_1.Typography, {
|
|
|
28
28
|
display: 'inline-flex',
|
|
29
29
|
userSelect: 'none',
|
|
30
30
|
}));
|
|
31
|
+
exports.IconButton = (0, styles_1.styled)(material_1.IconButton, {
|
|
32
|
+
shouldForwardProp: (prop) => prop !== 'active',
|
|
33
|
+
})(({ theme, active }) => {
|
|
34
|
+
const backgroundColor = theme.palette.mode === 'light'
|
|
35
|
+
? theme.palette.common.black
|
|
36
|
+
: theme.palette.common.white;
|
|
37
|
+
return {
|
|
38
|
+
backgroundColor: (0, styles_1.alpha)(backgroundColor, 0.04),
|
|
39
|
+
'&:hover': {
|
|
40
|
+
backgroundColor: (0, styles_1.alpha)(backgroundColor, 0.08),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
});
|
|
@@ -16,17 +16,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
16
16
|
const material_1 = require("@mui/material");
|
|
17
17
|
const Card_1 = require("../Card");
|
|
18
18
|
const SwapRouteCardSkeleton = (_a) => {
|
|
19
|
-
var {
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: dense, indented: true }, other, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width:
|
|
21
|
-
display: 'flex',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mr: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }) })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 32 })] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ ml: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
24
|
-
display: 'flex',
|
|
25
|
-
justifyContent: 'space-between',
|
|
26
|
-
} }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 56, height: 20 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 52, height: 16 })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
27
|
-
display: 'flex',
|
|
28
|
-
alignItems: 'flex-end',
|
|
29
|
-
flexDirection: 'column',
|
|
30
|
-
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 40, height: 20 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 16 })] }))] }))] })));
|
|
19
|
+
var { variant } = _a, other = __rest(_a, ["variant"]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'extended' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mr: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }) })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 32 })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'extended' ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] })), variant !== 'extended' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
|
|
31
21
|
};
|
|
32
22
|
exports.SwapRouteCardSkeleton = SwapRouteCardSkeleton;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
import type { SwapRouteCardSkeletonProps } from './types';
|
|
4
|
-
export declare const SwapRouteNotFoundCard: React.FC<SwapRouteCardSkeletonProps & BoxProps>;
|
|
2
|
+
export declare const SwapRouteNotFoundCard: React.FC;
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.SwapRouteNotFoundCard = void 0;
|
|
15
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
5
|
const icons_material_1 = require("@mui/icons-material");
|
|
17
6
|
const material_1 = require("@mui/material");
|
|
18
7
|
const react_i18next_1 = require("react-i18next");
|
|
19
|
-
const SwapRouteNotFoundCard = (
|
|
20
|
-
var { dense } = _a, other = __rest(_a, ["dense"]);
|
|
8
|
+
const SwapRouteNotFoundCard = () => {
|
|
21
9
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
22
10
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
23
11
|
display: 'flex',
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { Route } from '@lifi/sdk';
|
|
2
2
|
export interface SwapRouteCardProps {
|
|
3
3
|
route: Route;
|
|
4
|
-
|
|
4
|
+
variant?: 'default' | 'extended' | 'dense';
|
|
5
5
|
active?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface SwapRouteCardEssentialsProps {
|
|
8
|
+
route: Route;
|
|
8
9
|
dense?: boolean;
|
|
9
10
|
}
|
|
11
|
+
export interface SwapRouteCardSkeletonProps {
|
|
12
|
+
variant?: 'default' | 'extended' | 'dense';
|
|
13
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapRoutes = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
9
|
+
const react_i18next_1 = require("react-i18next");
|
|
10
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
11
|
+
const Card_1 = require("../../components/Card");
|
|
12
|
+
const ProgressToNextUpdate_1 = require("../../components/ProgressToNextUpdate");
|
|
13
|
+
const SwapRouteCard_1 = require("../../components/SwapRouteCard");
|
|
14
|
+
const hooks_1 = require("../../hooks");
|
|
15
|
+
const providers_1 = require("../../providers");
|
|
16
|
+
const stores_1 = require("../../stores");
|
|
17
|
+
const utils_1 = require("../../utils");
|
|
18
|
+
const SwapRoutes_style_1 = require("./SwapRoutes.style");
|
|
19
|
+
const SwapRoutes = (props) => {
|
|
20
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
21
|
+
const { variant } = (0, providers_1.useWidgetConfig)();
|
|
22
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
23
|
+
const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
|
|
24
|
+
const setSelectedRoute = (0, stores_1.useSelectedRouteStore)((state) => state.setSelectedRoute);
|
|
25
|
+
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
26
|
+
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
setSelectedRoute(!isFetching ? currentRoute : undefined);
|
|
29
|
+
return () => setSelectedRoute(undefined);
|
|
30
|
+
}, [currentRoute, isFetching, setSelectedRoute]);
|
|
31
|
+
if (!currentRoute && !isLoading && !isFetching && !isFetched) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const handleCardClick = () => {
|
|
35
|
+
navigate(utils_1.navigationRoutes.swapRoutes);
|
|
36
|
+
};
|
|
37
|
+
const routeNotFound = !currentRoute && !isLoading && !isFetching;
|
|
38
|
+
if (variant === 'expandable') {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
top: 8,
|
|
44
|
+
right: 8,
|
|
45
|
+
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
|
|
46
|
+
borderWidth: !routeNotFound && (isFetching || (routes && routes.length > 1))
|
|
47
|
+
? 1
|
|
48
|
+
: 0,
|
|
49
|
+
} }, { children: isLoading || isFetching ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" }), (0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })] })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), routes.length > 1 ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense" })) : null] })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !routeNotFound ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ py: 1, pr: 1 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleCardClick, size: "medium", "aria-label": "swap-routes", disabled: isValidating || !isValid }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowRight, {}) })) }))) : null }))] }))] })));
|
|
50
|
+
};
|
|
51
|
+
exports.SwapRoutes = SwapRoutes;
|