l-min-components 1.0.394 → 1.0.400
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
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
import { leftNavMenu, user, sideMenuOptions } from "../../hooks/leftNavMenu";
|
|
23
23
|
import InstructorAccountSwitcher from "../instructorAccountSwitcher";
|
|
24
24
|
// import SideMenu from "../sideBar/sideMenu";
|
|
25
|
+
import InstructorRightBar from "../fileRightBar/instructorRightBar";
|
|
26
|
+
import EnterpriseRightBar from "../fileRightBar/enterpriseRightBar";
|
|
25
27
|
|
|
26
28
|
const AppMainLayout = () => {
|
|
27
29
|
const [isOpen, setIsOpen] = useState(true);
|
|
@@ -41,6 +43,7 @@ const AppMainLayout = () => {
|
|
|
41
43
|
const [centerLayoutStyle, setCenterLayoutStyle] = useState({});
|
|
42
44
|
const [hideAffilicates, setHideAffilicates] = useState(false);
|
|
43
45
|
const [affiliatesActive, setAffiliatesActive] = useState(false);
|
|
46
|
+
const [accessToken, setAccessToken] = useState("");
|
|
44
47
|
|
|
45
48
|
useEffect(() => {
|
|
46
49
|
if (window.location.host.includes("coming")) {
|
|
@@ -65,6 +68,23 @@ const AppMainLayout = () => {
|
|
|
65
68
|
}
|
|
66
69
|
}, [defaultAcct]);
|
|
67
70
|
|
|
71
|
+
// set access token from cookie to context
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
let cookieValue = null;
|
|
74
|
+
const cookieName = "access";
|
|
75
|
+
// Retrieve the value of the cookie
|
|
76
|
+
const cookies = document.cookie.split(";");
|
|
77
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
78
|
+
const cookie = cookies[i].trim();
|
|
79
|
+
if (cookie.startsWith(cookieName + "=")) {
|
|
80
|
+
cookieValue = cookie.substring(cookieName.length + 1);
|
|
81
|
+
setDefaultAcct(cookieValue);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
setAccessToken(cookieValue)
|
|
86
|
+
}, [defaultAcct]);
|
|
87
|
+
|
|
68
88
|
return (
|
|
69
89
|
<OutletContext.Provider
|
|
70
90
|
value={{
|
|
@@ -89,6 +109,7 @@ const AppMainLayout = () => {
|
|
|
89
109
|
// return true if instructor affiliates is Active
|
|
90
110
|
setHideAffilicates,
|
|
91
111
|
affiliatesActive,
|
|
112
|
+
accessToken
|
|
92
113
|
}}
|
|
93
114
|
>
|
|
94
115
|
<Layout
|
|
@@ -119,6 +140,7 @@ const AppMainLayout = () => {
|
|
|
119
140
|
}
|
|
120
141
|
isOpen={isOpen}
|
|
121
142
|
setIsOpen={setIsOpen}
|
|
143
|
+
setRightComponent={setRightComponent}
|
|
122
144
|
/>
|
|
123
145
|
)}
|
|
124
146
|
</>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef, useContext } from "react";
|
|
2
|
+
import ReactFlagsSelect from "react-flags-select";
|
|
3
|
+
import useHeader from "./getHeaderDetails";
|
|
4
|
+
import { OutletContext } from "..";
|
|
5
|
+
import { useLocation } from "react-router-dom";
|
|
6
|
+
import usFlag from "../../assets/images/usFlag.png";
|
|
7
|
+
/**
|
|
8
|
+
* @param {{
|
|
9
|
+
* type: string,
|
|
10
|
+
* text: string,
|
|
11
|
+
* onClick: Function,
|
|
12
|
+
* style: CSSProperties,
|
|
13
|
+
* }} props - properties of Header Component
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
const LanguageDropdown = (props) => {
|
|
17
|
+
const [languageDropdown, setLanguageDropdown] = useState();
|
|
18
|
+
const { pathname } = useLocation();
|
|
19
|
+
const { setGeneralData, generalData } = useContext(OutletContext);
|
|
20
|
+
|
|
21
|
+
const containerRef = useRef(null);
|
|
22
|
+
|
|
23
|
+
// logic for closing language dropdown when clicking outside
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const handleClickOutside = (event) => {
|
|
26
|
+
if (
|
|
27
|
+
containerRef.current &&
|
|
28
|
+
!containerRef.current.contains(event.target)
|
|
29
|
+
) {
|
|
30
|
+
setLanguageDropdown();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
document.addEventListener("click", handleClickOutside);
|
|
35
|
+
|
|
36
|
+
return () => {
|
|
37
|
+
document.removeEventListener("click", handleClickOutside);
|
|
38
|
+
};
|
|
39
|
+
}, [setLanguageDropdown]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<>
|
|
43
|
+
<ul className="dropdown_list" ref={containerRef}>
|
|
44
|
+
<li onClick={() => setLanguageDropdown()}>
|
|
45
|
+
<img src={usFlag} alt="" /> <span>English</span>
|
|
46
|
+
</li>
|
|
47
|
+
</ul>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default LanguageDropdown;
|
|
@@ -13,6 +13,8 @@ import { IoIosArrowBack, IoIosArrowForward } from "react-icons/io";
|
|
|
13
13
|
import { CiLogout } from "react-icons/ci";
|
|
14
14
|
import UserCard from "../userCard";
|
|
15
15
|
import cx from "classnames";
|
|
16
|
+
import InstructorRightBar from "../../fileRightBar/instructorRightBar";
|
|
17
|
+
import EnterpriseRightBar from "../../fileRightBar/enterpriseRightBar";
|
|
16
18
|
|
|
17
19
|
const SideMenu = ({
|
|
18
20
|
user,
|
|
@@ -22,6 +24,7 @@ const SideMenu = ({
|
|
|
22
24
|
isOpen,
|
|
23
25
|
setIsOpen,
|
|
24
26
|
affiliatesActive,
|
|
27
|
+
setRightComponent
|
|
25
28
|
}) => {
|
|
26
29
|
// const [isOpen, setIsOpen] = useState(false);
|
|
27
30
|
const onToggle = () => {
|
|
@@ -47,6 +50,10 @@ const SideMenu = ({
|
|
|
47
50
|
setRouteFilter(filteredRoutes);
|
|
48
51
|
}
|
|
49
52
|
}, [affiliatesActive]);
|
|
53
|
+
|
|
54
|
+
// Right bars
|
|
55
|
+
const EnterpriseRight = <EnterpriseRightBar />
|
|
56
|
+
const InstructorRight = <InstructorRightBar />
|
|
50
57
|
|
|
51
58
|
const renderNavigationItem = (route, index) => {
|
|
52
59
|
const { icon, iconActive, text, notifications, path, affiliates } = route;
|
|
@@ -87,6 +94,7 @@ const SideMenu = ({
|
|
|
87
94
|
window.location.pathname.includes("/personal/courses") &&
|
|
88
95
|
path === "/personal/courses"
|
|
89
96
|
) {
|
|
97
|
+
setRightComponent(InstructorRight)
|
|
90
98
|
return (statusText = true);
|
|
91
99
|
}
|
|
92
100
|
if (
|
|
@@ -114,18 +122,21 @@ const SideMenu = ({
|
|
|
114
122
|
window.location.pathname.includes("/enterprise/dashboard") &&
|
|
115
123
|
path === "/enterprise/dashboard"
|
|
116
124
|
) {
|
|
125
|
+
setRightComponent(EnterpriseRight)
|
|
117
126
|
return (statusText = true);
|
|
118
127
|
}
|
|
119
128
|
if (
|
|
120
129
|
window.location.pathname.includes("/enterprise/courses") &&
|
|
121
130
|
path === "/enterprise/courses"
|
|
122
131
|
) {
|
|
132
|
+
setRightComponent(EnterpriseRight)
|
|
123
133
|
return (statusText = true);
|
|
124
134
|
}
|
|
125
135
|
if (
|
|
126
136
|
window.location.pathname.includes("/enterprise/reports") &&
|
|
127
137
|
path === "/enterprise/reports"
|
|
128
138
|
) {
|
|
139
|
+
setRightComponent(EnterpriseRight)
|
|
129
140
|
return (statusText = true);
|
|
130
141
|
}
|
|
131
142
|
if (
|
|
@@ -144,6 +155,7 @@ const SideMenu = ({
|
|
|
144
155
|
window.location.pathname.includes("/enterprise/announcements") &&
|
|
145
156
|
path === "/enterprise/announcements"
|
|
146
157
|
) {
|
|
158
|
+
setRightComponent(EnterpriseRight)
|
|
147
159
|
return (statusText = true);
|
|
148
160
|
}
|
|
149
161
|
if (
|
|
@@ -159,30 +171,35 @@ const SideMenu = ({
|
|
|
159
171
|
window.location.pathname.includes("/instructor/dashboard") &&
|
|
160
172
|
path === "/instructor/dashboard"
|
|
161
173
|
) {
|
|
174
|
+
setRightComponent(InstructorRight)
|
|
162
175
|
return (statusText = true);
|
|
163
176
|
}
|
|
164
177
|
if (
|
|
165
178
|
window.location.pathname.includes("/instructor/courses") &&
|
|
166
179
|
path === "/instructor/courses"
|
|
167
180
|
) {
|
|
181
|
+
setRightComponent(InstructorRight)
|
|
168
182
|
return (statusText = true);
|
|
169
183
|
}
|
|
170
184
|
if (
|
|
171
185
|
window.location.pathname.includes("/instructor/reports") &&
|
|
172
186
|
path === "/instructor/reports"
|
|
173
187
|
) {
|
|
188
|
+
setRightComponent(InstructorRight)
|
|
174
189
|
return (statusText = true);
|
|
175
190
|
}
|
|
176
191
|
if (
|
|
177
192
|
window.location.pathname.includes("/instructor/manage-teams") &&
|
|
178
193
|
path === "/instructor/manage-teams"
|
|
179
194
|
) {
|
|
195
|
+
setRightComponent(InstructorRight)
|
|
180
196
|
return (statusText = true);
|
|
181
197
|
}
|
|
182
198
|
if (
|
|
183
199
|
window.location.pathname.includes("/instructor/manage-students") &&
|
|
184
200
|
path === "/instructor/manage-students"
|
|
185
201
|
) {
|
|
202
|
+
setRightComponent(InstructorRight)
|
|
186
203
|
return (statusText = true);
|
|
187
204
|
}
|
|
188
205
|
if (
|
|
@@ -195,12 +212,14 @@ const SideMenu = ({
|
|
|
195
212
|
window.location.pathname.includes("/instructor/contracts") &&
|
|
196
213
|
path === "/instructor/contracts"
|
|
197
214
|
) {
|
|
215
|
+
setRightComponent(InstructorRight)
|
|
198
216
|
return (statusText = true);
|
|
199
217
|
}
|
|
200
218
|
if (
|
|
201
219
|
window.location.pathname.includes("/instructor/announcements") &&
|
|
202
220
|
path === "/instructor/announcements"
|
|
203
221
|
) {
|
|
222
|
+
setRightComponent(InstructorRight)
|
|
204
223
|
return (statusText = true);
|
|
205
224
|
}
|
|
206
225
|
if (
|