l-min-components 1.0.979 → 1.0.984

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.979",
3
+ "version": "1.0.984",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -172,8 +172,8 @@ const AppMainLayout = () => {
172
172
  "Sign in",
173
173
  "Sorry, you can’t access your account on a mobile browser.",
174
174
  "We know it's inconvenient. For better user accessibility, login with a desktop device or via our mobile app.",
175
- "Download on Google Play",
176
- "Download on Apple Store",
175
+ "Download on google play",
176
+ "Download on apple store",
177
177
  "Help",
178
178
  ];
179
179
 
@@ -259,9 +259,7 @@ const HeaderComponent = (props) => {
259
259
  : ".learngual.com"
260
260
  }; path=/; expires=${date.toUTCString()};`;
261
261
 
262
- localStorage.setItem(
263
- "defaultLang", (getDefaultAccount?.data?.language)
264
- );
262
+ localStorage.setItem("defaultLang", getDefaultAccount?.data?.language);
265
263
 
266
264
  setSelectedAccount(getDefaultAccount?.data);
267
265
  }
@@ -394,7 +392,6 @@ const HeaderComponent = (props) => {
394
392
 
395
393
  const value = localStorage.getItem("defaultLang");
396
394
 
397
-
398
395
  return (
399
396
  <Navbar>
400
397
  <img src={logo} alt="Learngual logo" />
@@ -28,10 +28,10 @@ const MobileLayout = (props) => {
28
28
 
29
29
  <div className="mlc_link_section">
30
30
  <a href="#">
31
- <img src={play} alt="play store" /> {props?.findText("Download on Google Play")}
31
+ <img src={play} alt="play store" /> {props?.findText("Download on google play")}
32
32
  </a>
33
33
  <a href="#">
34
- <img src={apple} alt="apple store" /> {props?.findText("Download on Apple Store")}
34
+ <img src={apple} alt="apple store" /> {props?.findText("Download on apple store")}
35
35
  </a>
36
36
  </div>
37
37
  </div>
@@ -1,13 +1,21 @@
1
- import React, { useCallback, useEffect, useState } from "react";
1
+ import React, { useCallback, useContext, useEffect, useState } from "react";
2
2
  import useAxios from "axios-hooks";
3
3
 
4
4
  const useTranslation = (initialSentences = []) => {
5
5
  const value = localStorage?.getItem("defaultLang");
6
6
 
7
+ useEffect(() => {
8
+ if (value) {
9
+ console.log("====================================");
10
+ console.log(value, "bfr");
11
+ console.log("====================================");
12
+ setDefaultLang(value);
13
+ }
14
+ }, [value]);
15
+
7
16
  const [defaultLang, setDefaultLang] = useState(value ?? "en");
8
17
  const [translations, setTranslations] = useState({}); // returned translation from backend
9
- const [isTranslationsLoading, setIsTranslationsLoading] = useState(true)
10
-
18
+ const [isTranslationsLoading, setIsTranslationsLoading] = useState(true);
11
19
 
12
20
  const findText = useCallback(
13
21
  (word, kwargs = {}) => {
@@ -47,9 +55,8 @@ const useTranslation = (initialSentences = []) => {
47
55
  }
48
56
  };
49
57
 
50
-
51
58
  useEffect(() => {
52
- handleTranslate(defaultLang, initialSentences);
59
+ handleTranslate(defaultLang, initialSentences);
53
60
  }, [defaultLang]);
54
61
 
55
62
  useEffect(() => {
@@ -66,13 +73,11 @@ const useTranslation = (initialSentences = []) => {
66
73
  }, [translateData?.data]);
67
74
 
68
75
  useEffect(() => {
69
-
70
- if(Object.keys(translations)?.length > 0){
71
- setIsTranslationsLoading(false)
72
- }
73
- }, [translations])
74
- console.log("translateData", translateData)
75
-
76
+ if (Object.keys(translations)?.length > 0) {
77
+ setIsTranslationsLoading(false);
78
+ }
79
+ }, [translations]);
80
+ console.log("translateData", translateData);
76
81
 
77
82
  return {
78
83
  defaultLang,
@@ -82,7 +87,7 @@ const useTranslation = (initialSentences = []) => {
82
87
  translations,
83
88
  findText,
84
89
  isTranslationsLoading,
85
- setIsTranslationsLoading
90
+ setIsTranslationsLoading,
86
91
  };
87
92
  };
88
93