l-min-components 1.7.1540 → 1.7.1542

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.7.1540",
3
+ "version": "1.7.1542",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -1,16 +1,16 @@
1
- import React, { useEffect, useState, useContext } from 'react';
2
- import { CloseIcon } from './assets/svg/close';
3
- import { AddIcon } from './assets/svg/add';
1
+ import React, { useEffect, useState, useContext } from "react";
2
+ import { CloseIcon } from "./assets/svg/close";
3
+ import { AddIcon } from "./assets/svg/add";
4
4
  import {
5
5
  AccountDropdownLayout,
6
6
  AccountDropdownHeader,
7
7
  AccountDropdownBody,
8
8
  AccountDropdownFooter,
9
- } from './index.styled';
10
- import { useLocation, useNavigate } from 'react-router-dom';
9
+ } from "./index.styled";
10
+ import { useLocation, useNavigate } from "react-router-dom";
11
11
  // import useHeader from "./getHeaderDetails";
12
- import { FullPageLoader, OutletContext } from '..';
13
- import deleteCookies from '../instructorAccountSwitcher/deleteCookies';
12
+ import { FullPageLoader, OutletContext } from "..";
13
+ import deleteCookies from "../instructorAccountSwitcher/deleteCookies";
14
14
  /**
15
15
  * @param {{
16
16
  * type: string,
@@ -36,9 +36,20 @@ const AccountDropdown = (props) => {
36
36
  }, [props?.selectedAccount]);
37
37
  const handleRedirectFunc = ({ type, id }) => {
38
38
  // optimize the use of this base later because it's redeclared on multiple files
39
- const base = `${window.location.hostname.includes('localhost') || window.location.hostname.includes('staging') ? `https://559staging.learngual.${window.location.hostname.includes('.ca') ? 'ca' : 'com'}` : `https://www.learngual.${window.location.hostname.includes('.ca') ? 'ca' : 'com'}`}`;
39
+ const base = `${
40
+ window.location.hostname.includes("localhost") ||
41
+ window.location.hostname.includes("staging")
42
+ ? `https://559staging.learngual.${
43
+ window.location.hostname.includes(".ca") ? "ca" : "com"
44
+ }`
45
+ : `https://www.learngual.${
46
+ window.location.hostname.includes(".ca") ? "ca" : "com"
47
+ }`
48
+ }`;
40
49
  if (window.location.port) {
41
- window.location.href = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/${type?.toLowerCase()}`;
50
+ window.location.href = `${window.location.protocol}//${
51
+ window.location.hostname
52
+ }:${window.location.port}/${type?.toLowerCase()}`;
42
53
  } else {
43
54
  window.location.href = `${base}/${type?.toLowerCase()}`;
44
55
  }
@@ -55,27 +66,28 @@ const AccountDropdown = (props) => {
55
66
  <div className="img_div">
56
67
  <img
57
68
  src={props?.selectedAccount?.profile_photo?.url || props?.avatar}
58
- alt={props?.findText('account photo')}
69
+ alt={props?.findText("account photo")}
59
70
  />
60
71
  </div>
61
72
  <div>
62
73
  <h1
63
74
  style={{
64
- textTransform: 'capitalize',
75
+ textTransform: "capitalize",
65
76
  }}
66
77
  >
67
- {' '}
78
+ {" "}
68
79
  {findAccountNames(props?.selectedAccount)}
69
80
  </h1>
70
81
  <h2
71
82
  style={{
72
- textTransform: 'capitalize',
83
+ textTransform: "capitalize",
73
84
  }}
74
85
  >
75
- {props?.selectedAccount?.type?.toLowerCase() === 'personal'
76
- ? 'Student'
77
- : props?.selectedAccount?.type?.toLowerCase() ||
78
- props.activeAccountType}{' '}
86
+ {props?.selectedAccount?.type?.toLowerCase() === "personal"
87
+ ? props?.findText("Student")
88
+ : props?.findText(
89
+ props?.selectedAccount?.type?.toLowerCase()
90
+ ) || props?.findText(props.activeAccountType)}{" "}
79
91
  </h2>
80
92
  </div>
81
93
  </AccountDropdownHeader>
@@ -122,20 +134,24 @@ const AccountDropdown = (props) => {
122
134
  marginBottom: 10,
123
135
  }}
124
136
  >
125
- {props.findText('Developer accounts')}
137
+ {props.findText("Developer accounts")}
126
138
  </h3>
127
139
  {props?.developerAccountData
128
140
  ?.filter((developerItem) => !developerItem?.pending_delete) // filter out pending delete items
129
141
  .map((developerItem, idx) => {
130
142
  return (
131
143
  <div
132
- className={`account-info ${developerItem?.id === props?.selectedAccount?.id ? 'activated' : ''}`}
144
+ className={`account-info ${
145
+ developerItem?.id === props?.selectedAccount?.id
146
+ ? "activated"
147
+ : ""
148
+ }`}
133
149
  onClick={() => {
134
150
  setIsLoading(true);
135
151
  deleteCookies([
136
- 'defaultAccountType',
137
- 'defaultAccountID',
138
- 'activeDeveloperAccount',
152
+ "defaultAccountType",
153
+ "defaultAccountID",
154
+ "activeDeveloperAccount",
139
155
  ]);
140
156
  props?.setSelectedAccount(developerItem);
141
157
  setTimeout(() => {
@@ -149,16 +165,16 @@ const AccountDropdown = (props) => {
149
165
  src={
150
166
  developerItem?.profile_photo?.url || props.avatar
151
167
  }
152
- alt={props?.findText('account photo')}
168
+ alt={props?.findText("account photo")}
153
169
  />
154
170
  </div>
155
171
  <div className="account-details">
156
172
  <h1
157
173
  style={{
158
- textTransform: 'capitalize',
174
+ textTransform: "capitalize",
159
175
  }}
160
176
  >
161
- {' '}
177
+ {" "}
162
178
  {findAccountNames(developerItem) ||
163
179
  props.accountName}
164
180
  </h1>
@@ -182,19 +198,23 @@ const AccountDropdown = (props) => {
182
198
  marginBottom: 10,
183
199
  }}
184
200
  >
185
- {props.findText('Instructor account')}
201
+ {props.findText("Instructor account")}
186
202
  </h3>
187
203
  {props?.instructorAccountData?.map((instructorItem, idx) => {
188
- console.log('account>>', instructorItem);
204
+ console.log("account>>", instructorItem);
189
205
  return (
190
206
  <div
191
- className={`account-info ${instructorItem?.id === props?.selectedAccount?.id ? 'activated' : ''}`}
207
+ className={`account-info ${
208
+ instructorItem?.id === props?.selectedAccount?.id
209
+ ? "activated"
210
+ : ""
211
+ }`}
192
212
  onClick={() => {
193
213
  setIsLoading(true);
194
214
  deleteCookies([
195
- 'defaultAccountType',
196
- 'defaultAccountID',
197
- 'activeDeveloperAccount',
215
+ "defaultAccountType",
216
+ "defaultAccountID",
217
+ "activeDeveloperAccount",
198
218
  ]);
199
219
  props?.setSelectedAccount(instructorItem);
200
220
  setTimeout(() => {
@@ -208,12 +228,12 @@ const AccountDropdown = (props) => {
208
228
  src={
209
229
  instructorItem?.profile_photo?.url || props.avatar
210
230
  }
211
- alt={props?.findText('account photo')}
231
+ alt={props?.findText("account photo")}
212
232
  />
213
233
  </div>
214
234
  <div className="account-details">
215
235
  <h1>
216
- {' '}
236
+ {" "}
217
237
  {findAccountNames(instructorItem) ||
218
238
  props.accountName}
219
239
  </h1>
@@ -233,17 +253,21 @@ const AccountDropdown = (props) => {
233
253
  marginBottom: 10,
234
254
  }}
235
255
  >
236
- {props?.findText('Enterprise account')}
256
+ {props?.findText("Enterprise account")}
237
257
  </h3>
238
258
  {props?.enterpriseAccountData?.map((enterpriseItem, idx) => (
239
259
  <div
240
- className={`account-info ${enterpriseItem?.id === props?.selectedAccount?.id ? 'activated' : ''}`}
260
+ className={`account-info ${
261
+ enterpriseItem?.id === props?.selectedAccount?.id
262
+ ? "activated"
263
+ : ""
264
+ }`}
241
265
  onClick={() => {
242
266
  setIsLoading(true);
243
267
  deleteCookies([
244
- 'defaultAccountType',
245
- 'defaultAccountID',
246
- 'activeDeveloperAccount',
268
+ "defaultAccountType",
269
+ "defaultAccountID",
270
+ "activeDeveloperAccount",
247
271
  ]);
248
272
  props?.setSelectedAccount(enterpriseItem);
249
273
  setTimeout(() => {
@@ -255,12 +279,12 @@ const AccountDropdown = (props) => {
255
279
  <div className="avatar-container">
256
280
  <img
257
281
  src={enterpriseItem?.profile_photo?.url || props.avatar}
258
- alt={props?.findText('account photo')}
282
+ alt={props?.findText("account photo")}
259
283
  />
260
284
  </div>
261
285
  <div className="account-details">
262
286
  <h1>
263
- {' '}
287
+ {" "}
264
288
  {findAccountNames(enterpriseItem) || props.accountName}
265
289
  </h1>
266
290
  {enterpriseItem?.notification_count > 0 && (
@@ -281,17 +305,21 @@ const AccountDropdown = (props) => {
281
305
  marginBottom: 10,
282
306
  }}
283
307
  >
284
- {props?.findText('Student account')}
308
+ {props?.findText("Student account")}
285
309
  </h3>
286
310
  {props?.personalAccountData?.map((personalItem, idx) => (
287
311
  <div
288
- className={`account-info ${personalItem?.id === props?.selectedAccount?.id ? 'activated' : ''}`}
312
+ className={`account-info ${
313
+ personalItem?.id === props?.selectedAccount?.id
314
+ ? "activated"
315
+ : ""
316
+ }`}
289
317
  onClick={() => {
290
318
  setIsLoading(true);
291
319
  deleteCookies([
292
- 'defaultAccountType',
293
- 'defaultAccountID',
294
- 'activeDeveloperAccount',
320
+ "defaultAccountType",
321
+ "defaultAccountID",
322
+ "activeDeveloperAccount",
295
323
  ]);
296
324
  props?.setSelectedAccount(personalItem);
297
325
  setTimeout(() => {
@@ -303,12 +331,12 @@ const AccountDropdown = (props) => {
303
331
  <div className="avatar-container">
304
332
  <img
305
333
  src={personalItem?.profile_photo?.url || props.avatar}
306
- alt={props?.findText('account photo')}
334
+ alt={props?.findText("account photo")}
307
335
  />
308
336
  </div>
309
337
  <div className="account-details">
310
338
  <h1>
311
- {' '}
339
+ {" "}
312
340
  {findAccountNames(personalItem) || props.accountName}
313
341
  </h1>
314
342
  {personalItem?.notification_count > 0 && (
@@ -328,16 +356,16 @@ const AccountDropdown = (props) => {
328
356
  <AccountDropdownFooter>
329
357
  <button
330
358
  onClick={() => {
331
- window.location.hostname?.includes('coming')
359
+ window.location.hostname?.includes("coming")
332
360
  ? (window.location.href =
333
- 'https://learngual.com/auth/account-type')
334
- : (window.location.href = '/auth/account-type');
361
+ "https://learngual.com/auth/account-type")
362
+ : (window.location.href = "/auth/account-type");
335
363
  }}
336
364
  style={{
337
- cursor: 'pointer',
365
+ cursor: "pointer",
338
366
  }}
339
367
  >
340
- <AddIcon /> {props.findText('Add account')}
368
+ <AddIcon /> {props.findText("Add account")}
341
369
  </button>
342
370
  </AccountDropdownFooter>
343
371
  </AccountDropdownLayout>
@@ -102,6 +102,9 @@ const ReportQuestions = ({
102
102
  useEffect(() => {
103
103
  if (commentData?.length && findedQuestion?.question_id)
104
104
  setComment(commentData?.[0]);
105
+ else {
106
+ setComment(null);
107
+ }
105
108
  }, [commentData, findedQuestion?.question_id, questionActivityID]);
106
109
  useEffect(() => {
107
110
  if (findedQuestion?.question_id) {