l-min-components 1.7.1385 → 1.7.1386
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 +11 -3
- package/src/components/dashboardState/images/information-icon.png +0 -0
- package/src/components/dashboardState/pendingDeleteState.jsx +1 -1
- package/src/components/getErrorFeatures/error404.jsx +0 -0
- package/src/components/getErrorFeatures/errorWrapper.jsx +205 -0
- package/src/components/getErrorFeatures/images/bg-403.png +0 -0
- package/src/components/getErrorFeatures/images/bg-404.png +0 -0
- package/src/components/getErrorFeatures/images/bg-500.png +0 -0
- package/src/components/getErrorFeatures/images/bg-503.png +0 -0
- package/src/components/getErrorFeatures/index.jsx +158 -0
- package/src/components/header/index.jsx +1 -9
- package/src/components/index.js +2 -0
- package/src/components/instructorAccountSwitcher/deleteCookies.jsx +7 -0
- package/src/components/instructorAccountSwitcher/index.jsx +8 -2
- package/src/components/sideBar/sideMenu/index.jsx +2 -3
- package/src/components/sideBar/userCard/index.jsx +9 -4
- package/src/components/sideNav/index.jsx +7 -0
- package/src/hooks/leftNavMenu.jsx +9 -3
- package/src/hooks/useCustomNavigate.jsx +21 -0
- package/src/utils/deleteCookies.js +6 -0
- package/src/utils/getCookie.js +13 -0
package/package.json
CHANGED
|
@@ -158,15 +158,22 @@ const AppMainLayout = ({ children }) => {
|
|
|
158
158
|
if (getDefaultAccount?.data) {
|
|
159
159
|
const date = new Date();
|
|
160
160
|
date.setDate(date.getDate() + 28);
|
|
161
|
+
|
|
162
|
+
const domain = window.location.href.includes("localhost")
|
|
163
|
+
? "localhost"
|
|
164
|
+
: window.location.hostname?.includes("ca")
|
|
165
|
+
? ".learngual.ca"
|
|
166
|
+
: ".learngual.com";
|
|
167
|
+
|
|
161
168
|
document.cookie =
|
|
162
169
|
"defaultAccountID=" +
|
|
163
170
|
getDefaultAccount?.data?.id +
|
|
164
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
171
|
+
`; domain=${domain}; path=/; expires=${date.toUTCString()};`;
|
|
165
172
|
|
|
166
173
|
document.cookie =
|
|
167
174
|
"defaultAccountType=" +
|
|
168
175
|
getDefaultAccount?.data?.type +
|
|
169
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
176
|
+
`; domain=${domain}; path=/; expires=${date.toUTCString()};`;
|
|
170
177
|
|
|
171
178
|
localStorage.setItem("defaultLang", getDefaultAccount?.data?.language);
|
|
172
179
|
|
|
@@ -418,7 +425,8 @@ const AppMainLayout = ({ children }) => {
|
|
|
418
425
|
</LeftLayout>
|
|
419
426
|
<CenterLayout isOpen={isOpen} style={centerLayoutStyle}>
|
|
420
427
|
{(window.location.pathname.includes("instructor") ||
|
|
421
|
-
activeAccountType === "instructor"
|
|
428
|
+
(activeAccountType === "instructor" &&
|
|
429
|
+
!accountIsPendingDeletion)) && (
|
|
422
430
|
<InstructorAccountSwitcher
|
|
423
431
|
// setAccountType={setAffiliatesActive}
|
|
424
432
|
generalData={generalData}
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
-
import warning from "./images/
|
|
2
|
+
import warning from "./images/information-icon.png";
|
|
3
3
|
import ButtonComponent from "../button";
|
|
4
4
|
import moment from "moment";
|
|
5
5
|
import redirectURL from "../../utils/redirectURL";
|
|
File without changes
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
|
|
4
|
+
import logo from "../../assets/images/logo.png";
|
|
5
|
+
import bg from "./images/bg-404.png";
|
|
6
|
+
import redirectURL from "../../utils/redirectURL";
|
|
7
|
+
import useCustomNavigate from "../../hooks/useCustomNavigate";
|
|
8
|
+
import getCookie from "../../utils/getCookie";
|
|
9
|
+
|
|
10
|
+
const ErrorWrapper = ({
|
|
11
|
+
title = "Oops!",
|
|
12
|
+
subTitle = "Page not found",
|
|
13
|
+
message = "Seems we can't find the page you are looking for. Let's get you back home.",
|
|
14
|
+
btnText = "Go to home page",
|
|
15
|
+
bgSrc,
|
|
16
|
+
fallbackPath,
|
|
17
|
+
isDashboard,
|
|
18
|
+
}) => {
|
|
19
|
+
const navigate = useCustomNavigate();
|
|
20
|
+
const handleNav = () => {
|
|
21
|
+
const accountType = getCookie("defaultAccountType")?.toLocaleLowerCase();
|
|
22
|
+
|
|
23
|
+
if (isDashboard && accountType) {
|
|
24
|
+
const route =
|
|
25
|
+
accountType === "developer"
|
|
26
|
+
? "/developer"
|
|
27
|
+
: `/${accountType}/dashboard`;
|
|
28
|
+
|
|
29
|
+
navigate(fallbackPath || route || "/", { reload: true });
|
|
30
|
+
} else {
|
|
31
|
+
navigate(fallbackPath || "/", { reload: true });
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return (
|
|
35
|
+
<Container>
|
|
36
|
+
<Navbar>
|
|
37
|
+
<a href="/">
|
|
38
|
+
<img src={logo} alt="Learngual logo" />
|
|
39
|
+
</a>
|
|
40
|
+
</Navbar>
|
|
41
|
+
<Content>
|
|
42
|
+
<LeftDiv>
|
|
43
|
+
<h1>{title}</h1>
|
|
44
|
+
<div>
|
|
45
|
+
{subTitle && <h2>{subTitle}</h2>}
|
|
46
|
+
{message && <p>{message}</p>}
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<button onClick={handleNav}>{btnText}</button>
|
|
50
|
+
</LeftDiv>
|
|
51
|
+
<ImageBox>
|
|
52
|
+
<img src={bgSrc || bg} alt="" />
|
|
53
|
+
</ImageBox>
|
|
54
|
+
</Content>
|
|
55
|
+
</Container>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const Container = styled.div`
|
|
60
|
+
min-height: 100vh;
|
|
61
|
+
width: 100%;
|
|
62
|
+
background-color: #fff;
|
|
63
|
+
padding: 0 25px;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
@media screen and (min-width: 850px) {
|
|
67
|
+
padding: 0 104px;
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
const Navbar = styled.nav`
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 80px;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: space-between;
|
|
77
|
+
img {
|
|
78
|
+
width: 52px;
|
|
79
|
+
}
|
|
80
|
+
@media screen and (min-width: 850px) {
|
|
81
|
+
height: 100px;
|
|
82
|
+
img {
|
|
83
|
+
width: 60px;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
const Content = styled.div`
|
|
89
|
+
flex: 1;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
padding-bottom: 80px;
|
|
93
|
+
gap: 30px;
|
|
94
|
+
flex-direction: column-reverse;
|
|
95
|
+
justify-content: flex-end;
|
|
96
|
+
padding-top: 60px;
|
|
97
|
+
max-width: 390px;
|
|
98
|
+
margin: 0 auto;
|
|
99
|
+
@media screen and (min-width: 850px) {
|
|
100
|
+
flex-direction: row;
|
|
101
|
+
padding-top: 0px;
|
|
102
|
+
justify-content: flex-start;
|
|
103
|
+
gap: 100px;
|
|
104
|
+
padding-bottom: 100px;
|
|
105
|
+
max-width: none;
|
|
106
|
+
margin: 0px;
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
const LeftDiv = styled.div`
|
|
111
|
+
width: 100%;
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
gap: 12px;
|
|
115
|
+
text-align: center;
|
|
116
|
+
align-items: center;
|
|
117
|
+
color: #313333;
|
|
118
|
+
border-radius: 15px;
|
|
119
|
+
background: #f5f7f7;
|
|
120
|
+
padding: 20px 18px;
|
|
121
|
+
h1 {
|
|
122
|
+
font-size: 25px;
|
|
123
|
+
}
|
|
124
|
+
> div {
|
|
125
|
+
width: 100%;
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
gap: 8px;
|
|
129
|
+
h2 {
|
|
130
|
+
font-weight: 500;
|
|
131
|
+
font-size: 18px;
|
|
132
|
+
}
|
|
133
|
+
p {
|
|
134
|
+
font-size: 16px;
|
|
135
|
+
color: #636666;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
button {
|
|
139
|
+
width: fit-content;
|
|
140
|
+
height: 40px;
|
|
141
|
+
padding: 0px 40px;
|
|
142
|
+
border-radius: 6px;
|
|
143
|
+
background: #febf10;
|
|
144
|
+
box-shadow: 0px 10px 20px 0px rgba(254, 191, 16, 0.25);
|
|
145
|
+
border: none;
|
|
146
|
+
outline: none;
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
color: white;
|
|
149
|
+
font-weight: 700;
|
|
150
|
+
font-size: 14px;
|
|
151
|
+
margin-top: 12px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@media screen and (min-width: 850px) {
|
|
155
|
+
max-width: 462px;
|
|
156
|
+
gap: 24px;
|
|
157
|
+
text-align: left;
|
|
158
|
+
flex: none;
|
|
159
|
+
align-items: flex-start;
|
|
160
|
+
border-radius: 0px;
|
|
161
|
+
background: transparent;
|
|
162
|
+
padding: 0px;
|
|
163
|
+
flex: 1;
|
|
164
|
+
h1 {
|
|
165
|
+
font-size: 44px;
|
|
166
|
+
}
|
|
167
|
+
> div {
|
|
168
|
+
gap: 12px;
|
|
169
|
+
h2 {
|
|
170
|
+
font-size: 30px;
|
|
171
|
+
}
|
|
172
|
+
p {
|
|
173
|
+
font-size: 18px;
|
|
174
|
+
line-height: 32px;
|
|
175
|
+
color: #313333;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
button {
|
|
179
|
+
margin-top: 0;
|
|
180
|
+
height: 50px;
|
|
181
|
+
font-size: 16px;
|
|
182
|
+
border-radius: 12px;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
const ImageBox = styled.div`
|
|
188
|
+
width: 100%;
|
|
189
|
+
height: 160px;
|
|
190
|
+
display: grid;
|
|
191
|
+
place-items: center;
|
|
192
|
+
img {
|
|
193
|
+
width: 100%;
|
|
194
|
+
max-width: 550px;
|
|
195
|
+
height: 100%;
|
|
196
|
+
max-height: 550px;
|
|
197
|
+
object-fit: contain;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@media screen and (min-width: 850px) {
|
|
201
|
+
height: 100%;
|
|
202
|
+
flex: 1;
|
|
203
|
+
}
|
|
204
|
+
`;
|
|
205
|
+
export default ErrorWrapper;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import ErrorWrapper from "./errorWrapper";
|
|
2
|
+
import bg403 from "./images/bg-403.png";
|
|
3
|
+
import bg500 from "./images/bg-500.png";
|
|
4
|
+
import bg503 from "./images/bg-503.png";
|
|
5
|
+
|
|
6
|
+
const Error404 = ({ btnText, fallbackPath, isDashboard }) => (
|
|
7
|
+
<ErrorWrapper
|
|
8
|
+
fallbackPath={fallbackPath}
|
|
9
|
+
btnText={btnText}
|
|
10
|
+
isDashboard={isDashboard}
|
|
11
|
+
/>
|
|
12
|
+
);
|
|
13
|
+
const Error403 = ({ btnText, fallbackPath, isDashboard }) => (
|
|
14
|
+
<ErrorWrapper
|
|
15
|
+
subTitle="Sorry, you don’t have permission to access this page."
|
|
16
|
+
message="If you believe this is a mistake, please contact the site administrator or check if you have the correct login credentials."
|
|
17
|
+
bgSrc={bg403}
|
|
18
|
+
fallbackPath={fallbackPath}
|
|
19
|
+
btnText={btnText}
|
|
20
|
+
isDashboard={isDashboard}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
const Error500 = ({ btnText, fallbackPath, isDashboard }) => (
|
|
24
|
+
<ErrorWrapper
|
|
25
|
+
subTitle="Something went wrong"
|
|
26
|
+
message="We’re so sorry about that! Our tech team is already on the case. Please try again later."
|
|
27
|
+
bgSrc={bg500}
|
|
28
|
+
fallbackPath={fallbackPath}
|
|
29
|
+
btnText={btnText}
|
|
30
|
+
isDashboard={isDashboard}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
const Error503 = ({ btnText, fallbackPath, isDashboard }) => (
|
|
34
|
+
<ErrorWrapper
|
|
35
|
+
subTitle=""
|
|
36
|
+
message="It'll be back up and running in a jiffy. Try again later."
|
|
37
|
+
title="Our servers are temporarily busy."
|
|
38
|
+
bgSrc={bg503}
|
|
39
|
+
fallbackPath={fallbackPath}
|
|
40
|
+
btnText={btnText}
|
|
41
|
+
isDashboard={isDashboard}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
function ErrorBoundary({
|
|
46
|
+
routeError,
|
|
47
|
+
isRouteErrorResponse,
|
|
48
|
+
fallbackPath,
|
|
49
|
+
btnText,
|
|
50
|
+
isDashboard,
|
|
51
|
+
}) {
|
|
52
|
+
if (isRouteErrorResponse?.(routeError)) {
|
|
53
|
+
if (error.status === 404)
|
|
54
|
+
return (
|
|
55
|
+
<Error404
|
|
56
|
+
fallbackPath={fallbackPath}
|
|
57
|
+
btnText={btnText}
|
|
58
|
+
isDashboard={isDashboard}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
if (error.status === 403)
|
|
62
|
+
return (
|
|
63
|
+
<Error403
|
|
64
|
+
fallbackPath={fallbackPath}
|
|
65
|
+
btnText={btnText}
|
|
66
|
+
isDashboard={isDashboard}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
if (error.status === 500)
|
|
70
|
+
return (
|
|
71
|
+
<Error500
|
|
72
|
+
fallbackPath={fallbackPath}
|
|
73
|
+
btnText={btnText}
|
|
74
|
+
isDashboard={isDashboard}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
if (error.status === 503)
|
|
78
|
+
return (
|
|
79
|
+
<Error503
|
|
80
|
+
fallbackPath={fallbackPath}
|
|
81
|
+
btnText={btnText}
|
|
82
|
+
isDashboard={isDashboard}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
return (
|
|
86
|
+
<Error500
|
|
87
|
+
fallbackPath={fallbackPath}
|
|
88
|
+
btnText={btnText}
|
|
89
|
+
isDashboard={isDashboard}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (error instanceof Error)
|
|
95
|
+
return (
|
|
96
|
+
<Error500
|
|
97
|
+
fallbackPath={fallbackPath}
|
|
98
|
+
btnText={btnText}
|
|
99
|
+
isDashboard={isDashboard}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
return (
|
|
103
|
+
<Error500
|
|
104
|
+
fallbackPath={fallbackPath}
|
|
105
|
+
btnText={btnText}
|
|
106
|
+
isDashboard={isDashboard}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function ErrorComponent({ fallbackPath, btnText, isDashboard = false }) {
|
|
112
|
+
const params = new URLSearchParams(window.location.search);
|
|
113
|
+
const errorParam = params.get("error-status");
|
|
114
|
+
|
|
115
|
+
if (errorParam === "_403_")
|
|
116
|
+
return (
|
|
117
|
+
<Error403
|
|
118
|
+
fallbackPath={fallbackPath}
|
|
119
|
+
btnText={btnText}
|
|
120
|
+
isDashboard={isDashboard}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
if (errorParam === "_500_")
|
|
124
|
+
return (
|
|
125
|
+
<Error500
|
|
126
|
+
fallbackPath={fallbackPath}
|
|
127
|
+
btnText={btnText}
|
|
128
|
+
isDashboard={isDashboard}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
if (errorParam === "_503_")
|
|
132
|
+
return (
|
|
133
|
+
<Error503
|
|
134
|
+
fallbackPath={fallbackPath}
|
|
135
|
+
btnText={btnText}
|
|
136
|
+
isDashboard={isDashboard}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
return (
|
|
140
|
+
<Error404
|
|
141
|
+
fallbackPath={fallbackPath}
|
|
142
|
+
btnText={btnText}
|
|
143
|
+
isDashboard={isDashboard}
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const getErrorFeatures = () => {
|
|
149
|
+
return {
|
|
150
|
+
Error404,
|
|
151
|
+
Error403,
|
|
152
|
+
Error500,
|
|
153
|
+
Error503,
|
|
154
|
+
ErrorBoundary,
|
|
155
|
+
ErrorComponent,
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export default getErrorFeatures;
|
|
@@ -10,15 +10,7 @@ import {
|
|
|
10
10
|
import { ArrowDownIcon } from "./assets/svg/arrow-down";
|
|
11
11
|
import AccountDropdown from "./account-dropdown";
|
|
12
12
|
import avatar from "./assets/images/avatar.png";
|
|
13
|
-
import {
|
|
14
|
-
Navbar,
|
|
15
|
-
NavGroup,
|
|
16
|
-
Nav,
|
|
17
|
-
SearchInputGroup,
|
|
18
|
-
SearchInput,
|
|
19
|
-
UserProfile,
|
|
20
|
-
Help,
|
|
21
|
-
} from "./index.styled";
|
|
13
|
+
import { Navbar, NavGroup, Nav, UserProfile } from "./index.styled";
|
|
22
14
|
import useHeader from "./getHeaderDetails";
|
|
23
15
|
import { FullPageLoader, OutletContext } from "..";
|
|
24
16
|
import { useLocation } from "react-router-dom";
|
package/src/components/index.js
CHANGED
|
@@ -62,3 +62,5 @@ export { default as useAiUtils } from "../utils/useAiUtils";
|
|
|
62
62
|
export { default as useAudioRecorder } from "../hooks/recorder-kit";
|
|
63
63
|
export { default as useCookiePolling } from "../hooks/utils/cookiePolling";
|
|
64
64
|
export { default as convertBlobToWav } from "../utils/webm2wav";
|
|
65
|
+
export { default as useErrorFeatures } from "./getErrorFeatures";
|
|
66
|
+
export { default as useCustomNavigate } from "../hooks/useCustomNavigate";
|
|
@@ -11,16 +11,23 @@ const deleteCookies = (name) => {
|
|
|
11
11
|
: "production";
|
|
12
12
|
if (env === "staging") {
|
|
13
13
|
Cookies.remove(name, {
|
|
14
|
+
domain: window.location.hostname?.includes("ca")
|
|
15
|
+
? ".learngual.ca"
|
|
16
|
+
: ".learngual.com",
|
|
14
17
|
expires: date,
|
|
15
18
|
path: "/",
|
|
16
19
|
});
|
|
17
20
|
} else if (env === "local") {
|
|
18
21
|
Cookies.remove(name, {
|
|
22
|
+
domain: "localhost",
|
|
19
23
|
expires: date,
|
|
20
24
|
path: "/",
|
|
21
25
|
});
|
|
22
26
|
} else {
|
|
23
27
|
Cookies.remove(name, {
|
|
28
|
+
domain: window.location.hostname?.includes("ca")
|
|
29
|
+
? ".learngual.ca"
|
|
30
|
+
: ".learngual.com",
|
|
24
31
|
expires: date,
|
|
25
32
|
path: "/",
|
|
26
33
|
});
|
|
@@ -71,7 +71,13 @@ const InstructorAccountSwitcher = ({
|
|
|
71
71
|
date.setDate(date.getDate() + 20);
|
|
72
72
|
const expires = "; expires=" + date.toUTCString();
|
|
73
73
|
const path = "; path=/";
|
|
74
|
-
|
|
74
|
+
const domain = window.location.href.includes("localhost")
|
|
75
|
+
? "localhost"
|
|
76
|
+
: window.location.hostname?.includes("ca")
|
|
77
|
+
? ".learngual.ca"
|
|
78
|
+
: ".learngual.com";
|
|
79
|
+
document.cookie =
|
|
80
|
+
"affiliateAccount=" + id + expires + path + "; domain=" + domain;
|
|
75
81
|
};
|
|
76
82
|
|
|
77
83
|
const cookieValue = getCookie();
|
|
@@ -262,7 +268,7 @@ const InstructorAccountSwitcher = ({
|
|
|
262
268
|
className={switchValue !== "affiliates" ? "active" : ""}
|
|
263
269
|
onClick={() => handleSwitch(1)}
|
|
264
270
|
>
|
|
265
|
-
<span>
|
|
271
|
+
<span>Personal</span>
|
|
266
272
|
<span className="circle"></span>
|
|
267
273
|
</button>
|
|
268
274
|
)}
|
|
@@ -83,11 +83,10 @@ const SideMenu = ({
|
|
|
83
83
|
}, [affiliatesActive, filteredRoutes]);
|
|
84
84
|
|
|
85
85
|
// Right bars
|
|
86
|
-
const EnterpriseRight = <EnterpriseRightBar />;
|
|
87
|
-
const InstructorRight = <InstructorRightBar />;
|
|
86
|
+
// const EnterpriseRight = <EnterpriseRightBar />;
|
|
87
|
+
// const InstructorRight = <InstructorRightBar />;
|
|
88
88
|
|
|
89
89
|
const renderNavigationItem = (route, index) => {
|
|
90
|
-
console.log(route, "route");
|
|
91
90
|
let notificationCount;
|
|
92
91
|
const { icon, iconActive, text, notifications, path, affiliates, newTab } =
|
|
93
92
|
route;
|
|
@@ -20,19 +20,25 @@ const UserCard = ({ isOpen, findText }) => {
|
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
if (generalData?.selectedAccount) {
|
|
22
22
|
const date = new Date();
|
|
23
|
+
const domain = window.location.href.includes("localhost")
|
|
24
|
+
? "localhost"
|
|
25
|
+
: window.location.hostname?.includes("ca")
|
|
26
|
+
? ".learngual.ca"
|
|
27
|
+
: ".learngual.com";
|
|
28
|
+
|
|
23
29
|
date.setDate(date.getDate() + 28);
|
|
24
30
|
document.cookie =
|
|
25
31
|
"activeDeveloperAccount=" +
|
|
26
32
|
generalData?.selectedAccount?.id +
|
|
27
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
33
|
+
`; path=/; domain=${domain}; expires=${date.toUTCString()};`;
|
|
28
34
|
document.cookie =
|
|
29
35
|
"defaultAccountID=" +
|
|
30
36
|
generalData?.selectedAccount?.id +
|
|
31
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
37
|
+
`; path=/; domain=${domain}; expires=${date.toUTCString()};`;
|
|
32
38
|
document.cookie =
|
|
33
39
|
"defaultAccountType=" +
|
|
34
40
|
generalData?.selectedAccount?.type +
|
|
35
|
-
`; path=/; expires=${date.toUTCString()};`;
|
|
41
|
+
`; path=/; domain=${domain}; expires=${date.toUTCString()};`;
|
|
36
42
|
|
|
37
43
|
handleSetDefaultAccount(generalData?.selectedAccount?.id);
|
|
38
44
|
|
|
@@ -45,7 +51,6 @@ const UserCard = ({ isOpen, findText }) => {
|
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
}, [generalData]);
|
|
48
|
-
console.log(generalData, "data...");
|
|
49
54
|
|
|
50
55
|
return (
|
|
51
56
|
<UserCardContainer isOpen={isOpen}>
|
|
@@ -24,16 +24,23 @@ const SideBar = ({ routes, findText }) => {
|
|
|
24
24
|
: "production";
|
|
25
25
|
if (env === "staging") {
|
|
26
26
|
Cookies.remove(name, {
|
|
27
|
+
domain: window.location.hostname?.includes("ca")
|
|
28
|
+
? ".learngual.ca"
|
|
29
|
+
: ".learngual.com",
|
|
27
30
|
expires: date,
|
|
28
31
|
path: "/",
|
|
29
32
|
});
|
|
30
33
|
} else if (env === "local") {
|
|
31
34
|
Cookies.remove(name, {
|
|
35
|
+
domain: "localhost",
|
|
32
36
|
expires: date,
|
|
33
37
|
path: "/",
|
|
34
38
|
});
|
|
35
39
|
} else {
|
|
36
40
|
Cookies.remove(name, {
|
|
41
|
+
domain: window.location.hostname?.includes("ca")
|
|
42
|
+
? ".learngual.ca"
|
|
43
|
+
: ".learngual.com",
|
|
37
44
|
expires: date,
|
|
38
45
|
path: "/",
|
|
39
46
|
});
|
|
@@ -83,7 +83,9 @@ export const leftNavMenu = [
|
|
|
83
83
|
icon: <DictionaryIcon />,
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
path:
|
|
86
|
+
path: window.location.hostname.includes("ca")
|
|
87
|
+
? "https://demo.learngual.ca/type-select"
|
|
88
|
+
: "https://demo.learngual.com/type-select",
|
|
87
89
|
label: "Demo",
|
|
88
90
|
icon: <CompuetrerIcon />,
|
|
89
91
|
},
|
|
@@ -92,7 +94,9 @@ export const leftNavMenu = [
|
|
|
92
94
|
export const getLeftRoutes = (accoutType) => {
|
|
93
95
|
const leftNavMenu = [
|
|
94
96
|
{
|
|
95
|
-
path:
|
|
97
|
+
path: window.location.hostname.includes("ca")
|
|
98
|
+
? `https://www.learngual.ca/${accoutType}`
|
|
99
|
+
: `https://www.learngual.com/${accoutType}`,
|
|
96
100
|
label: "Learning",
|
|
97
101
|
icon: <Learning />,
|
|
98
102
|
},
|
|
@@ -122,7 +126,9 @@ export const getLeftRoutes = (accoutType) => {
|
|
|
122
126
|
icon: <DictionaryIcon />,
|
|
123
127
|
},
|
|
124
128
|
{
|
|
125
|
-
path:
|
|
129
|
+
path: window.location.hostname.includes("ca")
|
|
130
|
+
? "https://demo.learngual.ca/type-select"
|
|
131
|
+
: "https://demo.learngual.com/type-select",
|
|
126
132
|
label: "Demo",
|
|
127
133
|
icon: <CompuetrerIcon />,
|
|
128
134
|
},
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default function useCustomNavigate() {
|
|
2
|
+
return (path, { replace = false, state = null, reload = false } = {}) => {
|
|
3
|
+
if (reload) {
|
|
4
|
+
if (replace) {
|
|
5
|
+
window.location.replace(path);
|
|
6
|
+
} else {
|
|
7
|
+
window.location.href = path;
|
|
8
|
+
}
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const historyState = { ...state };
|
|
13
|
+
if (replace) {
|
|
14
|
+
window.history.replaceState(historyState, "", path);
|
|
15
|
+
} else {
|
|
16
|
+
window.history.pushState(historyState, "", path);
|
|
17
|
+
}
|
|
18
|
+
//ssss
|
|
19
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -31,12 +31,18 @@ const deleteCookies = (names) => {
|
|
|
31
31
|
if (env === "local") {
|
|
32
32
|
// For local environment
|
|
33
33
|
deleteSingleCookie(name, {
|
|
34
|
+
domain: "localhost",
|
|
34
35
|
expires: date,
|
|
35
36
|
path: "/",
|
|
36
37
|
});
|
|
37
38
|
} else {
|
|
38
39
|
// For staging and production environments
|
|
39
40
|
deleteSingleCookie(name, {
|
|
41
|
+
domain: window.location.href.includes("localhost")
|
|
42
|
+
? "localhost"
|
|
43
|
+
: window.location.hostname?.includes("ca")
|
|
44
|
+
? ".learngual.ca"
|
|
45
|
+
: ".learngual.com",
|
|
40
46
|
expires: date,
|
|
41
47
|
path: "/",
|
|
42
48
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function getCookie(name) {
|
|
2
|
+
const cookieStr = document.cookie;
|
|
3
|
+
const cookies = cookieStr.split("; ");
|
|
4
|
+
|
|
5
|
+
for (const cookie of cookies) {
|
|
6
|
+
const [key, value] = cookie.split("=");
|
|
7
|
+
if (key === name) return decodeURIComponent(value);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return null; // Not found
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default getCookie;
|