l-min-components 1.0.921 → 1.0.926
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 +1 -1
- package/src/components/AppMainLayout/index.jsx +1 -1
- package/src/components/header/index.jsx +13 -3
- package/src/components/header/languageDropdown.jsx +1 -1
- package/src/components/header/login-header.jsx +1 -1
- package/src/components/sideNav/index.jsx +1 -1
- package/src/hooks/useTranslation.jsx +1 -1
package/package.json
CHANGED
|
@@ -390,10 +390,20 @@ const HeaderComponent = (props) => {
|
|
|
390
390
|
generalData?.selectedAccount?.pending_delete === true &&
|
|
391
391
|
window.location.hostname.includes("staging");
|
|
392
392
|
|
|
393
|
-
const value = JSON?.parse(localStorage.getItem("defaultLang"));
|
|
394
|
-
const currentFlag = value?.flag;
|
|
395
|
-
const selectedLanguage = languagesData?.find((lang) => lang?.slug === props.defaultLang);
|
|
396
393
|
|
|
394
|
+
const [currentFlag, setCurrentFlag] = useState(usFlag)
|
|
395
|
+
const value = JSON?.parse(localStorage?.getItem("defaultLang"));
|
|
396
|
+
const currentFlagIcon = value?.flag;
|
|
397
|
+
const selectedLanguage = languagesData?.find((lang) => lang?.slug === props?.defaultLang);
|
|
398
|
+
|
|
399
|
+
useEffect(() => {
|
|
400
|
+
if(currentFlagIcon) {
|
|
401
|
+
setCurrentFlag(currentFlagIcon)
|
|
402
|
+
} else {
|
|
403
|
+
setCurrentFlag(usFlag)
|
|
404
|
+
}
|
|
405
|
+
}, [])
|
|
406
|
+
|
|
397
407
|
|
|
398
408
|
return (
|
|
399
409
|
<Navbar>
|
|
@@ -99,7 +99,7 @@ const LanguageDropdown = ({
|
|
|
99
99
|
item?.slug === defaultLang
|
|
100
100
|
? setIsTranslationsLoading(false)
|
|
101
101
|
: setIsTranslationsLoading(true);
|
|
102
|
-
localStorage.setItem("defaultLang", JSON
|
|
102
|
+
localStorage.setItem("defaultLang", JSON?.stringify(item));
|
|
103
103
|
window.location.reload();
|
|
104
104
|
};
|
|
105
105
|
|
|
@@ -85,7 +85,7 @@ const HeaderComponentTwo = (props) => {
|
|
|
85
85
|
item?.slug === props.defaultLang
|
|
86
86
|
? props.setIsTranslationsLoading(false)
|
|
87
87
|
: props.setIsTranslationsLoading(true);
|
|
88
|
-
localStorage.setItem("defaultLang", JSON
|
|
88
|
+
localStorage.setItem("defaultLang", JSON?.stringify(item));
|
|
89
89
|
window.location.reload();
|
|
90
90
|
};
|
|
91
91
|
|
|
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useState } from "react";
|
|
|
2
2
|
import useAxios from "axios-hooks";
|
|
3
3
|
|
|
4
4
|
const useTranslation = (initialSentences = []) => {
|
|
5
|
-
const value = JSON?.parse(localStorage
|
|
5
|
+
const value = JSON?.parse(localStorage?.getItem("defaultLang"));
|
|
6
6
|
|
|
7
7
|
const [defaultLang, setDefaultLang] = useState(value?.slug ?? "en");
|
|
8
8
|
const [translations, setTranslations] = useState({}); // returned translation from backend
|