l-min-components 1.0.366 → 1.0.370
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 +4 -1
- package/src/components/index.js +1 -0
- package/src/components/sideBar/sideMenu/index.jsx +20 -3
- package/src/components/sideBar/userCard/index.jsx +25 -1
- package/src/components/sideBar/userCard/styles/index.jsx +2 -1
- package/src/hooks/leftNavMenu.jsx +1 -0
package/package.json
CHANGED
|
@@ -38,6 +38,7 @@ const AppMainLayout = () => {
|
|
|
38
38
|
const [sideMenuLayout, setSideMenuLayout] = useState(true);
|
|
39
39
|
const [defaultAcct, setDefaultAcct] = useState("");
|
|
40
40
|
const [centerLayoutStyle, setCenterLayoutStyle] = useState({});
|
|
41
|
+
const [affiliatesActive, setAffiliatesActive] = useState(false);
|
|
41
42
|
|
|
42
43
|
useEffect(() => {
|
|
43
44
|
if (window.location.host.includes("coming")) {
|
|
@@ -82,7 +83,8 @@ const AppMainLayout = () => {
|
|
|
82
83
|
selectedCourseId,
|
|
83
84
|
setSelectedCourseId,
|
|
84
85
|
centerLayoutStyle,
|
|
85
|
-
setCenterLayoutStyle
|
|
86
|
+
setCenterLayoutStyle,
|
|
87
|
+
setAffiliatesActive
|
|
86
88
|
}}
|
|
87
89
|
>
|
|
88
90
|
<Layout
|
|
@@ -99,6 +101,7 @@ const AppMainLayout = () => {
|
|
|
99
101
|
<SideMenu
|
|
100
102
|
user={user}
|
|
101
103
|
routes={sideMenuOptions}
|
|
104
|
+
affiliatesActive={affiliatesActive}
|
|
102
105
|
userType={
|
|
103
106
|
window.location.pathname.includes("enterprise")
|
|
104
107
|
? "enterprise"
|
package/src/components/index.js
CHANGED
|
@@ -31,3 +31,4 @@ export { OutletContext as OutletContext } from "./AppMainLayout";
|
|
|
31
31
|
export { default as DatePickerCalender } from "./datePicker";
|
|
32
32
|
export { default as TextEditor } from "./textEditor";
|
|
33
33
|
export { default as MessageAddon } from "./messageAddon/messages";
|
|
34
|
+
export { default as InstructorAccountSwitcher } from "./instructorAccountSwitcher";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import {
|
|
4
4
|
SideMenuContainer,
|
|
@@ -21,18 +21,35 @@ const SideMenu = ({
|
|
|
21
21
|
onLogout = () => {},
|
|
22
22
|
isOpen,
|
|
23
23
|
setIsOpen,
|
|
24
|
+
affiliatesActive,
|
|
24
25
|
}) => {
|
|
25
26
|
// const [isOpen, setIsOpen] = useState(false);
|
|
26
27
|
const onToggle = () => {
|
|
27
28
|
setIsOpen(!isOpen);
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
// Normal route filter
|
|
30
32
|
const filteredRoutes = routes.find(
|
|
31
33
|
(route) => route.userType === userType
|
|
32
34
|
)?.routes;
|
|
35
|
+
const [routeFilter, setRouteFilter] = useState(filteredRoutes);
|
|
36
|
+
|
|
37
|
+
// filter route to remove contract
|
|
38
|
+
const affiliatesFilteredRoute = filteredRoutes?.filter(
|
|
39
|
+
(route) => !route.affiliates
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
console.log("filteredRoutes", routeFilter, affiliatesActive);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!affiliatesActive) {
|
|
45
|
+
setRouteFilter(affiliatesFilteredRoute);
|
|
46
|
+
} else {
|
|
47
|
+
setRouteFilter(filteredRoutes);
|
|
48
|
+
}
|
|
49
|
+
}, [affiliatesActive]);
|
|
33
50
|
|
|
34
51
|
const renderNavigationItem = (route, index) => {
|
|
35
|
-
const { icon, iconActive, text, notifications, path } = route;
|
|
52
|
+
const { icon, iconActive, text, notifications, path, affiliates } = route;
|
|
36
53
|
const handlePathCheck = () => {
|
|
37
54
|
let statusText;
|
|
38
55
|
console.log(window.location.pathname, "pathname");
|
|
@@ -245,7 +262,7 @@ const SideMenu = ({
|
|
|
245
262
|
<UserCard user={user} isOpen={isOpen} />
|
|
246
263
|
|
|
247
264
|
<NavigationContainer>
|
|
248
|
-
{
|
|
265
|
+
{routeFilter && routeFilter?.map(renderNavigationItem)}
|
|
249
266
|
</NavigationContainer>
|
|
250
267
|
|
|
251
268
|
<LogoutButtonContainer onClick={onLogout}>
|
|
@@ -51,8 +51,32 @@ const UserCard = ({ user, isOpen }) => {
|
|
|
51
51
|
<Avatar
|
|
52
52
|
src={organizationName?.profile_photo?.url || avatar}
|
|
53
53
|
isOpen={isOpen}
|
|
54
|
+
onClick={() => {
|
|
55
|
+
if (window.location.pathname.includes("personal")) {
|
|
56
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/personal/profile`;
|
|
57
|
+
}
|
|
58
|
+
if (window.location.pathname.includes("enterprise")) {
|
|
59
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/enterprise/profile`;
|
|
60
|
+
}
|
|
61
|
+
if (window.location.pathname.includes("instructor")) {
|
|
62
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/instructor/profile`;
|
|
63
|
+
}
|
|
64
|
+
}}
|
|
54
65
|
/>
|
|
55
|
-
<UserDetail
|
|
66
|
+
<UserDetail
|
|
67
|
+
isOpen={isOpen}
|
|
68
|
+
onClick={() => {
|
|
69
|
+
if (window.location.pathname.includes("personal")) {
|
|
70
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/personal/profile`;
|
|
71
|
+
}
|
|
72
|
+
if (window.location.pathname.includes("enterprise")) {
|
|
73
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/enterprise/profile`;
|
|
74
|
+
}
|
|
75
|
+
if (window.location.pathname.includes("instructor")) {
|
|
76
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/instructor/profile`;
|
|
77
|
+
}
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
56
80
|
<UserName>Hello</UserName>
|
|
57
81
|
<Handle
|
|
58
82
|
style={{
|
|
@@ -15,7 +15,7 @@ export const UserDetail = styled.div`
|
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
gap: 5px;
|
|
17
17
|
align-items: center;
|
|
18
|
-
|
|
18
|
+
cursor: pointer;
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
21
|
export const Avatar = styled.img`
|
|
@@ -23,6 +23,7 @@ export const Avatar = styled.img`
|
|
|
23
23
|
width: ${({ isOpen }) => (isOpen ? "47px" : "28px")};
|
|
24
24
|
height: ${({ isOpen }) => (isOpen ? "47px" : "28px")};
|
|
25
25
|
border-radius: 50%;
|
|
26
|
+
cursor: pointer;
|
|
26
27
|
`;
|
|
27
28
|
|
|
28
29
|
export const UserName = styled.div`
|