analytica-frontend-lib 1.2.60 → 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.
Files changed (37) hide show
  1. package/dist/ActivitiesHistory/index.js +6 -2
  2. package/dist/ActivitiesHistory/index.js.map +1 -1
  3. package/dist/ActivitiesHistory/index.mjs +6 -2
  4. package/dist/ActivitiesHistory/index.mjs.map +1 -1
  5. package/dist/ActivityDetails/index.d.ts +1 -1
  6. package/dist/ActivityDetails/index.d.ts.map +1 -1
  7. package/dist/ActivityDetails/index.js +131 -49
  8. package/dist/ActivityDetails/index.js.map +1 -1
  9. package/dist/ActivityDetails/index.mjs +131 -49
  10. package/dist/ActivityDetails/index.mjs.map +1 -1
  11. package/dist/CorrectActivityModal/index.d.ts +1 -1
  12. package/dist/CorrectActivityModal/index.d.ts.map +1 -1
  13. package/dist/CorrectActivityModal/index.js +122 -38
  14. package/dist/CorrectActivityModal/index.js.map +1 -1
  15. package/dist/CorrectActivityModal/index.mjs +122 -38
  16. package/dist/CorrectActivityModal/index.mjs.map +1 -1
  17. package/dist/hooks/useActivitiesHistory/index.d.ts +4 -56
  18. package/dist/hooks/useActivitiesHistory/index.d.ts.map +1 -1
  19. package/dist/hooks/useActivitiesHistory/index.js +6 -2
  20. package/dist/hooks/useActivitiesHistory/index.js.map +1 -1
  21. package/dist/hooks/useActivitiesHistory/index.mjs +6 -2
  22. package/dist/hooks/useActivitiesHistory/index.mjs.map +1 -1
  23. package/dist/hooks/useActivitiesHistory.d.ts +4 -56
  24. package/dist/hooks/useActivitiesHistory.d.ts.map +1 -1
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +310 -77
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +303 -77
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/types/studentActivityCorrection.d.ts +5 -0
  32. package/dist/types/studentActivityCorrection.d.ts.map +1 -1
  33. package/dist/utils/filterHelpers.d.ts +105 -0
  34. package/dist/utils/filterHelpers.d.ts.map +1 -0
  35. package/dist/utils/subjectMappers.d.ts +29 -0
  36. package/dist/utils/subjectMappers.d.ts.map +1 -0
  37. package/package.json +1 -1
@@ -12,7 +12,7 @@ export interface CorrectActivityModalProps {
12
12
  /** Whether the modal is in view-only mode */
13
13
  isViewOnly?: boolean;
14
14
  /** Callback when observation is submitted with optional files */
15
- onObservationSubmit?: (observation: string, files: File[]) => void;
15
+ onObservationSubmit?: (studentId: string, observation: string, files: File[]) => void;
16
16
  }
17
17
  /**
18
18
  * Modal component for correcting or viewing student activity details
@@ -1 +1 @@
1
- {"version":3,"file":"CorrectActivityModal.d.ts","sourceRoot":"","sources":["../../../src/components/CorrectActivityModal/CorrectActivityModal.tsx"],"names":[],"mappings":"AAmBA,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,uCAAuC,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,gCAAgC;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC3C,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;CACpE;AAqFD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,oBAAoB,GAAI,6DAM3B,yBAAyB,mDA+V3B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"CorrectActivityModal.d.ts","sourceRoot":"","sources":["../../../src/components/CorrectActivityModal/CorrectActivityModal.tsx"],"names":[],"mappings":"AAmBA,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,uCAAuC,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,gCAAgC;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC3C,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,mBAAmB,CAAC,EAAE,CACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,IAAI,EAAE,KACV,IAAI,CAAC;CACX;AAqFD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,oBAAoB,GAAI,6DAM3B,yBAAyB,mDA+b3B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -3309,7 +3309,9 @@ var generateFileId = () => {
3309
3309
  var QUESTION_STATUS = {
3310
3310
  CORRETA: "CORRETA",
3311
3311
  INCORRETA: "INCORRETA",
3312
- EM_BRANCO: "EM_BRANCO"
3312
+ EM_BRANCO: "EM_BRANCO",
3313
+ /** Reserved for future use - pending teacher evaluation for essay questions */
3314
+ PENDENTE: "PENDENTE"
3313
3315
  };
3314
3316
  var getQuestionStatusBadgeConfig = (status) => {
3315
3317
  const configs = {
@@ -3327,6 +3329,11 @@ var getQuestionStatusBadgeConfig = (status) => {
3327
3329
  label: "Em branco",
3328
3330
  bgColor: "bg-gray-100",
3329
3331
  textColor: "text-gray-600"
3332
+ },
3333
+ [QUESTION_STATUS.PENDENTE]: {
3334
+ label: "Pendente",
3335
+ bgColor: "bg-warning-background",
3336
+ textColor: "text-warning-800"
3330
3337
  }
3331
3338
  };
3332
3339
  return configs[status];
@@ -3410,17 +3417,26 @@ var CorrectActivityModal = ({
3410
3417
  const [savedObservation, setSavedObservation] = (0, import_react9.useState)("");
3411
3418
  const [attachedFiles, setAttachedFiles] = (0, import_react9.useState)([]);
3412
3419
  const [savedFiles, setSavedFiles] = (0, import_react9.useState)([]);
3420
+ const [existingAttachment, setExistingAttachment] = (0, import_react9.useState)(
3421
+ null
3422
+ );
3413
3423
  const fileInputRef = (0, import_react9.useRef)(null);
3414
3424
  (0, import_react9.useEffect)(() => {
3415
3425
  if (isOpen) {
3416
3426
  setObservation("");
3417
3427
  setIsObservationExpanded(false);
3418
- setIsObservationSaved(false);
3419
- setSavedObservation("");
3420
3428
  setAttachedFiles([]);
3421
3429
  setSavedFiles([]);
3430
+ setExistingAttachment(data?.attachment ?? null);
3431
+ if (data?.observation || data?.attachment) {
3432
+ setIsObservationSaved(true);
3433
+ setSavedObservation(data.observation || "");
3434
+ } else {
3435
+ setIsObservationSaved(false);
3436
+ setSavedObservation("");
3437
+ }
3422
3438
  }
3423
- }, [isOpen, data?.studentId]);
3439
+ }, [isOpen, data?.studentId, data?.observation, data?.attachment]);
3424
3440
  const handleOpenObservation = () => {
3425
3441
  setIsObservationExpanded(true);
3426
3442
  };
@@ -3434,12 +3450,16 @@ var CorrectActivityModal = ({
3434
3450
  setAttachedFiles((prev) => prev.filter((f) => f.id !== id));
3435
3451
  };
3436
3452
  const handleSaveObservation = () => {
3437
- if (observation.trim() || attachedFiles.length > 0) {
3453
+ if (observation.trim() || attachedFiles.length > 0 || existingAttachment) {
3454
+ if (!data?.studentId) {
3455
+ return;
3456
+ }
3438
3457
  setSavedObservation(observation);
3439
3458
  setSavedFiles([...attachedFiles]);
3440
3459
  setIsObservationSaved(true);
3441
3460
  setIsObservationExpanded(false);
3442
3461
  onObservationSubmit?.(
3462
+ data.studentId,
3443
3463
  observation,
3444
3464
  attachedFiles.map((f) => f.file)
3445
3465
  );
@@ -3453,9 +3473,80 @@ var CorrectActivityModal = ({
3453
3473
  };
3454
3474
  if (!data) return null;
3455
3475
  const title = isViewOnly ? "Detalhes da atividade" : "Corrigir atividade";
3456
- const formattedScore = data.score === null ? "-" : data.score.toFixed(1);
3476
+ const formattedScore = data.score == null ? "-" : data.score.toFixed(1);
3457
3477
  const renderObservationSection = () => {
3458
- if (isViewOnly) return null;
3478
+ const getFileNameFromUrl = (url) => {
3479
+ try {
3480
+ const urlObj = new URL(url);
3481
+ const urlPath = urlObj.pathname;
3482
+ return urlPath.split("/").pop() || "Anexo";
3483
+ } catch {
3484
+ return "Anexo";
3485
+ }
3486
+ };
3487
+ const renderAttachmentInput = () => {
3488
+ if (attachedFiles.length > 0) {
3489
+ return /* @__PURE__ */ (0, import_jsx_runtime16.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: [
3490
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react7.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
3491
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
3492
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3493
+ "button",
3494
+ {
3495
+ type: "button",
3496
+ onClick: () => handleFileRemove(attachedFiles[0].id),
3497
+ className: "text-text-700 hover:text-text-800 flex-shrink-0",
3498
+ "aria-label": `Remover ${attachedFiles[0].file.name}`,
3499
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react7.X, { size: 18 })
3500
+ }
3501
+ )
3502
+ ] });
3503
+ }
3504
+ if (existingAttachment) {
3505
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
3506
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3507
+ "a",
3508
+ {
3509
+ href: existingAttachment,
3510
+ target: "_blank",
3511
+ rel: "noopener noreferrer",
3512
+ 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",
3513
+ children: [
3514
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react7.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
3515
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
3516
+ ]
3517
+ }
3518
+ ),
3519
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3520
+ Button_default,
3521
+ {
3522
+ type: "button",
3523
+ variant: "outline",
3524
+ size: "small",
3525
+ onClick: () => fileInputRef.current?.click(),
3526
+ className: "flex items-center gap-2",
3527
+ children: [
3528
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react7.Paperclip, { size: 18 }),
3529
+ "Trocar"
3530
+ ]
3531
+ }
3532
+ )
3533
+ ] });
3534
+ }
3535
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3536
+ Button_default,
3537
+ {
3538
+ type: "button",
3539
+ variant: "outline",
3540
+ size: "small",
3541
+ onClick: () => fileInputRef.current?.click(),
3542
+ className: "flex items-center gap-2",
3543
+ children: [
3544
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react7.Paperclip, { size: 18 }),
3545
+ "Anexar"
3546
+ ]
3547
+ }
3548
+ );
3549
+ };
3459
3550
  if (isObservationSaved) {
3460
3551
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "bg-background border border-border-100 rounded-lg p-4 space-y-2", children: [
3461
3552
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3", children: [
@@ -3471,6 +3562,25 @@ var CorrectActivityModal = ({
3471
3562
  ),
3472
3563
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: savedFiles[0].file.name })
3473
3564
  ] }),
3565
+ savedFiles.length === 0 && existingAttachment && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3566
+ "a",
3567
+ {
3568
+ href: existingAttachment,
3569
+ target: "_blank",
3570
+ rel: "noopener noreferrer",
3571
+ 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",
3572
+ children: [
3573
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3574
+ import_phosphor_react7.Paperclip,
3575
+ {
3576
+ size: 18,
3577
+ className: "text-text-800 flex-shrink-0"
3578
+ }
3579
+ ),
3580
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
3581
+ ]
3582
+ }
3583
+ ),
3474
3584
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3475
3585
  Button_default,
3476
3586
  {
@@ -3521,40 +3631,14 @@ var CorrectActivityModal = ({
3521
3631
  }
3522
3632
  ),
3523
3633
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col-reverse sm:flex-row gap-3 sm:justify-between", children: [
3524
- attachedFiles.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.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: [
3525
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react7.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
3526
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
3527
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3528
- "button",
3529
- {
3530
- type: "button",
3531
- onClick: () => handleFileRemove(attachedFiles[0].id),
3532
- className: "text-text-700 hover:text-text-800 flex-shrink-0",
3533
- "aria-label": `Remover ${attachedFiles[0].file.name}`,
3534
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react7.X, { size: 18 })
3535
- }
3536
- )
3537
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3538
- Button_default,
3539
- {
3540
- type: "button",
3541
- variant: "outline",
3542
- size: "small",
3543
- onClick: () => fileInputRef.current?.click(),
3544
- className: "flex items-center gap-2",
3545
- children: [
3546
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react7.Paperclip, { size: 18 }),
3547
- "Anexar"
3548
- ]
3549
- }
3550
- ),
3634
+ renderAttachmentInput(),
3551
3635
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3552
3636
  Button_default,
3553
3637
  {
3554
3638
  type: "button",
3555
3639
  size: "small",
3556
3640
  onClick: handleSaveObservation,
3557
- disabled: !observation.trim() && attachedFiles.length === 0,
3641
+ disabled: !observation.trim() && attachedFiles.length === 0 && !existingAttachment,
3558
3642
  children: "Salvar"
3559
3643
  }
3560
3644
  )
@@ -3580,8 +3664,8 @@ var CorrectActivityModal = ({
3580
3664
  contentClassName: "max-h-[80vh] overflow-y-auto",
3581
3665
  children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-6", children: [
3582
3666
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-3", children: [
3583
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName.charAt(0).toUpperCase() }) }),
3584
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName })
3667
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName?.charAt(0).toUpperCase() || "-" }) }),
3668
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName || "Aluno" })
3585
3669
  ] }),
3586
3670
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
3587
3671
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StatCard, { label: "Nota", value: formattedScore, variant: "score" }),
@@ -3605,7 +3689,7 @@ var CorrectActivityModal = ({
3605
3689
  renderObservationSection(),
3606
3690
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-2", children: [
3607
3691
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { className: "text-sm font-bold text-text-950", children: "Respostas" }),
3608
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions.map((question) => {
3692
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions?.map((question) => {
3609
3693
  const badgeConfig = getQuestionStatusBadgeConfig(question.status);
3610
3694
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3611
3695
  CardAccordation,