l-min-components 1.0.325 → 1.0.331
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 +20 -2
- package/src/components/header/account-dropdown.jsx +40 -4
- package/src/components/header/index.jsx +8 -1
- package/src/components/sideBar/sideMenu/index.jsx +5 -10
- package/src/components/sideBar/sideMenu/styles/index.jsx +2 -2
- package/src/hooks/leftNavMenu.jsx +3 -3
package/package.json
CHANGED
|
@@ -36,6 +36,8 @@ const AppMainLayout = () => {
|
|
|
36
36
|
const [hasLayoutBackgroundImage, setHasLayoutBackgroundImage] =
|
|
37
37
|
useState(false);
|
|
38
38
|
const [sideMenuLayout, setSideMenuLayout] = useState(true);
|
|
39
|
+
const [defaultAcct, setDefaultAcct] = useState("");
|
|
40
|
+
const centerLayoutStyle = {};
|
|
39
41
|
|
|
40
42
|
useEffect(() => {
|
|
41
43
|
if (window.location.host.includes("coming")) {
|
|
@@ -45,6 +47,21 @@ const AppMainLayout = () => {
|
|
|
45
47
|
}
|
|
46
48
|
}, []);
|
|
47
49
|
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
let cookieValue = null;
|
|
52
|
+
const cookieName = "defaultAccountType";
|
|
53
|
+
// Retrieve the value of the cookie
|
|
54
|
+
const cookies = document.cookie.split(";");
|
|
55
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
56
|
+
const cookie = cookies[i].trim();
|
|
57
|
+
if (cookie.startsWith(cookieName + "=")) {
|
|
58
|
+
cookieValue = cookie.substring(cookieName.length + 1);
|
|
59
|
+
setDefaultAcct(cookieValue)
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, [defaultAcct]);
|
|
64
|
+
|
|
48
65
|
return (
|
|
49
66
|
<OutletContext.Provider
|
|
50
67
|
value={{
|
|
@@ -64,6 +81,7 @@ const AppMainLayout = () => {
|
|
|
64
81
|
setPage,
|
|
65
82
|
selectedCourseId,
|
|
66
83
|
setSelectedCourseId,
|
|
84
|
+
centerLayoutStyle,
|
|
67
85
|
}}
|
|
68
86
|
>
|
|
69
87
|
<Layout
|
|
@@ -89,7 +107,7 @@ const AppMainLayout = () => {
|
|
|
89
107
|
? "instructor"
|
|
90
108
|
: window.location.pathname.includes("developer")
|
|
91
109
|
? "developer"
|
|
92
|
-
:
|
|
110
|
+
: defaultAcct
|
|
93
111
|
}
|
|
94
112
|
isOpen={isOpen}
|
|
95
113
|
setIsOpen={setIsOpen}
|
|
@@ -98,7 +116,7 @@ const AppMainLayout = () => {
|
|
|
98
116
|
</>
|
|
99
117
|
)}
|
|
100
118
|
</LeftLayout>
|
|
101
|
-
<CenterLayout isOpen={isOpen}>
|
|
119
|
+
<CenterLayout isOpen={isOpen} style={centerLayoutStyle}>
|
|
102
120
|
<Outlet />
|
|
103
121
|
</CenterLayout>
|
|
104
122
|
|
|
@@ -157,9 +157,9 @@ const AccountDropdown = (props) => {
|
|
|
157
157
|
props?.setSelectedAccount(instructorItem);
|
|
158
158
|
handleSetDefaultAccount(instructorItem?.id);
|
|
159
159
|
if (window.location.port) {
|
|
160
|
-
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/instructor`;
|
|
160
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/instructor/dashboard`;
|
|
161
161
|
} else {
|
|
162
|
-
window.location.href = `${window.location.protocol}//${window.location.hostname}/instructor`;
|
|
162
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/instructor/dashboard`;
|
|
163
163
|
}
|
|
164
164
|
}}
|
|
165
165
|
key={idx}
|
|
@@ -193,9 +193,9 @@ const AccountDropdown = (props) => {
|
|
|
193
193
|
props?.setSelectedAccount(enterpriseItem);
|
|
194
194
|
handleSetDefaultAccount(enterpriseItem?.id);
|
|
195
195
|
if (window.location.port) {
|
|
196
|
-
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/enterprise`;
|
|
196
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/enterprise/dashboard`;
|
|
197
197
|
} else {
|
|
198
|
-
window.location.href = `${window.location.protocol}//${window.location.hostname}/enterprise`;
|
|
198
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/enterprise/dashboard`;
|
|
199
199
|
}
|
|
200
200
|
}}
|
|
201
201
|
key={idx}
|
|
@@ -217,6 +217,42 @@ const AccountDropdown = (props) => {
|
|
|
217
217
|
))}
|
|
218
218
|
</div>
|
|
219
219
|
)}
|
|
220
|
+
{props?.personalAccountData?.length > 0 && (
|
|
221
|
+
<div>
|
|
222
|
+
<h3>Personal account</h3>
|
|
223
|
+
{props?.personalAccountData?.map((personalItem, idx) => (
|
|
224
|
+
<div
|
|
225
|
+
className={`account-info ${
|
|
226
|
+
personalItem === props?.selectedAccount ? "activated" : ""
|
|
227
|
+
}`}
|
|
228
|
+
onClick={() => {
|
|
229
|
+
props?.setSelectedAccount(personalItem);
|
|
230
|
+
handleSetDefaultAccount(personalItem?.id);
|
|
231
|
+
if (window.location.port) {
|
|
232
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/personal/dashboard`;
|
|
233
|
+
} else {
|
|
234
|
+
window.location.href = `${window.location.protocol}//${window.location.hostname}/personal/dashboard`;
|
|
235
|
+
}
|
|
236
|
+
}}
|
|
237
|
+
key={idx}
|
|
238
|
+
>
|
|
239
|
+
<div className="avatar-container">
|
|
240
|
+
<img
|
|
241
|
+
src={personalItem?.profile_photo?.url || props.avatar}
|
|
242
|
+
alt="account photo"
|
|
243
|
+
/>
|
|
244
|
+
</div>
|
|
245
|
+
<div className="account-details">
|
|
246
|
+
<h1>
|
|
247
|
+
{" "}
|
|
248
|
+
{personalItem?.display_name || props.accountName}
|
|
249
|
+
</h1>
|
|
250
|
+
<span>{props.notificationCount} </span>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
))}
|
|
254
|
+
</div>
|
|
255
|
+
)}
|
|
220
256
|
{/* // )} */}
|
|
221
257
|
</AccountDropdownBody>
|
|
222
258
|
|
|
@@ -176,7 +176,7 @@ const HeaderComponent = (props) => {
|
|
|
176
176
|
};
|
|
177
177
|
}, [setIsOpen]);
|
|
178
178
|
|
|
179
|
-
// get current default account and store in cookie
|
|
179
|
+
// get current default account and store in cookie (from api)
|
|
180
180
|
useEffect(() => {
|
|
181
181
|
if (getDefaultAccount?.data) {
|
|
182
182
|
const date = new Date();
|
|
@@ -201,6 +201,13 @@ const HeaderComponent = (props) => {
|
|
|
201
201
|
}
|
|
202
202
|
}, [getDefaultAccount?.response]);
|
|
203
203
|
|
|
204
|
+
// get current default account and store in cookie from path
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
if (pathname?.includes("personal")) {
|
|
207
|
+
// document.cookie = "activeAccount" + path;
|
|
208
|
+
}
|
|
209
|
+
}, []);
|
|
210
|
+
|
|
204
211
|
return (
|
|
205
212
|
<Navbar>
|
|
206
213
|
<img src={logo} alt="Learngual logo" />
|
|
@@ -107,7 +107,7 @@ const SideMenu = ({
|
|
|
107
107
|
}
|
|
108
108
|
if (
|
|
109
109
|
window.location.pathname.includes("/enterprise/reports") &&
|
|
110
|
-
path === "/enterprise/reports"
|
|
110
|
+
path === "/enterprise/reports/"
|
|
111
111
|
) {
|
|
112
112
|
return (statusText = true);
|
|
113
113
|
}
|
|
@@ -215,18 +215,13 @@ const SideMenu = ({
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
if (
|
|
218
|
-
window.location.hostname.includes("staging")
|
|
219
|
-
window.location.hostname.includes("enterprise")
|
|
218
|
+
window.location.hostname.includes("staging")
|
|
220
219
|
) {
|
|
221
|
-
window.location.href = `https://
|
|
220
|
+
window.location.href = `https://559staging.learngual.com/${path}`;
|
|
222
221
|
} else if (window.location.hostname.includes("localhost")) {
|
|
223
222
|
window.location.href = `http://localhost:${window.location.port}${path}`;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
!window.location.hostname.includes("staging")
|
|
227
|
-
) {
|
|
228
|
-
window.location.href = `https://developer.learngual.com${path}`;
|
|
229
|
-
}
|
|
223
|
+
}
|
|
224
|
+
|
|
230
225
|
}}
|
|
231
226
|
// to={route.path}
|
|
232
227
|
key={index}
|
|
@@ -49,9 +49,9 @@ export const NavigationItemContainer = styled.p`
|
|
|
49
49
|
position: relative;
|
|
50
50
|
padding: ${({ minimal }) => (minimal ? "12px 16px" : "12px 12px")};
|
|
51
51
|
color: ${({ active }) =>
|
|
52
|
-
active ? "rgb(255, 255, 255)" : "rgba(255, 255, 255, 0.625)"};
|
|
52
|
+
active ? "rgb(255, 255, 255) !important" : "rgba(255, 255, 255, 0.625) !important"};
|
|
53
53
|
&:hover {
|
|
54
|
-
color: #ffffff;
|
|
54
|
+
color: #ffffff !important;
|
|
55
55
|
background-color: #31cdcd;
|
|
56
56
|
|
|
57
57
|
> div {
|
|
@@ -125,7 +125,7 @@ export const sideMenuOptions = [
|
|
|
125
125
|
notifications: null,
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
|
-
path: "/enterprise/reports",
|
|
128
|
+
path: "/enterprise/reports/students",
|
|
129
129
|
icon: <AwardIcon />,
|
|
130
130
|
iconActive: <AwardIconActive />,
|
|
131
131
|
text: "Reports",
|
|
@@ -137,7 +137,7 @@ export const sideMenuOptions = [
|
|
|
137
137
|
text: "Courses",
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
|
-
path: "/enterprise/manage-teams",
|
|
140
|
+
path: "/enterprise/manage-teams/index",
|
|
141
141
|
icon: <TeamsIcon />,
|
|
142
142
|
iconActive: <TeamsIconActive />,
|
|
143
143
|
text: "Manage Teams",
|
|
@@ -149,7 +149,7 @@ export const sideMenuOptions = [
|
|
|
149
149
|
text: "Messages",
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
|
-
path: "/enterprise/announcements",
|
|
152
|
+
path: "/enterprise/announcements/index",
|
|
153
153
|
icon: <AnnouncementsIcon />,
|
|
154
154
|
iconActive: <AnnouncementsIconActive />,
|
|
155
155
|
text: "Announcements",
|