catchup-library-web 1.4.15 → 1.5.2
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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -5
- package/dist/index.mjs +3 -5
- package/package.json +1 -1
- package/src/components/activities/material-content/OpenEndedActivityMaterialContent.tsx +0 -757
- package/src/components/images/BaseImage.tsx +2 -1
- package/src/properties/ImageProperties.ts +1 -0
- package/src/utilization/ManagementUtilization.ts +3 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -304,6 +304,7 @@ var BaseImage = (props) => {
|
|
|
304
304
|
widthClassName,
|
|
305
305
|
heightClassName,
|
|
306
306
|
src,
|
|
307
|
+
hidden,
|
|
307
308
|
alt,
|
|
308
309
|
showLoading,
|
|
309
310
|
onLoad,
|
|
@@ -362,7 +363,7 @@ var BaseImage = (props) => {
|
|
|
362
363
|
return loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BaseLoading_default, { size: "small", primaryColor: "#57C2D3", secondaryColor: "#57C2D3" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
363
364
|
"span",
|
|
364
365
|
{
|
|
365
|
-
className: `${currentWidthClassName ? currentWidthClassName : ""} ${currentHeightClassName ? currentHeightClassName : ""} ${currentClassName ? currentClassName : ""} cursor-pointer inline-block`,
|
|
366
|
+
className: `${currentWidthClassName ? currentWidthClassName : ""} ${currentHeightClassName ? currentHeightClassName : ""} ${currentClassName ? currentClassName : ""} cursor-pointer inline-block ${hidden ? "hidden" : ""}`,
|
|
366
367
|
onClick: handleOnClick,
|
|
367
368
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
368
369
|
"img",
|
|
@@ -5669,9 +5670,6 @@ var OpenEndedActivityMaterialContent = ({
|
|
|
5669
5670
|
const { answerMap: answerMap2 } = retrieveAnswer();
|
|
5670
5671
|
return answerMap2;
|
|
5671
5672
|
};
|
|
5672
|
-
const checkShowContent = () => {
|
|
5673
|
-
return false;
|
|
5674
|
-
};
|
|
5675
5673
|
const RenderTextContent = (answerMap2) => {
|
|
5676
5674
|
const answerMapAnswer = answerMap2["ANSWER"];
|
|
5677
5675
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
@@ -7368,7 +7366,7 @@ var filterUserRoleOptionList = (accountType, userProfileRole) => {
|
|
|
7368
7366
|
} else {
|
|
7369
7367
|
if (userProfileRole === "STAFF") {
|
|
7370
7368
|
return retrieveUserRoleOptionList().filter(
|
|
7371
|
-
(userRoleOption) => userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER"
|
|
7369
|
+
(userRoleOption) => userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER" || userRoleOption.value === "CONTENT_CREATOR"
|
|
7372
7370
|
);
|
|
7373
7371
|
} else if (userProfileRole === "INDIVIDUAL") {
|
|
7374
7372
|
return retrieveUserRoleOptionList().filter(
|
package/dist/index.mjs
CHANGED
|
@@ -112,6 +112,7 @@ var BaseImage = (props) => {
|
|
|
112
112
|
widthClassName,
|
|
113
113
|
heightClassName,
|
|
114
114
|
src,
|
|
115
|
+
hidden,
|
|
115
116
|
alt,
|
|
116
117
|
showLoading,
|
|
117
118
|
onLoad,
|
|
@@ -170,7 +171,7 @@ var BaseImage = (props) => {
|
|
|
170
171
|
return loading ? /* @__PURE__ */ jsx2(BaseLoading_default, { size: "small", primaryColor: "#57C2D3", secondaryColor: "#57C2D3" }) : /* @__PURE__ */ jsx2(
|
|
171
172
|
"span",
|
|
172
173
|
{
|
|
173
|
-
className: `${currentWidthClassName ? currentWidthClassName : ""} ${currentHeightClassName ? currentHeightClassName : ""} ${currentClassName ? currentClassName : ""} cursor-pointer inline-block`,
|
|
174
|
+
className: `${currentWidthClassName ? currentWidthClassName : ""} ${currentHeightClassName ? currentHeightClassName : ""} ${currentClassName ? currentClassName : ""} cursor-pointer inline-block ${hidden ? "hidden" : ""}`,
|
|
174
175
|
onClick: handleOnClick,
|
|
175
176
|
children: /* @__PURE__ */ jsx2(
|
|
176
177
|
"img",
|
|
@@ -5477,9 +5478,6 @@ var OpenEndedActivityMaterialContent = ({
|
|
|
5477
5478
|
const { answerMap: answerMap2 } = retrieveAnswer();
|
|
5478
5479
|
return answerMap2;
|
|
5479
5480
|
};
|
|
5480
|
-
const checkShowContent = () => {
|
|
5481
|
-
return false;
|
|
5482
|
-
};
|
|
5483
5481
|
const RenderTextContent = (answerMap2) => {
|
|
5484
5482
|
const answerMapAnswer = answerMap2["ANSWER"];
|
|
5485
5483
|
return /* @__PURE__ */ jsx33(
|
|
@@ -7176,7 +7174,7 @@ var filterUserRoleOptionList = (accountType, userProfileRole) => {
|
|
|
7176
7174
|
} else {
|
|
7177
7175
|
if (userProfileRole === "STAFF") {
|
|
7178
7176
|
return retrieveUserRoleOptionList().filter(
|
|
7179
|
-
(userRoleOption) => userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER"
|
|
7177
|
+
(userRoleOption) => userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER" || userRoleOption.value === "CONTENT_CREATOR"
|
|
7180
7178
|
);
|
|
7181
7179
|
} else if (userProfileRole === "INDIVIDUAL") {
|
|
7182
7180
|
return retrieveUserRoleOptionList().filter(
|
package/package.json
CHANGED
|
@@ -1,137 +1,13 @@
|
|
|
1
|
-
// import { useAudioRecorder } from "react-audio-voice-recorder";
|
|
2
1
|
import InputGroup from "../../groups/InputGroup";
|
|
3
|
-
// import { useEffect, useRef, useState } from "react";
|
|
4
|
-
// import PrimaryButton from "../../buttons/PrimaryButton";
|
|
5
|
-
// import SecondaryButton from "../../buttons/SecondaryButton";
|
|
6
|
-
// import {
|
|
7
|
-
// createOrUpdateStorageFileFromCatchtivityApplication,
|
|
8
|
-
// createOrUpdateStorageFileFromCatchxamApplication,
|
|
9
|
-
// createOrUpdateStorageFileFromEtude,
|
|
10
|
-
// } from "../../../requests/StorageRequests";
|
|
11
|
-
// import connection_production from "../../../config/connection.json";
|
|
12
|
-
// import connection_development from "../../../config/connection_local.json";
|
|
13
|
-
// import endpoints from "../../../config/endpoints.json";
|
|
14
2
|
import i18n from "../../../language/i18n";
|
|
15
|
-
// import BaseImage from "../../images/BaseImage";
|
|
16
|
-
// import {
|
|
17
|
-
// convertDataURLtoFile,
|
|
18
|
-
// retrieveDocumentTypeFromAcceptedFormat,
|
|
19
|
-
// retrieveDocumentTypeFromExtension,
|
|
20
|
-
// } from "../../../utilization/StorageUtilization";
|
|
21
|
-
// import PDF from "../../pdf/PDF";
|
|
22
|
-
// import FullCard from "../../cards/FullCard";
|
|
23
|
-
// import BaseModal from "../../modal/BaseModal";
|
|
24
|
-
// import QRCode from "react-qr-code";
|
|
25
|
-
// import BaseTitle from "../../titles/BaseTitle";
|
|
26
|
-
// import { NotificationManager } from "react-notifications";
|
|
27
|
-
// import Konva from "../../konva/Konva";
|
|
28
|
-
// import useScreenSize from "../../../hooks/useScreenSize";
|
|
29
3
|
import DividerLine from "../../dividers/DividerLine";
|
|
30
4
|
import { IOpenEndedActivityMaterialProps } from "../../../properties/ActivityProperties";
|
|
31
5
|
|
|
32
|
-
// const connection =
|
|
33
|
-
// process.env.REACT_APP_NODE_ENV === "development"
|
|
34
|
-
// ? connection_development
|
|
35
|
-
// : connection_production;
|
|
36
|
-
|
|
37
6
|
const OpenEndedActivityMaterialContent = ({
|
|
38
7
|
answer,
|
|
39
8
|
contentMap,
|
|
40
9
|
onChange,
|
|
41
10
|
}: IOpenEndedActivityMaterialProps) => {
|
|
42
|
-
// const {
|
|
43
|
-
// answer,
|
|
44
|
-
// bodyMap,
|
|
45
|
-
// contentMap,
|
|
46
|
-
// onChange,
|
|
47
|
-
// userId,
|
|
48
|
-
// userProfileId,
|
|
49
|
-
// catchtivityApplicationId,
|
|
50
|
-
// catchxamApplicationId,
|
|
51
|
-
// etudeId,
|
|
52
|
-
// activityId,
|
|
53
|
-
// activityTemplateId,
|
|
54
|
-
// storageStompClient,
|
|
55
|
-
// } = props;
|
|
56
|
-
// const { containerSize } = useScreenSize();
|
|
57
|
-
// const [uploadFile, setUploadFile] = useState(null);
|
|
58
|
-
// const [uploadingStatus, setUploadingStatus] = useState(null);
|
|
59
|
-
// const {
|
|
60
|
-
// startRecording,
|
|
61
|
-
// stopRecording,
|
|
62
|
-
// togglePauseResume,
|
|
63
|
-
// recordingBlob,
|
|
64
|
-
// isRecording,
|
|
65
|
-
// isPaused,
|
|
66
|
-
// recordingTime,
|
|
67
|
-
// } = useAudioRecorder();
|
|
68
|
-
// const [showUploadFromPhoneModal, setShowUploadFromPhoneModal] =
|
|
69
|
-
// useState(false);
|
|
70
|
-
// const inputFileRef = useRef(null);
|
|
71
|
-
// const [subscribedId, setSubscribedId] = useState(null);
|
|
72
|
-
// const [showKonvaModal, setShowKonvaModal] = useState(false);
|
|
73
|
-
|
|
74
|
-
// useEffect(() => {
|
|
75
|
-
// if (recordingBlob) {
|
|
76
|
-
// let id;
|
|
77
|
-
// if (catchtivityApplicationId) {
|
|
78
|
-
// id = `catchtivity-${catchtivityApplicationId}`;
|
|
79
|
-
// } else if (catchxamApplicationId) {
|
|
80
|
-
// id = `catchxam-${catchxamApplicationId}`;
|
|
81
|
-
// } else if (etudeId) {
|
|
82
|
-
// id = `etude-${etudeId}`;
|
|
83
|
-
// }
|
|
84
|
-
// const url = URL.createObjectURL(recordingBlob);
|
|
85
|
-
// const blob = new File(
|
|
86
|
-
// [recordingBlob],
|
|
87
|
-
// `${id}-${activityId}-${activityTemplateId}.mp3`,
|
|
88
|
-
// { type: "audio/mp3" }
|
|
89
|
-
// );
|
|
90
|
-
// setUploadFile(blob);
|
|
91
|
-
// }
|
|
92
|
-
// }, [recordingBlob]);
|
|
93
|
-
|
|
94
|
-
// useEffect(() => {
|
|
95
|
-
// if (!uploadFile) return;
|
|
96
|
-
// handleUploadLearnerFile();
|
|
97
|
-
// }, [uploadFile]);
|
|
98
|
-
|
|
99
|
-
// useEffect(() => {
|
|
100
|
-
// if (catchtivityApplicationId && storageStompClient) {
|
|
101
|
-
// const subscribed = storageStompClient.subscribe(
|
|
102
|
-
// "/topic/storage-files/upload",
|
|
103
|
-
// (message) => {
|
|
104
|
-
// let { body } = message;
|
|
105
|
-
// body = JSON.parse(body);
|
|
106
|
-
// const {
|
|
107
|
-
// userId: bodyUserId,
|
|
108
|
-
// userProfileId: bodyUserProfileId,
|
|
109
|
-
// documentType,
|
|
110
|
-
// fileName,
|
|
111
|
-
// } = body;
|
|
112
|
-
// if (bodyUserId === userId && bodyUserProfileId === userProfileId) {
|
|
113
|
-
// onChange(
|
|
114
|
-
// answer,
|
|
115
|
-
// `${connection.base.storage.url}${
|
|
116
|
-
// endpoints.storage.learner.context
|
|
117
|
-
// }${
|
|
118
|
-
// endpoints.storage.learner.preview.file.context
|
|
119
|
-
// }/${userId}/${userProfileId}/${documentType.toLowerCase()}s/${fileName}`
|
|
120
|
-
// );
|
|
121
|
-
// setShowUploadFromPhoneModal(false);
|
|
122
|
-
// }
|
|
123
|
-
// }
|
|
124
|
-
// );
|
|
125
|
-
// setSubscribedId(subscribed.id);
|
|
126
|
-
// }
|
|
127
|
-
// return () => {
|
|
128
|
-
// if (!catchtivityApplicationId) return;
|
|
129
|
-
// if (!storageStompClient) return;
|
|
130
|
-
// storageStompClient.unsubscribe(subscribedId);
|
|
131
|
-
// setSubscribedId(null);
|
|
132
|
-
// };
|
|
133
|
-
// }, [catchtivityApplicationId]);
|
|
134
|
-
|
|
135
11
|
const retrieveAnswer = () => {
|
|
136
12
|
if (!answer)
|
|
137
13
|
return {
|
|
@@ -149,403 +25,6 @@ const OpenEndedActivityMaterialContent = ({
|
|
|
149
25
|
return answerMap;
|
|
150
26
|
};
|
|
151
27
|
|
|
152
|
-
const checkShowContent = () => {
|
|
153
|
-
// if (
|
|
154
|
-
// userId &&
|
|
155
|
-
// userProfileId &&
|
|
156
|
-
// (catchtivityApplicationId || catchxamApplicationId || etudeId)
|
|
157
|
-
// ) {
|
|
158
|
-
// return true;
|
|
159
|
-
// }
|
|
160
|
-
return false;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
// const constructQRData = () => {
|
|
164
|
-
// let type = "";
|
|
165
|
-
// if (catchtivityApplicationId) {
|
|
166
|
-
// type = "CATCHTIVITY_APPLICATION";
|
|
167
|
-
// } else if (catchxamApplicationId) {
|
|
168
|
-
// type = "CATCHXAM_APPLICATION";
|
|
169
|
-
// } else if (etudeId) {
|
|
170
|
-
// type = "ETUDE_APPLICATION";
|
|
171
|
-
// }
|
|
172
|
-
// const base64Data = {
|
|
173
|
-
// type,
|
|
174
|
-
// applicationId: catchtivityApplicationId
|
|
175
|
-
// ? catchtivityApplicationId
|
|
176
|
-
// : catchxamApplicationId
|
|
177
|
-
// ? catchxamApplicationId
|
|
178
|
-
// : etudeId,
|
|
179
|
-
// userId,
|
|
180
|
-
// userProfileId,
|
|
181
|
-
// activityId,
|
|
182
|
-
// activityTemplateId,
|
|
183
|
-
// };
|
|
184
|
-
|
|
185
|
-
// return `${connection.app.url}/upload/file-to-application/${btoa(
|
|
186
|
-
// encodeURI(JSON.stringify(base64Data))
|
|
187
|
-
// )}`;
|
|
188
|
-
// };
|
|
189
|
-
|
|
190
|
-
// const handleUploadLearnerFile = async () => {
|
|
191
|
-
// setUploadingStatus("UPLOADING");
|
|
192
|
-
// const formData = new FormData();
|
|
193
|
-
// formData.append("file", uploadFile);
|
|
194
|
-
// const documentType = retrieveDocumentTypeFromAcceptedFormat(
|
|
195
|
-
// uploadFile.type
|
|
196
|
-
// );
|
|
197
|
-
// formData.append(
|
|
198
|
-
// "path",
|
|
199
|
-
// `/${userId}/${userProfileId}/${documentType.toLowerCase()}s`
|
|
200
|
-
// );
|
|
201
|
-
|
|
202
|
-
// formData.append("documentType", documentType);
|
|
203
|
-
// formData.append("userId", userId);
|
|
204
|
-
// formData.append("userProfileId", userProfileId);
|
|
205
|
-
// formData.append("activityId", activityId);
|
|
206
|
-
// formData.append("activityTemplateId", activityTemplateId);
|
|
207
|
-
// let curData;
|
|
208
|
-
// let curErr;
|
|
209
|
-
// if (catchtivityApplicationId) {
|
|
210
|
-
// formData.append("catchtivityApplicationId", catchtivityApplicationId);
|
|
211
|
-
// const { data, err } =
|
|
212
|
-
// await createOrUpdateStorageFileFromCatchtivityApplication(formData);
|
|
213
|
-
// curData = data;
|
|
214
|
-
// curErr = err;
|
|
215
|
-
// } else if (catchxamApplicationId) {
|
|
216
|
-
// formData.append("catchxamApplicationId", catchxamApplicationId);
|
|
217
|
-
// const { data, err } =
|
|
218
|
-
// await createOrUpdateStorageFileFromCatchxamApplication(formData);
|
|
219
|
-
// curData = data;
|
|
220
|
-
// curErr = err;
|
|
221
|
-
// } else if (etudeId) {
|
|
222
|
-
// formData.append("etudeId", etudeId);
|
|
223
|
-
// const { data, err } = await createOrUpdateStorageFileFromEtude(formData);
|
|
224
|
-
// curData = data;
|
|
225
|
-
// curErr = err;
|
|
226
|
-
// }
|
|
227
|
-
|
|
228
|
-
// if (curErr) {
|
|
229
|
-
// setUploadingStatus("FAILED");
|
|
230
|
-
// console.log(curErr);
|
|
231
|
-
// return;
|
|
232
|
-
// }
|
|
233
|
-
// onChange(
|
|
234
|
-
// answer,
|
|
235
|
-
// `${connection.base.storage.url}${endpoints.storage.learner.context}${
|
|
236
|
-
// endpoints.storage.learner.preview.file.context
|
|
237
|
-
// }/${userId}/${userProfileId}/${documentType.toLowerCase()}s/${
|
|
238
|
-
// curData.fileName
|
|
239
|
-
// }`
|
|
240
|
-
// );
|
|
241
|
-
// setUploadingStatus("SUCCESS");
|
|
242
|
-
// };
|
|
243
|
-
|
|
244
|
-
// const handleAfterCompleteOnClick = (dataUri) => {
|
|
245
|
-
// const file = convertDataURLtoFile(dataUri, `${new Date().getTime()}.jpeg`);
|
|
246
|
-
// setUploadFile(file);
|
|
247
|
-
// setShowKonvaModal(false);
|
|
248
|
-
// };
|
|
249
|
-
|
|
250
|
-
// const convertBodyMapToKonvaItems = () => {
|
|
251
|
-
// const itemList = [];
|
|
252
|
-
// Object.keys(bodyMap).forEach((key) => {
|
|
253
|
-
// itemList.push(JSON.parse(bodyMap[key]));
|
|
254
|
-
// });
|
|
255
|
-
// return itemList;
|
|
256
|
-
// };
|
|
257
|
-
|
|
258
|
-
// const RenderStartRecordingContent = () => {
|
|
259
|
-
// if (isRecording) {
|
|
260
|
-
// return (
|
|
261
|
-
// <div
|
|
262
|
-
// className={`w-[320px] cursor-pointer transition-all duration-300 ${
|
|
263
|
-
// isPaused ? "opacity-100" : "opacity-0"
|
|
264
|
-
// }`}
|
|
265
|
-
// onClick={() => {
|
|
266
|
-
// if (checkShowContent()) {
|
|
267
|
-
// togglePauseResume();
|
|
268
|
-
// } else {
|
|
269
|
-
// NotificationManager.info(
|
|
270
|
-
// i18n.t("operations_not_permitted_at_preview")
|
|
271
|
-
// );
|
|
272
|
-
// }
|
|
273
|
-
// }}
|
|
274
|
-
// >
|
|
275
|
-
// <BaseImage
|
|
276
|
-
// src="/icons/ongoing-started-audio-element.webp"
|
|
277
|
-
// alt="audio-element"
|
|
278
|
-
// size="custom"
|
|
279
|
-
// className="w-full"
|
|
280
|
-
// />
|
|
281
|
-
// <p>{i18n.t("continue_recording_text")}</p>
|
|
282
|
-
// </div>
|
|
283
|
-
// );
|
|
284
|
-
// } else {
|
|
285
|
-
// return (
|
|
286
|
-
// <div
|
|
287
|
-
// className={`w-[320px] cursor-pointer transition-all duration-300 ${
|
|
288
|
-
// isRecording ? "opacity-0" : "opacity-100"
|
|
289
|
-
// }`}
|
|
290
|
-
// onClick={() => {
|
|
291
|
-
// if (checkShowContent()) {
|
|
292
|
-
// startRecording();
|
|
293
|
-
// } else {
|
|
294
|
-
// NotificationManager.info(
|
|
295
|
-
// i18n.t("operations_not_permitted_at_preview")
|
|
296
|
-
// );
|
|
297
|
-
// }
|
|
298
|
-
// }}
|
|
299
|
-
// >
|
|
300
|
-
// <BaseImage
|
|
301
|
-
// src="/icons/not-started-audio-element.webp"
|
|
302
|
-
// alt="audio-element"
|
|
303
|
-
// size="custom"
|
|
304
|
-
// className="w-full"
|
|
305
|
-
// />
|
|
306
|
-
// <p>{i18n.t("start_recording_text")}</p>
|
|
307
|
-
// </div>
|
|
308
|
-
// );
|
|
309
|
-
// }
|
|
310
|
-
// };
|
|
311
|
-
|
|
312
|
-
// const RenderListenAudioTextContent = (answerMapAnswer) => {
|
|
313
|
-
// if (!answerMapAnswer) return;
|
|
314
|
-
// return (
|
|
315
|
-
// <div
|
|
316
|
-
// className={`border rounded-catchup-xlarge border-catchup-dark-blue my-2`}
|
|
317
|
-
// >
|
|
318
|
-
// <p className="text-2xl text-catchup-dark-blue px-4 py-2 text-center">
|
|
319
|
-
// {i18n.t("completed_recording_text")}
|
|
320
|
-
// </p>
|
|
321
|
-
// </div>
|
|
322
|
-
// );
|
|
323
|
-
// };
|
|
324
|
-
|
|
325
|
-
// const RenderRecordingTextContent = () => {
|
|
326
|
-
// if (isPaused) {
|
|
327
|
-
// return (
|
|
328
|
-
// <div
|
|
329
|
-
// className={`border rounded-catchup-xlarge border-catchup-orange my-2`}
|
|
330
|
-
// >
|
|
331
|
-
// <p className="text-xl text-catchup-orange px-4 py-2 text-center">
|
|
332
|
-
// {i18n.t("paused_recording_text")}
|
|
333
|
-
// </p>
|
|
334
|
-
// </div>
|
|
335
|
-
// );
|
|
336
|
-
// } else {
|
|
337
|
-
// if (isRecording) {
|
|
338
|
-
// return (
|
|
339
|
-
// <div
|
|
340
|
-
// className={`border rounded-catchup-xlarge border-catchup-red my-2`}
|
|
341
|
-
// >
|
|
342
|
-
// <p className="text-xl text-catchup-red px-4 py-2 text-center">
|
|
343
|
-
// {i18n.t("currently_recording_text")}
|
|
344
|
-
// </p>
|
|
345
|
-
// </div>
|
|
346
|
-
// );
|
|
347
|
-
// } else {
|
|
348
|
-
// return (
|
|
349
|
-
// <div
|
|
350
|
-
// className={`border rounded-catchup-xlarge border-catchup-dark-blue my-2`}
|
|
351
|
-
// >
|
|
352
|
-
// <p className="text-xl text-catchup-dark-blue px-4 py-2 text-center">
|
|
353
|
-
// {i18n.t("not_started_recording_text")}
|
|
354
|
-
// </p>
|
|
355
|
-
// </div>
|
|
356
|
-
// );
|
|
357
|
-
// }
|
|
358
|
-
// }
|
|
359
|
-
// };
|
|
360
|
-
|
|
361
|
-
// const RenderStopRecordingContent = () => {
|
|
362
|
-
// if (isRecording) {
|
|
363
|
-
// return (
|
|
364
|
-
// <div
|
|
365
|
-
// className={`w-[320px] cursor-pointer transition-all duration-300 ${
|
|
366
|
-
// isPaused ? "opacity-0" : "opacity-100"
|
|
367
|
-
// }`}
|
|
368
|
-
// onClick={() => {
|
|
369
|
-
// if (checkShowContent()) {
|
|
370
|
-
// togglePauseResume();
|
|
371
|
-
// } else {
|
|
372
|
-
// NotificationManager.info(
|
|
373
|
-
// i18n.t("operations_not_permitted_at_preview")
|
|
374
|
-
// );
|
|
375
|
-
// }
|
|
376
|
-
// }}
|
|
377
|
-
// >
|
|
378
|
-
// <BaseImage
|
|
379
|
-
// src="/icons/started-audio-element.webp"
|
|
380
|
-
// alt="audio-element"
|
|
381
|
-
// size="custom"
|
|
382
|
-
// className="w-full"
|
|
383
|
-
// />
|
|
384
|
-
// <p>{i18n.t("stop_recording_text")}</p>
|
|
385
|
-
// </div>
|
|
386
|
-
// );
|
|
387
|
-
// }
|
|
388
|
-
// };
|
|
389
|
-
|
|
390
|
-
// const RenderRecordingContent = (answerMap) => {
|
|
391
|
-
// return (
|
|
392
|
-
// <div>
|
|
393
|
-
// {answerMap["ANSWER"] ? (
|
|
394
|
-
// <>
|
|
395
|
-
// {RenderListenAudioTextContent(answerMap["ANSWER"])}
|
|
396
|
-
// {RenderListenAudioContent(answerMap["ANSWER"])}
|
|
397
|
-
// <div className="flex flex-col items-center justify-center mt-4">
|
|
398
|
-
// <SecondaryButton
|
|
399
|
-
// title={i18n.t("restart")}
|
|
400
|
-
// size="small"
|
|
401
|
-
// onClick={() => {
|
|
402
|
-
// if (checkShowContent()) {
|
|
403
|
-
// onChange(answer, "");
|
|
404
|
-
// } else {
|
|
405
|
-
// NotificationManager.info(
|
|
406
|
-
// i18n.t("operations_not_permitted_at_preview")
|
|
407
|
-
// );
|
|
408
|
-
// }
|
|
409
|
-
// }}
|
|
410
|
-
// />
|
|
411
|
-
// </div>
|
|
412
|
-
// </>
|
|
413
|
-
// ) : (
|
|
414
|
-
// <>
|
|
415
|
-
// {RenderRecordingTextContent()}
|
|
416
|
-
// <div className="flex flex-row gap-x-2">
|
|
417
|
-
// {RenderStartRecordingContent()}
|
|
418
|
-
// {RenderStopRecordingContent()}
|
|
419
|
-
// </div>
|
|
420
|
-
// {isRecording ? (
|
|
421
|
-
// <div className="flex flex-col items-center justify-center mt-4">
|
|
422
|
-
// <PrimaryButton
|
|
423
|
-
// title={i18n.t("complete")}
|
|
424
|
-
// size="small"
|
|
425
|
-
// onClick={() => {
|
|
426
|
-
// if (checkShowContent()) {
|
|
427
|
-
// stopRecording();
|
|
428
|
-
// } else {
|
|
429
|
-
// NotificationManager.info(
|
|
430
|
-
// i18n.t("operations_not_permitted_at_preview")
|
|
431
|
-
// );
|
|
432
|
-
// }
|
|
433
|
-
// }}
|
|
434
|
-
// />
|
|
435
|
-
// </div>
|
|
436
|
-
// ) : null}
|
|
437
|
-
// </>
|
|
438
|
-
// )}
|
|
439
|
-
// </div>
|
|
440
|
-
// );
|
|
441
|
-
// };
|
|
442
|
-
|
|
443
|
-
// const RenderUploadStatusTextContent = () => {
|
|
444
|
-
// if (uploadingStatus === "UPLOADING") {
|
|
445
|
-
// return (
|
|
446
|
-
// <div className="flex flex-col items-center justify-center">
|
|
447
|
-
// <div className="flex flex-row items-center justify-center gap-x-2">
|
|
448
|
-
// <BaseImage
|
|
449
|
-
// src="/icons/three-dots.webp"
|
|
450
|
-
// alt="three-dots"
|
|
451
|
-
// size="medium"
|
|
452
|
-
// />
|
|
453
|
-
// <p>{i18n.t("please_wait_processing")}</p>
|
|
454
|
-
// </div>
|
|
455
|
-
// </div>
|
|
456
|
-
// );
|
|
457
|
-
// } else if (uploadingStatus === "FAILED") {
|
|
458
|
-
// return (
|
|
459
|
-
// <div className="flex flex-col items-center justify-center">
|
|
460
|
-
// <div className="flex flex-row items-center justift-center gap-x-2">
|
|
461
|
-
// <BaseImage
|
|
462
|
-
// src="/icons/cross-red.webp"
|
|
463
|
-
// alt="cross-red"
|
|
464
|
-
// size="medium"
|
|
465
|
-
// />
|
|
466
|
-
// <p>{i18n.t("error_occurred_please_wait")}</p>
|
|
467
|
-
// </div>
|
|
468
|
-
// <div className="mt-4">
|
|
469
|
-
// <PrimaryButton
|
|
470
|
-
// title={i18n.t("retry_again")}
|
|
471
|
-
// size="small"
|
|
472
|
-
// onClick={handleUploadLearnerFile}
|
|
473
|
-
// />
|
|
474
|
-
// </div>
|
|
475
|
-
// </div>
|
|
476
|
-
// );
|
|
477
|
-
// } else if (uploadingStatus === "SUCCESS") {
|
|
478
|
-
// return (
|
|
479
|
-
// <div className="flex flex-col items-center justify-center">
|
|
480
|
-
// <div className="flex flex-row items-center justify-center gap-x-2">
|
|
481
|
-
// <BaseImage src="/icons/info.webp" alt="info" size="medium" />
|
|
482
|
-
// <p>{i18n.t("processing_completed")}</p>
|
|
483
|
-
// </div>
|
|
484
|
-
// </div>
|
|
485
|
-
// );
|
|
486
|
-
// }
|
|
487
|
-
// return null;
|
|
488
|
-
// };
|
|
489
|
-
|
|
490
|
-
// const RenderListenAudioContent = (answerMapAnswer) => {
|
|
491
|
-
// if (!answerMapAnswer) return;
|
|
492
|
-
// return (
|
|
493
|
-
// <div className="flex flex-row items-center justify-center gap-x-2">
|
|
494
|
-
// <div className="w-[320px]">
|
|
495
|
-
// <BaseImage
|
|
496
|
-
// src="/icons/finished-audio-element.webp"
|
|
497
|
-
// alt="finished-audio-element"
|
|
498
|
-
// size="custom"
|
|
499
|
-
// className="w-full"
|
|
500
|
-
// />
|
|
501
|
-
// </div>
|
|
502
|
-
// <div className="h-16 w-[320px]">
|
|
503
|
-
// {RenderUploadStatusTextContent()}
|
|
504
|
-
// {uploadingStatus === "SUCCESS" ? (
|
|
505
|
-
// <audio
|
|
506
|
-
// className="h-full w-full rounded-catchup-xlarge"
|
|
507
|
-
// src={`${answerMapAnswer}`}
|
|
508
|
-
// controls
|
|
509
|
-
// onClick={() => {}}
|
|
510
|
-
// />
|
|
511
|
-
// ) : null}
|
|
512
|
-
// </div>
|
|
513
|
-
// </div>
|
|
514
|
-
// );
|
|
515
|
-
// };
|
|
516
|
-
|
|
517
|
-
// const RenderImageContent = (answerMap) => {
|
|
518
|
-
// const answerMapAnswer = answerMap["ANSWER"];
|
|
519
|
-
// let documentType;
|
|
520
|
-
// if (
|
|
521
|
-
// answerMapAnswer.startsWith(
|
|
522
|
-
// `${connection.base.storage.url}${endpoints.storage.learner.context}${endpoints.storage.learner.preview.file.context}/${userId}/${userProfileId}`
|
|
523
|
-
// )
|
|
524
|
-
// ) {
|
|
525
|
-
// const extension = answerMapAnswer.split(".").pop();
|
|
526
|
-
// documentType = retrieveDocumentTypeFromExtension(extension);
|
|
527
|
-
// }
|
|
528
|
-
// return (
|
|
529
|
-
// <>
|
|
530
|
-
// {RenderUploadFileContent(answerMapAnswer)}
|
|
531
|
-
// {documentType === "IMAGE" ? (
|
|
532
|
-
// <div className="flex flex-col justify-center items-center my-5">
|
|
533
|
-
// <BaseImage
|
|
534
|
-
// src={answerMapAnswer}
|
|
535
|
-
// alt="document"
|
|
536
|
-
// size="custom"
|
|
537
|
-
// className="w-[80%] rounded-catchup-xlarge"
|
|
538
|
-
// />
|
|
539
|
-
// </div>
|
|
540
|
-
// ) : documentType === "PDF" ? (
|
|
541
|
-
// <div className="flex flex-col justify-center items-center my-5">
|
|
542
|
-
// <PDF file={answerMapAnswer} />
|
|
543
|
-
// </div>
|
|
544
|
-
// ) : null}
|
|
545
|
-
// </>
|
|
546
|
-
// );
|
|
547
|
-
// };
|
|
548
|
-
|
|
549
28
|
const RenderTextContent = (answerMap: any) => {
|
|
550
29
|
const answerMapAnswer = answerMap["ANSWER"];
|
|
551
30
|
return (
|
|
@@ -560,237 +39,10 @@ const OpenEndedActivityMaterialContent = ({
|
|
|
560
39
|
);
|
|
561
40
|
};
|
|
562
41
|
|
|
563
|
-
// const RenderTextContent = (answerMap) => {
|
|
564
|
-
// const answerMapAnswer = answerMap["ANSWER"];
|
|
565
|
-
// let documentType = "TEXT";
|
|
566
|
-
// if (
|
|
567
|
-
// answerMapAnswer.includes(
|
|
568
|
-
// `${endpoints.storage.learner.context}${endpoints.storage.learner.preview.file.context}/`
|
|
569
|
-
// )
|
|
570
|
-
// ) {
|
|
571
|
-
// const extension = answerMapAnswer.split(".").pop();
|
|
572
|
-
// documentType = retrieveDocumentTypeFromExtension(extension);
|
|
573
|
-
// }
|
|
574
|
-
// return (
|
|
575
|
-
// <>
|
|
576
|
-
// {RenderUploadFileContent(answerMapAnswer)}
|
|
577
|
-
// {documentType === "IMAGE" ? (
|
|
578
|
-
// <div className="flex flex-col justify-center items-center my-5">
|
|
579
|
-
// <BaseImage
|
|
580
|
-
// src={answerMapAnswer}
|
|
581
|
-
// alt="document"
|
|
582
|
-
// size="custom"
|
|
583
|
-
// className="w-[80%] rounded-catchup-xlarge"
|
|
584
|
-
// />
|
|
585
|
-
// </div>
|
|
586
|
-
// ) : documentType === "PDF" ? (
|
|
587
|
-
// <div className="flex flex-col justify-center items-center my-5">
|
|
588
|
-
// <PDF file={answerMapAnswer} />
|
|
589
|
-
// </div>
|
|
590
|
-
// ) : (
|
|
591
|
-
// <InputGroup
|
|
592
|
-
// type="textarea"
|
|
593
|
-
// value={answerMapAnswer}
|
|
594
|
-
// useMinHeight={true}
|
|
595
|
-
// onChange={(e) => {
|
|
596
|
-
// onChange(answer, e.target.value);
|
|
597
|
-
// }}
|
|
598
|
-
// />
|
|
599
|
-
// )}
|
|
600
|
-
// </>
|
|
601
|
-
// );
|
|
602
|
-
// };
|
|
603
|
-
|
|
604
|
-
// const RenderUploadFileContent = (answerMapAnswer) => {
|
|
605
|
-
// let show = false;
|
|
606
|
-
// let exists = false;
|
|
607
|
-
// if (answerMapAnswer) {
|
|
608
|
-
// if (
|
|
609
|
-
// answerMapAnswer.startsWith(
|
|
610
|
-
// `${connection.base.storage.url}${endpoints.storage.learner.context}${endpoints.storage.learner.preview.file.context}/${userId}/${userProfileId}`
|
|
611
|
-
// )
|
|
612
|
-
// ) {
|
|
613
|
-
// show = true;
|
|
614
|
-
// exists = true;
|
|
615
|
-
// }
|
|
616
|
-
// } else {
|
|
617
|
-
// show = true;
|
|
618
|
-
// exists = false;
|
|
619
|
-
// }
|
|
620
|
-
// if (!show) return;
|
|
621
|
-
|
|
622
|
-
// return (
|
|
623
|
-
// <div className="flex flex-row justify-end items-center gap-x-4 flex-wrap">
|
|
624
|
-
// <div
|
|
625
|
-
// className="flex flex-row items-center justify-center cursor-pointer gap-x-2"
|
|
626
|
-
// onClick={() => {
|
|
627
|
-
// if (checkShowContent()) {
|
|
628
|
-
// setUploadFile(null);
|
|
629
|
-
// inputFileRef.current.click();
|
|
630
|
-
// } else {
|
|
631
|
-
// NotificationManager.info(
|
|
632
|
-
// i18n.t("operations_not_permitted_at_preview")
|
|
633
|
-
// );
|
|
634
|
-
// }
|
|
635
|
-
// }}
|
|
636
|
-
// >
|
|
637
|
-
// <BaseImage src="/icons/upload-pc.webp" alt="upload" size="small" />
|
|
638
|
-
// <p className="">
|
|
639
|
-
// {exists
|
|
640
|
-
// ? i18n.t("i_want_to_reupload_from_my_computer")
|
|
641
|
-
// : i18n.t("i_want_to_upload_from_my_computer")}
|
|
642
|
-
// </p>
|
|
643
|
-
// <input
|
|
644
|
-
// className="hidden"
|
|
645
|
-
// type="file"
|
|
646
|
-
// id="file"
|
|
647
|
-
// ref={inputFileRef}
|
|
648
|
-
// accept="image/jpeg, image/png, image/jpg, application/pdf"
|
|
649
|
-
// multiple={false}
|
|
650
|
-
// onChange={(event) => {
|
|
651
|
-
// setUploadFile(event.target.files[0]);
|
|
652
|
-
// }}
|
|
653
|
-
// onClick={(event) => {
|
|
654
|
-
// event.target.value = null;
|
|
655
|
-
// }}
|
|
656
|
-
// />
|
|
657
|
-
// </div>
|
|
658
|
-
// <div
|
|
659
|
-
// className="flex flex-row items-center justify-center cursor-pointer gap-x-2"
|
|
660
|
-
// onClick={() => {
|
|
661
|
-
// if (checkShowContent()) {
|
|
662
|
-
// setShowUploadFromPhoneModal(true);
|
|
663
|
-
// } else {
|
|
664
|
-
// NotificationManager.info(
|
|
665
|
-
// i18n.t("operations_not_permitted_at_preview")
|
|
666
|
-
// );
|
|
667
|
-
// }
|
|
668
|
-
// }}
|
|
669
|
-
// >
|
|
670
|
-
// <BaseImage src="/icons/upload-device.webp" alt="upload" size="small" />
|
|
671
|
-
// <p className="">
|
|
672
|
-
// {exists
|
|
673
|
-
// ? i18n.t("i_want_to_reupload_from_my_phone")
|
|
674
|
-
// : i18n.t("i_want_to_upload_from_my_phone")}
|
|
675
|
-
// </p>
|
|
676
|
-
// </div>
|
|
677
|
-
// <div
|
|
678
|
-
// className="flex flex-row items-center justify-center cursor-pointer gap-x-2"
|
|
679
|
-
// onClick={() => {
|
|
680
|
-
// if (checkShowContent()) {
|
|
681
|
-
// setShowKonvaModal(true);
|
|
682
|
-
// } else {
|
|
683
|
-
// NotificationManager.info(
|
|
684
|
-
// i18n.t("operations_not_permitted_at_preview")
|
|
685
|
-
// );
|
|
686
|
-
// }
|
|
687
|
-
// }}
|
|
688
|
-
// >
|
|
689
|
-
// <BaseImage src="/icons/upload-draw.webp" alt="upload" size="small" />
|
|
690
|
-
// <p className="">
|
|
691
|
-
// {exists
|
|
692
|
-
// ? i18n.t("i_want_to_reupload_by_drawing")
|
|
693
|
-
// : i18n.t("i_want_to_upload_by_drawing")}
|
|
694
|
-
// </p>
|
|
695
|
-
// </div>
|
|
696
|
-
// </div>
|
|
697
|
-
// );
|
|
698
|
-
// };
|
|
699
|
-
|
|
700
|
-
// const RenderUploadFromPhoneModal = () => {
|
|
701
|
-
// return (
|
|
702
|
-
// <BaseModal
|
|
703
|
-
// isOpen={showUploadFromPhoneModal}
|
|
704
|
-
// onAfterOpen={() => {}}
|
|
705
|
-
// onRequestClose={() => {
|
|
706
|
-
// setShowUploadFromPhoneModal(false);
|
|
707
|
-
// }}
|
|
708
|
-
// >
|
|
709
|
-
// <div className="flex-1 flex flex-col">
|
|
710
|
-
// <div className="ml-auto px-5 py-3">
|
|
711
|
-
// <BaseImage
|
|
712
|
-
// src="/icons/cross-red.webp"
|
|
713
|
-
// alt="cross-red"
|
|
714
|
-
// size="medium"
|
|
715
|
-
// onClick={() => {
|
|
716
|
-
// setShowUploadFromPhoneModal(false);
|
|
717
|
-
// }}
|
|
718
|
-
// />
|
|
719
|
-
// </div>
|
|
720
|
-
// <div className="">
|
|
721
|
-
// <FullCard>
|
|
722
|
-
// <div className="flex flex-row items-center justify-center flex-wrap">
|
|
723
|
-
// <div className="w-1/2">
|
|
724
|
-
// <div className="my-10">
|
|
725
|
-
// <div className="flex flex-col items-center justify-center">
|
|
726
|
-
// <QRCode
|
|
727
|
-
// size={256}
|
|
728
|
-
// value={constructQRData()}
|
|
729
|
-
// viewBox={`0 0 256 256`}
|
|
730
|
-
// level="L"
|
|
731
|
-
// />
|
|
732
|
-
// </div>
|
|
733
|
-
// </div>
|
|
734
|
-
// </div>
|
|
735
|
-
// <div className="flex-1">
|
|
736
|
-
// <BaseTitle title={i18n.t("instructions")} />
|
|
737
|
-
// <div className="px-4 my-2">
|
|
738
|
-
// <div className="flex flex-col justify-center gap-y-1">
|
|
739
|
-
// <div>
|
|
740
|
-
// <p>1. {i18n.t("open_camera_from_your_mobile_phone")}</p>
|
|
741
|
-
// </div>
|
|
742
|
-
// <div>
|
|
743
|
-
// <p>2. {i18n.t("read_the_qr_code")}</p>
|
|
744
|
-
// </div>
|
|
745
|
-
// <div>
|
|
746
|
-
// <p>3. {i18n.t("navigate_to_web_page")}</p>
|
|
747
|
-
// </div>
|
|
748
|
-
// <div>
|
|
749
|
-
// <p>4. {i18n.t("upload_your_file")}</p>
|
|
750
|
-
// </div>
|
|
751
|
-
// <div>
|
|
752
|
-
// <p>5. {i18n.t("wait_until_the_file_is_uploaded")}</p>
|
|
753
|
-
// </div>
|
|
754
|
-
// <div>
|
|
755
|
-
// <p>6. {i18n.t("close_panel")}</p>
|
|
756
|
-
// </div>
|
|
757
|
-
// </div>
|
|
758
|
-
// </div>
|
|
759
|
-
// </div>
|
|
760
|
-
// </div>
|
|
761
|
-
// </FullCard>
|
|
762
|
-
// </div>
|
|
763
|
-
// </div>
|
|
764
|
-
// </BaseModal>
|
|
765
|
-
// );
|
|
766
|
-
// };
|
|
767
|
-
|
|
768
|
-
// const RenderConvaContent = () => {
|
|
769
|
-
// return (
|
|
770
|
-
// <BaseModal
|
|
771
|
-
// isOpen={showKonvaModal}
|
|
772
|
-
// onAfterOpen={() => {}}
|
|
773
|
-
// onRequestClose={() => {
|
|
774
|
-
// setShowKonvaModal(false);
|
|
775
|
-
// }}
|
|
776
|
-
// >
|
|
777
|
-
// <FullCard>
|
|
778
|
-
// <Konva
|
|
779
|
-
// initialItemList={convertBodyMapToKonvaItems()}
|
|
780
|
-
// initialWidth={containerSize.width}
|
|
781
|
-
// handleAfterCompleteOnClick={handleAfterCompleteOnClick}
|
|
782
|
-
// />
|
|
783
|
-
// </FullCard>
|
|
784
|
-
// </BaseModal>
|
|
785
|
-
// );
|
|
786
|
-
// };
|
|
787
|
-
|
|
788
42
|
const answerMap = retrieveAnswerMap();
|
|
789
43
|
|
|
790
44
|
return (
|
|
791
45
|
<>
|
|
792
|
-
{/* {RenderConvaContent()} */}
|
|
793
|
-
{/* {RenderUploadFromPhoneModal()} */}
|
|
794
46
|
<div className="">
|
|
795
47
|
<div className="hidden md:block">
|
|
796
48
|
<span className="font-semibold text-xl opacity-60">
|
|
@@ -800,15 +52,6 @@ const OpenEndedActivityMaterialContent = ({
|
|
|
800
52
|
<div className="hidden md:contents">
|
|
801
53
|
<DividerLine />
|
|
802
54
|
</div>
|
|
803
|
-
{/* {contentMap.type === "TEXT" ? (
|
|
804
|
-
RenderTextContent(answerMap)
|
|
805
|
-
) : contentMap.type === "IMAGE" ? (
|
|
806
|
-
RenderImageContent(answerMap)
|
|
807
|
-
) : contentMap.type === "AUDIO" ? (
|
|
808
|
-
<div className="flex flex-col items-center justify-center">
|
|
809
|
-
{RenderRecordingContent(answerMap)}
|
|
810
|
-
</div>
|
|
811
|
-
) : null} */}
|
|
812
55
|
{contentMap.type === "TEXT" ? RenderTextContent(answerMap) : null}
|
|
813
56
|
</div>
|
|
814
57
|
</>
|
|
@@ -10,6 +10,7 @@ const BaseImage = (props: IBaseImageProps) => {
|
|
|
10
10
|
widthClassName,
|
|
11
11
|
heightClassName,
|
|
12
12
|
src,
|
|
13
|
+
hidden,
|
|
13
14
|
alt,
|
|
14
15
|
showLoading,
|
|
15
16
|
onLoad,
|
|
@@ -78,7 +79,7 @@ const BaseImage = (props: IBaseImageProps) => {
|
|
|
78
79
|
currentHeightClassName ? currentHeightClassName : ""
|
|
79
80
|
} ${
|
|
80
81
|
currentClassName ? currentClassName : ""
|
|
81
|
-
} cursor-pointer inline-block`}
|
|
82
|
+
} cursor-pointer inline-block ${hidden ? "hidden" : ""}`}
|
|
82
83
|
onClick={handleOnClick}
|
|
83
84
|
>
|
|
84
85
|
<img
|
|
@@ -541,7 +541,9 @@ export const filterUserRoleOptionList = (
|
|
|
541
541
|
if (userProfileRole === "STAFF") {
|
|
542
542
|
return retrieveUserRoleOptionList().filter(
|
|
543
543
|
(userRoleOption) =>
|
|
544
|
-
userRoleOption.value === "STAFF" ||
|
|
544
|
+
userRoleOption.value === "STAFF" ||
|
|
545
|
+
userRoleOption.value === "LEARNER" ||
|
|
546
|
+
userRoleOption.value === "CONTENT_CREATOR"
|
|
545
547
|
);
|
|
546
548
|
} else if (userProfileRole === "INDIVIDUAL") {
|
|
547
549
|
return retrieveUserRoleOptionList().filter(
|