l-min-components 1.0.757 → 1.0.765
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/package.json
CHANGED
|
@@ -153,7 +153,7 @@ const AppMainLayout = () => {
|
|
|
153
153
|
const currentPlan = userPlanData?.data?.current_plan;
|
|
154
154
|
const planState = userPlanData?.data?.state;
|
|
155
155
|
|
|
156
|
-
const { textSchema, setDefaultLang, findText } = useTranslation();
|
|
156
|
+
const { textSchema, setDefaultLang, defaultLang, findText } = useTranslation();
|
|
157
157
|
// console.log(findText());
|
|
158
158
|
return (
|
|
159
159
|
textSchema && (
|
|
@@ -161,6 +161,7 @@ const AppMainLayout = () => {
|
|
|
161
161
|
value={{
|
|
162
162
|
textSchema,
|
|
163
163
|
findText,
|
|
164
|
+
defaultLang,
|
|
164
165
|
setDefaultLang,
|
|
165
166
|
setRightComponent,
|
|
166
167
|
setRightLayout,
|
|
@@ -61,7 +61,7 @@ const HeaderComponent = (props) => {
|
|
|
61
61
|
handleGetNotification,
|
|
62
62
|
} = useHeader();
|
|
63
63
|
const { pathname } = useLocation();
|
|
64
|
-
const { setGeneralData, generalData, notificationMarkReadData, findText } =
|
|
64
|
+
const { setGeneralData, generalData, notificationMarkReadData, findText, defaultLang } =
|
|
65
65
|
useContext(OutletContext);
|
|
66
66
|
const [selectedAccount, setSelectedAccount] = useState();
|
|
67
67
|
const { setDefaultAccount, handleSetDefaultAccount } = useHeader();
|
|
@@ -363,7 +363,9 @@ const HeaderComponent = (props) => {
|
|
|
363
363
|
handleGetUnreadNotification();
|
|
364
364
|
handleGeneralNotificationCount();
|
|
365
365
|
}, [notificationMarkReadData?.response]);
|
|
366
|
-
|
|
366
|
+
const value = JSON?.parse(localStorage.getItem("defaultLang"));
|
|
367
|
+
const currentFlag = value?.flag;
|
|
368
|
+
console.log("defaultLang", defaultLang)
|
|
367
369
|
return (
|
|
368
370
|
<Navbar>
|
|
369
371
|
<img src={logo} alt="Learngual logo" />
|
|
@@ -455,7 +457,7 @@ const HeaderComponent = (props) => {
|
|
|
455
457
|
setLanguageDropdown(!languageDropdown);
|
|
456
458
|
setIsOpen();
|
|
457
459
|
}}>
|
|
458
|
-
<img src={usFlag} alt="" />
|
|
460
|
+
<img src={currentFlag || usFlag} alt="" />
|
|
459
461
|
<ArrowDownIcon />
|
|
460
462
|
</div>
|
|
461
463
|
{languageDropdown && (
|
|
@@ -23,11 +23,23 @@ import { DebounceInput } from "react-debounce-input";
|
|
|
23
23
|
const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
|
|
24
24
|
const { setGeneralData, generalData, defaultLang, setDefaultLang, findText } =
|
|
25
25
|
useContext(OutletContext);
|
|
26
|
+
const languagesData = [
|
|
27
|
+
{
|
|
28
|
+
name: "English",
|
|
29
|
+
flag: usFlag,
|
|
30
|
+
slug: "en",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Korean",
|
|
34
|
+
flag: koreanFlag,
|
|
35
|
+
slug: "ko",
|
|
36
|
+
},
|
|
37
|
+
];
|
|
26
38
|
const [filteredData, setFilteredData] = useState([]);
|
|
27
39
|
const [isSearch, setIsSearch] = useState(false);
|
|
28
40
|
const containerRef = useRef(null);
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
const value = JSON?.parse(localStorage.getItem("defaultLang"));
|
|
42
|
+
const currentFlag = value?.flag;
|
|
31
43
|
|
|
32
44
|
const handleFilter = (event) => {
|
|
33
45
|
const searchWord = event.target.value;
|
|
@@ -62,19 +74,6 @@ const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
|
|
|
62
74
|
};
|
|
63
75
|
}, [setLanguageDropdown]);
|
|
64
76
|
|
|
65
|
-
const languagesData = [
|
|
66
|
-
{
|
|
67
|
-
name: "English",
|
|
68
|
-
flag: usFlag,
|
|
69
|
-
slug: "en",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: "Korean",
|
|
73
|
-
flag: koreanFlag,
|
|
74
|
-
slug: "ko",
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
|
|
78
77
|
return (
|
|
79
78
|
<LanguageDropdownContainer ref={containerRef}>
|
|
80
79
|
<div className="ldc_header">
|
|
@@ -109,7 +108,7 @@ const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
|
|
|
109
108
|
onClick={() => {
|
|
110
109
|
setLanguageDropdown();
|
|
111
110
|
setDefaultLang(item?.slug);
|
|
112
|
-
localStorage.setItem("defaultLang", item
|
|
111
|
+
localStorage.setItem("defaultLang", JSON.stringify(item));
|
|
113
112
|
}}
|
|
114
113
|
>
|
|
115
114
|
<img src={item?.flag} alt="" /> <span>{item?.name}</span>
|
|
@@ -124,7 +123,7 @@ const LanguageDropdown = ({ languageDropdown, setLanguageDropdown }) => {
|
|
|
124
123
|
onClick={() => {
|
|
125
124
|
setLanguageDropdown();
|
|
126
125
|
setDefaultLang(item?.slug);
|
|
127
|
-
localStorage.setItem("defaultLang", item
|
|
126
|
+
localStorage.setItem("defaultLang", JSON.stringify(item));
|
|
128
127
|
}}
|
|
129
128
|
>
|
|
130
129
|
<img src={item?.flag} alt="" />{" "}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
useState,
|
|
3
|
+
useEffect,
|
|
4
|
+
useRef,
|
|
5
|
+
useCallback,
|
|
6
|
+
useContext,
|
|
7
|
+
} from "react";
|
|
2
8
|
import ReactFlagsSelect from "react-flags-select";
|
|
3
9
|
import logo from "./assets/images/logo.png";
|
|
4
10
|
import { Navbar2, NavGroup2, Nav2, CountryFlagGroup2 } from "./index.styled";
|
|
@@ -8,6 +14,7 @@ import { useLocation, useNavigate } from "react-router-dom";
|
|
|
8
14
|
import usFlag from "../../assets/images/usFlag.png";
|
|
9
15
|
import koreanFlag from "../../assets/images/koreaFlag.png";
|
|
10
16
|
import { OutletContext } from "..";
|
|
17
|
+
import useTranslation from "../../hooks/useTranslation";
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* @param {{
|
|
@@ -19,16 +26,17 @@ import { OutletContext } from "..";
|
|
|
19
26
|
*
|
|
20
27
|
*/
|
|
21
28
|
const HeaderComponentTwo = (props) => {
|
|
22
|
-
const {
|
|
23
|
-
|
|
29
|
+
const { textSchema, setDefaultLang, defaultLang, findText } = useTranslation();
|
|
30
|
+
|
|
24
31
|
const [selected, setSelected] = useState("ES");
|
|
25
32
|
const [isOpen, setIsOpen] = useState(false);
|
|
26
33
|
const [searchResultOpen, setSearchResultOpen] = useState(false);
|
|
27
34
|
const [languageDropdown, setLanguageDropdown] = useState();
|
|
35
|
+
const value = JSON?.parse(localStorage.getItem("defaultLang"));
|
|
36
|
+
const currentFlag = value?.flag;
|
|
28
37
|
|
|
29
38
|
const navigate = useNavigate();
|
|
30
39
|
const location = useLocation();
|
|
31
|
-
// console.log(location);
|
|
32
40
|
useEffect(() => {
|
|
33
41
|
setIsOpen(false);
|
|
34
42
|
}, []);
|
|
@@ -104,7 +112,7 @@ const HeaderComponentTwo = (props) => {
|
|
|
104
112
|
className="drop_holder"
|
|
105
113
|
onClick={() => setLanguageDropdown(!languageDropdown)}
|
|
106
114
|
>
|
|
107
|
-
<img src={usFlag} alt="" />
|
|
115
|
+
<img src={currentFlag || usFlag} alt="" />
|
|
108
116
|
<ArrowDownIcon />
|
|
109
117
|
</div>
|
|
110
118
|
{languageDropdown && (
|
|
@@ -114,7 +122,7 @@ const HeaderComponentTwo = (props) => {
|
|
|
114
122
|
onClick={() => {
|
|
115
123
|
setLanguageDropdown();
|
|
116
124
|
setDefaultLang(item?.slug);
|
|
117
|
-
localStorage.setItem("defaultLang", item
|
|
125
|
+
localStorage.setItem("defaultLang", JSON.stringify(item));
|
|
118
126
|
}}
|
|
119
127
|
>
|
|
120
128
|
<img src={item?.flag} alt="" /> <span>{item?.name}</span>
|
|
@@ -2,10 +2,10 @@ import React, { useCallback, useEffect, useState } from "react";
|
|
|
2
2
|
import loadTranslations from "./utils/translation";
|
|
3
3
|
|
|
4
4
|
const useTranslation = () => {
|
|
5
|
-
const value = localStorage.getItem("defaultLang");
|
|
5
|
+
const value = JSON?.parse(localStorage.getItem("defaultLang"));
|
|
6
6
|
const [textSchema, setTextSchema] = useState(null);
|
|
7
7
|
|
|
8
|
-
const [defaultLang, setDefaultLang] = useState(value || "en");
|
|
8
|
+
const [defaultLang, setDefaultLang] = useState(value?.slug || "en");
|
|
9
9
|
const findText = useCallback((str) => textSchema[str] ?? str, [textSchema]);
|
|
10
10
|
|
|
11
11
|
useEffect(() => {
|