@rango-dev/widget-embedded 0.51.1-next.7 → 0.51.1-next.9
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.constants.d.ts +5 -3
- package/dist/components/Layout/Layout.constants.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Detached.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.d.ts.map +1 -1
- package/dist/containers/App/App.styles.d.ts.map +1 -1
- package/dist/hooks/useScreenDetect.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +2 -2
- package/src/components/Layout/Layout.constants.ts +5 -3
- package/src/components/Layout/Layout.styles.ts +12 -5
- package/src/components/Layout/Layout.tsx +18 -32
- package/src/components/WalletStatefulConnect/Detached.tsx +16 -4
- package/src/components/WalletStatefulConnect/Namespaces.tsx +16 -4
- package/src/containers/App/App.styles.ts +1 -0
- package/src/hooks/useScreenDetect.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.51.1-next.
|
|
3
|
+
"version": "0.51.1-next.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@rango-dev/queue-manager-rango-preset": "^0.53.1-next.2",
|
|
31
31
|
"@rango-dev/queue-manager-react": "^0.32.1-next.0",
|
|
32
32
|
"@rango-dev/signer-solana": "^0.44.0",
|
|
33
|
-
"@rango-dev/ui": "^0.54.1-next.
|
|
33
|
+
"@rango-dev/ui": "^0.54.1-next.4",
|
|
34
34
|
"@rango-dev/wallets-core": "^0.50.1-next.1",
|
|
35
35
|
"@rango-dev/wallets-react": "^0.37.1-next.2",
|
|
36
36
|
"@rango-dev/wallets-shared": "^0.51.1-next.1",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export const WIDGET_MAX_HEIGHT =
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
1
|
+
export const WIDGET_MAX_HEIGHT = '700px';
|
|
2
|
+
export const WIDGET_MIN_HEIGHT_FOR_SMALL_SCREENS = '425px';
|
|
3
|
+
export const WIDGET_MIN_HEIGHT_FOR_LARGE_SCREENS = '550px';
|
|
4
|
+
export const COMPACT_TOKEN_SELECTOR_THRESHOLD = '640px';
|
|
5
|
+
export const LARGE_SCREEN_MIN_HEIGHT = '800px';
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { css, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
LARGE_SCREEN_MIN_HEIGHT,
|
|
5
|
+
WIDGET_MAX_HEIGHT,
|
|
6
|
+
WIDGET_MIN_HEIGHT_FOR_LARGE_SCREENS,
|
|
7
|
+
WIDGET_MIN_HEIGHT_FOR_SMALL_SCREENS,
|
|
8
|
+
} from './Layout.constants';
|
|
4
9
|
|
|
5
10
|
export const LayoutContainer = css({
|
|
6
11
|
borderRadius: '$primary',
|
|
@@ -16,16 +21,18 @@ export const Container = styled('div', {
|
|
|
16
21
|
minWidth: '300px',
|
|
17
22
|
maxWidth: '390px',
|
|
18
23
|
backgroundColor: '$background',
|
|
24
|
+
maxHeight: WIDGET_MAX_HEIGHT,
|
|
19
25
|
variants: {
|
|
20
26
|
height: {
|
|
21
27
|
auto: {
|
|
22
28
|
height: 'auto',
|
|
23
|
-
maxHeight: WIDGET_MAX_HEIGHT,
|
|
24
29
|
},
|
|
25
30
|
fixed: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
height:
|
|
31
|
+
height: '100%',
|
|
32
|
+
minHeight: WIDGET_MIN_HEIGHT_FOR_SMALL_SCREENS,
|
|
33
|
+
[`@media screen and (min-height: ${LARGE_SCREEN_MIN_HEIGHT})`]: {
|
|
34
|
+
minHeight: WIDGET_MIN_HEIGHT_FOR_LARGE_SCREENS,
|
|
35
|
+
},
|
|
29
36
|
},
|
|
30
37
|
},
|
|
31
38
|
showBanner: {
|
|
@@ -10,7 +10,6 @@ import { WIDGET_UI_ID } from '../../constants';
|
|
|
10
10
|
import { useIframe } from '../../hooks/useIframe';
|
|
11
11
|
import { isAppLoadedIntoIframe } from '../../hooks/useIframe/useIframe.helpers';
|
|
12
12
|
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
13
|
-
import useScreenDetect from '../../hooks/useScreenDetect';
|
|
14
13
|
import { useTheme } from '../../hooks/useTheme';
|
|
15
14
|
import { useAppStore } from '../../store/AppStore';
|
|
16
15
|
import { tabManager, useUiStore } from '../../store/ui';
|
|
@@ -22,10 +21,7 @@ import { ActivateTabModal } from '../common/ActivateTabModal';
|
|
|
22
21
|
import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
|
|
23
22
|
import { RefreshModal } from '../RefreshModal';
|
|
24
23
|
|
|
25
|
-
import {
|
|
26
|
-
COMPACT_TOKEN_SELECTOR_THRESHOLD,
|
|
27
|
-
WIDGET_MAX_HEIGHT,
|
|
28
|
-
} from './Layout.constants';
|
|
24
|
+
import { COMPACT_TOKEN_SELECTOR_THRESHOLD } from './Layout.constants';
|
|
29
25
|
import { onScrollContentAttachStatusToContainer } from './Layout.helpers';
|
|
30
26
|
import {
|
|
31
27
|
BannerContainer,
|
|
@@ -47,7 +43,7 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
47
43
|
const {
|
|
48
44
|
config: { features, theme },
|
|
49
45
|
} = useAppStore();
|
|
50
|
-
const { watermark
|
|
46
|
+
const { watermark } = useUiStore();
|
|
51
47
|
|
|
52
48
|
const hasWatermark = watermark === 'FULL';
|
|
53
49
|
const { activeTheme } = useTheme(theme || {});
|
|
@@ -64,10 +60,10 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
64
60
|
showActivateTabModal,
|
|
65
61
|
setShowActivateTabModal,
|
|
66
62
|
activateCurrentTab,
|
|
63
|
+
setShowCompactTokenSelector,
|
|
67
64
|
} = useUiStore();
|
|
68
65
|
const navigateBack = useNavigateBack();
|
|
69
66
|
const { manager } = useManager();
|
|
70
|
-
const { isTablet, isMobile } = useScreenDetect();
|
|
71
67
|
const pendingSwaps: PendingSwap[] = getPendingSwaps(manager).map(
|
|
72
68
|
({ swap }) => swap
|
|
73
69
|
);
|
|
@@ -134,35 +130,25 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
134
130
|
}, [fetchStatus]);
|
|
135
131
|
|
|
136
132
|
useLayoutEffect(() => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const handler = () => {
|
|
142
|
-
if (isFixedHeight) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
133
|
+
if (!containerRef.current) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
145
136
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
137
|
+
const observer = new ResizeObserver((entries) => {
|
|
138
|
+
for (const entry of entries) {
|
|
139
|
+
if (entry.contentRect) {
|
|
140
|
+
setShowCompactTokenSelector(
|
|
141
|
+
entry.contentRect.height <
|
|
142
|
+
parseInt(COMPACT_TOKEN_SELECTOR_THRESHOLD)
|
|
143
|
+
);
|
|
144
|
+
}
|
|
152
145
|
}
|
|
146
|
+
});
|
|
153
147
|
|
|
154
|
-
|
|
155
|
-
parseFloat(containerRef.current.style.height) <
|
|
156
|
-
COMPACT_TOKEN_SELECTOR_THRESHOLD
|
|
157
|
-
);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
handler();
|
|
148
|
+
observer.observe(containerRef.current);
|
|
161
149
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return () => window.removeEventListener('resize', handler);
|
|
165
|
-
}, [height, isMobile, isTablet]);
|
|
150
|
+
return () => observer.disconnect();
|
|
151
|
+
}, []);
|
|
166
152
|
|
|
167
153
|
return (
|
|
168
154
|
<Container
|
|
@@ -75,7 +75,10 @@ export function Detached(props: PropTypes) {
|
|
|
75
75
|
if (!!singleSelection) {
|
|
76
76
|
return (
|
|
77
77
|
<>
|
|
78
|
-
<Divider
|
|
78
|
+
<Divider
|
|
79
|
+
size={20}
|
|
80
|
+
className="_detached_namespace_list_header_alert_top_divider"
|
|
81
|
+
/>
|
|
79
82
|
<Alert
|
|
80
83
|
id="widget-wallet-stateful-connect-alert"
|
|
81
84
|
variant="alarm"
|
|
@@ -84,13 +87,19 @@ export function Detached(props: PropTypes) {
|
|
|
84
87
|
'This wallet can only connect to one chain at a time.'
|
|
85
88
|
)}
|
|
86
89
|
/>
|
|
87
|
-
<Divider
|
|
90
|
+
<Divider
|
|
91
|
+
size={30}
|
|
92
|
+
className="_detached_namespace_list_header_alert_bottom_divider"
|
|
93
|
+
/>
|
|
88
94
|
</>
|
|
89
95
|
);
|
|
90
96
|
}
|
|
91
97
|
return (
|
|
92
98
|
<>
|
|
93
|
-
<Divider
|
|
99
|
+
<Divider
|
|
100
|
+
size={30}
|
|
101
|
+
className="_detached_namespace_list_header_button_top_divider"
|
|
102
|
+
/>
|
|
94
103
|
<NamespacesHeader>
|
|
95
104
|
<Button
|
|
96
105
|
id="widget-detached-disconnect-wallet-btn"
|
|
@@ -102,7 +111,10 @@ export function Detached(props: PropTypes) {
|
|
|
102
111
|
{i18n.t('Disconnect wallet')}
|
|
103
112
|
</Button>
|
|
104
113
|
</NamespacesHeader>
|
|
105
|
-
<Divider
|
|
114
|
+
<Divider
|
|
115
|
+
size={16}
|
|
116
|
+
className="_detached_namespace_list_header_button_bottom_divider"
|
|
117
|
+
/>
|
|
106
118
|
</>
|
|
107
119
|
);
|
|
108
120
|
};
|
|
@@ -120,7 +120,10 @@ export function Namespaces(props: PropTypes) {
|
|
|
120
120
|
/>
|
|
121
121
|
{singleNamespace ? (
|
|
122
122
|
<>
|
|
123
|
-
<Divider
|
|
123
|
+
<Divider
|
|
124
|
+
size={20}
|
|
125
|
+
className="_initial_namespace_list_header_alert_top_divider"
|
|
126
|
+
/>
|
|
124
127
|
<Alert
|
|
125
128
|
id="widget-wallet-stateful-connect-alert"
|
|
126
129
|
variant="alarm"
|
|
@@ -129,11 +132,17 @@ export function Namespaces(props: PropTypes) {
|
|
|
129
132
|
'This wallet can only connect to one chain at a time. '
|
|
130
133
|
)}
|
|
131
134
|
/>
|
|
132
|
-
<Divider
|
|
135
|
+
<Divider
|
|
136
|
+
size={30}
|
|
137
|
+
className="_initial_namespace_list_header_alert_bottom_divider"
|
|
138
|
+
/>
|
|
133
139
|
</>
|
|
134
140
|
) : (
|
|
135
141
|
<>
|
|
136
|
-
<Divider
|
|
142
|
+
<Divider
|
|
143
|
+
size={30}
|
|
144
|
+
className="_initial_namespace_list_header_button_top_divider"
|
|
145
|
+
/>
|
|
137
146
|
<Button
|
|
138
147
|
style={{ marginLeft: 'auto' }}
|
|
139
148
|
id="widget-name-space-select-all-btn"
|
|
@@ -145,7 +154,10 @@ export function Namespaces(props: PropTypes) {
|
|
|
145
154
|
? i18n.t('Deselect all')
|
|
146
155
|
: i18n.t('Select all')}
|
|
147
156
|
</Button>
|
|
148
|
-
<Divider
|
|
157
|
+
<Divider
|
|
158
|
+
size={10}
|
|
159
|
+
className="_initial_namespace_list_header_button_bottom_divider"
|
|
160
|
+
/>
|
|
149
161
|
</>
|
|
150
162
|
)}
|
|
151
163
|
<NamespaceList>
|
|
@@ -43,7 +43,13 @@ const useScreenDetect = () => {
|
|
|
43
43
|
return () => window.removeEventListener('resize', handleResize);
|
|
44
44
|
}, []);
|
|
45
45
|
|
|
46
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
isMobile,
|
|
48
|
+
isTablet,
|
|
49
|
+
isNotebook,
|
|
50
|
+
isLargeScreen,
|
|
51
|
+
isExtraLargeScreen,
|
|
52
|
+
};
|
|
47
53
|
};
|
|
48
54
|
|
|
49
55
|
export default useScreenDetect;
|