l-min-components 1.0.761 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.761",
3
+ "version": "1.0.765",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -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();
@@ -365,7 +365,7 @@ const HeaderComponent = (props) => {
365
365
  }, [notificationMarkReadData?.response]);
366
366
  const value = JSON?.parse(localStorage.getItem("defaultLang"));
367
367
  const currentFlag = value?.flag;
368
-
368
+ console.log("defaultLang", defaultLang)
369
369
  return (
370
370
  <Navbar>
371
371
  <img src={logo} alt="Learngual logo" />
@@ -1,4 +1,10 @@
1
- import React, { useState, useEffect, useRef, useCallback, useContext } from "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,8 +26,8 @@ import { OutletContext } from "..";
19
26
  *
20
27
  */
21
28
  const HeaderComponentTwo = (props) => {
22
- const { setGeneralData, generalData, setDefaultLang, findText } =
23
- useContext(OutletContext);
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);
@@ -30,7 +37,6 @@ const HeaderComponentTwo = (props) => {
30
37
 
31
38
  const navigate = useNavigate();
32
39
  const location = useLocation();
33
- // console.log(location);
34
40
  useEffect(() => {
35
41
  setIsOpen(false);
36
42
  }, []);
@@ -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(() => {