@lifi/widget 1.10.2 → 1.11.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 -10
- package/AppDrawer.js +1 -1
- package/AppDrawer.style.d.ts +1 -1
- package/AppDrawer.style.js +0 -1
- package/AppProvider.d.ts +1 -0
- package/AppProvider.js +5 -2
- package/components/AppContainer.d.ts +10 -0
- package/components/AppContainer.js +4 -7
- package/components/Card/Card.d.ts +11 -5
- package/components/Card/Card.js +29 -5
- package/components/Card/index.d.ts +0 -1
- package/components/Card/index.js +0 -1
- package/components/Dialog.d.ts +3 -0
- package/components/Dialog.js +23 -0
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +48 -0
- package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.d.ts → GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts} +0 -0
- package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.js → GasSufficiencyMessage/GasSufficiencyMessage.style.js} +1 -0
- package/components/GasSufficiencyMessage/index.d.ts +1 -0
- package/components/GasSufficiencyMessage/index.js +1 -0
- package/components/Header/Header.js +5 -6
- package/components/Header/Header.style.js +2 -1
- package/components/Header/NavigationHeader.js +27 -23
- package/components/Header/WalletHeader.js +4 -4
- package/components/Header/index.d.ts +1 -0
- package/components/Header/index.js +1 -0
- package/components/Header/types.d.ts +9 -0
- package/components/Header/types.js +1 -0
- package/components/Header/useHeaderActionStore.d.ts +6 -0
- package/components/Header/useHeaderActionStore.js +21 -0
- package/components/PoweredBy/PoweredBy.js +0 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +14 -2
- package/components/ReverseTokensButton/ReverseTokensButton.js +5 -7
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.js +4 -2
- package/components/SelectTokenButton/SelectTokenButton.js +9 -7
- package/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -10
- package/components/SelectTokenButton/SelectTokenButton.style.js +0 -7
- package/components/SmallAvatar.d.ts +16 -0
- package/components/SmallAvatar.js +8 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.js +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.style.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.style.js +0 -0
- package/components/Step/Step.d.ts +7 -0
- package/{pages/SwapPage/StepItem.js → components/Step/Step.js} +6 -6
- package/{pages/SwapPage/ExecutionItem.d.ts → components/Step/StepProcess.d.ts} +1 -1
- package/{pages/SwapPage/ExecutionItem.js → components/Step/StepProcess.js} +2 -2
- package/{pages/SwapPage/ExecutionItem.style.d.ts → components/Step/StepProcess.style.d.ts} +1 -1
- package/{pages/SwapPage/ExecutionItem.style.js → components/Step/StepProcess.style.js} +0 -0
- package/{pages/SwapPage → components/Step}/StepTimer.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/StepTimer.js +0 -0
- package/components/Step/index.d.ts +1 -0
- package/components/Step/index.js +1 -0
- package/components/Step/utils.d.ts +6 -0
- package/components/Step/utils.js +89 -0
- package/components/StepActions/StepActions.js +17 -7
- package/components/StepActions/StepActions.style.js +2 -2
- package/{pages/SwapPage → components/StepDivider}/StepDivider.d.ts +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.js +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.style.d.ts +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.style.js +0 -0
- package/components/StepDivider/index.d.ts +1 -0
- package/components/StepDivider/index.js +1 -0
- package/components/SwapButton/SwapButton.js +9 -12
- package/components/SwapButton/SwapButton.style.d.ts +1 -1
- package/components/SwapButton/SwapButton.style.js +1 -5
- package/components/SwapButton/types.d.ts +2 -0
- package/components/SwapInProgress/SwapInProgress.js +9 -6
- package/components/SwapInProgress/SwapInProgress.style.d.ts +9 -21
- package/components/SwapInProgress/SwapInProgress.style.js +5 -6
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.js +4 -5
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.js +0 -2
- package/components/SwapRouteCard/SwapRouteCard.js +15 -15
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +0 -20
- package/components/SwapRouteCard/SwapRouteCard.style.js +7 -54
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +6 -10
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +3 -3
- package/components/SwapRouteCard/types.d.ts +0 -3
- package/components/{StepToken.d.ts → Token/Token.d.ts} +2 -1
- package/components/Token/Token.js +31 -0
- package/components/Token/Token.style.d.ts +24 -0
- package/components/Token/Token.style.js +31 -0
- package/components/Token/index.d.ts +2 -0
- package/components/Token/index.js +2 -0
- package/components/TokenAvatar/TokenAvatar.d.ts +7 -0
- package/components/TokenAvatar/TokenAvatar.js +8 -0
- package/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
- package/components/TokenAvatar/TokenAvatar.style.js +16 -0
- package/components/TokenAvatar/index.d.ts +2 -0
- package/components/TokenAvatar/index.js +2 -0
- package/components/TokenList/TokenList.js +2 -2
- package/components/TokenList/TokenList.style.js +1 -1
- package/components/TokenList/TokenListItem.d.ts +1 -0
- package/components/TokenList/TokenListItem.js +13 -7
- package/components/TokenList/types.d.ts +1 -0
- package/config/queryClient.d.ts +1 -1
- package/config/queryClient.js +1 -1
- package/config/sentry.js +1 -1
- package/config/theme.js +14 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +1 -1
- package/hooks/index.js +1 -1
- package/hooks/useChains.d.ts +8 -8
- package/hooks/useChains.js +1 -1
- package/hooks/useContentHeight.js +1 -1
- package/hooks/useGasSufficiency.d.ts +15 -0
- package/hooks/useGasSufficiency.js +91 -0
- package/hooks/useRouteExecution.d.ts +3 -3
- package/hooks/useRouteExecution.js +23 -19
- package/hooks/useScrollableContainer.js +1 -1
- package/hooks/useSwapRoutes.d.ts +1 -1
- package/hooks/useSwapRoutes.js +2 -14
- package/hooks/useTelemetry.js +11 -3
- package/hooks/useTokenBalance.js +5 -5
- package/hooks/useTokenBalances.d.ts +2 -2
- package/hooks/useTokenBalances.js +8 -10
- package/hooks/useTokens.js +1 -1
- package/hooks/useTools.d.ts +10 -1
- package/hooks/useTools.js +13 -3
- package/i18n/en/translation.json +18 -9
- package/i18n/index.d.ts +12 -3
- package/icons/LiFiToolLogo.svg +6 -0
- package/index.js +0 -2
- package/package.json +9 -9
- package/pages/MainPage/MainPage.js +2 -3
- package/pages/MainPage/MainSwapButton.js +6 -7
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.d.ts +0 -0
- package/pages/MainPage/SwapRoutes.js +36 -0
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.d.ts +0 -0
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.js +4 -0
- package/pages/SelectTokenPage/ChainSelect.js +2 -2
- package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
- package/pages/SelectWalletPage/SelectWalletPage.js +4 -23
- package/pages/SelectWalletPage/SelectWalletPage.style.js +1 -1
- package/pages/SettingsPage/AdvancedPreferences.js +1 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledBridgesSelect.js +7 -4
- package/pages/SettingsPage/EnabledExchangesSelect.js +7 -4
- package/pages/SettingsPage/GasPriceSelect.js +2 -2
- package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
- package/pages/SettingsPage/SlippageInput.js +3 -3
- package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +63 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.style.js +5 -0
- package/pages/SwapDetailsPage/index.d.ts +1 -0
- package/pages/SwapDetailsPage/index.js +1 -0
- package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +14 -0
- package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
- package/pages/SwapHistoryPage/SwapHistoryItem.js +23 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.js +14 -0
- package/pages/SwapHistoryPage/index.d.ts +1 -0
- package/pages/SwapHistoryPage/index.js +1 -0
- package/pages/SwapPage/StatusBottomSheet.js +4 -4
- package/pages/SwapPage/SwapPage.js +13 -10
- package/pages/SwapPage/SwapPage.style.d.ts +0 -33
- package/pages/SwapPage/SwapPage.style.js +2 -9
- package/pages/SwapPage/utils.js +1 -1
- package/pages/SwapRoutesPage/SwapRoutesPage.js +14 -7
- package/pages/SwapRoutesPage/SwapRoutesPage.style.js +1 -1
- package/providers/WalletProvider/WalletProvider.js +7 -26
- package/providers/WalletProvider/types.d.ts +0 -1
- package/providers/WidgetProvider/WidgetProvider.js +1 -1
- package/stores/route/index.d.ts +1 -1
- package/stores/route/index.js +1 -1
- package/stores/route/types.d.ts +2 -4
- package/stores/route/useExecutingRoutes.d.ts +2 -1
- package/stores/route/useExecutingRoutes.js +4 -2
- package/stores/route/useRouteStore.d.ts +4 -1
- package/stores/route/useRouteStore.js +23 -24
- package/stores/route/useSwapHistory.d.ts +2 -0
- package/stores/route/useSwapHistory.js +11 -0
- package/stores/settings/useSettingsStore.d.ts +13 -0
- package/types/widget.d.ts +3 -4
- package/utils/index.d.ts +6 -0
- package/utils/index.js +6 -0
- package/utils/navigationRoutes.d.ts +13 -0
- package/utils/navigationRoutes.js +12 -0
- package/components/Card/CardContainer.d.ts +0 -11
- package/components/Card/CardContainer.js +0 -16
- package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.d.ts +0 -3
- package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.js +0 -31
- package/components/InsufficientGasOrFundsMessage/index.d.ts +0 -1
- package/components/InsufficientGasOrFundsMessage/index.js +0 -1
- package/components/StepToken.js +0 -21
- package/components/SwapRoutes/SwapRoutes.js +0 -32
- package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +0 -3
- package/components/SwapRoutes/SwapRoutesUpdateProgress.js +0 -24
- package/components/SwapRoutes/index.d.ts +0 -1
- package/components/SwapRoutes/index.js +0 -1
- package/hooks/useHasSufficientBalance.d.ts +0 -5
- package/hooks/useHasSufficientBalance.js +0 -72
- package/pages/SwapPage/StepItem.d.ts +0 -7
- package/stores/route/useCurrentRoute.d.ts +0 -2
- package/stores/route/useCurrentRoute.js +0 -5
- package/utils/routes.d.ts +0 -11
- package/utils/routes.js +0 -10
package/App.js
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
2
|
import { Route, Routes } from 'react-router-dom';
|
|
4
3
|
import { AppProvider } from './AppProvider';
|
|
5
|
-
import { AppContainer } from './components/AppContainer';
|
|
4
|
+
import { AppContainer, FlexContainer } from './components/AppContainer';
|
|
6
5
|
import { Header } from './components/Header';
|
|
7
6
|
import { Initializer } from './components/Initializer';
|
|
8
7
|
import { NotFound } from './components/NotFound';
|
|
8
|
+
import { PoweredBy } from './components/PoweredBy';
|
|
9
9
|
import { MainPage } from './pages/MainPage';
|
|
10
10
|
import { SelectTokenPage } from './pages/SelectTokenPage';
|
|
11
11
|
import { SelectWalletPage } from './pages/SelectWalletPage';
|
|
12
12
|
import { SettingsPage } from './pages/SettingsPage';
|
|
13
|
+
import { SwapDetailsPage } from './pages/SwapDetailsPage';
|
|
14
|
+
import { SwapHistoryPage } from './pages/SwapHistoryPage';
|
|
13
15
|
import { SwapPage } from './pages/SwapPage';
|
|
14
16
|
import { SwapRoutesPage } from './pages/SwapRoutesPage';
|
|
15
|
-
import {
|
|
16
|
-
import { routes } from './utils/routes';
|
|
17
|
+
import { navigationRoutes } from './utils';
|
|
17
18
|
export const App = ({ config }) => {
|
|
18
19
|
return (_jsx(AppProvider, Object.assign({ config: config }, { children: _jsx(AppDefault, {}) })));
|
|
19
20
|
};
|
|
20
21
|
export const AppDefault = () => {
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
attemptEagerConnect();
|
|
24
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
-
}, []);
|
|
26
|
-
return (_jsxs(AppContainer, { children: [_jsx(Header, {}), _jsxs(Routes, { children: [_jsx(Route, { path: routes.home, element: _jsx(MainPage, {}) }), _jsx(Route, { path: routes.selectWallet, element: _jsx(SelectWalletPage, {}) }), _jsx(Route, { path: `${routes.swapRoutes}/${routes.swap}/${routes.selectWallet}`, element: _jsx(SelectWalletPage, {}) }), _jsx(Route, { path: routes.settings, element: _jsx(SettingsPage, {}) }), _jsx(Route, { path: routes.fromToken, element: _jsx(SelectTokenPage, { formType: "from" }) }), _jsx(Route, { path: routes.toToken, element: _jsx(SelectTokenPage, { formType: "to" }) }), _jsx(Route, { path: routes.swapRoutes, element: _jsx(SwapRoutesPage, {}) }), _jsx(Route, { path: `${routes.swapRoutes}/${routes.swap}`, element: _jsx(SwapPage, {}) }), _jsx(Route, { path: routes.swap, element: _jsx(SwapPage, {}) }), _jsx(Route, { path: "*", element: _jsx(NotFound, {}) })] }), _jsx(Initializer, {})] }));
|
|
22
|
+
return (_jsxs(AppContainer, { children: [_jsx(Header, {}), _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsx(MainPage, {}) }), _jsx(Route, { path: navigationRoutes.selectWallet, element: _jsx(SelectWalletPage, {}) }), _jsx(Route, { path: navigationRoutes.settings, element: _jsx(SettingsPage, {}) }), _jsx(Route, { path: navigationRoutes.swapHistory, element: _jsx(SwapHistoryPage, {}) }), _jsx(Route, { path: navigationRoutes.swapDetails, element: _jsx(SwapDetailsPage, {}) }), _jsx(Route, { path: navigationRoutes.fromToken, element: _jsx(SelectTokenPage, { formType: "from" }) }), _jsx(Route, { path: navigationRoutes.toToken, element: _jsx(SelectTokenPage, { formType: "to" }) }), _jsx(Route, { path: navigationRoutes.swapRoutes, element: _jsx(SwapRoutesPage, {}) }), _jsx(Route, { path: navigationRoutes.swap, element: _jsx(SwapPage, {}) }), _jsx(Route, { path: "*", element: _jsx(NotFound, {}) })] }) })), _jsx(PoweredBy, {}), _jsx(Initializer, {})] }));
|
|
27
23
|
};
|
package/AppDrawer.js
CHANGED
|
@@ -26,7 +26,7 @@ export const AppDrawer = forwardRef(({ elementRef, open, config }, ref) => {
|
|
|
26
26
|
openDrawer,
|
|
27
27
|
closeDrawer,
|
|
28
28
|
}), [closeDrawer, openDrawer, toggleDrawer]);
|
|
29
|
-
return (_jsxs(AppProvider, Object.assign({ config: config }, { children: [_jsxs(DrawerButton, Object.assign({ variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config === null || config === void 0 ? void 0 : config.containerStyle
|
|
29
|
+
return (_jsxs(AppProvider, Object.assign({ config: config }, { children: [_jsxs(DrawerButton, Object.assign({ variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config === null || config === void 0 ? void 0 : config.containerStyle }, { children: [drawerOpen ? _jsx(KeyboardArrowRightIcon, {}) : _jsx(KeyboardArrowLeftIcon, {}), _jsx(DrawerButtonTypography, { children: drawerOpen ? t('button.hide') : t('button.lifiSwap') })] })), _jsx(Drawer, Object.assign({ ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
|
|
30
30
|
sx: {
|
|
31
31
|
backgroundColor: 'rgb(0 0 0 / 48%)',
|
|
32
32
|
backdropFilter: 'blur(3px)',
|
package/AppDrawer.style.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const DrawerButton: import("@emotion/styled").StyledComponent<{
|
|
|
9
9
|
endIcon?: import("react").ReactNode;
|
|
10
10
|
fullWidth?: boolean | undefined;
|
|
11
11
|
href?: string | undefined;
|
|
12
|
-
size?: "small" | "
|
|
12
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
13
13
|
startIcon?: import("react").ReactNode;
|
|
14
14
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
15
|
variant?: "text" | "outlined" | "contained" | undefined;
|
package/AppDrawer.style.js
CHANGED
package/AppProvider.d.ts
CHANGED
package/AppProvider.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable camelcase */
|
|
3
3
|
/* eslint-disable react/jsx-pascal-case */
|
|
4
|
+
import { QueryClientProvider, } from '@tanstack/react-query';
|
|
4
5
|
import { Fragment } from 'react';
|
|
5
|
-
import { QueryClientProvider } from 'react-query';
|
|
6
6
|
import { MemoryRouter, useInRouterContext } from 'react-router-dom';
|
|
7
7
|
import { queryClient } from './config/queryClient';
|
|
8
8
|
import { useTelemetry } from './hooks';
|
|
@@ -13,7 +13,10 @@ import { WidgetProvider } from './providers/WidgetProvider';
|
|
|
13
13
|
const QueryProvider = QueryClientProvider;
|
|
14
14
|
export const AppProvider = ({ children, config, }) => {
|
|
15
15
|
useTelemetry(config === null || config === void 0 ? void 0 : config.disableTelemetry);
|
|
16
|
+
return (_jsx(WidgetProvider, Object.assign({ config: config }, { children: _jsx(ThemeProvider, { children: _jsx(QueryProvider, Object.assign({ client: queryClient }, { children: _jsx(WalletProvider, { children: _jsx(SwapFormProvider, { children: _jsx(AppRouter, { children: children }) }) }) })) }) })));
|
|
17
|
+
};
|
|
18
|
+
export const AppRouter = ({ children }) => {
|
|
16
19
|
const inRouterContext = useInRouterContext();
|
|
17
20
|
const Router = inRouterContext ? Fragment : MemoryRouter;
|
|
18
|
-
return
|
|
21
|
+
return _jsx(Router, { children: children });
|
|
19
22
|
};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
export declare const FlexContainer: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").ContainerClasses> | undefined;
|
|
5
|
+
disableGutters?: boolean | undefined;
|
|
6
|
+
fixed?: boolean | undefined;
|
|
7
|
+
maxWidth?: false | import("@mui/material").Breakpoint | undefined;
|
|
8
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
+
} & 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
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "maxWidth" | "fixed" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
2
12
|
export declare const AppContainer: React.FC<PropsWithChildren<{}>>;
|
|
3
13
|
export declare const ScrollToLocation: React.FC<{
|
|
4
14
|
elementRef: RefObject<HTMLElement>;
|
|
@@ -4,8 +4,7 @@ import { styled } from '@mui/material/styles';
|
|
|
4
4
|
import { useLayoutEffect, useRef } from 'react';
|
|
5
5
|
import { useLocation } from 'react-router-dom';
|
|
6
6
|
import { useWidgetConfig } from '../providers/WidgetProvider';
|
|
7
|
-
import { ElementId } from '../utils
|
|
8
|
-
import { PoweredBy } from './PoweredBy';
|
|
7
|
+
import { ElementId } from '../utils';
|
|
9
8
|
const CssBaselineContainer = styled(ScopedCssBaseline)(({ theme }) => ({
|
|
10
9
|
// height: '100%',
|
|
11
10
|
display: 'flex',
|
|
@@ -13,9 +12,7 @@ const CssBaselineContainer = styled(ScopedCssBaseline)(({ theme }) => ({
|
|
|
13
12
|
flexDirection: 'column',
|
|
14
13
|
overflowX: 'clip',
|
|
15
14
|
marginRight: 0,
|
|
16
|
-
|
|
17
|
-
maxWidth: 392,
|
|
18
|
-
},
|
|
15
|
+
width: '100%',
|
|
19
16
|
}));
|
|
20
17
|
const RelativeContainer = styled(Box)(({ theme }) => ({
|
|
21
18
|
position: 'relative',
|
|
@@ -35,7 +32,7 @@ const ScrollableContainer = styled(Box)({
|
|
|
35
32
|
flex: 1,
|
|
36
33
|
display: 'flex',
|
|
37
34
|
});
|
|
38
|
-
const FlexContainer = styled(Container)({
|
|
35
|
+
export const FlexContainer = styled(Container)({
|
|
39
36
|
display: 'flex',
|
|
40
37
|
flexBasis: 'auto',
|
|
41
38
|
flexDirection: 'column',
|
|
@@ -45,7 +42,7 @@ const FlexContainer = styled(Container)({
|
|
|
45
42
|
export const AppContainer = ({ children }) => {
|
|
46
43
|
const ref = useRef(null);
|
|
47
44
|
const { containerStyle } = useWidgetConfig();
|
|
48
|
-
return (_jsxs(RelativeContainer, Object.assign({ sx: containerStyle }, { children: [_jsx(ScrollableContainer, Object.assign({ id: ElementId.ScrollableContainer, ref: ref }, { children: _jsx(CssBaselineContainer, Object.assign({ enableColorScheme: true }, { children:
|
|
45
|
+
return (_jsxs(RelativeContainer, Object.assign({ sx: containerStyle }, { children: [_jsx(ScrollableContainer, Object.assign({ id: ElementId.ScrollableContainer, ref: ref }, { children: _jsx(CssBaselineContainer, Object.assign({ enableColorScheme: true }, { children: _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: children })) })) })), _jsx(ScrollToLocation, { elementRef: ref })] })));
|
|
49
46
|
};
|
|
50
47
|
export const ScrollToLocation = ({ elementRef }) => {
|
|
51
48
|
const { pathname } = useLocation();
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Card: import("@emotion/styled").StyledComponent<
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
|
+
export declare const Card: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
component?: import("react").ElementType<any> | undefined;
|
|
5
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
5
6
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
6
7
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
7
8
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
8
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
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
|
+
variant?: "default" | "error" | undefined;
|
|
11
|
+
dense?: boolean | undefined;
|
|
12
|
+
indented?: boolean | undefined;
|
|
13
|
+
onClick?: MouseEventHandler<HTMLDivElement> | undefined;
|
|
14
|
+
}, {}, {}>;
|
package/components/Card/Card.js
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
3
|
-
export const Card = styled(
|
|
4
|
-
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { darken, lighten, styled } from '@mui/material/styles';
|
|
3
|
+
export const Card = styled(Box, {
|
|
4
|
+
shouldForwardProp: (prop) => !['dense', 'variant', 'indented'].includes(prop),
|
|
5
|
+
})(({ theme, variant, dense, indented, onClick }) => ({
|
|
6
|
+
backgroundColor: theme.palette.background.paper,
|
|
7
|
+
border: `1px solid`,
|
|
8
|
+
borderColor: variant === 'error'
|
|
9
|
+
? theme.palette.error.main
|
|
10
|
+
: theme.palette.mode === 'light'
|
|
11
|
+
? theme.palette.grey[300]
|
|
12
|
+
: theme.palette.grey[800],
|
|
13
|
+
borderRadius: dense
|
|
14
|
+
? theme.shape.borderRadiusSecondary
|
|
15
|
+
: theme.shape.borderRadius,
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
position: 'relative',
|
|
18
|
+
padding: indented ? theme.spacing(2) : 0,
|
|
19
|
+
boxSizing: 'border-box',
|
|
5
20
|
'&:hover': {
|
|
6
|
-
cursor: 'pointer',
|
|
21
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
22
|
+
backgroundColor: onClick
|
|
23
|
+
? theme.palette.mode === 'light'
|
|
24
|
+
? darken(theme.palette.background.paper, 0.02)
|
|
25
|
+
: lighten(theme.palette.background.paper, 0.02)
|
|
26
|
+
: theme.palette.background.paper,
|
|
7
27
|
},
|
|
28
|
+
transition: theme.transitions.create(['background-color'], {
|
|
29
|
+
duration: theme.transitions.duration.enteringScreen,
|
|
30
|
+
easing: theme.transitions.easing.easeOut,
|
|
31
|
+
}),
|
|
8
32
|
}));
|
package/components/Card/index.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as MuiDialog } from '@mui/material';
|
|
3
|
+
import { useScrollableContainer } from '../hooks';
|
|
4
|
+
export const Dialog = ({ children, open, onClose, }) => {
|
|
5
|
+
const containerElement = useScrollableContainer();
|
|
6
|
+
return (_jsx(MuiDialog, Object.assign({ open: open, onClose: onClose, container: containerElement, sx: {
|
|
7
|
+
position: 'absolute',
|
|
8
|
+
overflow: 'hidden',
|
|
9
|
+
}, PaperProps: {
|
|
10
|
+
sx: (theme) => ({
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
backgroundImage: 'none',
|
|
13
|
+
borderTopLeftRadius: theme.shape.borderRadius,
|
|
14
|
+
borderTopRightRadius: theme.shape.borderRadius,
|
|
15
|
+
}),
|
|
16
|
+
}, BackdropProps: {
|
|
17
|
+
sx: {
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
backgroundColor: 'rgb(0 0 0 / 32%)',
|
|
20
|
+
backdropFilter: 'blur(3px)',
|
|
21
|
+
},
|
|
22
|
+
} }, { children: children })));
|
|
23
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { WarningAmber as WarningIcon } from '@mui/icons-material';
|
|
14
|
+
import { Box, Typography } from '@mui/material';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useGasSufficiency } from '../../hooks';
|
|
17
|
+
import { CardTitle } from '../Card';
|
|
18
|
+
import { MessageCard } from './GasSufficiencyMessage.style';
|
|
19
|
+
export const GasSufficiencyMessage = (_a) => {
|
|
20
|
+
var { route } = _a, props = __rest(_a, ["route"]);
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const { insufficientFunds, insufficientGas } = useGasSufficiency(route);
|
|
23
|
+
if (!insufficientFunds || !insufficientGas.length) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
let title;
|
|
27
|
+
let message;
|
|
28
|
+
if (insufficientFunds) {
|
|
29
|
+
message = t(`swap.warning.message.insufficientFunds`);
|
|
30
|
+
}
|
|
31
|
+
else if (insufficientGas.length) {
|
|
32
|
+
title = t(`swap.warning.title.insufficientGas`);
|
|
33
|
+
message = t(`swap.warning.message.insufficientGas`);
|
|
34
|
+
}
|
|
35
|
+
return (_jsxs(MessageCard, Object.assign({}, props, { children: [_jsx(WarningIcon, { sx: {
|
|
36
|
+
marginTop: 2,
|
|
37
|
+
marginLeft: 2,
|
|
38
|
+
} }), _jsxs(Box, { children: [title ? _jsx(CardTitle, { children: title }) : null, _jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: !insufficientFunds && insufficientGas.length ? 0 : 2, pt: title ? 1 : 2 }, { children: message })), !insufficientFunds && insufficientGas.length
|
|
39
|
+
? insufficientGas.map((item, index) => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
return (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
|
|
42
|
+
amount: (_a = item.insufficientAmount) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
43
|
+
tokenSymbol: item.token.symbol,
|
|
44
|
+
chainName: (_b = item.chain) === null || _b === void 0 ? void 0 : _b.name,
|
|
45
|
+
}) }), index));
|
|
46
|
+
})
|
|
47
|
+
: null] })] })));
|
|
48
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GasSufficiencyMessage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GasSufficiencyMessage';
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLocation } from 'react-router-dom';
|
|
3
3
|
import { useWidgetConfig } from '../../providers/WidgetProvider';
|
|
4
|
-
import { ElementId } from '../../utils
|
|
5
|
-
import { routes } from '../../utils/routes';
|
|
4
|
+
import { ElementId, navigationRoutes } from '../../utils';
|
|
6
5
|
import { Container } from './Header.style';
|
|
7
6
|
import { NavigationHeader } from './NavigationHeader';
|
|
8
7
|
import { WalletHeader } from './WalletHeader';
|
|
9
8
|
const stickyHeaderRoutes = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
navigationRoutes.selectWallet,
|
|
10
|
+
navigationRoutes.settings,
|
|
11
|
+
navigationRoutes.swapRoutes,
|
|
13
12
|
];
|
|
14
13
|
const HeaderContainer = ({ children }) => {
|
|
15
14
|
const { pathname } = useLocation();
|
|
16
|
-
return (_jsx(Container, Object.assign({ id: ElementId.Header, sticky: stickyHeaderRoutes.
|
|
15
|
+
return (_jsx(Container, Object.assign({ id: ElementId.Header, sticky: stickyHeaderRoutes.includes(pathname) }, { children: children })));
|
|
17
16
|
};
|
|
18
17
|
export const Header = () => {
|
|
19
18
|
const { walletManagement } = useWidgetConfig();
|
|
@@ -6,10 +6,11 @@ export const HeaderAppBar = styled(AppBar)(({ theme }) => ({
|
|
|
6
6
|
flexDirection: 'row',
|
|
7
7
|
alignItems: 'center',
|
|
8
8
|
position: 'relative',
|
|
9
|
-
minHeight:
|
|
9
|
+
minHeight: 40,
|
|
10
10
|
padding: theme.spacing(0, 3, 0, 3),
|
|
11
11
|
':first-of-type': {
|
|
12
12
|
paddingTop: theme.spacing(1.5),
|
|
13
|
+
paddingBottom: theme.spacing(0.5),
|
|
13
14
|
},
|
|
14
15
|
}));
|
|
15
16
|
export const Container = styled(Box, {
|
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ArrowBack as ArrowBackIcon,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowBack as ArrowBackIcon, History as HistoryIcon, SettingsOutlined as SettingsIcon, } from '@mui/icons-material';
|
|
3
3
|
import { Box, IconButton, Typography } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useWallet } from '../../providers/WalletProvider';
|
|
7
|
+
import { navigationRoutes } from '../../utils';
|
|
8
8
|
import { HeaderAppBar } from './Header.style';
|
|
9
|
+
import { useHeaderActionStore } from './useHeaderActionStore';
|
|
9
10
|
const backButtonRoutes = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
navigationRoutes.selectWallet,
|
|
12
|
+
navigationRoutes.settings,
|
|
13
|
+
navigationRoutes.swapHistory,
|
|
14
|
+
navigationRoutes.fromToken,
|
|
15
|
+
navigationRoutes.toToken,
|
|
16
|
+
navigationRoutes.swapRoutes,
|
|
17
|
+
navigationRoutes.swap,
|
|
18
|
+
navigationRoutes.swapDetails,
|
|
16
19
|
];
|
|
17
20
|
export const NavigationHeader = () => {
|
|
18
21
|
const { t } = useTranslation();
|
|
19
22
|
const { pathname } = useLocation();
|
|
20
|
-
const path = pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
21
|
-
const hasPath = routesValues.includes(path);
|
|
22
23
|
const navigate = useNavigate();
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
};
|
|
24
|
+
const { account } = useWallet();
|
|
25
|
+
const { path: actionPath, element } = useHeaderActionStore();
|
|
26
26
|
const handleBack = () => {
|
|
27
27
|
navigate(-1);
|
|
28
28
|
};
|
|
29
29
|
const handleHeaderTitle = () => {
|
|
30
|
-
switch (
|
|
31
|
-
case
|
|
30
|
+
switch (pathname) {
|
|
31
|
+
case navigationRoutes.selectWallet:
|
|
32
32
|
return t(`header.selectWallet`);
|
|
33
|
-
case
|
|
33
|
+
case navigationRoutes.settings:
|
|
34
34
|
return t(`header.settings`);
|
|
35
|
-
case
|
|
35
|
+
case navigationRoutes.swapHistory:
|
|
36
|
+
return t(`header.swapHistory`);
|
|
37
|
+
case navigationRoutes.fromToken:
|
|
36
38
|
return t(`header.from`);
|
|
37
|
-
case
|
|
39
|
+
case navigationRoutes.toToken:
|
|
38
40
|
return t(`header.to`);
|
|
39
|
-
case
|
|
41
|
+
case navigationRoutes.swapRoutes:
|
|
40
42
|
return t(`header.routes`);
|
|
41
|
-
case
|
|
43
|
+
case navigationRoutes.swap:
|
|
42
44
|
return t(`header.swap`);
|
|
45
|
+
case navigationRoutes.swapDetails:
|
|
46
|
+
return t(`header.swapDetails`);
|
|
43
47
|
default:
|
|
44
48
|
return t(`header.swap`);
|
|
45
49
|
}
|
|
46
50
|
};
|
|
47
|
-
return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(
|
|
51
|
+
return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(pathname) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: handleBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: pathname === '/' ? 24 : 18, align: pathname === '/' ? 'left' : 'center', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) }))) : null, _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(navigationRoutes.settings) }, { children: _jsx(SettingsIcon, {}) }))] }) }), _jsx(Route, { path: actionPath !== null && actionPath !== void 0 ? actionPath : '*', element: element || _jsx(Box, { width: 28, height: 40 }) })] })] })));
|
|
48
52
|
};
|
|
@@ -8,13 +8,13 @@ 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 { AccountBalanceWalletOutlined as AccountBalanceWalletIcon, Logout as LogoutIcon, } 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';
|
|
15
15
|
import { useWallet } from '../../providers/WalletProvider';
|
|
16
16
|
import { useWidgetConfig } from '../../providers/WidgetProvider';
|
|
17
|
-
import {
|
|
17
|
+
import { navigationRoutes } from '../../utils';
|
|
18
18
|
import { HeaderAppBar } from './Header.style';
|
|
19
19
|
export const WalletHeader = () => {
|
|
20
20
|
const { t } = useTranslation();
|
|
@@ -38,7 +38,7 @@ const ConnectButton = () => {
|
|
|
38
38
|
yield walletConnect();
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
navigate(
|
|
41
|
+
navigate(navigationRoutes.selectWallet);
|
|
42
42
|
});
|
|
43
|
-
return (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: !pathname.includes(
|
|
43
|
+
return (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined }, { children: _jsx(AccountBalanceWalletIcon, {}) })));
|
|
44
44
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface HeaderActionState {
|
|
3
|
+
path?: string | null;
|
|
4
|
+
element?: React.ReactNode | null;
|
|
5
|
+
}
|
|
6
|
+
export interface HeaderActionStore extends HeaderActionState {
|
|
7
|
+
setAction(path?: string, element?: React.ReactNode | null): () => void;
|
|
8
|
+
removeAction(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { HeaderActionStore } from './types';
|
|
3
|
+
export declare const useHeaderActionStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<HeaderActionStore>, "setState"> & {
|
|
4
|
+
setState(nextStateOrUpdater: HeaderActionStore | Partial<HeaderActionStore> | ((state: import("immer/dist/internal").WritableDraft<HeaderActionStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useSetHeaderAction: () => (path?: string | undefined, element?: import("react").ReactNode) => () => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable no-underscore-dangle */
|
|
2
|
+
import create from 'zustand';
|
|
3
|
+
import { immer } from 'zustand/middleware/immer';
|
|
4
|
+
export const useHeaderActionStore = create()(immer((set, get) => ({
|
|
5
|
+
setAction: (path, element) => {
|
|
6
|
+
set((state) => {
|
|
7
|
+
state.path = path;
|
|
8
|
+
state.element = element;
|
|
9
|
+
});
|
|
10
|
+
return get().removeAction;
|
|
11
|
+
},
|
|
12
|
+
removeAction: () => {
|
|
13
|
+
set((state) => {
|
|
14
|
+
state.path = null;
|
|
15
|
+
state.element = null;
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
})));
|
|
19
|
+
export const useSetHeaderAction = () => {
|
|
20
|
+
return useHeaderActionStore((state) => state.setAction);
|
|
21
|
+
};
|
|
@@ -7,6 +7,5 @@ export const PoweredBy = () => {
|
|
|
7
7
|
display: 'flex',
|
|
8
8
|
alignItems: 'flex-end',
|
|
9
9
|
justifyContent: 'flex-end',
|
|
10
|
-
flex: 1,
|
|
11
10
|
} }, { children: _jsxs(Link, Object.assign({ href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [_jsx(Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })));
|
|
12
11
|
};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import { Box, CircularProgress, IconButton, Tooltip, } from '@mui/material';
|
|
3
14
|
import { useEffect, useState } from 'react';
|
|
@@ -6,7 +17,8 @@ const getProgressValue = (updatedAt, timeToUpdate) => updatedAt
|
|
|
6
17
|
? Math.min(100, ((Date.now() - updatedAt) / timeToUpdate) * 100)
|
|
7
18
|
: 0;
|
|
8
19
|
const getSecondsToUpdate = (updatedAt, timeToUpdate) => Math.max(Math.round((timeToUpdate - (Date.now() - updatedAt)) / 1000), 0);
|
|
9
|
-
export const ProgressToNextUpdate = (
|
|
20
|
+
export const ProgressToNextUpdate = (_a) => {
|
|
21
|
+
var { updatedAt, timeToUpdate, isLoading, onClick } = _a, other = __rest(_a, ["updatedAt", "timeToUpdate", "isLoading", "onClick"]);
|
|
10
22
|
const { t } = useTranslation();
|
|
11
23
|
const [value, setValue] = useState(() => getProgressValue(updatedAt, timeToUpdate));
|
|
12
24
|
useEffect(() => {
|
|
@@ -25,7 +37,7 @@ export const ProgressToNextUpdate = ({ updatedAt, timeToUpdate, isLoading, onCli
|
|
|
25
37
|
setValue(0);
|
|
26
38
|
}
|
|
27
39
|
}, [isLoading]);
|
|
28
|
-
return (_jsx(IconButton, Object.assign({ onClick: onClick,
|
|
40
|
+
return (_jsx(IconButton, Object.assign({ onClick: onClick, disabled: isLoading }, other, { children: _jsx(Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
|
|
29
41
|
value: getSecondsToUpdate(updatedAt, timeToUpdate),
|
|
30
42
|
}), placement: "top", enterDelay: 250, arrow: true }, { children: _jsxs(Box, Object.assign({ sx: {
|
|
31
43
|
display: 'grid',
|
|
@@ -12,13 +12,11 @@ export const ReverseTokensButton = ({ vertical, }) => {
|
|
|
12
12
|
SwapFormKey.ToChain,
|
|
13
13
|
SwapFormKey.ToToken,
|
|
14
14
|
]);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
setValue(SwapFormKey.ToToken, fromToken);
|
|
21
|
-
}
|
|
15
|
+
setValue(SwapFormKey.FromAmount, '');
|
|
16
|
+
setValue(SwapFormKey.FromChain, toChain);
|
|
17
|
+
setValue(SwapFormKey.FromToken, toToken);
|
|
18
|
+
setValue(SwapFormKey.ToChain, fromChain);
|
|
19
|
+
setValue(SwapFormKey.ToToken, fromToken);
|
|
22
20
|
};
|
|
23
21
|
return (_jsx(IconButton, Object.assign({ onClick: handleClick, size: "small", "aria-label": "swap-destinations" }, { children: vertical ? _jsx(SwapVertIcon, {}) : _jsx(SwapHorizIcon, {}) })));
|
|
24
22
|
};
|