@cuemath/leap 3.1.10-j3 → 3.1.11
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/constants/country.js +994 -2
- package/dist/constants/country.js.map +1 -1
- package/dist/features/auth/account-selector/account-selector.js +1 -1
- package/dist/features/auth/account-selector/account-selector.js.map +1 -1
- package/dist/features/auth/signup/claim-user-account/claim-user-account.js +1 -1
- package/dist/features/auth/signup/claim-user-account/claim-user-account.js.map +1 -1
- package/dist/features/auth/signup/custom-input-field/country-selector/country-list-menu.js +1 -1
- package/dist/features/auth/signup/custom-input-field/country-selector/country-list-menu.js.map +1 -1
- package/dist/features/auth/signup/signup-constants.js +10 -1
- package/dist/features/auth/signup/signup-constants.js.map +1 -1
- package/dist/features/auth/{comps/user-list → user-list}/user-item/user-item-styled.js +1 -1
- package/dist/features/auth/user-list/user-item/user-item-styled.js.map +1 -0
- package/dist/features/auth/{comps/user-list → user-list}/user-item/user-item.js +4 -4
- package/dist/features/auth/user-list/user-item/user-item.js.map +1 -0
- package/dist/features/auth/user-list/user-list-constants.js.map +1 -0
- package/dist/features/auth/user-list/user-list-styled.js.map +1 -0
- package/dist/features/auth/{comps/user-list → user-list}/user-list.js +3 -3
- package/dist/features/auth/user-list/user-list.js.map +1 -0
- package/dist/features/cue-canvas/toolbar/color-palette.js +18 -17
- package/dist/features/cue-canvas/toolbar/color-palette.js.map +1 -1
- package/dist/features/cue-canvas/toolbar/toolbar.js +12 -12
- package/dist/features/cue-canvas/toolbar/toolbar.js.map +1 -1
- package/dist/features/ui/inputs/text-input/text-input-styled.js +20 -43
- package/dist/features/ui/inputs/text-input/text-input-styled.js.map +1 -1
- package/dist/features/ui/modals/modal-context.js +13 -0
- package/dist/features/ui/modals/modal-context.js.map +1 -0
- package/dist/features/ui/modals/modal-helpers.js +17 -0
- package/dist/features/ui/modals/modal-helpers.js.map +1 -0
- package/dist/features/ui/modals/modal-provider.js +48 -0
- package/dist/features/ui/modals/modal-provider.js.map +1 -0
- package/dist/features/ui/modals/modal-styled.js +154 -0
- package/dist/features/ui/modals/modal-styled.js.map +1 -0
- package/dist/features/ui/modals/modal.js +19 -0
- package/dist/features/ui/modals/modal.js.map +1 -0
- package/dist/features/ui/modals/use-modal-actions.js +10 -0
- package/dist/features/ui/modals/use-modal-actions.js.map +1 -0
- package/dist/features/ui/modals/use-modal-params.js +10 -0
- package/dist/features/ui/modals/use-modal-params.js.map +1 -0
- package/dist/features/worksheet/worksheet/worksheet-question/subjective-feedback.js +60 -60
- package/dist/features/worksheet/worksheet/worksheet-question/subjective-feedback.js.map +1 -1
- package/dist/index.d.ts +56 -10
- package/dist/index.js +382 -377
- package/dist/index.js.map +1 -1
- package/dist/node_modules/query-string/base.js +1 -1
- package/dist/node_modules/query-string/node_modules/decode-uri-component/index.js.map +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/regex.js +5 -0
- package/dist/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +2 -3
- package/dist/node_modules/uuid/dist/esm-browser/rng.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +10 -6
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +9 -12
- package/dist/node_modules/uuid/dist/esm-browser/v4.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/validate.js +8 -0
- package/dist/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
- package/package.json +1 -1
- package/dist/features/auth/auth-constants.js +0 -1005
- package/dist/features/auth/auth-constants.js.map +0 -1
- package/dist/features/auth/comps/user-list/user-item/user-item-styled.js.map +0 -1
- package/dist/features/auth/comps/user-list/user-item/user-item.js.map +0 -1
- package/dist/features/auth/comps/user-list/user-list-constants.js.map +0 -1
- package/dist/features/auth/comps/user-list/user-list-styled.js.map +0 -1
- package/dist/features/auth/comps/user-list/user-list.js.map +0 -1
- package/dist/node_modules/decode-uri-component/index.js.map +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/native.js +0 -7
- package/dist/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
- /package/dist/features/auth/{comps/user-list → user-list}/user-list-constants.js +0 -0
- /package/dist/features/auth/{comps/user-list → user-list}/user-list-styled.js +0 -0
- /package/dist/node_modules/{decode-uri-component → query-string/node_modules/decode-uri-component}/index.js +0 -0
@@ -1,109 +1,109 @@
|
|
1
1
|
import { jsx as e, jsxs as l, Fragment as M } from "react/jsx-runtime";
|
2
2
|
import { h as ee } from "../../../../node_modules/humanize-plus/dist/humanize.js";
|
3
|
-
import { memo as te, useState as
|
3
|
+
import { memo as te, useState as y, useMemo as A, useCallback as s } from "react";
|
4
4
|
import re from "../../../../assets/line-icons/icons/down.js";
|
5
5
|
import ie from "../../../../assets/line-icons/icons/up.js";
|
6
|
-
import
|
7
|
-
import
|
6
|
+
import R from "../../../ui/buttons/button/button.js";
|
7
|
+
import D from "../../../ui/buttons/clickable/clickable.js";
|
8
8
|
import ce from "../../../ui/buttons/text-button/text-button.js";
|
9
9
|
import m from "../../../ui/layout/flex-view.js";
|
10
10
|
import u from "../../../ui/separator/separator.js";
|
11
11
|
import f from "../../../ui/text/text.js";
|
12
|
-
import
|
13
|
-
import { TextArea as
|
14
|
-
const se = { type: "subjective_response" },
|
12
|
+
import oe from "../hooks/use-s3-helper.js";
|
13
|
+
import { TextArea as ne, FileInputLabel as le, FileInput as ae } from "./subjective-styled.js";
|
14
|
+
const se = { type: "subjective_response" }, Ie = te(
|
15
15
|
({
|
16
|
-
responses:
|
17
|
-
response:
|
18
|
-
nextQuestionId:
|
16
|
+
responses: S,
|
17
|
+
response: r,
|
18
|
+
nextQuestionId: x,
|
19
19
|
responseId: h,
|
20
|
-
studentId:
|
20
|
+
studentId: E,
|
21
21
|
onAddReviewComment: g,
|
22
22
|
openImagesReviewModal: b,
|
23
|
-
handleReviewSubmit:
|
24
|
-
isSubmittingReview:
|
23
|
+
handleReviewSubmit: L,
|
24
|
+
isSubmittingReview: z
|
25
25
|
}) => {
|
26
|
-
var
|
27
|
-
const { score:
|
28
|
-
((
|
29
|
-
),
|
30
|
-
var t,
|
31
|
-
return ((t =
|
32
|
-
}, [d,
|
33
|
-
var
|
34
|
-
if (!
|
26
|
+
var F, T;
|
27
|
+
const { score: B } = r ?? {}, { max_score: $, score: H } = B ?? {}, O = (r == null ? void 0 : r.response) !== void 0, [d, _] = y(((F = r == null ? void 0 : r.teacherReview) == null ? void 0 : F.reviewComment) ?? ""), [q, j] = y(!1), [c, U] = y(H ?? 0), [o, C] = y(
|
28
|
+
((T = r == null ? void 0 : r.teacherReview) == null ? void 0 : T.images) ?? []
|
29
|
+
), v = o.length, K = A(() => {
|
30
|
+
var t, i, n;
|
31
|
+
return ((t = r == null ? void 0 : r.teacherReview) == null ? void 0 : t.reviewComment) === d && ((i = r.teacherReview.images) == null ? void 0 : i.length) === o.length && ((n = r.score) == null ? void 0 : n.score) === c;
|
32
|
+
}, [d, r, c, o.length]), W = A(() => {
|
33
|
+
var i, n, a, p;
|
34
|
+
if (!S) return !1;
|
35
35
|
let t = !0;
|
36
|
-
for (const
|
37
|
-
const P = !!
|
36
|
+
for (const w of Object.values(S)) {
|
37
|
+
const P = !!w.response, Z = ((i = w.teacherReview) == null ? void 0 : i.images) && ((a = (n = w.teacherReview) == null ? void 0 : n.images) == null ? void 0 : a.length) > 0 || !!((p = w.teacherReview) != null && p.reviewComment);
|
38
38
|
if (P && !Z) {
|
39
39
|
t = !1;
|
40
40
|
break;
|
41
41
|
}
|
42
42
|
}
|
43
43
|
return t;
|
44
|
-
}, [
|
45
|
-
studentId:
|
44
|
+
}, [S]), k = oe({
|
45
|
+
studentId: E,
|
46
46
|
query: se
|
47
47
|
}), N = s((t) => {
|
48
|
-
|
48
|
+
_(t.target.value);
|
49
49
|
}, []), Q = s(() => {
|
50
|
-
|
50
|
+
U(c + 0.5);
|
51
51
|
}, [c]), V = s(() => {
|
52
|
-
|
52
|
+
U(c - 0.5);
|
53
53
|
}, [c]), I = s(
|
54
54
|
(t) => {
|
55
|
-
|
56
|
-
const
|
57
|
-
t &&
|
55
|
+
j(!1);
|
56
|
+
const i = o.filter((a) => typeof a == "string"), n = t ? [...i, ...t] : i;
|
57
|
+
t && C(n), g == null || g(h, {
|
58
58
|
score: {
|
59
59
|
score: c,
|
60
|
-
max_score:
|
60
|
+
max_score: $
|
61
61
|
},
|
62
62
|
teacherReview: {
|
63
63
|
reviewComment: d,
|
64
|
-
images:
|
64
|
+
images: n
|
65
65
|
}
|
66
66
|
});
|
67
67
|
},
|
68
|
-
[d,
|
68
|
+
[d, $, g, h, c, o]
|
69
69
|
), Y = s(() => {
|
70
|
-
const t =
|
71
|
-
t.length > 0 ? (
|
70
|
+
const t = o.filter((i) => typeof i != "string");
|
71
|
+
t.length > 0 ? (j(!0), k({
|
72
72
|
fileKey: `subjective-responses/${h}/`,
|
73
73
|
onSuccess: I,
|
74
74
|
onError: () => {
|
75
75
|
},
|
76
76
|
images: t
|
77
77
|
})) : I();
|
78
|
-
}, [I, h,
|
78
|
+
}, [I, h, o, k]), X = s(
|
79
79
|
({ filteredImages: t }) => {
|
80
|
-
|
80
|
+
C(t);
|
81
81
|
},
|
82
82
|
[]
|
83
83
|
), G = s(() => {
|
84
|
-
const t =
|
84
|
+
const t = o.map((i) => typeof i == "string" ? i : i.url);
|
85
85
|
t && (b == null || b({
|
86
86
|
isReviewed: !1,
|
87
87
|
disableScoreForm: !1,
|
88
88
|
imageUrls: t,
|
89
|
-
filteredImageUrls:
|
90
|
-
uploadedImages:
|
89
|
+
filteredImageUrls: X,
|
90
|
+
uploadedImages: o
|
91
91
|
}));
|
92
|
-
}, [b,
|
93
|
-
const { files:
|
94
|
-
if (!
|
95
|
-
const
|
96
|
-
const
|
97
|
-
return { file: a, url:
|
92
|
+
}, [b, X, o]), J = s((t) => {
|
93
|
+
const { files: i } = t.currentTarget;
|
94
|
+
if (!i) return;
|
95
|
+
const n = Array.from(i).map((a) => {
|
96
|
+
const p = URL.createObjectURL(a);
|
97
|
+
return { file: a, url: p };
|
98
98
|
});
|
99
|
-
|
99
|
+
C((a) => [...a, ...n]);
|
100
100
|
}, []);
|
101
|
-
return
|
101
|
+
return r ? !O && x ? /* @__PURE__ */ e(f, { $renderAs: "body1", children: " The student did not attempt this questions." }) : /* @__PURE__ */ l(M, { children: [
|
102
102
|
/* @__PURE__ */ l(m, { $flexDirection: "row", $justifyContent: "space-between", children: [
|
103
103
|
/* @__PURE__ */ l(m, { children: [
|
104
104
|
/* @__PURE__ */ l(f, { $renderAs: "body3", children: [
|
105
105
|
"Score (out of ",
|
106
|
-
|
106
|
+
$,
|
107
107
|
")"
|
108
108
|
] }),
|
109
109
|
/* @__PURE__ */ e(u, { heightX: 1 }),
|
@@ -122,16 +122,16 @@ const se = { type: "subjective_response" }, xe = te(
|
|
122
122
|
),
|
123
123
|
/* @__PURE__ */ e(u, { width: 16 }),
|
124
124
|
/* @__PURE__ */ l(m, { $background: "WHITE", $gutterX: 0.5, $gapX: 0.5, children: [
|
125
|
-
/* @__PURE__ */ e(
|
125
|
+
/* @__PURE__ */ e(D, { label: "up", onClick: Q, disabled: c === $, children: /* @__PURE__ */ e(ie, {}) }),
|
126
126
|
/* @__PURE__ */ e(u, { height: 16 }),
|
127
|
-
/* @__PURE__ */ e(
|
127
|
+
/* @__PURE__ */ e(D, { label: "down", onClick: V, disabled: c === 0, children: /* @__PURE__ */ e(re, {}) })
|
128
128
|
] })
|
129
129
|
] })
|
130
130
|
] }),
|
131
131
|
/* @__PURE__ */ l(m, { children: [
|
132
132
|
/* @__PURE__ */ e(f, { $renderAs: "body1", children: "Comments" }),
|
133
133
|
/* @__PURE__ */ e(u, { heightX: 1 }),
|
134
|
-
/* @__PURE__ */ e(
|
134
|
+
/* @__PURE__ */ e(ne, { value: d, onChange: N })
|
135
135
|
] }),
|
136
136
|
/* @__PURE__ */ l(m, { $alignItems: "center", children: [
|
137
137
|
/* @__PURE__ */ l(f, { $renderAs: "body1", children: [
|
@@ -155,7 +155,7 @@ const se = { type: "subjective_response" }, xe = te(
|
|
155
155
|
ce,
|
156
156
|
{
|
157
157
|
onClick: G,
|
158
|
-
label:
|
158
|
+
label: v ? `${v} ${ee.pluralize(v, "file")}` : "No files"
|
159
159
|
}
|
160
160
|
)
|
161
161
|
] })
|
@@ -170,7 +170,7 @@ const se = { type: "subjective_response" }, xe = te(
|
|
170
170
|
$gapX: 1,
|
171
171
|
children: [
|
172
172
|
/* @__PURE__ */ e(
|
173
|
-
|
173
|
+
R,
|
174
174
|
{
|
175
175
|
widthX: 6,
|
176
176
|
renderAs: "secondary",
|
@@ -182,15 +182,15 @@ const se = { type: "subjective_response" }, xe = te(
|
|
182
182
|
}
|
183
183
|
),
|
184
184
|
/* @__PURE__ */ e(u, { width: 20 }),
|
185
|
-
!
|
186
|
-
|
185
|
+
!x && /* @__PURE__ */ e(
|
186
|
+
R,
|
187
187
|
{
|
188
188
|
widthX: 6,
|
189
189
|
renderAs: "secondary",
|
190
190
|
size: "small",
|
191
191
|
label: "Submit Review",
|
192
|
-
onClick:
|
193
|
-
busy:
|
192
|
+
onClick: L,
|
193
|
+
busy: z,
|
194
194
|
disabled: !W
|
195
195
|
}
|
196
196
|
)
|
@@ -201,6 +201,6 @@ const se = { type: "subjective_response" }, xe = te(
|
|
201
201
|
}
|
202
202
|
);
|
203
203
|
export {
|
204
|
-
|
204
|
+
Ie as default
|
205
205
|
};
|
206
206
|
//# sourceMappingURL=subjective-feedback.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"subjective-feedback.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-question/subjective-feedback.tsx"],"sourcesContent":["import type { ISubjectiveQuestionReviewProps, IFile } from './subjective-review';\nimport type { FC } from 'react';\n\nimport { pluralize } from 'humanize-plus';\nimport { memo, useCallback, useMemo, useState } from 'react';\n\nimport DownIcon from '../../../../assets/line-icons/icons/down';\nimport UpIcon from '../../../../assets/line-icons/icons/up';\nimport Button from '../../../ui/buttons/button/button';\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport useS3ImageUploadHelper from '../hooks/use-s3-helper';\nimport { TextArea, FileInput, FileInputLabel } from './subjective-styled';\n\nconst QUERY = { type: 'subjective_response' };\n\nconst SubjectiveQuestionFeedback: FC<ISubjectiveQuestionReviewProps> = memo(\n ({\n responses,\n response,\n nextQuestionId,\n responseId,\n studentId,\n onAddReviewComment,\n openImagesReviewModal,\n handleReviewSubmit,\n isSubmittingReview,\n }) => {\n const { score: responseScore } = response ?? {};\n const { max_score: maxScore, score } = responseScore ?? {};\n const isAttempted = responseScore && 'score' in responseScore && 'max_score' in responseScore;\n const [comment, setComment] = useState(response?.teacherReview?.reviewComment ?? '');\n const [isUploading, setIsUploading] = useState<boolean>(false);\n const [scored, setScored] = useState(score ?? 0.0);\n const [selectedImages, setSelectedImage] = useState<(string | IFile)[]>(\n response?.teacherReview?.images ?? [],\n );\n const noOfImages = selectedImages.length;\n const isSaveDisabled = useMemo(() => {\n if (\n response?.teacherReview?.reviewComment === comment &&\n response.teacherReview.images?.length === selectedImages.length &&\n response.score?.score === scored\n ) {\n return true;\n }\n\n return false;\n }, [comment, response, scored, selectedImages.length]);\n\n const canSubmitReview = useMemo(() => {\n if (!responses) return false;\n\n let canSubmit = true;\n\n for (const item of Object.values(responses)) {\n const currResponse = item.response;\n\n const isCurrItemAttempted = !!currResponse;\n const currentItemReviewed =\n (item.teacherReview?.images && item.teacherReview?.images?.length > 0) ||\n !!item.teacherReview?.reviewComment;\n\n if (isCurrItemAttempted && !currentItemReviewed) {\n canSubmit = false;\n break;\n }\n }\n\n return canSubmit;\n }, [responses]);\n\n const uploadImages = useS3ImageUploadHelper({\n studentId,\n query: QUERY,\n });\n\n const onCommentChange = useCallback((e: { target: { value: string } }) => {\n setComment(e.target.value);\n }, []);\n\n const onScoreUp = useCallback(() => {\n setScored(scored + 0.5);\n }, [scored]);\n\n const onScoreDown = useCallback(() => {\n setScored(scored - 0.5);\n }, [scored]);\n\n const onSuccess = useCallback(\n (images?: string[]) => {\n setIsUploading(false);\n const reponseImages = selectedImages.filter(item => typeof item === 'string');\n const allImages = images ? [...reponseImages, ...images] : reponseImages;\n\n if (images) {\n setSelectedImage(allImages);\n }\n onAddReviewComment?.(responseId, {\n score: {\n score: scored,\n max_score: maxScore as number,\n },\n teacherReview: {\n reviewComment: comment,\n images: allImages,\n },\n });\n },\n [comment, maxScore, onAddReviewComment, responseId, scored, selectedImages],\n );\n\n const handleSave = useCallback(() => {\n const imagesToUpload = selectedImages.filter(images => typeof images !== 'string');\n\n if (imagesToUpload.length > 0) {\n setIsUploading(true);\n uploadImages({\n fileKey: `subjective-responses/${responseId}/`,\n onSuccess: onSuccess,\n onError: () => {},\n images: imagesToUpload,\n });\n } else {\n onSuccess();\n }\n }, [onSuccess, responseId, selectedImages, uploadImages]);\n\n const updateImages = useCallback(\n ({ filteredImages }: { filteredImages: string[]; newImages: IFile[] }) => {\n setSelectedImage(filteredImages);\n },\n [],\n );\n\n const openImagesModal = useCallback(() => {\n const previewImages = selectedImages.map(item => {\n if (typeof item === 'string') return item;\n\n return item.url;\n });\n\n if (!previewImages) return;\n\n openImagesReviewModal?.({\n isReviewed: false,\n disableScoreForm: false,\n imageUrls: previewImages,\n filteredImageUrls: updateImages,\n uploadedImages: selectedImages,\n });\n }, [openImagesReviewModal, updateImages, selectedImages]);\n\n const onSelectImages = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { files } = e.currentTarget;\n\n if (!files) return;\n\n const newFilesList = Array.from(files).map(file => {\n const url = URL.createObjectURL(file);\n\n return { file, url };\n });\n\n setSelectedImage(prevImages => [...prevImages, ...newFilesList]);\n }, []);\n\n if (!response) {\n return null;\n }\n\n if (!isAttempted && nextQuestionId) {\n return <Text $renderAs=\"body1\"> The student did not attempt this questions.</Text>;\n }\n\n return (\n <>\n <FlexView $flexDirection=\"row\" $justifyContent=\"space-between\">\n <FlexView>\n <Text $renderAs=\"body3\">Score (out of {maxScore})</Text>\n <Separator heightX={1} />\n <FlexView $flexDirection=\"row\" $gapX={0.5}>\n <FlexView\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $borderColor=\"BLACK\"\n $width={50}\n $height={50}\n $background=\"WHITE\"\n >\n <Text $renderAs=\"body1\">{scored}</Text>\n </FlexView>\n <Separator width={16} />\n <FlexView $background=\"WHITE\" $gutterX={0.5} $gapX={0.5}>\n <Clickable label=\"up\" onClick={onScoreUp} disabled={scored === maxScore}>\n <UpIcon />\n </Clickable>\n <Separator height={16} />\n <Clickable label=\"down\" onClick={onScoreDown} disabled={scored === 0}>\n <DownIcon />\n </Clickable>\n </FlexView>\n </FlexView>\n </FlexView>\n <FlexView>\n <Text $renderAs=\"body1\">Comments</Text>\n <Separator heightX={1} />\n <TextArea value={comment} onChange={onCommentChange} />\n </FlexView>\n <FlexView $alignItems=\"center\">\n <Text $renderAs=\"body1\">\n Upload Images <small>(max 12)</small>\n </Text>\n <Separator heightX={1} />\n <FileInputLabel htmlFor={`files${responseId}`}>Browse</FileInputLabel>\n <Separator heightX={1} />\n <FileInput\n type=\"file\"\n accept=\".jpeg, .jpg, .png\"\n id={`files${responseId}`}\n multiple\n onChange={onSelectImages}\n />\n <TextButton\n onClick={openImagesModal}\n label={noOfImages ? `${noOfImages} ${pluralize(noOfImages, 'file')}` : 'No files'}\n />\n </FlexView>\n </FlexView>\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $gutterX={1}\n $gapX={1}\n >\n <Button\n widthX={6}\n renderAs=\"secondary\"\n size=\"small\"\n label=\"Save\"\n onClick={handleSave}\n busy={isUploading}\n disabled={isSaveDisabled}\n />\n <Separator width={20} />\n {!nextQuestionId && (\n <Button\n widthX={6}\n renderAs=\"secondary\"\n size=\"small\"\n label=\"Submit Review\"\n onClick={handleReviewSubmit}\n busy={isSubmittingReview}\n disabled={!canSubmitReview}\n />\n )}\n </FlexView>\n </>\n );\n },\n);\n\nexport default SubjectiveQuestionFeedback;\n"],"names":["QUERY","SubjectiveQuestionFeedback","memo","responses","response","nextQuestionId","responseId","studentId","onAddReviewComment","openImagesReviewModal","handleReviewSubmit","isSubmittingReview","responseScore","maxScore","score","isAttempted","comment","setComment","useState","_a","isUploading","setIsUploading","scored","setScored","selectedImages","setSelectedImage","_b","noOfImages","isSaveDisabled","useMemo","_c","canSubmitReview","canSubmit","item","isCurrItemAttempted","currentItemReviewed","_d","uploadImages","useS3ImageUploadHelper","onCommentChange","useCallback","e","onScoreUp","onScoreDown","onSuccess","images","reponseImages","allImages","handleSave","imagesToUpload","updateImages","filteredImages","openImagesModal","previewImages","onSelectImages","files","newFilesList","file","url","prevImages","jsx","Text","jsxs","Fragment","FlexView","Separator","Clickable","UpIcon","DownIcon","TextArea","FileInputLabel","FileInput","TextButton","pluralize","Button"],"mappings":";;;;;;;;;;;;;AAiBA,MAAMA,KAAQ,EAAE,MAAM,yBAEhBC,KAAiEC;AAAA,EACrE,CAAC;AAAA,IACC,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,MACI;;AACJ,UAAM,EAAE,OAAOC,MAAkBR,KAAY,CAAA,GACvC,EAAE,WAAWS,GAAU,OAAAC,EAAM,IAAIF,KAAiB,CAAA,GAClDG,IAAcH,KAAiB,WAAWA,KAAiB,eAAeA,GAC1E,CAACI,GAASC,CAAU,IAAIC,IAASC,IAAAf,KAAA,gBAAAA,EAAU,kBAAV,gBAAAe,EAAyB,kBAAiB,EAAE,GAC7E,CAACC,GAAaC,CAAc,IAAIH,EAAkB,EAAK,GACvD,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AAAL;AAAA,YAACW;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,QAAO;AAAA,cACP,IAAI,QAAQjE,CAAU;AAAA,cACtB,UAAQ;AAAA,cACR,UAAUgD;AAAA,YAAA;AAAA,UACZ;AAAA,UACA,gBAAAM;AAAA,YAACY;AAAA,YAAA;AAAA,cACC,SAASpB;AAAA,cACT,OAAOzB,IAAa,GAAGA,CAAU,IAAI8C,GAAU,UAAA9C,GAAY,MAAM,CAAC,KAAK;AAAA,YAAA;AAAA,UACzE;AAAA,QAAA,GACF;AAAA,MAAA,GACF;AAAA,MACA,gBAAAmC;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,gBAAe;AAAA,UACf,aAAY;AAAA,UACZ,iBAAgB;AAAA,UAChB,UAAU;AAAA,UACV,OAAO;AAAA,UAEP,UAAA;AAAA,YAAA,gBAAAJ;AAAA,cAACc;AAAA,cAAA;AAAA,gBACC,QAAQ;AAAA,gBACR,UAAS;AAAA,gBACT,MAAK;AAAA,gBACL,OAAM;AAAA,gBACN,SAAS1B;AAAA,gBACT,MAAM5B;AAAA,gBACN,UAAUQ;AAAA,cAAA;AAAA,YACZ;AAAA,YACA,gBAAAgC,EAACK,GAAU,EAAA,OAAO,GAAI,CAAA;AAAA,YACrB,CAAC5D,KACA,gBAAAuD;AAAA,cAACc;AAAA,cAAA;AAAA,gBACC,QAAQ;AAAA,gBACR,UAAS;AAAA,gBACT,MAAK;AAAA,gBACL,OAAM;AAAA,gBACN,SAAShE;AAAA,gBACT,MAAMC;AAAA,gBACN,UAAU,CAACoB;AAAA,cAAA;AAAA,YACb;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ;AAAA,IACF,EAAA,CAAA,IA1FO;AAAA,EA4FX;AACF;"}
|
1
|
+
{"version":3,"file":"subjective-feedback.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-question/subjective-feedback.tsx"],"sourcesContent":["import type { ISubjectiveQuestionReviewProps, IFile } from './subjective-review';\nimport type { FC } from 'react';\n\nimport { pluralize } from 'humanize-plus';\nimport { memo, useCallback, useMemo, useState } from 'react';\n\nimport DownIcon from '../../../../assets/line-icons/icons/down';\nimport UpIcon from '../../../../assets/line-icons/icons/up';\nimport Button from '../../../ui/buttons/button/button';\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport useS3ImageUploadHelper from '../hooks/use-s3-helper';\nimport { TextArea, FileInput, FileInputLabel } from './subjective-styled';\n\nconst QUERY = { type: 'subjective_response' };\n\nconst SubjectiveQuestionFeedback: FC<ISubjectiveQuestionReviewProps> = memo(\n ({\n responses,\n response,\n nextQuestionId,\n responseId,\n studentId,\n onAddReviewComment,\n openImagesReviewModal,\n handleReviewSubmit,\n isSubmittingReview,\n }) => {\n const { score: responseScore } = response ?? {};\n const { max_score: maxScore, score } = responseScore ?? {};\n const isAttempted = response?.response !== undefined;\n const [comment, setComment] = useState(response?.teacherReview?.reviewComment ?? '');\n const [isUploading, setIsUploading] = useState<boolean>(false);\n const [scored, setScored] = useState(score ?? 0.0);\n const [selectedImages, setSelectedImage] = useState<(string | IFile)[]>(\n response?.teacherReview?.images ?? [],\n );\n const noOfImages = selectedImages.length;\n const isSaveDisabled = useMemo(() => {\n if (\n response?.teacherReview?.reviewComment === comment &&\n response.teacherReview.images?.length === selectedImages.length &&\n response.score?.score === scored\n ) {\n return true;\n }\n\n return false;\n }, [comment, response, scored, selectedImages.length]);\n\n const canSubmitReview = useMemo(() => {\n if (!responses) return false;\n\n let canSubmit = true;\n\n for (const item of Object.values(responses)) {\n const currResponse = item.response;\n\n const isCurrItemAttempted = !!currResponse;\n const currentItemReviewed =\n (item.teacherReview?.images && item.teacherReview?.images?.length > 0) ||\n !!item.teacherReview?.reviewComment;\n\n if (isCurrItemAttempted && !currentItemReviewed) {\n canSubmit = false;\n break;\n }\n }\n\n return canSubmit;\n }, [responses]);\n\n const uploadImages = useS3ImageUploadHelper({\n studentId,\n query: QUERY,\n });\n\n const onCommentChange = useCallback((e: { target: { value: string } }) => {\n setComment(e.target.value);\n }, []);\n\n const onScoreUp = useCallback(() => {\n setScored(scored + 0.5);\n }, [scored]);\n\n const onScoreDown = useCallback(() => {\n setScored(scored - 0.5);\n }, [scored]);\n\n const onSuccess = useCallback(\n (images?: string[]) => {\n setIsUploading(false);\n const reponseImages = selectedImages.filter(item => typeof item === 'string');\n const allImages = images ? [...reponseImages, ...images] : reponseImages;\n\n if (images) {\n setSelectedImage(allImages);\n }\n onAddReviewComment?.(responseId, {\n score: {\n score: scored,\n max_score: maxScore as number,\n },\n teacherReview: {\n reviewComment: comment,\n images: allImages,\n },\n });\n },\n [comment, maxScore, onAddReviewComment, responseId, scored, selectedImages],\n );\n\n const handleSave = useCallback(() => {\n const imagesToUpload = selectedImages.filter(images => typeof images !== 'string');\n\n if (imagesToUpload.length > 0) {\n setIsUploading(true);\n uploadImages({\n fileKey: `subjective-responses/${responseId}/`,\n onSuccess: onSuccess,\n onError: () => {},\n images: imagesToUpload,\n });\n } else {\n onSuccess();\n }\n }, [onSuccess, responseId, selectedImages, uploadImages]);\n\n const updateImages = useCallback(\n ({ filteredImages }: { filteredImages: string[]; newImages: IFile[] }) => {\n setSelectedImage(filteredImages);\n },\n [],\n );\n\n const openImagesModal = useCallback(() => {\n const previewImages = selectedImages.map(item => {\n if (typeof item === 'string') return item;\n\n return item.url;\n });\n\n if (!previewImages) return;\n\n openImagesReviewModal?.({\n isReviewed: false,\n disableScoreForm: false,\n imageUrls: previewImages,\n filteredImageUrls: updateImages,\n uploadedImages: selectedImages,\n });\n }, [openImagesReviewModal, updateImages, selectedImages]);\n\n const onSelectImages = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { files } = e.currentTarget;\n\n if (!files) return;\n\n const newFilesList = Array.from(files).map(file => {\n const url = URL.createObjectURL(file);\n\n return { file, url };\n });\n\n setSelectedImage(prevImages => [...prevImages, ...newFilesList]);\n }, []);\n\n if (!response) {\n return null;\n }\n\n if (!isAttempted && nextQuestionId) {\n return <Text $renderAs=\"body1\"> The student did not attempt this questions.</Text>;\n }\n\n return (\n <>\n <FlexView $flexDirection=\"row\" $justifyContent=\"space-between\">\n <FlexView>\n <Text $renderAs=\"body3\">Score (out of {maxScore})</Text>\n <Separator heightX={1} />\n <FlexView $flexDirection=\"row\" $gapX={0.5}>\n <FlexView\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $borderColor=\"BLACK\"\n $width={50}\n $height={50}\n $background=\"WHITE\"\n >\n <Text $renderAs=\"body1\">{scored}</Text>\n </FlexView>\n <Separator width={16} />\n <FlexView $background=\"WHITE\" $gutterX={0.5} $gapX={0.5}>\n <Clickable label=\"up\" onClick={onScoreUp} disabled={scored === maxScore}>\n <UpIcon />\n </Clickable>\n <Separator height={16} />\n <Clickable label=\"down\" onClick={onScoreDown} disabled={scored === 0}>\n <DownIcon />\n </Clickable>\n </FlexView>\n </FlexView>\n </FlexView>\n <FlexView>\n <Text $renderAs=\"body1\">Comments</Text>\n <Separator heightX={1} />\n <TextArea value={comment} onChange={onCommentChange} />\n </FlexView>\n <FlexView $alignItems=\"center\">\n <Text $renderAs=\"body1\">\n Upload Images <small>(max 12)</small>\n </Text>\n <Separator heightX={1} />\n <FileInputLabel htmlFor={`files${responseId}`}>Browse</FileInputLabel>\n <Separator heightX={1} />\n <FileInput\n type=\"file\"\n accept=\".jpeg, .jpg, .png\"\n id={`files${responseId}`}\n multiple\n onChange={onSelectImages}\n />\n <TextButton\n onClick={openImagesModal}\n label={noOfImages ? `${noOfImages} ${pluralize(noOfImages, 'file')}` : 'No files'}\n />\n </FlexView>\n </FlexView>\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $gutterX={1}\n $gapX={1}\n >\n <Button\n widthX={6}\n renderAs=\"secondary\"\n size=\"small\"\n label=\"Save\"\n onClick={handleSave}\n busy={isUploading}\n disabled={isSaveDisabled}\n />\n <Separator width={20} />\n {!nextQuestionId && (\n <Button\n widthX={6}\n renderAs=\"secondary\"\n size=\"small\"\n label=\"Submit Review\"\n onClick={handleReviewSubmit}\n busy={isSubmittingReview}\n disabled={!canSubmitReview}\n />\n )}\n </FlexView>\n </>\n );\n },\n);\n\nexport default SubjectiveQuestionFeedback;\n"],"names":["QUERY","SubjectiveQuestionFeedback","memo","responses","response","nextQuestionId","responseId","studentId","onAddReviewComment","openImagesReviewModal","handleReviewSubmit","isSubmittingReview","responseScore","maxScore","score","isAttempted","comment","setComment","useState","_a","isUploading","setIsUploading","scored","setScored","selectedImages","setSelectedImage","_b","noOfImages","isSaveDisabled","useMemo","_c","canSubmitReview","canSubmit","item","isCurrItemAttempted","currentItemReviewed","_d","uploadImages","useS3ImageUploadHelper","onCommentChange","useCallback","e","onScoreUp","onScoreDown","onSuccess","images","reponseImages","allImages","handleSave","imagesToUpload","updateImages","filteredImages","openImagesModal","previewImages","onSelectImages","files","newFilesList","file","url","prevImages","jsx","Text","jsxs","Fragment","FlexView","Separator","Clickable","UpIcon","DownIcon","TextArea","FileInputLabel","FileInput","TextButton","pluralize","Button"],"mappings":";;;;;;;;;;;;;AAiBA,MAAMA,KAAQ,EAAE,MAAM,yBAEhBC,KAAiEC;AAAA,EACrE,CAAC;AAAA,IACC,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,MACI;;AACJ,UAAM,EAAE,OAAOC,MAAkBR,KAAY,CAAA,GACvC,EAAE,WAAWS,GAAU,OAAAC,EAAM,IAAIF,KAAiB,CAAA,GAClDG,KAAcX,KAAA,gBAAAA,EAAU,cAAa,QACrC,CAACY,GAASC,CAAU,IAAIC,IAASC,IAAAf,KAAA,gBAAAA,EAAU,kB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C<React.SVGProps<SVGSVGElement>>;
|
|
277
277
|
|
278
278
|
export declare const CountdownTimer: FC<ICountdownTimer>;
|
279
279
|
|
280
|
-
export declare const COUNTRY_CODE_MAP: {
|
281
|
-
id: string;
|
282
|
-
code: string;
|
283
|
-
label: string;
|
284
|
-
value: string;
|
285
|
-
icon: string;
|
286
|
-
url: string;
|
287
|
-
geoIPCountryCode: string;
|
288
|
-
}[];
|
289
|
-
|
290
280
|
declare const COURSE_STREAMS: {
|
291
281
|
readonly SAT_DEMO: "SAT-DEMO";
|
292
282
|
readonly SAT_MATH: "SAT-MATH";
|
@@ -2360,6 +2350,45 @@ declare interface IMilestoneWidgetResourcesProps extends INodeCardCallbacks {
|
|
2360
2350
|
canUpdatePlan?: boolean;
|
2361
2351
|
}
|
2362
2352
|
|
2353
|
+
/**
|
2354
|
+
* Configuration for a modal component
|
2355
|
+
*/
|
2356
|
+
export declare interface IModal {
|
2357
|
+
/** Unique identifier for the modal */
|
2358
|
+
name: string;
|
2359
|
+
/** Content to display inside the modal */
|
2360
|
+
element: JSX.Element;
|
2361
|
+
/** Rendering style of the modal */
|
2362
|
+
renderAs?: 'modal' | 'fullscreen' | 'spotlight';
|
2363
|
+
/** Whether the modal can be dismissed by clicking outside or ESC key (default: true) */
|
2364
|
+
isDismissable?: boolean;
|
2365
|
+
/** Whether the modal requires authentication to view (default: true) */
|
2366
|
+
isPrivate?: boolean;
|
2367
|
+
/** Width of the modal in CSS units (e.g., '500px', '80vw') */
|
2368
|
+
modalWidth: string;
|
2369
|
+
}
|
2370
|
+
|
2371
|
+
/**
|
2372
|
+
* Context for managing modals throughout the application
|
2373
|
+
*/
|
2374
|
+
declare interface IModalContext {
|
2375
|
+
/** Currently active modal or null if no modal is open */
|
2376
|
+
modal: IModal | null;
|
2377
|
+
/** Parameters passed to the modal when opened */
|
2378
|
+
modalParams?: Record<string, unknown>;
|
2379
|
+
/** Opens a modal by name with optional parameters */
|
2380
|
+
openModal: <T = undefined>(name: string, params?: T) => void;
|
2381
|
+
/** Closes the currently open modal */
|
2382
|
+
closeModal: () => void;
|
2383
|
+
/** Whether the modal is in the process of closing (for animation) */
|
2384
|
+
isClosing?: boolean;
|
2385
|
+
}
|
2386
|
+
|
2387
|
+
declare interface IModalProviderProps extends PropsWithChildren {
|
2388
|
+
modals: IModal[];
|
2389
|
+
isUserAuthenticated?: boolean;
|
2390
|
+
}
|
2391
|
+
|
2363
2392
|
export declare interface IMultiplayerWebGameProps extends IBaseWebGameProps, ISyncableWebGameProps {
|
2364
2393
|
enablePlayerTurnIndicators?: boolean;
|
2365
2394
|
}
|
@@ -3565,6 +3594,14 @@ declare interface IUseIsTabBlocked {
|
|
3565
3594
|
(): IMultiTabBlockerContextValue;
|
3566
3595
|
}
|
3567
3596
|
|
3597
|
+
declare interface IUseModalActions {
|
3598
|
+
(): Pick<IModalContext, 'openModal' | 'closeModal' | 'isClosing'>;
|
3599
|
+
}
|
3600
|
+
|
3601
|
+
declare interface IUseModalParams {
|
3602
|
+
<T = undefined>(): T;
|
3603
|
+
}
|
3604
|
+
|
3568
3605
|
declare interface IusePointerSyncMethods {
|
3569
3606
|
publishMouseMove?: (data: IPointerData) => void;
|
3570
3607
|
susbcribeMouseMove?: (qrId: string, cb: (data: IPointerData) => void) => void;
|
@@ -4128,6 +4165,11 @@ export declare const MistakeIcon: React.FC<React.SVGProps<SVGSVGElement>>;
|
|
4128
4165
|
|
4129
4166
|
export declare const Mobile: React.FC<React.SVGProps<SVGSVGElement>>;
|
4130
4167
|
|
4168
|
+
/**
|
4169
|
+
* Provider component that manages modal state and provides modal context to child components
|
4170
|
+
*/
|
4171
|
+
export declare const ModalProvider: FC<IModalProviderProps>;
|
4172
|
+
|
4131
4173
|
export declare const MoreVerticalIcon: React.FC<React.SVGProps<SVGSVGElement>>;
|
4132
4174
|
|
4133
4175
|
export declare const MultiTabBlocker: FC<PropsWithChildren<IMultiTabBlockerProps>>;
|
@@ -5845,6 +5887,10 @@ export declare const useIsTabBlocked: IUseIsTabBlocked;
|
|
5845
5887
|
|
5846
5888
|
export declare const useJourney: () => IJourneyContext;
|
5847
5889
|
|
5890
|
+
export declare const useModalActions: IUseModalActions;
|
5891
|
+
|
5892
|
+
export declare const useModalParams: IUseModalParams;
|
5893
|
+
|
5848
5894
|
export declare const usePointerSync: ({ userType, targetUserId, }: IusePointerSyncProps) => IusePointerSyncMethods;
|
5849
5895
|
|
5850
5896
|
export declare const User2Icon: React.FC<React.SVGProps<SVGSVGElement>>;
|