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.
Files changed (31) 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.js +137 -51
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +137 -51
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/types/studentActivityCorrection.d.ts +5 -0
  30. package/dist/types/studentActivityCorrection.d.ts.map +1 -1
  31. package/package.json +1 -1
@@ -3321,7 +3321,9 @@ var generateFileId = () => {
3321
3321
  var QUESTION_STATUS = {
3322
3322
  CORRETA: "CORRETA",
3323
3323
  INCORRETA: "INCORRETA",
3324
- EM_BRANCO: "EM_BRANCO"
3324
+ EM_BRANCO: "EM_BRANCO",
3325
+ /** Reserved for future use - pending teacher evaluation for essay questions */
3326
+ PENDENTE: "PENDENTE"
3325
3327
  };
3326
3328
  var getQuestionStatusBadgeConfig = (status) => {
3327
3329
  const configs = {
@@ -3339,6 +3341,11 @@ var getQuestionStatusBadgeConfig = (status) => {
3339
3341
  label: "Em branco",
3340
3342
  bgColor: "bg-gray-100",
3341
3343
  textColor: "text-gray-600"
3344
+ },
3345
+ [QUESTION_STATUS.PENDENTE]: {
3346
+ label: "Pendente",
3347
+ bgColor: "bg-warning-background",
3348
+ textColor: "text-warning-800"
3342
3349
  }
3343
3350
  };
3344
3351
  return configs[status];
@@ -3422,17 +3429,26 @@ var CorrectActivityModal = ({
3422
3429
  const [savedObservation, setSavedObservation] = useState6("");
3423
3430
  const [attachedFiles, setAttachedFiles] = useState6([]);
3424
3431
  const [savedFiles, setSavedFiles] = useState6([]);
3432
+ const [existingAttachment, setExistingAttachment] = useState6(
3433
+ null
3434
+ );
3425
3435
  const fileInputRef = useRef5(null);
3426
3436
  useEffect6(() => {
3427
3437
  if (isOpen) {
3428
3438
  setObservation("");
3429
3439
  setIsObservationExpanded(false);
3430
- setIsObservationSaved(false);
3431
- setSavedObservation("");
3432
3440
  setAttachedFiles([]);
3433
3441
  setSavedFiles([]);
3442
+ setExistingAttachment(data?.attachment ?? null);
3443
+ if (data?.observation || data?.attachment) {
3444
+ setIsObservationSaved(true);
3445
+ setSavedObservation(data.observation || "");
3446
+ } else {
3447
+ setIsObservationSaved(false);
3448
+ setSavedObservation("");
3449
+ }
3434
3450
  }
3435
- }, [isOpen, data?.studentId]);
3451
+ }, [isOpen, data?.studentId, data?.observation, data?.attachment]);
3436
3452
  const handleOpenObservation = () => {
3437
3453
  setIsObservationExpanded(true);
3438
3454
  };
@@ -3446,12 +3462,16 @@ var CorrectActivityModal = ({
3446
3462
  setAttachedFiles((prev) => prev.filter((f) => f.id !== id));
3447
3463
  };
3448
3464
  const handleSaveObservation = () => {
3449
- if (observation.trim() || attachedFiles.length > 0) {
3465
+ if (observation.trim() || attachedFiles.length > 0 || existingAttachment) {
3466
+ if (!data?.studentId) {
3467
+ return;
3468
+ }
3450
3469
  setSavedObservation(observation);
3451
3470
  setSavedFiles([...attachedFiles]);
3452
3471
  setIsObservationSaved(true);
3453
3472
  setIsObservationExpanded(false);
3454
3473
  onObservationSubmit?.(
3474
+ data.studentId,
3455
3475
  observation,
3456
3476
  attachedFiles.map((f) => f.file)
3457
3477
  );
@@ -3465,9 +3485,80 @@ var CorrectActivityModal = ({
3465
3485
  };
3466
3486
  if (!data) return null;
3467
3487
  const title = isViewOnly ? "Detalhes da atividade" : "Corrigir atividade";
3468
- const formattedScore = data.score === null ? "-" : data.score.toFixed(1);
3488
+ const formattedScore = data.score == null ? "-" : data.score.toFixed(1);
3469
3489
  const renderObservationSection = () => {
3470
- if (isViewOnly) return null;
3490
+ const getFileNameFromUrl = (url) => {
3491
+ try {
3492
+ const urlObj = new URL(url);
3493
+ const urlPath = urlObj.pathname;
3494
+ return urlPath.split("/").pop() || "Anexo";
3495
+ } catch {
3496
+ return "Anexo";
3497
+ }
3498
+ };
3499
+ const renderAttachmentInput = () => {
3500
+ if (attachedFiles.length > 0) {
3501
+ return /* @__PURE__ */ jsxs13("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: [
3502
+ /* @__PURE__ */ jsx16(Paperclip2, { size: 18, className: "text-text-800 flex-shrink-0" }),
3503
+ /* @__PURE__ */ jsx16("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
3504
+ /* @__PURE__ */ jsx16(
3505
+ "button",
3506
+ {
3507
+ type: "button",
3508
+ onClick: () => handleFileRemove(attachedFiles[0].id),
3509
+ className: "text-text-700 hover:text-text-800 flex-shrink-0",
3510
+ "aria-label": `Remover ${attachedFiles[0].file.name}`,
3511
+ children: /* @__PURE__ */ jsx16(X3, { size: 18 })
3512
+ }
3513
+ )
3514
+ ] });
3515
+ }
3516
+ if (existingAttachment) {
3517
+ return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
3518
+ /* @__PURE__ */ jsxs13(
3519
+ "a",
3520
+ {
3521
+ href: existingAttachment,
3522
+ target: "_blank",
3523
+ rel: "noopener noreferrer",
3524
+ 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",
3525
+ children: [
3526
+ /* @__PURE__ */ jsx16(Paperclip2, { size: 18, className: "text-text-800 flex-shrink-0" }),
3527
+ /* @__PURE__ */ jsx16("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
3528
+ ]
3529
+ }
3530
+ ),
3531
+ /* @__PURE__ */ jsxs13(
3532
+ Button_default,
3533
+ {
3534
+ type: "button",
3535
+ variant: "outline",
3536
+ size: "small",
3537
+ onClick: () => fileInputRef.current?.click(),
3538
+ className: "flex items-center gap-2",
3539
+ children: [
3540
+ /* @__PURE__ */ jsx16(Paperclip2, { size: 18 }),
3541
+ "Trocar"
3542
+ ]
3543
+ }
3544
+ )
3545
+ ] });
3546
+ }
3547
+ return /* @__PURE__ */ jsxs13(
3548
+ Button_default,
3549
+ {
3550
+ type: "button",
3551
+ variant: "outline",
3552
+ size: "small",
3553
+ onClick: () => fileInputRef.current?.click(),
3554
+ className: "flex items-center gap-2",
3555
+ children: [
3556
+ /* @__PURE__ */ jsx16(Paperclip2, { size: 18 }),
3557
+ "Anexar"
3558
+ ]
3559
+ }
3560
+ );
3561
+ };
3471
3562
  if (isObservationSaved) {
3472
3563
  return /* @__PURE__ */ jsxs13("div", { className: "bg-background border border-border-100 rounded-lg p-4 space-y-2", children: [
3473
3564
  /* @__PURE__ */ jsxs13("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3", children: [
@@ -3483,6 +3574,25 @@ var CorrectActivityModal = ({
3483
3574
  ),
3484
3575
  /* @__PURE__ */ jsx16("span", { className: "text-base font-medium text-text-800 truncate", children: savedFiles[0].file.name })
3485
3576
  ] }),
3577
+ savedFiles.length === 0 && existingAttachment && /* @__PURE__ */ jsxs13(
3578
+ "a",
3579
+ {
3580
+ href: existingAttachment,
3581
+ target: "_blank",
3582
+ rel: "noopener noreferrer",
3583
+ 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",
3584
+ children: [
3585
+ /* @__PURE__ */ jsx16(
3586
+ Paperclip2,
3587
+ {
3588
+ size: 18,
3589
+ className: "text-text-800 flex-shrink-0"
3590
+ }
3591
+ ),
3592
+ /* @__PURE__ */ jsx16("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
3593
+ ]
3594
+ }
3595
+ ),
3486
3596
  /* @__PURE__ */ jsxs13(
3487
3597
  Button_default,
3488
3598
  {
@@ -3533,40 +3643,14 @@ var CorrectActivityModal = ({
3533
3643
  }
3534
3644
  ),
3535
3645
  /* @__PURE__ */ jsxs13("div", { className: "flex flex-col-reverse sm:flex-row gap-3 sm:justify-between", children: [
3536
- attachedFiles.length > 0 ? /* @__PURE__ */ jsxs13("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: [
3537
- /* @__PURE__ */ jsx16(Paperclip2, { size: 18, className: "text-text-800 flex-shrink-0" }),
3538
- /* @__PURE__ */ jsx16("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
3539
- /* @__PURE__ */ jsx16(
3540
- "button",
3541
- {
3542
- type: "button",
3543
- onClick: () => handleFileRemove(attachedFiles[0].id),
3544
- className: "text-text-700 hover:text-text-800 flex-shrink-0",
3545
- "aria-label": `Remover ${attachedFiles[0].file.name}`,
3546
- children: /* @__PURE__ */ jsx16(X3, { size: 18 })
3547
- }
3548
- )
3549
- ] }) : /* @__PURE__ */ jsxs13(
3550
- Button_default,
3551
- {
3552
- type: "button",
3553
- variant: "outline",
3554
- size: "small",
3555
- onClick: () => fileInputRef.current?.click(),
3556
- className: "flex items-center gap-2",
3557
- children: [
3558
- /* @__PURE__ */ jsx16(Paperclip2, { size: 18 }),
3559
- "Anexar"
3560
- ]
3561
- }
3562
- ),
3646
+ renderAttachmentInput(),
3563
3647
  /* @__PURE__ */ jsx16(
3564
3648
  Button_default,
3565
3649
  {
3566
3650
  type: "button",
3567
3651
  size: "small",
3568
3652
  onClick: handleSaveObservation,
3569
- disabled: !observation.trim() && attachedFiles.length === 0,
3653
+ disabled: !observation.trim() && attachedFiles.length === 0 && !existingAttachment,
3570
3654
  children: "Salvar"
3571
3655
  }
3572
3656
  )
@@ -3592,8 +3676,8 @@ var CorrectActivityModal = ({
3592
3676
  contentClassName: "max-h-[80vh] overflow-y-auto",
3593
3677
  children: /* @__PURE__ */ jsxs13("div", { className: "space-y-6", children: [
3594
3678
  /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
3595
- /* @__PURE__ */ jsx16("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx16(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName.charAt(0).toUpperCase() }) }),
3596
- /* @__PURE__ */ jsx16(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName })
3679
+ /* @__PURE__ */ jsx16("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx16(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName?.charAt(0).toUpperCase() || "-" }) }),
3680
+ /* @__PURE__ */ jsx16(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName || "Aluno" })
3597
3681
  ] }),
3598
3682
  /* @__PURE__ */ jsxs13("div", { className: "grid grid-cols-3 gap-4", children: [
3599
3683
  /* @__PURE__ */ jsx16(StatCard, { label: "Nota", value: formattedScore, variant: "score" }),
@@ -3617,7 +3701,7 @@ var CorrectActivityModal = ({
3617
3701
  renderObservationSection(),
3618
3702
  /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
3619
3703
  /* @__PURE__ */ jsx16(Text_default, { className: "text-sm font-bold text-text-950", children: "Respostas" }),
3620
- /* @__PURE__ */ jsx16(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions.map((question) => {
3704
+ /* @__PURE__ */ jsx16(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions?.map((question) => {
3621
3705
  const badgeConfig = getQuestionStatusBadgeConfig(question.status);
3622
3706
  return /* @__PURE__ */ jsx16(
3623
3707
  CardAccordation,