@rango-dev/widget-embedded 0.1.16-next.2 → 0.1.16-next.8
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/TokenInfo.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts +2 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/types/config.d.ts +11 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/common.d.ts +0 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js +78 -110
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js +78 -110
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js +79 -111
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +9 -8
- package/src/components/AppRoutes.tsx +1 -1
- package/src/components/BottomLogo.tsx +1 -1
- package/src/components/RoutesOverview.tsx +2 -2
- package/src/components/TokenInfo.tsx +9 -8
- package/src/components/TokenPreview.tsx +6 -6
- package/src/hooks/useTheme.ts +42 -59
- package/src/pages/ConfirmSwapPage.tsx +25 -17
- package/src/pages/SettingsPage.tsx +3 -1
- package/src/types/config.ts +8 -1
- package/src/utils/common.ts +0 -21
- package/src/utils/wallets.ts +1 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.1.16-next.
|
|
3
|
+
"version": "0.1.16-next.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "tsdx build"
|
|
13
|
+
"build": "tsdx build --tsconfig ./tsconfig.json"
|
|
14
14
|
},
|
|
15
15
|
"husky": {
|
|
16
16
|
"hooks": {
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"trailingComma": "es5"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@rango-dev/provider-all": "^0.1.
|
|
28
|
-
"@rango-dev/queue-manager-core": "^0.1.
|
|
29
|
-
"@rango-dev/queue-manager-rango-preset": "^0.1.
|
|
27
|
+
"@rango-dev/provider-all": "^0.1.14-next.4",
|
|
28
|
+
"@rango-dev/queue-manager-core": "^0.1.13-next.0",
|
|
29
|
+
"@rango-dev/queue-manager-rango-preset": "^0.1.13-next.1",
|
|
30
30
|
"@rango-dev/queue-manager-react": "^0.1.11",
|
|
31
|
-
"@rango-dev/ui": "^0.1.
|
|
32
|
-
"@rango-dev/wallets-core": "^0.1.
|
|
33
|
-
"@rango-dev/wallets-shared": "^0.1.
|
|
31
|
+
"@rango-dev/ui": "^0.1.14-next.1",
|
|
32
|
+
"@rango-dev/wallets-core": "^0.1.14-next.0",
|
|
33
|
+
"@rango-dev/wallets-shared": "^0.1.13-next.0",
|
|
34
34
|
"bignumber.js": "^9.1.1",
|
|
35
35
|
"copy-to-clipboard": "^3.3.3",
|
|
36
36
|
"dayjs": "^1.11.7",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"react-dom": "^18.2.0",
|
|
47
47
|
"react-i18next": "^12.2.0",
|
|
48
48
|
"react-router-dom": "^6.8.0",
|
|
49
|
+
"values.js": "2.1.1",
|
|
49
50
|
"zustand": "^4.3.2"
|
|
50
51
|
},
|
|
51
52
|
"publishConfig": {
|
|
@@ -55,7 +55,7 @@ export function AppRoutes(props: PropTypes) {
|
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
path: navigationRoutes.settings,
|
|
58
|
-
element: <SettingsPage supportedSwappers={config?.liquiditySources} />,
|
|
58
|
+
element: <SettingsPage singleTheme= {config?.theme?.singleTheme} supportedSwappers={config?.liquiditySources} />,
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
path: navigationRoutes.liquiditySources,
|
|
@@ -29,7 +29,7 @@ export function BottomLogo() {
|
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<Container>
|
|
32
|
-
<Typography variant="caption" color="$
|
|
32
|
+
<Typography variant="caption" color="$neutral600">
|
|
33
33
|
{t('Powered By')}
|
|
34
34
|
</Typography>
|
|
35
35
|
<StyledAnchor href="https://rango.exchange" target="_blank">
|
|
@@ -8,8 +8,8 @@ export const Container = styled('div', {
|
|
|
8
8
|
justifyContent: 'space-between',
|
|
9
9
|
padding: '$8',
|
|
10
10
|
borderRadius: '$5',
|
|
11
|
-
backgroundColor: '$
|
|
12
|
-
color: '$
|
|
11
|
+
backgroundColor: '$neutral100',
|
|
12
|
+
color: '$neutral800',
|
|
13
13
|
fontSize: '$12',
|
|
14
14
|
|
|
15
15
|
'.routes': {
|
|
@@ -48,10 +48,11 @@ const Container = styled('div', {
|
|
|
48
48
|
variants: {
|
|
49
49
|
type: {
|
|
50
50
|
filled: {
|
|
51
|
-
backgroundColor: '$
|
|
51
|
+
backgroundColor: '$neutral100',
|
|
52
52
|
},
|
|
53
53
|
outlined: {
|
|
54
|
-
border: '1px solid $
|
|
54
|
+
border: '1px solid $neutral100',
|
|
55
|
+
backgroundColor: '$surface',
|
|
55
56
|
},
|
|
56
57
|
},
|
|
57
58
|
},
|
|
@@ -105,7 +106,7 @@ const Options = styled('div', {
|
|
|
105
106
|
const ImagePlaceholder = styled('span', {
|
|
106
107
|
width: '24px',
|
|
107
108
|
height: '24px',
|
|
108
|
-
backgroundColor: '$
|
|
109
|
+
backgroundColor: '$neutral100',
|
|
109
110
|
borderRadius: '99999px',
|
|
110
111
|
});
|
|
111
112
|
|
|
@@ -113,7 +114,7 @@ const OutputContainer = styled('div', {
|
|
|
113
114
|
windth: '100%',
|
|
114
115
|
height: '$48',
|
|
115
116
|
borderRadius: '$5',
|
|
116
|
-
backgroundColor: '$
|
|
117
|
+
backgroundColor: '$surface',
|
|
117
118
|
border: '1px solid transparent',
|
|
118
119
|
position: 'relative',
|
|
119
120
|
display: 'flex',
|
|
@@ -185,7 +186,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
185
186
|
<Box>
|
|
186
187
|
<Container type={props.type === 'From' ? 'filled' : 'outlined'}>
|
|
187
188
|
<div className="head">
|
|
188
|
-
<Typography variant="body2" color="
|
|
189
|
+
<Typography variant="body2" color="neutral800">
|
|
189
190
|
{t(type)}
|
|
190
191
|
</Typography>
|
|
191
192
|
{props.type === 'From' ? (
|
|
@@ -197,7 +198,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
197
198
|
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
198
199
|
}}
|
|
199
200
|
>
|
|
200
|
-
<Typography variant="body3" color="
|
|
201
|
+
<Typography variant="body3" color="neutral600">{`${t(
|
|
201
202
|
'Balance'
|
|
202
203
|
)}: ${tokenBalance} ${fromToken?.symbol || ''}`}</Typography>
|
|
203
204
|
<Spacer size={4} />
|
|
@@ -215,7 +216,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
215
216
|
<div>
|
|
216
217
|
<Typography
|
|
217
218
|
variant="caption"
|
|
218
|
-
color="
|
|
219
|
+
color="neutral600"
|
|
219
220
|
>{`$${numberToString(props.outputUsdValue)}`}</Typography>
|
|
220
221
|
</div>
|
|
221
222
|
</div>
|
|
@@ -293,7 +294,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
293
294
|
>
|
|
294
295
|
<Typography
|
|
295
296
|
variant="caption"
|
|
296
|
-
color="
|
|
297
|
+
color="neutral800"
|
|
297
298
|
>{`$${numberToString(inputUsdValue)}`}</Typography>
|
|
298
299
|
</span>
|
|
299
300
|
}
|
|
@@ -27,10 +27,10 @@ const Container = styled('div', {
|
|
|
27
27
|
variants: {
|
|
28
28
|
type: {
|
|
29
29
|
filled: {
|
|
30
|
-
backgroundColor: '$
|
|
30
|
+
backgroundColor: '$neutral100',
|
|
31
31
|
},
|
|
32
32
|
outlined: {
|
|
33
|
-
border: '1px solid $
|
|
33
|
+
border: '1px solid $neutral100',
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
},
|
|
@@ -70,7 +70,7 @@ const Container = styled('div', {
|
|
|
70
70
|
const ImagePlaceholder = styled('span', {
|
|
71
71
|
width: '24px',
|
|
72
72
|
height: '24px',
|
|
73
|
-
backgroundColor: '$
|
|
73
|
+
backgroundColor: '$neutral100',
|
|
74
74
|
borderRadius: '99999px',
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -78,7 +78,7 @@ const OutputContainer = styled('div', {
|
|
|
78
78
|
windth: '100%',
|
|
79
79
|
height: '$48',
|
|
80
80
|
borderRadius: '$5',
|
|
81
|
-
backgroundColor: '$
|
|
81
|
+
backgroundColor: '$surface',
|
|
82
82
|
border: '1px solid transparent',
|
|
83
83
|
position: 'relative',
|
|
84
84
|
display: 'flex',
|
|
@@ -123,7 +123,7 @@ export function TokenPreview(props: PropTypes) {
|
|
|
123
123
|
<Box>
|
|
124
124
|
<Container type={'outlined'}>
|
|
125
125
|
<div className="head">
|
|
126
|
-
<Typography variant="body2" color="
|
|
126
|
+
<Typography variant="body2" color="neutral800">
|
|
127
127
|
{props.label}
|
|
128
128
|
</Typography>
|
|
129
129
|
<div>
|
|
@@ -131,7 +131,7 @@ export function TokenPreview(props: PropTypes) {
|
|
|
131
131
|
{props.usdValue && (
|
|
132
132
|
<Typography
|
|
133
133
|
variant="caption"
|
|
134
|
-
color="
|
|
134
|
+
color="neutral600"
|
|
135
135
|
className="usd-value"
|
|
136
136
|
>{`$${numberToString(props.usdValue)}`}</Typography>
|
|
137
137
|
)}
|
package/src/hooks/useTheme.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { createTheme } from '@rango-dev/ui';
|
|
1
|
+
import { createTheme, generateRangeColors } from '@rango-dev/ui';
|
|
2
2
|
import { useState, useEffect, useLayoutEffect } from 'react';
|
|
3
3
|
import { useMetaStore } from '../store/meta';
|
|
4
4
|
import { useSettingsStore } from '../store/settings';
|
|
5
5
|
import { WidgetTheme } from '../types';
|
|
6
|
-
import { shadeColor } from '../utils/common';
|
|
7
6
|
import usePrevious from './usePrevious';
|
|
8
7
|
|
|
9
8
|
export function useTheme({
|
|
@@ -15,98 +14,81 @@ export function useTheme({
|
|
|
15
14
|
const theme = useSettingsStore.use.theme();
|
|
16
15
|
const fetchMeta = useMetaStore.use.fetchMeta();
|
|
17
16
|
const setTheme = useSettingsStore.use.setTheme();
|
|
17
|
+
const light = themeColors?.light;
|
|
18
|
+
const dark = themeColors?.dark;
|
|
19
|
+
const neutral = light?.neutral || '#fafafa';
|
|
20
|
+
const background = light?.background || '#fff';
|
|
21
|
+
const foreground = light?.foreground || '#000';
|
|
18
22
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
primary300: shadeColor(primary, -15),
|
|
38
|
-
primary400: shadeColor(primary, -20),
|
|
39
|
-
primary500: shadeColor(primary, -25),
|
|
40
|
-
primary600: shadeColor(primary, -30),
|
|
41
|
-
primary700: shadeColor(primary, -35),
|
|
42
|
-
primary800: shadeColor(primary, -40),
|
|
43
|
-
primary900: shadeColor(primary, -45),
|
|
23
|
+
const darkColors = {
|
|
24
|
+
...generateRangeColors('primary', 'dark', dark?.primary),
|
|
25
|
+
...generateRangeColors('error', 'dark', dark?.error),
|
|
26
|
+
...generateRangeColors('warning', 'dark', dark?.warning),
|
|
27
|
+
...generateRangeColors('success', 'dark', dark?.success),
|
|
28
|
+
...generateRangeColors('neutral', 'dark', dark?.neutral),
|
|
29
|
+
surface: dark?.surface,
|
|
30
|
+
background: dark?.background,
|
|
31
|
+
foreground: dark?.foreground,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const lightColors = {
|
|
35
|
+
surface: light?.surface || '#fff',
|
|
36
|
+
...generateRangeColors('primary', 'light', light?.primary || '#5FA425'),
|
|
37
|
+
...generateRangeColors('error', 'light', light?.error || '#FF0000'),
|
|
38
|
+
...generateRangeColors('warning', 'light', light?.warning || '#F5A623'),
|
|
39
|
+
...generateRangeColors('success', 'light', light?.success || '#0070F3'),
|
|
40
|
+
...generateRangeColors('neutral', 'light', neutral),
|
|
44
41
|
background,
|
|
45
42
|
foreground,
|
|
46
|
-
error,
|
|
47
|
-
error100: shadeColor(error, 50),
|
|
48
|
-
error300: shadeColor(error, -10),
|
|
49
|
-
error500: shadeColor(error, -20),
|
|
50
|
-
error700: shadeColor(error, -30),
|
|
51
|
-
warning,
|
|
52
|
-
warning100: shadeColor(warning, 50),
|
|
53
|
-
warning300: shadeColor(warning, -10),
|
|
54
|
-
warning500: shadeColor(warning, -20),
|
|
55
|
-
warning700: shadeColor(warning, -30),
|
|
56
|
-
success,
|
|
57
|
-
success100: shadeColor(success, 50),
|
|
58
|
-
success300: shadeColor(success, -10),
|
|
59
|
-
success500: shadeColor(success, -20),
|
|
60
|
-
success700: shadeColor(success, -30),
|
|
61
43
|
};
|
|
62
44
|
|
|
63
45
|
const customeLightTheme = createTheme({
|
|
64
|
-
colors,
|
|
46
|
+
colors: lightColors,
|
|
65
47
|
radii: {
|
|
66
48
|
5: `${borderRadius}px`,
|
|
67
49
|
},
|
|
68
50
|
shadows: {
|
|
69
|
-
s:
|
|
51
|
+
s: `0px 3px 5px 3px ${light?.neutral || '#f0f2f5'} ,0px 6px 10px 3px ${
|
|
52
|
+
light?.neutral || '#f0f2f5'
|
|
53
|
+
}, 0px 1px 18px 3px ${light?.neutral || '#f0f2f5'}`,
|
|
70
54
|
},
|
|
71
55
|
});
|
|
72
56
|
|
|
73
57
|
const customeDarkTheme = createTheme({
|
|
74
58
|
colors: {
|
|
75
|
-
...
|
|
76
|
-
|
|
77
|
-
neutrals300: '#333333',
|
|
78
|
-
neutrals400: '#444444',
|
|
79
|
-
neutrals500: '#acacac',
|
|
80
|
-
neutrals600: '#cccccc',
|
|
81
|
-
neutrals700: '#dedede',
|
|
82
|
-
neutrals800: '#f2f2f2',
|
|
83
|
-
neutrals900: '#FAFAFA',
|
|
59
|
+
...lightColors,
|
|
60
|
+
...generateRangeColors('neutral', 'dark', '#111111'),
|
|
84
61
|
foreground: background,
|
|
85
62
|
background: foreground,
|
|
63
|
+
surface: '#000',
|
|
64
|
+
...JSON.parse(JSON.stringify(darkColors)),
|
|
86
65
|
},
|
|
87
66
|
radii: {
|
|
88
67
|
5: `${borderRadius}px`,
|
|
89
68
|
},
|
|
90
69
|
shadows: {
|
|
91
|
-
s:
|
|
70
|
+
s: `0px 3px 5px 3px ${dark?.neutral || '#222'}, 0px 6px 10px 3px ${
|
|
71
|
+
dark?.neutral || '#222'
|
|
72
|
+
}, 0px 1px 18px 3px ${dark?.neutral || '#222'}`,
|
|
92
73
|
},
|
|
93
74
|
});
|
|
94
|
-
const [OSTheme, setOSTheme] = useState(
|
|
75
|
+
const [OSTheme, setOSTheme] = useState('light');
|
|
76
|
+
|
|
95
77
|
useEffect(() => {
|
|
96
78
|
(async () => {
|
|
97
79
|
await fetchMeta();
|
|
98
80
|
})();
|
|
99
81
|
|
|
100
82
|
const switchTheme = (event: MediaQueryListEvent) => {
|
|
101
|
-
if (event.matches) setOSTheme(
|
|
102
|
-
else setOSTheme(
|
|
83
|
+
if (event.matches) setOSTheme('dark');
|
|
84
|
+
else setOSTheme('light');
|
|
103
85
|
};
|
|
104
86
|
|
|
105
87
|
if (
|
|
106
88
|
window.matchMedia &&
|
|
107
89
|
window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
108
90
|
) {
|
|
109
|
-
setOSTheme(
|
|
91
|
+
setOSTheme('dark');
|
|
110
92
|
}
|
|
111
93
|
|
|
112
94
|
window
|
|
@@ -131,7 +113,8 @@ export function useTheme({
|
|
|
131
113
|
}, [fontFamily]);
|
|
132
114
|
|
|
133
115
|
const getActiveTheme = () => {
|
|
134
|
-
if (theme === 'auto')
|
|
116
|
+
if (theme === 'auto')
|
|
117
|
+
return OSTheme === 'dark' ? customeDarkTheme : customeLightTheme;
|
|
135
118
|
else return theme === 'dark' ? customeDarkTheme : customeLightTheme;
|
|
136
119
|
};
|
|
137
120
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useNavigate } from 'react-router-dom';
|
|
3
3
|
import { useBestRouteStore } from '../store/bestRoute';
|
|
4
4
|
import { useWalletsStore } from '../store/wallets';
|
|
@@ -49,7 +49,7 @@ export function ConfirmSwapPage() {
|
|
|
49
49
|
const inputUsdValue = useBestRouteStore.use.inputUsdValue();
|
|
50
50
|
const outputUsdValue = useBestRouteStore.use.outputUsdValue();
|
|
51
51
|
const setInputAmount = useBestRouteStore.use.setInputAmount();
|
|
52
|
-
|
|
52
|
+
const [dbErrorMessage, setDbErrorMessage] = useState<string>('');
|
|
53
53
|
const bestRouteloadingStatus = getBestRouteStatus(
|
|
54
54
|
fetchingBestRoute,
|
|
55
55
|
!!fetchingBestRouteError
|
|
@@ -106,21 +106,25 @@ export function ConfirmSwapPage() {
|
|
|
106
106
|
requiredWallets={getRequiredChains(bestRoute)}
|
|
107
107
|
selectableWallets={selectableWallets}
|
|
108
108
|
onBack={navigateBackFrom.bind(null, navigationRoutes.confirmSwap)}
|
|
109
|
-
onConfirm={() => {
|
|
110
|
-
confirmSwap?.().then((swap) => {
|
|
109
|
+
onConfirm={async () => {
|
|
110
|
+
confirmSwap?.().then(async (swap) => {
|
|
111
111
|
if (swap) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
try {
|
|
113
|
+
await manager?.create(
|
|
114
|
+
'swap',
|
|
115
|
+
{ swapDetails: swap },
|
|
116
|
+
{ id: swap.requestId }
|
|
117
|
+
);
|
|
118
|
+
setSelectedSwap(swap.requestId);
|
|
119
|
+
navigate('/' + navigationRoutes.swaps + `/${swap.requestId}`, {
|
|
120
|
+
replace: true,
|
|
121
|
+
});
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
setInputAmount('');
|
|
124
|
+
}, 0);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
setDbErrorMessage('Error: ' + (e as any)?.message);
|
|
127
|
+
}
|
|
124
128
|
}
|
|
125
129
|
});
|
|
126
130
|
}}
|
|
@@ -186,7 +190,11 @@ export function ConfirmSwapPage() {
|
|
|
186
190
|
/>
|
|
187
191
|
}
|
|
188
192
|
loading={fetchingConfirmedRoute}
|
|
189
|
-
errors={
|
|
193
|
+
errors={
|
|
194
|
+
dbErrorMessage
|
|
195
|
+
? [dbErrorMessage, ...ConfirmSwapErrors(errors)]
|
|
196
|
+
: ConfirmSwapErrors(errors)
|
|
197
|
+
}
|
|
190
198
|
warnings={ConfirmSwapWarnings(warnings)}
|
|
191
199
|
extraMessages={
|
|
192
200
|
<>
|
|
@@ -13,8 +13,9 @@ import {
|
|
|
13
13
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
14
14
|
interface PropTypes {
|
|
15
15
|
supportedSwappers?: string[];
|
|
16
|
+
singleTheme?: boolean;
|
|
16
17
|
}
|
|
17
|
-
export function SettingsPage({ supportedSwappers }: PropTypes) {
|
|
18
|
+
export function SettingsPage({ supportedSwappers, singleTheme }: PropTypes) {
|
|
18
19
|
const slippage = useSettingsStore.use.slippage();
|
|
19
20
|
const setSlippage = useSettingsStore.use.setSlippage();
|
|
20
21
|
const disabledLiquiditySources =
|
|
@@ -77,6 +78,7 @@ export function SettingsPage({ supportedSwappers }: PropTypes) {
|
|
|
77
78
|
selectedLiquiditySources={supportedUniqueSwappersGroups.filter(
|
|
78
79
|
(s) => s.selected
|
|
79
80
|
)}
|
|
81
|
+
singleTheme={singleTheme}
|
|
80
82
|
customSlippage={customSlippage || NaN}
|
|
81
83
|
onCustomSlippageChange={setCustomSlippage}
|
|
82
84
|
minSlippage={MIN_SLIPPGAE}
|
package/src/types/config.ts
CHANGED
|
@@ -9,6 +9,9 @@ import { WalletType } from '@rango-dev/wallets-shared';
|
|
|
9
9
|
* @property {string} success
|
|
10
10
|
* @property {string} error
|
|
11
11
|
* @property {string} warning
|
|
12
|
+
* @property {string} surface
|
|
13
|
+
* @property {string} neutral
|
|
14
|
+
|
|
12
15
|
*/
|
|
13
16
|
export type WidgetColors = {
|
|
14
17
|
background?: string;
|
|
@@ -17,6 +20,8 @@ export type WidgetColors = {
|
|
|
17
20
|
success?: string;
|
|
18
21
|
error?: string;
|
|
19
22
|
warning?: string;
|
|
23
|
+
surface?: string;
|
|
24
|
+
neutral?: string;
|
|
20
25
|
};
|
|
21
26
|
|
|
22
27
|
/**
|
|
@@ -33,14 +38,16 @@ export type WidgetColors = {
|
|
|
33
38
|
* specifies the radius of the corners of a widget.
|
|
34
39
|
* @property {number} width - The `width` property is a number that represents the width of the widget.
|
|
35
40
|
* @property {number} height - The `height` property is a number that specifies the height of the widget.
|
|
41
|
+
* @property {boolean} singleTheme - The `singleTheme` property is a boolean that specifies the theme is support dark and light or only light.
|
|
36
42
|
*/
|
|
37
43
|
export type WidgetTheme = {
|
|
38
44
|
mode?: 'auto' | 'light' | 'dark';
|
|
39
45
|
fontFamily?: string;
|
|
40
|
-
colors?: WidgetColors;
|
|
46
|
+
colors?: { light: WidgetColors; dark: WidgetColors };
|
|
41
47
|
borderRadius?: number;
|
|
42
48
|
width?: number;
|
|
43
49
|
height?: number;
|
|
50
|
+
singleTheme?: boolean;
|
|
44
51
|
};
|
|
45
52
|
|
|
46
53
|
/**
|
package/src/utils/common.ts
CHANGED
|
@@ -10,29 +10,8 @@ export function areEqual(
|
|
|
10
10
|
array1.length === array2.length && array1.every((v, i) => v === array2[i])
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
export function shadeColor(color: string, percent: number) {
|
|
14
|
-
var R = parseInt(color.substring(1, 3), 16);
|
|
15
|
-
var G = parseInt(color.substring(3, 5), 16);
|
|
16
|
-
var B = parseInt(color.substring(5, 7), 16);
|
|
17
13
|
|
|
18
|
-
R = (R * (100 + percent)) / 100;
|
|
19
|
-
G = (G * (100 + percent)) / 100;
|
|
20
|
-
B = (B * (100 + percent)) / 100;
|
|
21
14
|
|
|
22
|
-
R = R < 255 ? R : 255;
|
|
23
|
-
G = G < 255 ? G : 255;
|
|
24
|
-
B = B < 255 ? B : 255;
|
|
25
|
-
|
|
26
|
-
R = Math.round(R);
|
|
27
|
-
G = Math.round(G);
|
|
28
|
-
B = Math.round(B);
|
|
29
|
-
|
|
30
|
-
var RR = R.toString(16).length == 1 ? '0' + R.toString(16) : R.toString(16);
|
|
31
|
-
var GG = G.toString(16).length == 1 ? '0' + G.toString(16) : G.toString(16);
|
|
32
|
-
var BB = B.toString(16).length == 1 ? '0' + B.toString(16) : B.toString(16);
|
|
33
|
-
|
|
34
|
-
return '#' + RR + GG + BB;
|
|
35
|
-
}
|
|
36
15
|
|
|
37
16
|
export function debounce(fn: Function, time: number) {
|
|
38
17
|
let timeoutId: ReturnType<typeof setTimeout> | null;
|
package/src/utils/wallets.ts
CHANGED
|
@@ -42,23 +42,13 @@ export function getStateWallet(state: WalletState): WalletStatus {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export const excludedWallets = [
|
|
46
|
-
WalletType.UNKNOWN,
|
|
47
|
-
WalletType.TERRA_STATION,
|
|
48
|
-
WalletType.LEAP,
|
|
49
|
-
];
|
|
45
|
+
export const excludedWallets = [WalletType.UNKNOWN, WalletType.LEAP];
|
|
50
46
|
|
|
51
47
|
export function getlistWallet(
|
|
52
48
|
getState: (type: WalletType) => WalletState,
|
|
53
49
|
getWalletInfo: (type: WalletType) => WalletInfo,
|
|
54
50
|
list: WalletType[]
|
|
55
51
|
): ModalWalletInfo[] {
|
|
56
|
-
const excludedWallets = [
|
|
57
|
-
WalletType.UNKNOWN,
|
|
58
|
-
WalletType.TERRA_STATION,
|
|
59
|
-
WalletType.LEAP,
|
|
60
|
-
];
|
|
61
|
-
|
|
62
52
|
return list
|
|
63
53
|
.filter((wallet) => !excludedWallets.includes(wallet))
|
|
64
54
|
.map((type) => {
|