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
@@ -5531,7 +5531,9 @@ var generateFileId = () => {
5531
5531
  var QUESTION_STATUS = {
5532
5532
  CORRETA: "CORRETA",
5533
5533
  INCORRETA: "INCORRETA",
5534
- EM_BRANCO: "EM_BRANCO"
5534
+ EM_BRANCO: "EM_BRANCO",
5535
+ /** Reserved for future use - pending teacher evaluation for essay questions */
5536
+ PENDENTE: "PENDENTE"
5535
5537
  };
5536
5538
  var getQuestionStatusBadgeConfig = (status) => {
5537
5539
  const configs = {
@@ -5549,6 +5551,11 @@ var getQuestionStatusBadgeConfig = (status) => {
5549
5551
  label: "Em branco",
5550
5552
  bgColor: "bg-gray-100",
5551
5553
  textColor: "text-gray-600"
5554
+ },
5555
+ [QUESTION_STATUS.PENDENTE]: {
5556
+ label: "Pendente",
5557
+ bgColor: "bg-warning-background",
5558
+ textColor: "text-warning-800"
5552
5559
  }
5553
5560
  };
5554
5561
  return configs[status];
@@ -5632,17 +5639,26 @@ var CorrectActivityModal = ({
5632
5639
  const [savedObservation, setSavedObservation] = useState12("");
5633
5640
  const [attachedFiles, setAttachedFiles] = useState12([]);
5634
5641
  const [savedFiles, setSavedFiles] = useState12([]);
5642
+ const [existingAttachment, setExistingAttachment] = useState12(
5643
+ null
5644
+ );
5635
5645
  const fileInputRef = useRef7(null);
5636
5646
  useEffect12(() => {
5637
5647
  if (isOpen) {
5638
5648
  setObservation("");
5639
5649
  setIsObservationExpanded(false);
5640
- setIsObservationSaved(false);
5641
- setSavedObservation("");
5642
5650
  setAttachedFiles([]);
5643
5651
  setSavedFiles([]);
5652
+ setExistingAttachment(data?.attachment ?? null);
5653
+ if (data?.observation || data?.attachment) {
5654
+ setIsObservationSaved(true);
5655
+ setSavedObservation(data.observation || "");
5656
+ } else {
5657
+ setIsObservationSaved(false);
5658
+ setSavedObservation("");
5659
+ }
5644
5660
  }
5645
- }, [isOpen, data?.studentId]);
5661
+ }, [isOpen, data?.studentId, data?.observation, data?.attachment]);
5646
5662
  const handleOpenObservation = () => {
5647
5663
  setIsObservationExpanded(true);
5648
5664
  };
@@ -5656,12 +5672,16 @@ var CorrectActivityModal = ({
5656
5672
  setAttachedFiles((prev) => prev.filter((f) => f.id !== id));
5657
5673
  };
5658
5674
  const handleSaveObservation = () => {
5659
- if (observation.trim() || attachedFiles.length > 0) {
5675
+ if (observation.trim() || attachedFiles.length > 0 || existingAttachment) {
5676
+ if (!data?.studentId) {
5677
+ return;
5678
+ }
5660
5679
  setSavedObservation(observation);
5661
5680
  setSavedFiles([...attachedFiles]);
5662
5681
  setIsObservationSaved(true);
5663
5682
  setIsObservationExpanded(false);
5664
5683
  onObservationSubmit?.(
5684
+ data.studentId,
5665
5685
  observation,
5666
5686
  attachedFiles.map((f) => f.file)
5667
5687
  );
@@ -5675,9 +5695,80 @@ var CorrectActivityModal = ({
5675
5695
  };
5676
5696
  if (!data) return null;
5677
5697
  const title = isViewOnly ? "Detalhes da atividade" : "Corrigir atividade";
5678
- const formattedScore = data.score === null ? "-" : data.score.toFixed(1);
5698
+ const formattedScore = data.score == null ? "-" : data.score.toFixed(1);
5679
5699
  const renderObservationSection = () => {
5680
- if (isViewOnly) return null;
5700
+ const getFileNameFromUrl = (url) => {
5701
+ try {
5702
+ const urlObj = new URL(url);
5703
+ const urlPath = urlObj.pathname;
5704
+ return urlPath.split("/").pop() || "Anexo";
5705
+ } catch {
5706
+ return "Anexo";
5707
+ }
5708
+ };
5709
+ const renderAttachmentInput = () => {
5710
+ if (attachedFiles.length > 0) {
5711
+ return /* @__PURE__ */ jsxs22("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: [
5712
+ /* @__PURE__ */ jsx27(Paperclip2, { size: 18, className: "text-text-800 flex-shrink-0" }),
5713
+ /* @__PURE__ */ jsx27("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
5714
+ /* @__PURE__ */ jsx27(
5715
+ "button",
5716
+ {
5717
+ type: "button",
5718
+ onClick: () => handleFileRemove(attachedFiles[0].id),
5719
+ className: "text-text-700 hover:text-text-800 flex-shrink-0",
5720
+ "aria-label": `Remover ${attachedFiles[0].file.name}`,
5721
+ children: /* @__PURE__ */ jsx27(X4, { size: 18 })
5722
+ }
5723
+ )
5724
+ ] });
5725
+ }
5726
+ if (existingAttachment) {
5727
+ return /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
5728
+ /* @__PURE__ */ jsxs22(
5729
+ "a",
5730
+ {
5731
+ href: existingAttachment,
5732
+ target: "_blank",
5733
+ rel: "noopener noreferrer",
5734
+ 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",
5735
+ children: [
5736
+ /* @__PURE__ */ jsx27(Paperclip2, { size: 18, className: "text-text-800 flex-shrink-0" }),
5737
+ /* @__PURE__ */ jsx27("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
5738
+ ]
5739
+ }
5740
+ ),
5741
+ /* @__PURE__ */ jsxs22(
5742
+ Button_default,
5743
+ {
5744
+ type: "button",
5745
+ variant: "outline",
5746
+ size: "small",
5747
+ onClick: () => fileInputRef.current?.click(),
5748
+ className: "flex items-center gap-2",
5749
+ children: [
5750
+ /* @__PURE__ */ jsx27(Paperclip2, { size: 18 }),
5751
+ "Trocar"
5752
+ ]
5753
+ }
5754
+ )
5755
+ ] });
5756
+ }
5757
+ return /* @__PURE__ */ jsxs22(
5758
+ Button_default,
5759
+ {
5760
+ type: "button",
5761
+ variant: "outline",
5762
+ size: "small",
5763
+ onClick: () => fileInputRef.current?.click(),
5764
+ className: "flex items-center gap-2",
5765
+ children: [
5766
+ /* @__PURE__ */ jsx27(Paperclip2, { size: 18 }),
5767
+ "Anexar"
5768
+ ]
5769
+ }
5770
+ );
5771
+ };
5681
5772
  if (isObservationSaved) {
5682
5773
  return /* @__PURE__ */ jsxs22("div", { className: "bg-background border border-border-100 rounded-lg p-4 space-y-2", children: [
5683
5774
  /* @__PURE__ */ jsxs22("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3", children: [
@@ -5693,6 +5784,25 @@ var CorrectActivityModal = ({
5693
5784
  ),
5694
5785
  /* @__PURE__ */ jsx27("span", { className: "text-base font-medium text-text-800 truncate", children: savedFiles[0].file.name })
5695
5786
  ] }),
5787
+ savedFiles.length === 0 && existingAttachment && /* @__PURE__ */ jsxs22(
5788
+ "a",
5789
+ {
5790
+ href: existingAttachment,
5791
+ target: "_blank",
5792
+ rel: "noopener noreferrer",
5793
+ 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",
5794
+ children: [
5795
+ /* @__PURE__ */ jsx27(
5796
+ Paperclip2,
5797
+ {
5798
+ size: 18,
5799
+ className: "text-text-800 flex-shrink-0"
5800
+ }
5801
+ ),
5802
+ /* @__PURE__ */ jsx27("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
5803
+ ]
5804
+ }
5805
+ ),
5696
5806
  /* @__PURE__ */ jsxs22(
5697
5807
  Button_default,
5698
5808
  {
@@ -5743,40 +5853,14 @@ var CorrectActivityModal = ({
5743
5853
  }
5744
5854
  ),
5745
5855
  /* @__PURE__ */ jsxs22("div", { className: "flex flex-col-reverse sm:flex-row gap-3 sm:justify-between", children: [
5746
- attachedFiles.length > 0 ? /* @__PURE__ */ jsxs22("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: [
5747
- /* @__PURE__ */ jsx27(Paperclip2, { size: 18, className: "text-text-800 flex-shrink-0" }),
5748
- /* @__PURE__ */ jsx27("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
5749
- /* @__PURE__ */ jsx27(
5750
- "button",
5751
- {
5752
- type: "button",
5753
- onClick: () => handleFileRemove(attachedFiles[0].id),
5754
- className: "text-text-700 hover:text-text-800 flex-shrink-0",
5755
- "aria-label": `Remover ${attachedFiles[0].file.name}`,
5756
- children: /* @__PURE__ */ jsx27(X4, { size: 18 })
5757
- }
5758
- )
5759
- ] }) : /* @__PURE__ */ jsxs22(
5760
- Button_default,
5761
- {
5762
- type: "button",
5763
- variant: "outline",
5764
- size: "small",
5765
- onClick: () => fileInputRef.current?.click(),
5766
- className: "flex items-center gap-2",
5767
- children: [
5768
- /* @__PURE__ */ jsx27(Paperclip2, { size: 18 }),
5769
- "Anexar"
5770
- ]
5771
- }
5772
- ),
5856
+ renderAttachmentInput(),
5773
5857
  /* @__PURE__ */ jsx27(
5774
5858
  Button_default,
5775
5859
  {
5776
5860
  type: "button",
5777
5861
  size: "small",
5778
5862
  onClick: handleSaveObservation,
5779
- disabled: !observation.trim() && attachedFiles.length === 0,
5863
+ disabled: !observation.trim() && attachedFiles.length === 0 && !existingAttachment,
5780
5864
  children: "Salvar"
5781
5865
  }
5782
5866
  )
@@ -5802,8 +5886,8 @@ var CorrectActivityModal = ({
5802
5886
  contentClassName: "max-h-[80vh] overflow-y-auto",
5803
5887
  children: /* @__PURE__ */ jsxs22("div", { className: "space-y-6", children: [
5804
5888
  /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-3", children: [
5805
- /* @__PURE__ */ jsx27("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx27(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName.charAt(0).toUpperCase() }) }),
5806
- /* @__PURE__ */ jsx27(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName })
5889
+ /* @__PURE__ */ jsx27("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx27(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName?.charAt(0).toUpperCase() || "-" }) }),
5890
+ /* @__PURE__ */ jsx27(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName || "Aluno" })
5807
5891
  ] }),
5808
5892
  /* @__PURE__ */ jsxs22("div", { className: "grid grid-cols-3 gap-4", children: [
5809
5893
  /* @__PURE__ */ jsx27(StatCard, { label: "Nota", value: formattedScore, variant: "score" }),
@@ -5827,7 +5911,7 @@ var CorrectActivityModal = ({
5827
5911
  renderObservationSection(),
5828
5912
  /* @__PURE__ */ jsxs22("div", { className: "space-y-2", children: [
5829
5913
  /* @__PURE__ */ jsx27(Text_default, { className: "text-sm font-bold text-text-950", children: "Respostas" }),
5830
- /* @__PURE__ */ jsx27(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions.map((question) => {
5914
+ /* @__PURE__ */ jsx27(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions?.map((question) => {
5831
5915
  const badgeConfig = getQuestionStatusBadgeConfig(question.status);
5832
5916
  return /* @__PURE__ */ jsx27(
5833
5917
  CardAccordation,
@@ -7259,7 +7343,11 @@ var ActivityDetails = ({
7259
7343
  setIsViewOnlyModal(isViewOnly);
7260
7344
  setCorrectionError(null);
7261
7345
  try {
7262
- const correction = await fetchStudentCorrection(activityId, studentId);
7346
+ const correction = await fetchStudentCorrection(
7347
+ activityId,
7348
+ studentId,
7349
+ student.studentName || "Aluno"
7350
+ );
7263
7351
  setCorrectionData(correction);
7264
7352
  setIsModalOpen(true);
7265
7353
  } catch (err) {
@@ -7275,21 +7363,15 @@ var ActivityDetails = ({
7275
7363
  setIsModalOpen(false);
7276
7364
  }, []);
7277
7365
  const handleObservationSubmit = useCallback3(
7278
- async (observation, files) => {
7279
- if (!activityId || !correctionData?.studentId) return;
7366
+ async (studentId, observation, files) => {
7367
+ if (!activityId || !studentId) return;
7280
7368
  try {
7281
- await submitObservation(
7282
- activityId,
7283
- correctionData.studentId,
7284
- observation,
7285
- files
7286
- );
7287
- setIsModalOpen(false);
7369
+ await submitObservation(activityId, studentId, observation, files);
7288
7370
  } catch (err) {
7289
7371
  console.error("Failed to submit observation:", err);
7290
7372
  }
7291
7373
  },
7292
- [activityId, correctionData?.studentId, submitObservation]
7374
+ [activityId, submitObservation]
7293
7375
  );
7294
7376
  const tableData = useMemo6(() => {
7295
7377
  if (!data?.students) return [];