analytica-frontend-lib 1.2.61 → 1.2.62
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/ActivitiesHistory/index.js +6 -2
- package/dist/ActivitiesHistory/index.js.map +1 -1
- package/dist/ActivitiesHistory/index.mjs +6 -2
- package/dist/ActivitiesHistory/index.mjs.map +1 -1
- package/dist/ActivityDetails/index.d.ts +1 -1
- package/dist/ActivityDetails/index.d.ts.map +1 -1
- package/dist/ActivityDetails/index.js +131 -49
- package/dist/ActivityDetails/index.js.map +1 -1
- package/dist/ActivityDetails/index.mjs +131 -49
- package/dist/ActivityDetails/index.mjs.map +1 -1
- package/dist/CorrectActivityModal/index.d.ts +1 -1
- package/dist/CorrectActivityModal/index.d.ts.map +1 -1
- package/dist/CorrectActivityModal/index.js +122 -38
- package/dist/CorrectActivityModal/index.js.map +1 -1
- package/dist/CorrectActivityModal/index.mjs +122 -38
- package/dist/CorrectActivityModal/index.mjs.map +1 -1
- package/dist/hooks/useActivitiesHistory/index.d.ts +4 -56
- package/dist/hooks/useActivitiesHistory/index.d.ts.map +1 -1
- package/dist/hooks/useActivitiesHistory/index.js +6 -2
- package/dist/hooks/useActivitiesHistory/index.js.map +1 -1
- package/dist/hooks/useActivitiesHistory/index.mjs +6 -2
- package/dist/hooks/useActivitiesHistory/index.mjs.map +1 -1
- package/dist/hooks/useActivitiesHistory.d.ts +4 -56
- package/dist/hooks/useActivitiesHistory.d.ts.map +1 -1
- package/dist/index.js +137 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +137 -51
- package/dist/index.mjs.map +1 -1
- package/dist/types/studentActivityCorrection.d.ts +5 -0
- package/dist/types/studentActivityCorrection.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10012,7 +10012,9 @@ var FileAttachment_default = FileAttachment;
|
|
|
10012
10012
|
var QUESTION_STATUS2 = {
|
|
10013
10013
|
CORRETA: "CORRETA",
|
|
10014
10014
|
INCORRETA: "INCORRETA",
|
|
10015
|
-
EM_BRANCO: "EM_BRANCO"
|
|
10015
|
+
EM_BRANCO: "EM_BRANCO",
|
|
10016
|
+
/** Reserved for future use - pending teacher evaluation for essay questions */
|
|
10017
|
+
PENDENTE: "PENDENTE"
|
|
10016
10018
|
};
|
|
10017
10019
|
var getQuestionStatusBadgeConfig = (status) => {
|
|
10018
10020
|
const configs = {
|
|
@@ -10030,6 +10032,11 @@ var getQuestionStatusBadgeConfig = (status) => {
|
|
|
10030
10032
|
label: "Em branco",
|
|
10031
10033
|
bgColor: "bg-gray-100",
|
|
10032
10034
|
textColor: "text-gray-600"
|
|
10035
|
+
},
|
|
10036
|
+
[QUESTION_STATUS2.PENDENTE]: {
|
|
10037
|
+
label: "Pendente",
|
|
10038
|
+
bgColor: "bg-warning-background",
|
|
10039
|
+
textColor: "text-warning-800"
|
|
10033
10040
|
}
|
|
10034
10041
|
};
|
|
10035
10042
|
return configs[status];
|
|
@@ -10113,17 +10120,26 @@ var CorrectActivityModal = ({
|
|
|
10113
10120
|
const [savedObservation, setSavedObservation] = (0, import_react29.useState)("");
|
|
10114
10121
|
const [attachedFiles, setAttachedFiles] = (0, import_react29.useState)([]);
|
|
10115
10122
|
const [savedFiles, setSavedFiles] = (0, import_react29.useState)([]);
|
|
10123
|
+
const [existingAttachment, setExistingAttachment] = (0, import_react29.useState)(
|
|
10124
|
+
null
|
|
10125
|
+
);
|
|
10116
10126
|
const fileInputRef = (0, import_react29.useRef)(null);
|
|
10117
10127
|
(0, import_react29.useEffect)(() => {
|
|
10118
10128
|
if (isOpen) {
|
|
10119
10129
|
setObservation("");
|
|
10120
10130
|
setIsObservationExpanded(false);
|
|
10121
|
-
setIsObservationSaved(false);
|
|
10122
|
-
setSavedObservation("");
|
|
10123
10131
|
setAttachedFiles([]);
|
|
10124
10132
|
setSavedFiles([]);
|
|
10133
|
+
setExistingAttachment(data?.attachment ?? null);
|
|
10134
|
+
if (data?.observation || data?.attachment) {
|
|
10135
|
+
setIsObservationSaved(true);
|
|
10136
|
+
setSavedObservation(data.observation || "");
|
|
10137
|
+
} else {
|
|
10138
|
+
setIsObservationSaved(false);
|
|
10139
|
+
setSavedObservation("");
|
|
10140
|
+
}
|
|
10125
10141
|
}
|
|
10126
|
-
}, [isOpen, data?.studentId]);
|
|
10142
|
+
}, [isOpen, data?.studentId, data?.observation, data?.attachment]);
|
|
10127
10143
|
const handleOpenObservation = () => {
|
|
10128
10144
|
setIsObservationExpanded(true);
|
|
10129
10145
|
};
|
|
@@ -10137,12 +10153,16 @@ var CorrectActivityModal = ({
|
|
|
10137
10153
|
setAttachedFiles((prev) => prev.filter((f) => f.id !== id));
|
|
10138
10154
|
};
|
|
10139
10155
|
const handleSaveObservation = () => {
|
|
10140
|
-
if (observation.trim() || attachedFiles.length > 0) {
|
|
10156
|
+
if (observation.trim() || attachedFiles.length > 0 || existingAttachment) {
|
|
10157
|
+
if (!data?.studentId) {
|
|
10158
|
+
return;
|
|
10159
|
+
}
|
|
10141
10160
|
setSavedObservation(observation);
|
|
10142
10161
|
setSavedFiles([...attachedFiles]);
|
|
10143
10162
|
setIsObservationSaved(true);
|
|
10144
10163
|
setIsObservationExpanded(false);
|
|
10145
10164
|
onObservationSubmit?.(
|
|
10165
|
+
data.studentId,
|
|
10146
10166
|
observation,
|
|
10147
10167
|
attachedFiles.map((f) => f.file)
|
|
10148
10168
|
);
|
|
@@ -10156,9 +10176,80 @@ var CorrectActivityModal = ({
|
|
|
10156
10176
|
};
|
|
10157
10177
|
if (!data) return null;
|
|
10158
10178
|
const title = isViewOnly ? "Detalhes da atividade" : "Corrigir atividade";
|
|
10159
|
-
const formattedScore = data.score
|
|
10179
|
+
const formattedScore = data.score == null ? "-" : data.score.toFixed(1);
|
|
10160
10180
|
const renderObservationSection = () => {
|
|
10161
|
-
|
|
10181
|
+
const getFileNameFromUrl = (url) => {
|
|
10182
|
+
try {
|
|
10183
|
+
const urlObj = new URL(url);
|
|
10184
|
+
const urlPath = urlObj.pathname;
|
|
10185
|
+
return urlPath.split("/").pop() || "Anexo";
|
|
10186
|
+
} catch {
|
|
10187
|
+
return "Anexo";
|
|
10188
|
+
}
|
|
10189
|
+
};
|
|
10190
|
+
const renderAttachmentInput = () => {
|
|
10191
|
+
if (attachedFiles.length > 0) {
|
|
10192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px]", children: [
|
|
10193
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
|
|
10194
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
|
|
10195
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10196
|
+
"button",
|
|
10197
|
+
{
|
|
10198
|
+
type: "button",
|
|
10199
|
+
onClick: () => handleFileRemove(attachedFiles[0].id),
|
|
10200
|
+
className: "text-text-700 hover:text-text-800 flex-shrink-0",
|
|
10201
|
+
"aria-label": `Remover ${attachedFiles[0].file.name}`,
|
|
10202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.X, { size: 18 })
|
|
10203
|
+
}
|
|
10204
|
+
)
|
|
10205
|
+
] });
|
|
10206
|
+
}
|
|
10207
|
+
if (existingAttachment) {
|
|
10208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10209
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
10210
|
+
"a",
|
|
10211
|
+
{
|
|
10212
|
+
href: existingAttachment,
|
|
10213
|
+
target: "_blank",
|
|
10214
|
+
rel: "noopener noreferrer",
|
|
10215
|
+
className: "flex items-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px] hover:bg-secondary-600 transition-colors",
|
|
10216
|
+
children: [
|
|
10217
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
|
|
10218
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
|
|
10219
|
+
]
|
|
10220
|
+
}
|
|
10221
|
+
),
|
|
10222
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
10223
|
+
Button_default,
|
|
10224
|
+
{
|
|
10225
|
+
type: "button",
|
|
10226
|
+
variant: "outline",
|
|
10227
|
+
size: "small",
|
|
10228
|
+
onClick: () => fileInputRef.current?.click(),
|
|
10229
|
+
className: "flex items-center gap-2",
|
|
10230
|
+
children: [
|
|
10231
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18 }),
|
|
10232
|
+
"Trocar"
|
|
10233
|
+
]
|
|
10234
|
+
}
|
|
10235
|
+
)
|
|
10236
|
+
] });
|
|
10237
|
+
}
|
|
10238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
10239
|
+
Button_default,
|
|
10240
|
+
{
|
|
10241
|
+
type: "button",
|
|
10242
|
+
variant: "outline",
|
|
10243
|
+
size: "small",
|
|
10244
|
+
onClick: () => fileInputRef.current?.click(),
|
|
10245
|
+
className: "flex items-center gap-2",
|
|
10246
|
+
children: [
|
|
10247
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18 }),
|
|
10248
|
+
"Anexar"
|
|
10249
|
+
]
|
|
10250
|
+
}
|
|
10251
|
+
);
|
|
10252
|
+
};
|
|
10162
10253
|
if (isObservationSaved) {
|
|
10163
10254
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "bg-background border border-border-100 rounded-lg p-4 space-y-2", children: [
|
|
10164
10255
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3", children: [
|
|
@@ -10174,6 +10265,25 @@ var CorrectActivityModal = ({
|
|
|
10174
10265
|
),
|
|
10175
10266
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: savedFiles[0].file.name })
|
|
10176
10267
|
] }),
|
|
10268
|
+
savedFiles.length === 0 && existingAttachment && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
10269
|
+
"a",
|
|
10270
|
+
{
|
|
10271
|
+
href: existingAttachment,
|
|
10272
|
+
target: "_blank",
|
|
10273
|
+
rel: "noopener noreferrer",
|
|
10274
|
+
className: "flex items-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px] hover:bg-secondary-600 transition-colors",
|
|
10275
|
+
children: [
|
|
10276
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10277
|
+
import_phosphor_react23.Paperclip,
|
|
10278
|
+
{
|
|
10279
|
+
size: 18,
|
|
10280
|
+
className: "text-text-800 flex-shrink-0"
|
|
10281
|
+
}
|
|
10282
|
+
),
|
|
10283
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
|
|
10284
|
+
]
|
|
10285
|
+
}
|
|
10286
|
+
),
|
|
10177
10287
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
10178
10288
|
Button_default,
|
|
10179
10289
|
{
|
|
@@ -10224,40 +10334,14 @@ var CorrectActivityModal = ({
|
|
|
10224
10334
|
}
|
|
10225
10335
|
),
|
|
10226
10336
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col-reverse sm:flex-row gap-3 sm:justify-between", children: [
|
|
10227
|
-
|
|
10228
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
|
|
10229
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
|
|
10230
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10231
|
-
"button",
|
|
10232
|
-
{
|
|
10233
|
-
type: "button",
|
|
10234
|
-
onClick: () => handleFileRemove(attachedFiles[0].id),
|
|
10235
|
-
className: "text-text-700 hover:text-text-800 flex-shrink-0",
|
|
10236
|
-
"aria-label": `Remover ${attachedFiles[0].file.name}`,
|
|
10237
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.X, { size: 18 })
|
|
10238
|
-
}
|
|
10239
|
-
)
|
|
10240
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
10241
|
-
Button_default,
|
|
10242
|
-
{
|
|
10243
|
-
type: "button",
|
|
10244
|
-
variant: "outline",
|
|
10245
|
-
size: "small",
|
|
10246
|
-
onClick: () => fileInputRef.current?.click(),
|
|
10247
|
-
className: "flex items-center gap-2",
|
|
10248
|
-
children: [
|
|
10249
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18 }),
|
|
10250
|
-
"Anexar"
|
|
10251
|
-
]
|
|
10252
|
-
}
|
|
10253
|
-
),
|
|
10337
|
+
renderAttachmentInput(),
|
|
10254
10338
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10255
10339
|
Button_default,
|
|
10256
10340
|
{
|
|
10257
10341
|
type: "button",
|
|
10258
10342
|
size: "small",
|
|
10259
10343
|
onClick: handleSaveObservation,
|
|
10260
|
-
disabled: !observation.trim() && attachedFiles.length === 0,
|
|
10344
|
+
disabled: !observation.trim() && attachedFiles.length === 0 && !existingAttachment,
|
|
10261
10345
|
children: "Salvar"
|
|
10262
10346
|
}
|
|
10263
10347
|
)
|
|
@@ -10283,8 +10367,8 @@ var CorrectActivityModal = ({
|
|
|
10283
10367
|
contentClassName: "max-h-[80vh] overflow-y-auto",
|
|
10284
10368
|
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "space-y-6", children: [
|
|
10285
10369
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
10286
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName
|
|
10287
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName })
|
|
10370
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName?.charAt(0).toUpperCase() || "-" }) }),
|
|
10371
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName || "Aluno" })
|
|
10288
10372
|
] }),
|
|
10289
10373
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
|
|
10290
10374
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(StatCard, { label: "Nota", value: formattedScore, variant: "score" }),
|
|
@@ -10308,7 +10392,7 @@ var CorrectActivityModal = ({
|
|
|
10308
10392
|
renderObservationSection(),
|
|
10309
10393
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "space-y-2", children: [
|
|
10310
10394
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-sm font-bold text-text-950", children: "Respostas" }),
|
|
10311
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions
|
|
10395
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions?.map((question) => {
|
|
10312
10396
|
const badgeConfig = getQuestionStatusBadgeConfig(question.status);
|
|
10313
10397
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10314
10398
|
CardAccordation,
|
|
@@ -20862,7 +20946,11 @@ var ActivityDetails = ({
|
|
|
20862
20946
|
setIsViewOnlyModal(isViewOnly);
|
|
20863
20947
|
setCorrectionError(null);
|
|
20864
20948
|
try {
|
|
20865
|
-
const correction = await fetchStudentCorrection(
|
|
20949
|
+
const correction = await fetchStudentCorrection(
|
|
20950
|
+
activityId,
|
|
20951
|
+
studentId,
|
|
20952
|
+
student.studentName || "Aluno"
|
|
20953
|
+
);
|
|
20866
20954
|
setCorrectionData(correction);
|
|
20867
20955
|
setIsModalOpen(true);
|
|
20868
20956
|
} catch (err) {
|
|
@@ -20878,21 +20966,15 @@ var ActivityDetails = ({
|
|
|
20878
20966
|
setIsModalOpen(false);
|
|
20879
20967
|
}, []);
|
|
20880
20968
|
const handleObservationSubmit = (0, import_react63.useCallback)(
|
|
20881
|
-
async (observation, files) => {
|
|
20882
|
-
if (!activityId || !
|
|
20969
|
+
async (studentId, observation, files) => {
|
|
20970
|
+
if (!activityId || !studentId) return;
|
|
20883
20971
|
try {
|
|
20884
|
-
await submitObservation(
|
|
20885
|
-
activityId,
|
|
20886
|
-
correctionData.studentId,
|
|
20887
|
-
observation,
|
|
20888
|
-
files
|
|
20889
|
-
);
|
|
20890
|
-
setIsModalOpen(false);
|
|
20972
|
+
await submitObservation(activityId, studentId, observation, files);
|
|
20891
20973
|
} catch (err) {
|
|
20892
20974
|
console.error("Failed to submit observation:", err);
|
|
20893
20975
|
}
|
|
20894
20976
|
},
|
|
20895
|
-
[activityId,
|
|
20977
|
+
[activityId, submitObservation]
|
|
20896
20978
|
);
|
|
20897
20979
|
const tableData = (0, import_react63.useMemo)(() => {
|
|
20898
20980
|
if (!data?.students) return [];
|
|
@@ -24625,7 +24707,7 @@ var activityHistoryResponseSchema = import_zod7.z.object({
|
|
|
24625
24707
|
startDate: import_zod7.z.string().nullable(),
|
|
24626
24708
|
finalDate: import_zod7.z.string().nullable(),
|
|
24627
24709
|
status: import_zod7.z.nativeEnum(GenericApiStatus),
|
|
24628
|
-
completionPercentage: import_zod7.z.number().min(0).max(100),
|
|
24710
|
+
completionPercentage: import_zod7.z.number().min(0).max(100).optional().default(0),
|
|
24629
24711
|
subjectId: import_zod7.z.string().uuid().optional().nullable(),
|
|
24630
24712
|
schoolId: import_zod7.z.string().optional(),
|
|
24631
24713
|
schoolName: import_zod7.z.string().optional(),
|
|
@@ -24636,7 +24718,11 @@ var activityHistoryResponseSchema = import_zod7.z.object({
|
|
|
24636
24718
|
var activitiesHistoryApiResponseSchema = import_zod7.z.object({
|
|
24637
24719
|
message: import_zod7.z.string(),
|
|
24638
24720
|
data: import_zod7.z.object({
|
|
24639
|
-
activities: import_zod7.z.array(
|
|
24721
|
+
activities: import_zod7.z.array(import_zod7.z.unknown()).transform(
|
|
24722
|
+
(items) => items.map((item) => activityHistoryResponseSchema.safeParse(item)).filter(
|
|
24723
|
+
(result) => result.success
|
|
24724
|
+
).map((result) => result.data)
|
|
24725
|
+
),
|
|
24640
24726
|
pagination: import_zod7.z.object({
|
|
24641
24727
|
total: import_zod7.z.number(),
|
|
24642
24728
|
page: import_zod7.z.number(),
|