l-min-components 1.0.976 → 1.0.979
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
|
@@ -26,7 +26,7 @@ import usFlag from "../../assets/images/usFlag.png";
|
|
|
26
26
|
import LanguageDropdown from "./languageDropdown";
|
|
27
27
|
import { getCookie } from "./getCookies";
|
|
28
28
|
// import { data } from "../GraphMap/data";
|
|
29
|
-
import { languagesData } from "./languages";
|
|
29
|
+
import { languagesData, selectedLanguageData } from "./languages";
|
|
30
30
|
import { QuestionMark } from "./assets/svg/questionMark";
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -260,8 +260,7 @@ const HeaderComponent = (props) => {
|
|
|
260
260
|
}; path=/; expires=${date.toUTCString()};`;
|
|
261
261
|
|
|
262
262
|
localStorage.setItem(
|
|
263
|
-
"defaultLang",
|
|
264
|
-
JSON?.stringify(getDefaultAccount?.data?.language)
|
|
263
|
+
"defaultLang", (getDefaultAccount?.data?.language)
|
|
265
264
|
);
|
|
266
265
|
|
|
267
266
|
setSelectedAccount(getDefaultAccount?.data);
|
|
@@ -393,20 +392,8 @@ const HeaderComponent = (props) => {
|
|
|
393
392
|
generalData?.selectedAccount?.pending_delete === true &&
|
|
394
393
|
window.location.hostname.includes("staging");
|
|
395
394
|
|
|
396
|
-
const
|
|
397
|
-
const value = JSON?.parse(localStorage?.getItem("defaultLang"));
|
|
398
|
-
const currentFlagIcon = value?.flag;
|
|
399
|
-
const selectedLanguage = languagesData?.find(
|
|
400
|
-
(lang) => lang?.slug === props?.defaultLang
|
|
401
|
-
);
|
|
395
|
+
const value = localStorage.getItem("defaultLang");
|
|
402
396
|
|
|
403
|
-
useEffect(() => {
|
|
404
|
-
if (currentFlagIcon) {
|
|
405
|
-
setCurrentFlag(currentFlagIcon);
|
|
406
|
-
} else {
|
|
407
|
-
setCurrentFlag(usFlag);
|
|
408
|
-
}
|
|
409
|
-
}, []);
|
|
410
397
|
|
|
411
398
|
return (
|
|
412
399
|
<Navbar>
|
|
@@ -540,7 +527,7 @@ const HeaderComponent = (props) => {
|
|
|
540
527
|
setIsOpen();
|
|
541
528
|
}}
|
|
542
529
|
>
|
|
543
|
-
<img src={
|
|
530
|
+
<img src={selectedLanguageData[value] || usFlag} alt="" />
|
|
544
531
|
<ArrowDownIcon />
|
|
545
532
|
</div>
|
|
546
533
|
{languageDropdown && (
|
|
@@ -10,6 +10,7 @@ import { RiCloseCircleFill } from "react-icons/ri";
|
|
|
10
10
|
import { HiSearch } from "react-icons/hi";
|
|
11
11
|
import { InputSearchIcon } from "./assets/svg/search";
|
|
12
12
|
import { DebounceInput } from "react-debounce-input";
|
|
13
|
+
import { languagesData } from "./languages";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {{
|
|
@@ -37,23 +38,9 @@ const LanguageDropdown = ({
|
|
|
37
38
|
handleUpdateUserAccount,
|
|
38
39
|
} = useHeader();
|
|
39
40
|
|
|
40
|
-
const languagesData = [
|
|
41
|
-
{
|
|
42
|
-
name: "English",
|
|
43
|
-
flag: usFlag,
|
|
44
|
-
slug: "en",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "Korean",
|
|
48
|
-
flag: koreanFlag,
|
|
49
|
-
slug: "ko",
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
41
|
const [filteredData, setFilteredData] = useState([]);
|
|
53
42
|
const [isSearch, setIsSearch] = useState(false);
|
|
54
43
|
const containerRef = useRef(null);
|
|
55
|
-
const value = JSON?.parse(localStorage.getItem("defaultLang"));
|
|
56
|
-
const currentFlag = value?.flag;
|
|
57
44
|
|
|
58
45
|
const handleFilter = (event) => {
|
|
59
46
|
const searchWord = event.target.value;
|
|
@@ -99,7 +86,7 @@ const LanguageDropdown = ({
|
|
|
99
86
|
item?.slug === defaultLang
|
|
100
87
|
? setIsTranslationsLoading(false)
|
|
101
88
|
: setIsTranslationsLoading(true);
|
|
102
|
-
localStorage.setItem("defaultLang",
|
|
89
|
+
localStorage.setItem("defaultLang", (item?.slug));
|
|
103
90
|
window.location.reload();
|
|
104
91
|
};
|
|
105
92
|
|
|
@@ -7,6 +7,7 @@ import { useLocation, useNavigate } from "react-router-dom";
|
|
|
7
7
|
import usFlag from "../../assets/images/usFlag.png";
|
|
8
8
|
import koreanFlag from "../../assets/images/koreaFlag.png";
|
|
9
9
|
import { FullPageLoader } from "..";
|
|
10
|
+
import { languagesData, selectedLanguageData } from "./languages";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @param {{
|
|
@@ -22,9 +23,9 @@ const HeaderComponentTwo = (props) => {
|
|
|
22
23
|
const [isOpen, setIsOpen] = useState(false);
|
|
23
24
|
const [searchResultOpen, setSearchResultOpen] = useState(false);
|
|
24
25
|
const [languageDropdown, setLanguageDropdown] = useState();
|
|
25
|
-
const value =
|
|
26
|
-
const currentFlag = value?.flag;
|
|
26
|
+
const value = localStorage.getItem("defaultLang");
|
|
27
27
|
|
|
28
|
+
|
|
28
29
|
const navigate = useNavigate();
|
|
29
30
|
const location = useLocation();
|
|
30
31
|
useEffect(() => {
|
|
@@ -60,18 +61,6 @@ const HeaderComponentTwo = (props) => {
|
|
|
60
61
|
};
|
|
61
62
|
}, [setLanguageDropdown]);
|
|
62
63
|
|
|
63
|
-
const languagesData = [
|
|
64
|
-
{
|
|
65
|
-
name: "English",
|
|
66
|
-
flag: usFlag,
|
|
67
|
-
slug: "en",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "Korean",
|
|
71
|
-
flag: koreanFlag,
|
|
72
|
-
slug: "ko",
|
|
73
|
-
},
|
|
74
|
-
];
|
|
75
64
|
|
|
76
65
|
const handleLanguageChange = async (item) => {
|
|
77
66
|
setLanguageDropdown();
|
|
@@ -79,7 +68,7 @@ const HeaderComponentTwo = (props) => {
|
|
|
79
68
|
item?.slug === props.defaultLang
|
|
80
69
|
? props?.setIsTranslationsLoading(false)
|
|
81
70
|
: props?.setIsTranslationsLoading(true);
|
|
82
|
-
localStorage.setItem("defaultLang",
|
|
71
|
+
localStorage.setItem("defaultLang", (item?.slug));
|
|
83
72
|
window.location.reload();
|
|
84
73
|
};
|
|
85
74
|
|
|
@@ -113,7 +102,7 @@ const HeaderComponentTwo = (props) => {
|
|
|
113
102
|
className="drop_holder"
|
|
114
103
|
onClick={() => setLanguageDropdown(!languageDropdown)}
|
|
115
104
|
>
|
|
116
|
-
<img src={
|
|
105
|
+
<img src={selectedLanguageData[value] || usFlag} alt="" />
|
|
117
106
|
<ArrowDownIcon />
|
|
118
107
|
</div>
|
|
119
108
|
{languageDropdown && (
|
|
@@ -2,9 +2,9 @@ import React, { useCallback, useEffect, useState } from "react";
|
|
|
2
2
|
import useAxios from "axios-hooks";
|
|
3
3
|
|
|
4
4
|
const useTranslation = (initialSentences = []) => {
|
|
5
|
-
const value =
|
|
5
|
+
const value = localStorage?.getItem("defaultLang");
|
|
6
6
|
|
|
7
|
-
const [defaultLang, setDefaultLang] = useState(value
|
|
7
|
+
const [defaultLang, setDefaultLang] = useState(value ?? "en");
|
|
8
8
|
const [translations, setTranslations] = useState({}); // returned translation from backend
|
|
9
9
|
const [isTranslationsLoading, setIsTranslationsLoading] = useState(true)
|
|
10
10
|
|