@rango-dev/widget-embedded 0.23.1-next.27 → 0.23.1-next.29
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/containers/Settings/Lists.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/pages/LanguagePage.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/containers/Settings/Lists.tsx +20 -4
- package/src/hooks/useTheme.ts +1 -8
- package/src/pages/LanguagePage.tsx +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LanguagePage.d.ts","sourceRoot":"","sources":["../../src/pages/LanguagePage.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LanguagePage.d.ts","sourceRoot":"","sources":["../../src/pages/LanguagePage.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,wBAAgB,YAAY,sBAkD3B"}
|
package/package.json
CHANGED
|
@@ -29,6 +29,7 @@ import { useNavigate } from 'react-router-dom';
|
|
|
29
29
|
import { SlippageTooltipContainer as TooltipContainer } from '../../components/Slippage/Slippage.styles';
|
|
30
30
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
31
31
|
import { ThemeModeEnum } from '../../constants/settings';
|
|
32
|
+
import { useLanguage } from '../../hooks/useLanguage';
|
|
32
33
|
import { useAppStore } from '../../store/AppStore';
|
|
33
34
|
import { getContainer } from '../../utils/common';
|
|
34
35
|
import { getUniqueSwappersGroups, isFeatureHidden } from '../../utils/settings';
|
|
@@ -85,6 +86,10 @@ export function SettingsLists() {
|
|
|
85
86
|
const navigate = useNavigate();
|
|
86
87
|
const { theme: themeConfig } = useAppStore().config;
|
|
87
88
|
const { setTheme, theme } = useAppStore();
|
|
89
|
+
const { activeLanguage, languages } = useLanguage();
|
|
90
|
+
const currentLanguage = languages.find(
|
|
91
|
+
(language) => language.local === activeLanguage
|
|
92
|
+
)?.label;
|
|
88
93
|
|
|
89
94
|
const fetchStatus = useAppStore().fetchStatus;
|
|
90
95
|
const swappers = useAppStore().swappers();
|
|
@@ -122,7 +127,7 @@ export function SettingsLists() {
|
|
|
122
127
|
(uniqueItem) => uniqueItem.selected
|
|
123
128
|
).length;
|
|
124
129
|
|
|
125
|
-
const
|
|
130
|
+
const handleSwapperEndItem = (totalSelected: number, total: number) => {
|
|
126
131
|
switch (fetchStatus) {
|
|
127
132
|
case 'loading':
|
|
128
133
|
return <Skeleton variant="text" size="medium" width={50} />;
|
|
@@ -150,7 +155,7 @@ export function SettingsLists() {
|
|
|
150
155
|
),
|
|
151
156
|
end: (
|
|
152
157
|
<>
|
|
153
|
-
{
|
|
158
|
+
{handleSwapperEndItem(totalSelectedBridgeSources, totalBridgeSources)}
|
|
154
159
|
<Divider direction="horizontal" size={8} />
|
|
155
160
|
<ChevronRightIcon color="black" />
|
|
156
161
|
</>
|
|
@@ -168,7 +173,10 @@ export function SettingsLists() {
|
|
|
168
173
|
),
|
|
169
174
|
end: (
|
|
170
175
|
<>
|
|
171
|
-
{
|
|
176
|
+
{handleSwapperEndItem(
|
|
177
|
+
totalSelectedExchangeSources,
|
|
178
|
+
totalExchangeSources
|
|
179
|
+
)}
|
|
172
180
|
<Divider direction="horizontal" size={8} />
|
|
173
181
|
<ChevronRightIcon color="gray" />
|
|
174
182
|
</>
|
|
@@ -185,7 +193,15 @@ export function SettingsLists() {
|
|
|
185
193
|
</Typography>
|
|
186
194
|
),
|
|
187
195
|
start: <LanguageIcon color="gray" size={14} />,
|
|
188
|
-
end:
|
|
196
|
+
end: (
|
|
197
|
+
<>
|
|
198
|
+
<Typography variant="body" size="medium">
|
|
199
|
+
{currentLanguage}
|
|
200
|
+
</Typography>
|
|
201
|
+
<Divider direction="horizontal" size={8} />
|
|
202
|
+
<ChevronRightIcon color="gray" />,
|
|
203
|
+
</>
|
|
204
|
+
),
|
|
189
205
|
onClick: () => navigate(navigationRoutes.languages),
|
|
190
206
|
};
|
|
191
207
|
|
package/src/hooks/useTheme.ts
CHANGED
|
@@ -21,12 +21,11 @@ export function useTheme(props: WidgetTheme) {
|
|
|
21
21
|
fontFamily = DEFAULT_FONT_FAMILY,
|
|
22
22
|
borderRadius = DEFAULT_PRIMARY_RADIUS,
|
|
23
23
|
secondaryBorderRadius = DEFAULT_SECONDARY_RADIUS,
|
|
24
|
-
mode = 'auto',
|
|
25
24
|
} = props;
|
|
26
25
|
|
|
27
26
|
const [OSTheme, setOSTheme] = useState('light');
|
|
28
27
|
|
|
29
|
-
const {
|
|
28
|
+
const { theme } = useAppStore();
|
|
30
29
|
|
|
31
30
|
const { dark, light } = customizedThemeTokens(colors);
|
|
32
31
|
|
|
@@ -81,12 +80,6 @@ export function useTheme(props: WidgetTheme) {
|
|
|
81
80
|
};
|
|
82
81
|
}, []);
|
|
83
82
|
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
if (mode !== 'auto') {
|
|
86
|
-
setTheme(mode);
|
|
87
|
-
}
|
|
88
|
-
}, [mode]);
|
|
89
|
-
|
|
90
83
|
const getActiveTheme = () => {
|
|
91
84
|
const lightClassNames = lightThemeClasses.join(' ');
|
|
92
85
|
const darkClassNames = darkThemeClasses.join(' ');
|
|
@@ -12,9 +12,11 @@ import React from 'react';
|
|
|
12
12
|
|
|
13
13
|
import { Layout, PageContainer } from '../components/Layout';
|
|
14
14
|
import { useLanguage } from '../hooks/useLanguage';
|
|
15
|
+
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
15
16
|
|
|
16
17
|
export function LanguagePage() {
|
|
17
18
|
const { activeLanguage, changeLanguage, languages } = useLanguage();
|
|
19
|
+
const navigateBack = useNavigateBack();
|
|
18
20
|
|
|
19
21
|
const languageList = languages.map((languageItem) => {
|
|
20
22
|
const { local, label, SVGFlag } = languageItem;
|
|
@@ -26,7 +28,10 @@ export function LanguagePage() {
|
|
|
26
28
|
{label}
|
|
27
29
|
</Typography>
|
|
28
30
|
),
|
|
29
|
-
onClick: () =>
|
|
31
|
+
onClick: () => {
|
|
32
|
+
changeLanguage(languageItem.local);
|
|
33
|
+
navigateBack();
|
|
34
|
+
},
|
|
30
35
|
end: <Radio value={local} />,
|
|
31
36
|
start: <SVGFlag />,
|
|
32
37
|
};
|