@rango-dev/widget-embedded 0.12.1-next.17 → 0.12.1-next.18
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/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
- package/src/components/Layout/Layout.styles.ts +1 -1
- package/src/components/Layout/Layout.tsx +3 -20
- package/src/components/SwapDetails/SwapDetails.styles.ts +1 -1
- package/src/components/SwapDetails/SwapDetails.tsx +1 -9
- package/src/components/SwitchFromAndTo.tsx +1 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.12.1-next.
|
|
3
|
+
"version": "0.12.1-next.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@rango-dev/queue-manager-core": "^0.15.1-next.1",
|
|
24
24
|
"@rango-dev/queue-manager-rango-preset": "^0.15.1-next.5",
|
|
25
25
|
"@rango-dev/queue-manager-react": "^0.15.1-next.3",
|
|
26
|
-
"@rango-dev/ui": "^0.15.1-next.
|
|
26
|
+
"@rango-dev/ui": "^0.15.1-next.11",
|
|
27
27
|
"@rango-dev/wallets-react": "^0.1.1-next.5",
|
|
28
28
|
"@rango-dev/wallets-shared": "^0.15.1-next.3",
|
|
29
29
|
"bignumber.js": "^9.1.1",
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { PropTypes, Ref } from './Layout.types';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
Divider,
|
|
7
|
-
Header,
|
|
8
|
-
theme,
|
|
9
|
-
usePaddingRight,
|
|
10
|
-
} from '@rango-dev/ui';
|
|
11
|
-
import React, { useRef } from 'react';
|
|
4
|
+
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
5
|
+
import React from 'react';
|
|
12
6
|
import { useNavigate } from 'react-router-dom';
|
|
13
7
|
|
|
14
8
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
@@ -18,8 +12,6 @@ import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
|
|
|
18
12
|
|
|
19
13
|
import { Container, Content, Footer } from './Layout.styles';
|
|
20
14
|
|
|
21
|
-
const DEFAULT_CONTENT_PADDING = 20;
|
|
22
|
-
|
|
23
15
|
function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
24
16
|
const {
|
|
25
17
|
children,
|
|
@@ -35,13 +27,6 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
35
27
|
useUiStore.use.connectWalletsButtonDisabled();
|
|
36
28
|
const navigate = useNavigate();
|
|
37
29
|
|
|
38
|
-
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
39
|
-
|
|
40
|
-
usePaddingRight({
|
|
41
|
-
elementRef: contentRef,
|
|
42
|
-
paddingRight: noPadding ? '0' : theme.sizes[DEFAULT_CONTENT_PADDING],
|
|
43
|
-
});
|
|
44
|
-
|
|
45
30
|
const onConnectWallet = () => {
|
|
46
31
|
if (!connectWalletsButtonDisabled) {
|
|
47
32
|
navigate('/' + navigationRoutes.wallets);
|
|
@@ -65,9 +50,7 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
65
50
|
</>
|
|
66
51
|
}
|
|
67
52
|
/>
|
|
68
|
-
<Content noPadding={noPadding}
|
|
69
|
-
{children}
|
|
70
|
-
</Content>
|
|
53
|
+
<Content noPadding={noPadding}>{children}</Content>
|
|
71
54
|
{(hasLogo || footer) && (
|
|
72
55
|
<Footer>
|
|
73
56
|
<div className="footer__content">{footer}</div>
|
|
@@ -16,10 +16,8 @@ import {
|
|
|
16
16
|
RouteCost,
|
|
17
17
|
RouteSummary,
|
|
18
18
|
StepDetails,
|
|
19
|
-
theme,
|
|
20
19
|
Typography,
|
|
21
20
|
useCopyToClipboard,
|
|
22
|
-
usePaddingRight,
|
|
23
21
|
} from '@rango-dev/ui';
|
|
24
22
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
25
23
|
import React, { useEffect, useRef, useState } from 'react';
|
|
@@ -65,15 +63,14 @@ import {
|
|
|
65
63
|
} from './SwapDetails.helpers';
|
|
66
64
|
import { Container, HeaderDetails, StepsList } from './SwapDetails.styles';
|
|
67
65
|
|
|
68
|
-
const DEFAULT_CONTENT_PADDING = 20;
|
|
69
66
|
export function SwapDetails(props: SwapDetailsProps) {
|
|
70
67
|
const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
|
|
71
68
|
const { canSwitchNetworkTo, connect, getWalletInfo } = useWallets();
|
|
72
69
|
const retry = useBestRouteStore.use.retry();
|
|
73
70
|
const navigate = useNavigate();
|
|
74
71
|
const { navigateBackFrom } = useNavigateBack();
|
|
75
|
-
const listRef = useRef<HTMLDivElement | null>(null);
|
|
76
72
|
const [_, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
|
|
73
|
+
const listRef = useRef<HTMLDivElement | null>(null);
|
|
77
74
|
const [modalState, setModalState] = useState<ModalState>(null);
|
|
78
75
|
const [showCompletedModal, setShowCompletedModal] = useState<
|
|
79
76
|
'success' | 'failed' | null
|
|
@@ -82,11 +79,6 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
82
79
|
meta: { tokens },
|
|
83
80
|
} = useMetaStore();
|
|
84
81
|
|
|
85
|
-
usePaddingRight({
|
|
86
|
-
elementRef: listRef,
|
|
87
|
-
paddingRight: theme.sizes[DEFAULT_CONTENT_PADDING],
|
|
88
|
-
});
|
|
89
|
-
|
|
90
82
|
const onCancel = () => {
|
|
91
83
|
onCancelProps();
|
|
92
84
|
setModalState(null);
|
|
@@ -1,38 +1,8 @@
|
|
|
1
1
|
import { ReverseIcon, styled } from '@rango-dev/ui';
|
|
2
|
-
import React
|
|
3
|
-
import { useInRouterContext, useSearchParams } from 'react-router-dom';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
|
|
5
|
-
import { SearchParams } from '../constants/searchParams';
|
|
6
4
|
import { useBestRouteStore } from '../store/bestRoute';
|
|
7
5
|
|
|
8
|
-
function SwitchFromAndTo({ count }: { count: number }) {
|
|
9
|
-
const firstRender = useRef(true);
|
|
10
|
-
const [searchParams, setSearchParams] = useSearchParams();
|
|
11
|
-
const outputAmount = useBestRouteStore.use.outputAmount();
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (!firstRender.current) {
|
|
15
|
-
const fromChainString = searchParams.get(SearchParams.FROM_CHAIN);
|
|
16
|
-
const fromTokenString = searchParams.get(SearchParams.FROM_TOKEN);
|
|
17
|
-
const toChainString = searchParams.get(SearchParams.TO_CHAIN);
|
|
18
|
-
const toTokenString = searchParams.get(SearchParams.TO_TOKEN);
|
|
19
|
-
setSearchParams({
|
|
20
|
-
...(toChainString && { [SearchParams.FROM_CHAIN]: toChainString }),
|
|
21
|
-
...(toTokenString && { [SearchParams.FROM_TOKEN]: toTokenString }),
|
|
22
|
-
...(fromChainString && { [SearchParams.TO_CHAIN]: fromChainString }),
|
|
23
|
-
...(fromTokenString && { [SearchParams.TO_TOKEN]: fromTokenString }),
|
|
24
|
-
...(outputAmount && {
|
|
25
|
-
[SearchParams.FROM_AMOUNT]: outputAmount.toString(),
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
firstRender.current = false;
|
|
30
|
-
}
|
|
31
|
-
}, [count]);
|
|
32
|
-
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
6
|
const SwitchButtonContainer = styled('div', {
|
|
37
7
|
position: 'absolute',
|
|
38
8
|
bottom: '-12px',
|
|
@@ -58,18 +28,14 @@ const StyledButton = styled('div', {
|
|
|
58
28
|
|
|
59
29
|
export function SwitchFromAndToButton() {
|
|
60
30
|
const switchFromAndTo = useBestRouteStore.use.switchFromAndTo();
|
|
61
|
-
const isRouterInContext = useInRouterContext();
|
|
62
|
-
const [count, setCount] = useState(0);
|
|
63
31
|
|
|
64
32
|
return (
|
|
65
33
|
<SwitchButtonContainer>
|
|
66
34
|
<StyledButton
|
|
67
35
|
onClick={() => {
|
|
68
36
|
switchFromAndTo();
|
|
69
|
-
setCount((prev) => prev + 1);
|
|
70
37
|
}}>
|
|
71
38
|
<ReverseIcon size={12} />
|
|
72
|
-
{isRouterInContext && <SwitchFromAndTo count={count} />}
|
|
73
39
|
</StyledButton>
|
|
74
40
|
</SwitchButtonContainer>
|
|
75
41
|
);
|