l-min-components 1.0.968 → 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 +1 -1
- package/src/components/header/index.jsx +25 -37
- package/src/components/header/languageDropdown.jsx +2 -15
- package/src/components/header/languages.js +6 -1
- package/src/components/header/login-header.jsx +10 -30
- package/src/components/sideBar/sideMenu/index.jsx +2 -2
- package/src/hooks/useTranslation.jsx +2 -2
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
SearchInputGroup,
|
|
18
18
|
SearchInput,
|
|
19
19
|
UserProfile,
|
|
20
|
-
Help
|
|
20
|
+
Help,
|
|
21
21
|
} from "./index.styled";
|
|
22
22
|
import useHeader from "./getHeaderDetails";
|
|
23
23
|
import { FullPageLoader, OutletContext } from "..";
|
|
@@ -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
|
/**
|
|
@@ -62,14 +62,11 @@ const HeaderComponent = (props) => {
|
|
|
62
62
|
retrieveUserDetailsData,
|
|
63
63
|
handleRetrieveUserDetails,
|
|
64
64
|
updateUserAccountData,
|
|
65
|
-
handleUpdateUserAccount
|
|
65
|
+
handleUpdateUserAccount,
|
|
66
66
|
} = useHeader();
|
|
67
67
|
const { pathname } = useLocation();
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
generalData,
|
|
71
|
-
notificationMarkReadData,
|
|
72
|
-
} = useContext(OutletContext);
|
|
68
|
+
const { setGeneralData, generalData, notificationMarkReadData } =
|
|
69
|
+
useContext(OutletContext);
|
|
73
70
|
const [selectedAccount, setSelectedAccount] = useState();
|
|
74
71
|
const { setDefaultAccount, handleSetDefaultAccount } = useHeader();
|
|
75
72
|
|
|
@@ -81,7 +78,6 @@ const HeaderComponent = (props) => {
|
|
|
81
78
|
handleGetUnreadNotification();
|
|
82
79
|
}, []);
|
|
83
80
|
|
|
84
|
-
|
|
85
81
|
// Merge the notification_count into the results data using find
|
|
86
82
|
|
|
87
83
|
const allUserAccountsDetail = userAccountsDetail?.data?.results.map(
|
|
@@ -263,6 +259,10 @@ const HeaderComponent = (props) => {
|
|
|
263
259
|
: ".learngual.com"
|
|
264
260
|
}; path=/; expires=${date.toUTCString()};`;
|
|
265
261
|
|
|
262
|
+
localStorage.setItem(
|
|
263
|
+
"defaultLang", (getDefaultAccount?.data?.language)
|
|
264
|
+
);
|
|
265
|
+
|
|
266
266
|
setSelectedAccount(getDefaultAccount?.data);
|
|
267
267
|
}
|
|
268
268
|
}, [getDefaultAccount?.data]);
|
|
@@ -373,7 +373,7 @@ const HeaderComponent = (props) => {
|
|
|
373
373
|
websocket2.addEventListener("message", handler, { passive: true });
|
|
374
374
|
|
|
375
375
|
return () => {
|
|
376
|
-
|
|
376
|
+
websocket2.removeEventListener("message", handler);
|
|
377
377
|
//console.log("room websocket closed");
|
|
378
378
|
};
|
|
379
379
|
}, []);
|
|
@@ -391,25 +391,12 @@ const HeaderComponent = (props) => {
|
|
|
391
391
|
const isPendingDelete =
|
|
392
392
|
generalData?.selectedAccount?.pending_delete === true &&
|
|
393
393
|
window.location.hostname.includes("staging");
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
const value = JSON?.parse(localStorage?.getItem("defaultLang"));
|
|
398
|
-
const currentFlagIcon = value?.flag;
|
|
399
|
-
const selectedLanguage = languagesData?.find((lang) => lang?.slug === props?.defaultLang);
|
|
400
|
-
|
|
401
|
-
useEffect(() => {
|
|
402
|
-
if(currentFlagIcon) {
|
|
403
|
-
setCurrentFlag(currentFlagIcon)
|
|
404
|
-
} else {
|
|
405
|
-
setCurrentFlag(usFlag)
|
|
406
|
-
}
|
|
407
|
-
}, [])
|
|
408
|
-
|
|
394
|
+
|
|
395
|
+
const value = localStorage.getItem("defaultLang");
|
|
396
|
+
|
|
409
397
|
|
|
410
398
|
return (
|
|
411
399
|
<Navbar>
|
|
412
|
-
|
|
413
400
|
<img src={logo} alt="Learngual logo" />
|
|
414
401
|
<Nav
|
|
415
402
|
onClick={() => {
|
|
@@ -483,20 +470,21 @@ const HeaderComponent = (props) => {
|
|
|
483
470
|
{props.findText("Notifications")}
|
|
484
471
|
</a>
|
|
485
472
|
</li>
|
|
486
|
-
<li style={{marginLeft: "20%", cursor: "pointer"}}>
|
|
487
|
-
<a
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
473
|
+
<li style={{ marginLeft: "20%", cursor: "pointer" }}>
|
|
474
|
+
<a
|
|
475
|
+
onClick={() => {
|
|
476
|
+
window.location.href =
|
|
477
|
+
"https://559staging.learngual.com/help-center";
|
|
478
|
+
}}
|
|
479
|
+
className={
|
|
493
480
|
window.location.pathname.includes("help-center") ? "active" : ""
|
|
494
|
-
}
|
|
495
|
-
|
|
481
|
+
}
|
|
482
|
+
>
|
|
483
|
+
<QuestionMark /> {props?.findText("Help")}
|
|
496
484
|
</a>
|
|
497
485
|
</li>
|
|
498
486
|
</Nav>
|
|
499
|
-
{/*
|
|
487
|
+
{/*
|
|
500
488
|
<Help>
|
|
501
489
|
<QuestionMark />
|
|
502
490
|
Help
|
|
@@ -539,7 +527,7 @@ const HeaderComponent = (props) => {
|
|
|
539
527
|
setIsOpen();
|
|
540
528
|
}}
|
|
541
529
|
>
|
|
542
|
-
<img src={
|
|
530
|
+
<img src={selectedLanguageData[value] || usFlag} alt="" />
|
|
543
531
|
<ArrowDownIcon />
|
|
544
532
|
</div>
|
|
545
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
|
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useState,
|
|
3
|
-
useEffect,
|
|
4
|
-
useRef,
|
|
5
|
-
useCallback,
|
|
6
|
-
} from "react";
|
|
1
|
+
import React, { useState, useEffect, useRef, useCallback } from "react";
|
|
7
2
|
import logo from "./assets/images/logo.png";
|
|
8
|
-
import { Navbar2, NavGroup2
|
|
3
|
+
import { Navbar2, NavGroup2 } from "./index.styled";
|
|
9
4
|
import { ArrowDownIcon } from "./assets/svg/arrow-down";
|
|
10
5
|
import ButtonComponent from "../button";
|
|
11
6
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
12
7
|
import usFlag from "../../assets/images/usFlag.png";
|
|
13
8
|
import koreanFlag from "../../assets/images/koreaFlag.png";
|
|
14
9
|
import { FullPageLoader } from "..";
|
|
10
|
+
import { languagesData, selectedLanguageData } from "./languages";
|
|
15
11
|
|
|
16
12
|
/**
|
|
17
13
|
* @param {{
|
|
@@ -23,14 +19,13 @@ import { FullPageLoader } from "..";
|
|
|
23
19
|
*
|
|
24
20
|
*/
|
|
25
21
|
const HeaderComponentTwo = (props) => {
|
|
26
|
-
|
|
27
22
|
const [selected, setSelected] = useState("ES");
|
|
28
23
|
const [isOpen, setIsOpen] = useState(false);
|
|
29
24
|
const [searchResultOpen, setSearchResultOpen] = useState(false);
|
|
30
25
|
const [languageDropdown, setLanguageDropdown] = useState();
|
|
31
|
-
const value =
|
|
32
|
-
const currentFlag = value?.flag;
|
|
26
|
+
const value = localStorage.getItem("defaultLang");
|
|
33
27
|
|
|
28
|
+
|
|
34
29
|
const navigate = useNavigate();
|
|
35
30
|
const location = useLocation();
|
|
36
31
|
useEffect(() => {
|
|
@@ -66,26 +61,14 @@ const HeaderComponentTwo = (props) => {
|
|
|
66
61
|
};
|
|
67
62
|
}, [setLanguageDropdown]);
|
|
68
63
|
|
|
69
|
-
const languagesData = [
|
|
70
|
-
{
|
|
71
|
-
name: "English",
|
|
72
|
-
flag: usFlag,
|
|
73
|
-
slug: "en",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "Korean",
|
|
77
|
-
flag: koreanFlag,
|
|
78
|
-
slug: "ko",
|
|
79
|
-
},
|
|
80
|
-
];
|
|
81
64
|
|
|
82
65
|
const handleLanguageChange = async (item) => {
|
|
83
66
|
setLanguageDropdown();
|
|
84
67
|
props.setDefaultLang(item?.slug);
|
|
85
68
|
item?.slug === props.defaultLang
|
|
86
|
-
? props
|
|
87
|
-
: props
|
|
88
|
-
localStorage.setItem("defaultLang",
|
|
69
|
+
? props?.setIsTranslationsLoading(false)
|
|
70
|
+
: props?.setIsTranslationsLoading(true);
|
|
71
|
+
localStorage.setItem("defaultLang", (item?.slug));
|
|
89
72
|
window.location.reload();
|
|
90
73
|
};
|
|
91
74
|
|
|
@@ -119,16 +102,13 @@ const HeaderComponentTwo = (props) => {
|
|
|
119
102
|
className="drop_holder"
|
|
120
103
|
onClick={() => setLanguageDropdown(!languageDropdown)}
|
|
121
104
|
>
|
|
122
|
-
<img src={
|
|
105
|
+
<img src={selectedLanguageData[value] || usFlag} alt="" />
|
|
123
106
|
<ArrowDownIcon />
|
|
124
107
|
</div>
|
|
125
108
|
{languageDropdown && (
|
|
126
109
|
<ul className="dropdown_list" ref={containerRef}>
|
|
127
110
|
{languagesData?.map((item, idx) => (
|
|
128
|
-
<li
|
|
129
|
-
key={idx}
|
|
130
|
-
onClick={() => handleLanguageChange(item)}
|
|
131
|
-
>
|
|
111
|
+
<li key={idx} onClick={() => handleLanguageChange(item)}>
|
|
132
112
|
<img src={item?.flag} alt="" /> <span>{item?.name}</span>
|
|
133
113
|
</li>
|
|
134
114
|
))}
|
|
@@ -49,7 +49,7 @@ const SideMenu = ({
|
|
|
49
49
|
generalData?.selectedAccount?.type === "PERSONAL" &&
|
|
50
50
|
window.location.hostname.includes("staging");
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
// When pending delete and on staging
|
|
53
53
|
const isPendingDelete =
|
|
54
54
|
generalData?.selectedAccount?.pending_delete === true &&
|
|
55
55
|
window.location.hostname.includes("staging");
|
|
@@ -346,7 +346,7 @@ const SideMenu = ({
|
|
|
346
346
|
<IconContainer>{/* <CiLogout /> */}</IconContainer>
|
|
347
347
|
{/* <TextContainer minimal={isOpen}>Log out</TextContainer> */}
|
|
348
348
|
</LogoutButtonContainer>
|
|
349
|
-
<div className="toggle" onClick={onToggle}>
|
|
349
|
+
<div className="toggle" onClick={onToggle} style={{ cursor: "pointer" }}>
|
|
350
350
|
{isOpen ? <IoIosArrowBack /> : <IoIosArrowForward />}
|
|
351
351
|
</div>
|
|
352
352
|
</SideMenuContainer>
|
|
@@ -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
|
|