analytica-frontend-lib 1.2.50 → 1.2.52
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.css +19387 -0
- package/dist/ActivitiesHistory/index.css.map +1 -0
- package/dist/ActivitiesHistory/index.d.ts +2 -0
- package/dist/ActivitiesHistory/index.d.ts.map +1 -0
- package/dist/ActivitiesHistory/index.js +7381 -0
- package/dist/ActivitiesHistory/index.js.map +1 -0
- package/dist/ActivitiesHistory/index.mjs +7424 -0
- package/dist/ActivitiesHistory/index.mjs.map +1 -0
- package/dist/ActivityCardQuestionBanks/index.css +25 -0
- package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.css +25 -0
- package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
- package/dist/ActivityDetails/index.css +25 -0
- package/dist/ActivityDetails/index.css.map +1 -1
- package/dist/ActivityFilters/index.css +25 -0
- package/dist/ActivityFilters/index.css.map +1 -1
- package/dist/ActivityPreview/index.css +25 -0
- package/dist/ActivityPreview/index.css.map +1 -1
- package/dist/AlertManager/index.css +25 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.css +25 -0
- package/dist/RecommendedLessonsHistory/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.js +10 -2
- package/dist/RecommendedLessonsHistory/index.js.map +1 -1
- package/dist/RecommendedLessonsHistory/index.mjs +10 -2
- package/dist/RecommendedLessonsHistory/index.mjs.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.css +25 -0
- package/dist/SendActivityModal/SendActivityModal.css.map +1 -1
- package/dist/SendActivityModal/index.css +25 -0
- package/dist/SendActivityModal/index.css.map +1 -1
- package/dist/TableProvider/index.css +25 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/hooks/useActivitiesHistory/index.d.ts +210 -0
- package/dist/hooks/useActivitiesHistory/index.d.ts.map +1 -0
- package/dist/hooks/useActivitiesHistory/index.js +181 -0
- package/dist/hooks/useActivitiesHistory/index.js.map +1 -0
- package/dist/hooks/useActivitiesHistory/index.mjs +141 -0
- package/dist/hooks/useActivitiesHistory/index.mjs.map +1 -0
- package/dist/hooks/useActivitiesHistory.d.ts +210 -0
- package/dist/hooks/useActivitiesHistory.d.ts.map +1 -0
- package/dist/hooks/useActivityModels/index.d.ts +220 -0
- package/dist/hooks/useActivityModels/index.d.ts.map +1 -0
- package/dist/hooks/useActivityModels/index.js +186 -0
- package/dist/hooks/useActivityModels/index.js.map +1 -0
- package/dist/hooks/useActivityModels/index.mjs +146 -0
- package/dist/hooks/useActivityModels/index.mjs.map +1 -0
- package/dist/hooks/useActivityModels.d.ts +220 -0
- package/dist/hooks/useActivityModels.d.ts.map +1 -0
- package/dist/index.css +25 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1369 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1350 -37
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +25 -0
- package/dist/styles.css.map +1 -1
- package/dist/types/activitiesHistory/index.d.ts +196 -0
- package/dist/types/activitiesHistory/index.d.ts.map +1 -0
- package/dist/types/activitiesHistory/index.js +92 -0
- package/dist/types/activitiesHistory/index.js.map +1 -0
- package/dist/types/activitiesHistory/index.mjs +59 -0
- package/dist/types/activitiesHistory/index.mjs.map +1 -0
- package/dist/types/activitiesHistory.d.ts +196 -0
- package/dist/types/activitiesHistory.d.ts.map +1 -0
- package/dist/types/common.d.ts +44 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/recommendedLessons/index.d.ts +10 -18
- package/dist/types/recommendedLessons/index.d.ts.map +1 -1
- package/dist/types/recommendedLessons/index.js +27 -22
- package/dist/types/recommendedLessons/index.js.map +1 -1
- package/dist/types/recommendedLessons/index.mjs +26 -23
- package/dist/types/recommendedLessons/index.mjs.map +1 -1
- package/dist/types/recommendedLessons.d.ts +10 -18
- package/dist/types/recommendedLessons.d.ts.map +1 -1
- package/dist/utils/hookErrorHandler.d.ts +24 -0
- package/dist/utils/hookErrorHandler.d.ts.map +1 -0
- package/package.json +7 -1
- package/dist/RecommendedLessonDetails/index.d.ts +0 -4
- package/dist/RecommendedLessonDetails/index.d.ts.map +0 -1
- package/dist/RecommendedLessonDetails/index.js +0 -2250
- package/dist/RecommendedLessonDetails/index.js.map +0 -1
- package/dist/RecommendedLessonDetails/index.mjs +0 -2242
- package/dist/RecommendedLessonDetails/index.mjs.map +0 -1
- package/dist/hooks/useRecommendedLessonDetails/index.d.ts +0 -780
- package/dist/hooks/useRecommendedLessonDetails/index.d.ts.map +0 -1
- package/dist/hooks/useRecommendedLessonDetails/index.js +0 -204
- package/dist/hooks/useRecommendedLessonDetails/index.js.map +0 -1
- package/dist/hooks/useRecommendedLessonDetails/index.mjs +0 -174
- package/dist/hooks/useRecommendedLessonDetails/index.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4985,6 +4985,11 @@ var Toaster = () => {
|
|
|
4985
4985
|
toast.id
|
|
4986
4986
|
)) });
|
|
4987
4987
|
};
|
|
4988
|
+
var useToast = () => {
|
|
4989
|
+
const addToast = ToastStore_default((state) => state.addToast);
|
|
4990
|
+
const removeToast = ToastStore_default((state) => state.removeToast);
|
|
4991
|
+
return { addToast, removeToast };
|
|
4992
|
+
};
|
|
4988
4993
|
var Toaster_default = Toaster;
|
|
4989
4994
|
|
|
4990
4995
|
// src/components/Search/Search.tsx
|
|
@@ -22421,26 +22426,26 @@ var SendActivityModal_default = SendActivityModal;
|
|
|
22421
22426
|
import { useState as useState44, useCallback as useCallback20, useMemo as useMemo25, useRef as useRef25 } from "react";
|
|
22422
22427
|
import { Plus as Plus3, CaretRight as CaretRight10, Trash as Trash2, PencilSimple as PencilSimple2 } from "phosphor-react";
|
|
22423
22428
|
|
|
22424
|
-
// src/types/
|
|
22425
|
-
var
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
return
|
|
22430
|
-
})(
|
|
22431
|
-
var
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
return
|
|
22436
|
-
})(
|
|
22437
|
-
var
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
return
|
|
22442
|
-
})(
|
|
22443
|
-
var
|
|
22429
|
+
// src/types/common.ts
|
|
22430
|
+
var GenericApiStatus = /* @__PURE__ */ ((GenericApiStatus2) => {
|
|
22431
|
+
GenericApiStatus2["A_VENCER"] = "A_VENCER";
|
|
22432
|
+
GenericApiStatus2["VENCIDA"] = "VENCIDA";
|
|
22433
|
+
GenericApiStatus2["CONCLUIDA"] = "CONCLUIDA";
|
|
22434
|
+
return GenericApiStatus2;
|
|
22435
|
+
})(GenericApiStatus || {});
|
|
22436
|
+
var GenericDisplayStatus = /* @__PURE__ */ ((GenericDisplayStatus4) => {
|
|
22437
|
+
GenericDisplayStatus4["ATIVA"] = "ATIVA";
|
|
22438
|
+
GenericDisplayStatus4["VENCIDA"] = "VENCIDA";
|
|
22439
|
+
GenericDisplayStatus4["CONCLUIDA"] = "CONCLU\xCDDA";
|
|
22440
|
+
return GenericDisplayStatus4;
|
|
22441
|
+
})(GenericDisplayStatus || {});
|
|
22442
|
+
var BadgeActionType = /* @__PURE__ */ ((BadgeActionType4) => {
|
|
22443
|
+
BadgeActionType4["SUCCESS"] = "success";
|
|
22444
|
+
BadgeActionType4["WARNING"] = "warning";
|
|
22445
|
+
BadgeActionType4["ERROR"] = "error";
|
|
22446
|
+
return BadgeActionType4;
|
|
22447
|
+
})(BadgeActionType || {});
|
|
22448
|
+
var getStatusBadgeAction2 = (status) => {
|
|
22444
22449
|
const actionMap = {
|
|
22445
22450
|
["CONCLU\xCDDA" /* CONCLUIDA */]: "success" /* SUCCESS */,
|
|
22446
22451
|
["ATIVA" /* ATIVA */]: "warning" /* WARNING */,
|
|
@@ -22448,6 +22453,17 @@ var getGoalStatusBadgeAction = (status) => {
|
|
|
22448
22453
|
};
|
|
22449
22454
|
return actionMap[status] ?? "warning" /* WARNING */;
|
|
22450
22455
|
};
|
|
22456
|
+
var mapApiStatusToDisplay = (apiStatus) => {
|
|
22457
|
+
const statusMap = {
|
|
22458
|
+
["A_VENCER" /* A_VENCER */]: "ATIVA" /* ATIVA */,
|
|
22459
|
+
["VENCIDA" /* VENCIDA */]: "VENCIDA" /* VENCIDA */,
|
|
22460
|
+
["CONCLUIDA" /* CONCLUIDA */]: "CONCLU\xCDDA" /* CONCLUIDA */
|
|
22461
|
+
};
|
|
22462
|
+
return statusMap[apiStatus];
|
|
22463
|
+
};
|
|
22464
|
+
|
|
22465
|
+
// src/types/recommendedLessons.ts
|
|
22466
|
+
var getGoalStatusBadgeAction = (status) => getStatusBadgeAction2(status);
|
|
22451
22467
|
var GOAL_FILTER_STATUS_OPTIONS = [
|
|
22452
22468
|
{ id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
|
|
22453
22469
|
{ id: "A_VENCER" /* A_VENCER */, name: "Ativa" }
|
|
@@ -23125,7 +23141,7 @@ var RecommendedLessonsHistory = ({
|
|
|
23125
23141
|
};
|
|
23126
23142
|
|
|
23127
23143
|
// src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
|
|
23128
|
-
import { useMemo as
|
|
23144
|
+
import { useMemo as useMemo27 } from "react";
|
|
23129
23145
|
|
|
23130
23146
|
// src/components/RecommendedLessonDetails/components/Breadcrumb.tsx
|
|
23131
23147
|
import { CaretRightIcon as CaretRightIcon2 } from "@phosphor-icons/react";
|
|
@@ -23442,6 +23458,16 @@ var StudentsTable = ({
|
|
|
23442
23458
|
] }) });
|
|
23443
23459
|
};
|
|
23444
23460
|
|
|
23461
|
+
// src/components/RecommendedLessonDetails/components/StudentPerformanceModal.tsx
|
|
23462
|
+
import { useMemo as useMemo26 } from "react";
|
|
23463
|
+
import {
|
|
23464
|
+
LightbulbFilamentIcon,
|
|
23465
|
+
WarningCircleIcon as WarningCircleIcon2,
|
|
23466
|
+
UserIcon as UserIcon2,
|
|
23467
|
+
CheckCircleIcon,
|
|
23468
|
+
XCircleIcon
|
|
23469
|
+
} from "@phosphor-icons/react";
|
|
23470
|
+
|
|
23445
23471
|
// src/components/RecommendedLessonDetails/types.ts
|
|
23446
23472
|
var DEFAULT_LABELS = {
|
|
23447
23473
|
viewLesson: "Ver aula",
|
|
@@ -23455,9 +23481,285 @@ var DEFAULT_LABELS = {
|
|
|
23455
23481
|
completionColumn: "Conclus\xE3o",
|
|
23456
23482
|
durationColumn: "Dura\xE7\xE3o"
|
|
23457
23483
|
};
|
|
23484
|
+
var DEFAULT_PERFORMANCE_LABELS = {
|
|
23485
|
+
title: "Desempenho",
|
|
23486
|
+
correctAnswersLabel: "N\xB0 DE QUEST\xD5ES CORRETAS",
|
|
23487
|
+
incorrectAnswersLabel: "N\xB0 DE QUEST\xD5ES INCORRETAS",
|
|
23488
|
+
bestResultLabel: "MELHOR RESULTADO",
|
|
23489
|
+
hardestTopicLabel: "MAIOR DIFICULDADE",
|
|
23490
|
+
lessonsTitle: "Aulas"
|
|
23491
|
+
};
|
|
23458
23492
|
|
|
23459
|
-
// src/components/RecommendedLessonDetails/
|
|
23493
|
+
// src/components/RecommendedLessonDetails/components/StudentPerformanceModal.tsx
|
|
23460
23494
|
import { jsx as jsx93, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
23495
|
+
var PerformanceCard = ({
|
|
23496
|
+
icon,
|
|
23497
|
+
label,
|
|
23498
|
+
value,
|
|
23499
|
+
secondaryLabel,
|
|
23500
|
+
secondaryValue,
|
|
23501
|
+
variant
|
|
23502
|
+
}) => {
|
|
23503
|
+
const headerBgColor = {
|
|
23504
|
+
success: "bg-success-200",
|
|
23505
|
+
error: "bg-error-100"
|
|
23506
|
+
}[variant];
|
|
23507
|
+
const valueColor = {
|
|
23508
|
+
success: "text-success-700",
|
|
23509
|
+
error: "text-error-700"
|
|
23510
|
+
}[variant];
|
|
23511
|
+
const iconBgColor = {
|
|
23512
|
+
success: "bg-warning-300",
|
|
23513
|
+
error: "bg-error-300"
|
|
23514
|
+
}[variant];
|
|
23515
|
+
const secondaryLabelColor = {
|
|
23516
|
+
success: "text-success-600",
|
|
23517
|
+
error: "text-error-600"
|
|
23518
|
+
}[variant];
|
|
23519
|
+
return /* @__PURE__ */ jsxs76("div", { className: "flex flex-col rounded-xl border border-border-50 bg-background overflow-hidden", children: [
|
|
23520
|
+
/* @__PURE__ */ jsxs76(
|
|
23521
|
+
"div",
|
|
23522
|
+
{
|
|
23523
|
+
className: `flex flex-col items-center justify-center p-4 gap-1 ${headerBgColor}`,
|
|
23524
|
+
children: [
|
|
23525
|
+
/* @__PURE__ */ jsx93(
|
|
23526
|
+
Text_default,
|
|
23527
|
+
{
|
|
23528
|
+
as: "span",
|
|
23529
|
+
className: `size-8 rounded-full flex items-center justify-center ${iconBgColor}`,
|
|
23530
|
+
children: icon
|
|
23531
|
+
}
|
|
23532
|
+
),
|
|
23533
|
+
/* @__PURE__ */ jsx93(
|
|
23534
|
+
Text_default,
|
|
23535
|
+
{
|
|
23536
|
+
size: "2xs",
|
|
23537
|
+
weight: "medium",
|
|
23538
|
+
className: "text-text-800 uppercase text-center leading-none",
|
|
23539
|
+
children: label
|
|
23540
|
+
}
|
|
23541
|
+
),
|
|
23542
|
+
/* @__PURE__ */ jsx93(Text_default, { size: "xl", weight: "bold", className: `${valueColor} text-center`, children: value })
|
|
23543
|
+
]
|
|
23544
|
+
}
|
|
23545
|
+
),
|
|
23546
|
+
/* @__PURE__ */ jsxs76("div", { className: "flex flex-col items-center gap-2 px-4 py-3", children: [
|
|
23547
|
+
/* @__PURE__ */ jsx93(
|
|
23548
|
+
Text_default,
|
|
23549
|
+
{
|
|
23550
|
+
size: "2xs",
|
|
23551
|
+
weight: "medium",
|
|
23552
|
+
className: `${secondaryLabelColor} uppercase text-center`,
|
|
23553
|
+
children: secondaryLabel
|
|
23554
|
+
}
|
|
23555
|
+
),
|
|
23556
|
+
/* @__PURE__ */ jsx93(Badge_default, { size: "large", action: "info", children: secondaryValue || "-" })
|
|
23557
|
+
] })
|
|
23558
|
+
] });
|
|
23559
|
+
};
|
|
23560
|
+
var getAlternativeStatus = (isCorrect, isSelected) => {
|
|
23561
|
+
if (isCorrect) {
|
|
23562
|
+
return "correct";
|
|
23563
|
+
}
|
|
23564
|
+
if (isSelected) {
|
|
23565
|
+
return "incorrect";
|
|
23566
|
+
}
|
|
23567
|
+
return void 0;
|
|
23568
|
+
};
|
|
23569
|
+
var mapAlternatives = (question) => {
|
|
23570
|
+
return question.alternatives.map((alt) => ({
|
|
23571
|
+
value: alt.id,
|
|
23572
|
+
label: alt.text,
|
|
23573
|
+
status: getAlternativeStatus(alt.isCorrect, alt.isSelected)
|
|
23574
|
+
}));
|
|
23575
|
+
};
|
|
23576
|
+
var getSelectedValue = (question) => {
|
|
23577
|
+
const selected = question.alternatives.find((alt) => alt.isSelected);
|
|
23578
|
+
return selected?.id;
|
|
23579
|
+
};
|
|
23580
|
+
var QuestionAccordionItem = ({
|
|
23581
|
+
question,
|
|
23582
|
+
index
|
|
23583
|
+
}) => /* @__PURE__ */ jsx93(
|
|
23584
|
+
CardAccordation,
|
|
23585
|
+
{
|
|
23586
|
+
value: question.id,
|
|
23587
|
+
className: "bg-background rounded-xl border border-border-50",
|
|
23588
|
+
triggerClassName: "py-5 px-5",
|
|
23589
|
+
contentClassName: "px-5 pb-5",
|
|
23590
|
+
trigger: /* @__PURE__ */ jsxs76("div", { className: "flex items-center justify-between flex-1", children: [
|
|
23591
|
+
/* @__PURE__ */ jsxs76(Text_default, { size: "sm", weight: "semibold", className: "text-text-950", children: [
|
|
23592
|
+
"Quest\xE3o ",
|
|
23593
|
+
index + 1
|
|
23594
|
+
] }),
|
|
23595
|
+
/* @__PURE__ */ jsx93(
|
|
23596
|
+
Badge_default,
|
|
23597
|
+
{
|
|
23598
|
+
size: "small",
|
|
23599
|
+
action: question.isCorrect ? "success" : "error",
|
|
23600
|
+
variant: "solid",
|
|
23601
|
+
iconLeft: question.isCorrect ? /* @__PURE__ */ jsx93(CheckCircleIcon, {}) : /* @__PURE__ */ jsx93(XCircleIcon, {}),
|
|
23602
|
+
children: question.isCorrect ? "Correta" : "Incorreta"
|
|
23603
|
+
}
|
|
23604
|
+
)
|
|
23605
|
+
] }),
|
|
23606
|
+
children: /* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-3", children: [
|
|
23607
|
+
/* @__PURE__ */ jsx93(Text_default, { size: "sm", className: "text-text-700", children: question.statement }),
|
|
23608
|
+
/* @__PURE__ */ jsx93(
|
|
23609
|
+
CardAccordation,
|
|
23610
|
+
{
|
|
23611
|
+
value: `${question.id}-alternatives`,
|
|
23612
|
+
className: "bg-background rounded-lg border border-border-50",
|
|
23613
|
+
triggerClassName: "py-5 px-5",
|
|
23614
|
+
contentClassName: "px-5 py-5",
|
|
23615
|
+
trigger: /* @__PURE__ */ jsx93(Text_default, { size: "sm", weight: "medium", className: "text-text-800", children: "Alternativas" }),
|
|
23616
|
+
children: /* @__PURE__ */ jsx93(
|
|
23617
|
+
AlternativesList,
|
|
23618
|
+
{
|
|
23619
|
+
mode: "readonly",
|
|
23620
|
+
alternatives: mapAlternatives(question),
|
|
23621
|
+
selectedValue: getSelectedValue(question),
|
|
23622
|
+
layout: "default"
|
|
23623
|
+
}
|
|
23624
|
+
)
|
|
23625
|
+
}
|
|
23626
|
+
)
|
|
23627
|
+
] })
|
|
23628
|
+
}
|
|
23629
|
+
);
|
|
23630
|
+
var LessonAccordionItem = ({ lesson }) => /* @__PURE__ */ jsx93(
|
|
23631
|
+
CardAccordation,
|
|
23632
|
+
{
|
|
23633
|
+
value: lesson.id,
|
|
23634
|
+
className: "bg-background rounded-xl border border-border-50",
|
|
23635
|
+
triggerClassName: "py-5 px-5",
|
|
23636
|
+
contentClassName: "px-5 pb-5",
|
|
23637
|
+
trigger: /* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-1 flex-1", children: [
|
|
23638
|
+
/* @__PURE__ */ jsx93(Text_default, { size: "sm", weight: "semibold", className: "text-text-950", children: lesson.title }),
|
|
23639
|
+
/* @__PURE__ */ jsx93(
|
|
23640
|
+
ProgressBar_default,
|
|
23641
|
+
{
|
|
23642
|
+
value: lesson.progress,
|
|
23643
|
+
variant: "blue",
|
|
23644
|
+
size: "medium",
|
|
23645
|
+
showPercentage: true,
|
|
23646
|
+
layout: "default"
|
|
23647
|
+
}
|
|
23648
|
+
)
|
|
23649
|
+
] }),
|
|
23650
|
+
children: /* @__PURE__ */ jsx93("div", { className: "flex flex-col gap-2", children: lesson.questions.map((question, index) => /* @__PURE__ */ jsx93(
|
|
23651
|
+
QuestionAccordionItem,
|
|
23652
|
+
{
|
|
23653
|
+
question,
|
|
23654
|
+
index
|
|
23655
|
+
},
|
|
23656
|
+
question.id
|
|
23657
|
+
)) })
|
|
23658
|
+
}
|
|
23659
|
+
);
|
|
23660
|
+
var LoadingSkeleton2 = () => /* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-4 animate-pulse", children: [
|
|
23661
|
+
/* @__PURE__ */ jsx93("div", { className: "h-6 bg-background-200 rounded w-48" }),
|
|
23662
|
+
/* @__PURE__ */ jsxs76("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
23663
|
+
/* @__PURE__ */ jsx93("div", { className: "h-44 bg-background-200 rounded-xl" }),
|
|
23664
|
+
/* @__PURE__ */ jsx93("div", { className: "h-44 bg-background-200 rounded-xl" })
|
|
23665
|
+
] })
|
|
23666
|
+
] });
|
|
23667
|
+
var PerformanceContent = ({
|
|
23668
|
+
data,
|
|
23669
|
+
labels
|
|
23670
|
+
}) => /* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-5", children: [
|
|
23671
|
+
/* @__PURE__ */ jsxs76("div", { className: "flex items-center gap-2", children: [
|
|
23672
|
+
/* @__PURE__ */ jsx93(
|
|
23673
|
+
Text_default,
|
|
23674
|
+
{
|
|
23675
|
+
as: "span",
|
|
23676
|
+
className: "size-8 rounded-full bg-background-100 flex items-center justify-center",
|
|
23677
|
+
children: /* @__PURE__ */ jsx93(UserIcon2, { size: 16, className: "text-text-500" })
|
|
23678
|
+
}
|
|
23679
|
+
),
|
|
23680
|
+
/* @__PURE__ */ jsx93(Text_default, { size: "md", weight: "medium", className: "text-text-950", children: data.studentName })
|
|
23681
|
+
] }),
|
|
23682
|
+
/* @__PURE__ */ jsxs76("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
23683
|
+
/* @__PURE__ */ jsx93(
|
|
23684
|
+
PerformanceCard,
|
|
23685
|
+
{
|
|
23686
|
+
icon: /* @__PURE__ */ jsx93(
|
|
23687
|
+
LightbulbFilamentIcon,
|
|
23688
|
+
{
|
|
23689
|
+
size: 18,
|
|
23690
|
+
weight: "fill",
|
|
23691
|
+
className: "text-white"
|
|
23692
|
+
}
|
|
23693
|
+
),
|
|
23694
|
+
label: labels.correctAnswersLabel,
|
|
23695
|
+
value: data.correctAnswers,
|
|
23696
|
+
secondaryLabel: labels.bestResultLabel,
|
|
23697
|
+
secondaryValue: data.bestResult,
|
|
23698
|
+
variant: "success"
|
|
23699
|
+
}
|
|
23700
|
+
),
|
|
23701
|
+
/* @__PURE__ */ jsx93(
|
|
23702
|
+
PerformanceCard,
|
|
23703
|
+
{
|
|
23704
|
+
icon: /* @__PURE__ */ jsx93(
|
|
23705
|
+
WarningCircleIcon2,
|
|
23706
|
+
{
|
|
23707
|
+
size: 18,
|
|
23708
|
+
weight: "fill",
|
|
23709
|
+
className: "text-error-700"
|
|
23710
|
+
}
|
|
23711
|
+
),
|
|
23712
|
+
label: labels.incorrectAnswersLabel,
|
|
23713
|
+
value: data.incorrectAnswers,
|
|
23714
|
+
secondaryLabel: labels.hardestTopicLabel,
|
|
23715
|
+
secondaryValue: data.hardestTopic,
|
|
23716
|
+
variant: "error"
|
|
23717
|
+
}
|
|
23718
|
+
)
|
|
23719
|
+
] }),
|
|
23720
|
+
data.lessons.length > 0 && /* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-3", children: [
|
|
23721
|
+
/* @__PURE__ */ jsx93(Text_default, { size: "md", weight: "semibold", className: "text-text-950", children: labels.lessonsTitle }),
|
|
23722
|
+
/* @__PURE__ */ jsx93("div", { className: "flex flex-col gap-2", children: data.lessons.map((lesson) => /* @__PURE__ */ jsx93(LessonAccordionItem, { lesson }, lesson.id)) })
|
|
23723
|
+
] })
|
|
23724
|
+
] });
|
|
23725
|
+
var renderModalContent = (loading, data, labels) => {
|
|
23726
|
+
if (loading) {
|
|
23727
|
+
return /* @__PURE__ */ jsx93(LoadingSkeleton2, {});
|
|
23728
|
+
}
|
|
23729
|
+
if (data) {
|
|
23730
|
+
return /* @__PURE__ */ jsx93(PerformanceContent, { data, labels });
|
|
23731
|
+
}
|
|
23732
|
+
return null;
|
|
23733
|
+
};
|
|
23734
|
+
var StudentPerformanceModal = ({
|
|
23735
|
+
isOpen,
|
|
23736
|
+
onClose,
|
|
23737
|
+
data,
|
|
23738
|
+
loading = false,
|
|
23739
|
+
labels: customLabels
|
|
23740
|
+
}) => {
|
|
23741
|
+
const labels = useMemo26(
|
|
23742
|
+
() => ({ ...DEFAULT_PERFORMANCE_LABELS, ...customLabels }),
|
|
23743
|
+
[customLabels]
|
|
23744
|
+
);
|
|
23745
|
+
if (!data && !loading) {
|
|
23746
|
+
return null;
|
|
23747
|
+
}
|
|
23748
|
+
return /* @__PURE__ */ jsx93(
|
|
23749
|
+
Modal_default,
|
|
23750
|
+
{
|
|
23751
|
+
isOpen,
|
|
23752
|
+
onClose,
|
|
23753
|
+
title: labels.title,
|
|
23754
|
+
size: "lg",
|
|
23755
|
+
contentClassName: "max-h-[70vh] overflow-y-auto",
|
|
23756
|
+
children: renderModalContent(loading, data, labels)
|
|
23757
|
+
}
|
|
23758
|
+
);
|
|
23759
|
+
};
|
|
23760
|
+
|
|
23761
|
+
// src/components/RecommendedLessonDetails/RecommendedLessonDetails.tsx
|
|
23762
|
+
import { jsx as jsx94, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
23461
23763
|
var RecommendedLessonDetails = ({
|
|
23462
23764
|
data,
|
|
23463
23765
|
loading = false,
|
|
@@ -23470,11 +23772,11 @@ var RecommendedLessonDetails = ({
|
|
|
23470
23772
|
labels: customLabels,
|
|
23471
23773
|
className
|
|
23472
23774
|
}) => {
|
|
23473
|
-
const labels =
|
|
23775
|
+
const labels = useMemo27(
|
|
23474
23776
|
() => ({ ...DEFAULT_LABELS, ...customLabels }),
|
|
23475
23777
|
[customLabels]
|
|
23476
23778
|
);
|
|
23477
|
-
const defaultBreadcrumbs =
|
|
23779
|
+
const defaultBreadcrumbs = useMemo27(
|
|
23478
23780
|
() => [
|
|
23479
23781
|
{ label: "Aulas recomendadas", path: "/aulas-recomendadas" },
|
|
23480
23782
|
{ label: data?.goal.title || "Detalhes" }
|
|
@@ -23482,7 +23784,7 @@ var RecommendedLessonDetails = ({
|
|
|
23482
23784
|
[data?.goal.title]
|
|
23483
23785
|
);
|
|
23484
23786
|
const breadcrumbItems = breadcrumbs || defaultBreadcrumbs;
|
|
23485
|
-
const displayStudents =
|
|
23787
|
+
const displayStudents = useMemo27(() => {
|
|
23486
23788
|
if (!data?.details.students) return [];
|
|
23487
23789
|
const deadline = data?.goal.finalDate;
|
|
23488
23790
|
return data.details.students.map(
|
|
@@ -23490,17 +23792,17 @@ var RecommendedLessonDetails = ({
|
|
|
23490
23792
|
);
|
|
23491
23793
|
}, [data?.details.students, data?.goal.finalDate]);
|
|
23492
23794
|
if (loading) {
|
|
23493
|
-
return /* @__PURE__ */
|
|
23795
|
+
return /* @__PURE__ */ jsx94(
|
|
23494
23796
|
"div",
|
|
23495
23797
|
{
|
|
23496
23798
|
className: cn("flex flex-col gap-6", className),
|
|
23497
23799
|
"data-testid": "lesson-details-loading",
|
|
23498
|
-
children: /* @__PURE__ */
|
|
23800
|
+
children: /* @__PURE__ */ jsx94(LoadingSkeleton, {})
|
|
23499
23801
|
}
|
|
23500
23802
|
);
|
|
23501
23803
|
}
|
|
23502
23804
|
if (error) {
|
|
23503
|
-
return /* @__PURE__ */
|
|
23805
|
+
return /* @__PURE__ */ jsx94(
|
|
23504
23806
|
"div",
|
|
23505
23807
|
{
|
|
23506
23808
|
className: cn(
|
|
@@ -23508,21 +23810,21 @@ var RecommendedLessonDetails = ({
|
|
|
23508
23810
|
className
|
|
23509
23811
|
),
|
|
23510
23812
|
"data-testid": "lesson-details-error",
|
|
23511
|
-
children: /* @__PURE__ */
|
|
23813
|
+
children: /* @__PURE__ */ jsx94(Text_default, { size: "md", className: "text-error-700", children: error })
|
|
23512
23814
|
}
|
|
23513
23815
|
);
|
|
23514
23816
|
}
|
|
23515
23817
|
if (!data) {
|
|
23516
23818
|
return null;
|
|
23517
23819
|
}
|
|
23518
|
-
return /* @__PURE__ */
|
|
23820
|
+
return /* @__PURE__ */ jsxs77(
|
|
23519
23821
|
"div",
|
|
23520
23822
|
{
|
|
23521
23823
|
className: cn("flex flex-col gap-6", className),
|
|
23522
23824
|
"data-testid": "recommended-lesson-details",
|
|
23523
23825
|
children: [
|
|
23524
|
-
/* @__PURE__ */
|
|
23525
|
-
/* @__PURE__ */
|
|
23826
|
+
/* @__PURE__ */ jsx94(Breadcrumb, { items: breadcrumbItems, onItemClick: onBreadcrumbClick }),
|
|
23827
|
+
/* @__PURE__ */ jsx94(
|
|
23526
23828
|
LessonHeader,
|
|
23527
23829
|
{
|
|
23528
23830
|
data,
|
|
@@ -23531,8 +23833,8 @@ var RecommendedLessonDetails = ({
|
|
|
23531
23833
|
viewLessonLabel: labels.viewLesson
|
|
23532
23834
|
}
|
|
23533
23835
|
),
|
|
23534
|
-
/* @__PURE__ */
|
|
23535
|
-
/* @__PURE__ */
|
|
23836
|
+
/* @__PURE__ */ jsx94(ResultsSection, { data, labels }),
|
|
23837
|
+
/* @__PURE__ */ jsx94(
|
|
23536
23838
|
StudentsTable,
|
|
23537
23839
|
{
|
|
23538
23840
|
students: displayStudents,
|
|
@@ -23711,13 +24013,1009 @@ var createUseRecommendedLessonDetails = (apiClient) => {
|
|
|
23711
24013
|
};
|
|
23712
24014
|
};
|
|
23713
24015
|
var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
|
|
24016
|
+
|
|
24017
|
+
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
24018
|
+
import { useState as useState49 } from "react";
|
|
24019
|
+
|
|
24020
|
+
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
24021
|
+
import { useCallback as useCallback24, useMemo as useMemo28, useRef as useRef26 } from "react";
|
|
24022
|
+
import { Plus as Plus4 } from "phosphor-react";
|
|
24023
|
+
|
|
24024
|
+
// src/components/ActivitiesHistory/components/ErrorDisplay.tsx
|
|
24025
|
+
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
24026
|
+
var ErrorDisplay = ({ error }) => /* @__PURE__ */ jsx95("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx95(Text_default, { size: "lg", color: "text-error-500", children: error }) });
|
|
24027
|
+
|
|
24028
|
+
// src/components/ActivitiesHistory/config/historyTableColumns.tsx
|
|
24029
|
+
import { CaretRight as CaretRight11 } from "phosphor-react";
|
|
24030
|
+
|
|
24031
|
+
// src/components/ActivitiesHistory/utils/renderSubjectCell.tsx
|
|
24032
|
+
import { jsx as jsx96, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
24033
|
+
var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
|
|
24034
|
+
if (!subjectName) {
|
|
24035
|
+
return showEmptyDash ? /* @__PURE__ */ jsx96(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
|
|
24036
|
+
}
|
|
24037
|
+
const subjectEnum = mapSubjectNameToEnum?.(subjectName);
|
|
24038
|
+
if (!subjectEnum) {
|
|
24039
|
+
return /* @__PURE__ */ jsx96(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
|
|
24040
|
+
}
|
|
24041
|
+
const subjectInfo = getSubjectInfo(subjectEnum);
|
|
24042
|
+
return /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-2", title: subjectName, children: [
|
|
24043
|
+
/* @__PURE__ */ jsx96(
|
|
24044
|
+
"span",
|
|
24045
|
+
{
|
|
24046
|
+
className: cn(
|
|
24047
|
+
"w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
|
|
24048
|
+
subjectInfo.colorClass
|
|
24049
|
+
),
|
|
24050
|
+
children: subjectInfo.icon
|
|
24051
|
+
}
|
|
24052
|
+
),
|
|
24053
|
+
/* @__PURE__ */ jsx96(Text_default, { size: "sm", className: "truncate", children: subjectName })
|
|
24054
|
+
] });
|
|
24055
|
+
};
|
|
24056
|
+
|
|
24057
|
+
// src/components/ActivitiesHistory/utils/renderTruncatedText.tsx
|
|
24058
|
+
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
24059
|
+
var renderTruncatedText = (value) => {
|
|
24060
|
+
const text = typeof value === "string" ? value : "";
|
|
24061
|
+
return /* @__PURE__ */ jsx97(Text_default, { size: "sm", title: text, children: text });
|
|
24062
|
+
};
|
|
24063
|
+
|
|
24064
|
+
// src/components/ActivitiesHistory/utils/filterBuilders.ts
|
|
24065
|
+
var isNonEmptyArray2 = (param) => Array.isArray(param) && param.length > 0;
|
|
24066
|
+
var isValidApiStatus = (value) => Object.values(GenericApiStatus).includes(value);
|
|
24067
|
+
var buildHistoryFiltersFromParams = (params) => {
|
|
24068
|
+
const filters = {
|
|
24069
|
+
page: params.page,
|
|
24070
|
+
limit: params.limit
|
|
24071
|
+
};
|
|
24072
|
+
if (params.search) {
|
|
24073
|
+
filters.search = params.search;
|
|
24074
|
+
}
|
|
24075
|
+
if (isNonEmptyArray2(params.status) && isValidApiStatus(params.status[0])) {
|
|
24076
|
+
filters.status = params.status[0];
|
|
24077
|
+
}
|
|
24078
|
+
if (isNonEmptyArray2(params.school)) {
|
|
24079
|
+
filters.schoolId = params.school[0];
|
|
24080
|
+
}
|
|
24081
|
+
if (isNonEmptyArray2(params.subject)) {
|
|
24082
|
+
filters.subjectId = params.subject[0];
|
|
24083
|
+
}
|
|
24084
|
+
return filters;
|
|
24085
|
+
};
|
|
24086
|
+
var buildModelsFiltersFromParams = (params) => {
|
|
24087
|
+
const filters = {
|
|
24088
|
+
page: params.page,
|
|
24089
|
+
limit: params.limit
|
|
24090
|
+
};
|
|
24091
|
+
if (params.search) {
|
|
24092
|
+
filters.search = params.search;
|
|
24093
|
+
}
|
|
24094
|
+
if (isNonEmptyArray2(params.subject)) {
|
|
24095
|
+
filters.subjectId = params.subject[0];
|
|
24096
|
+
}
|
|
24097
|
+
return filters;
|
|
24098
|
+
};
|
|
24099
|
+
|
|
24100
|
+
// src/components/ActivitiesHistory/utils/filterOptions.ts
|
|
24101
|
+
var getSchoolOptions2 = (data) => {
|
|
24102
|
+
if (!data?.schools) return [];
|
|
24103
|
+
return data.schools.map((school) => ({
|
|
24104
|
+
id: school.id,
|
|
24105
|
+
name: school.name
|
|
24106
|
+
}));
|
|
24107
|
+
};
|
|
24108
|
+
var getSubjectOptions2 = (data) => {
|
|
24109
|
+
if (!data?.subjects) return [];
|
|
24110
|
+
return data.subjects.map((subject) => ({
|
|
24111
|
+
id: subject.id,
|
|
24112
|
+
name: subject.name
|
|
24113
|
+
}));
|
|
24114
|
+
};
|
|
24115
|
+
|
|
24116
|
+
// src/types/activitiesHistory.ts
|
|
24117
|
+
var ActivityDraftType = /* @__PURE__ */ ((ActivityDraftType2) => {
|
|
24118
|
+
ActivityDraftType2["MODELO"] = "MODELO";
|
|
24119
|
+
ActivityDraftType2["RASCUNHO"] = "RASCUNHO";
|
|
24120
|
+
return ActivityDraftType2;
|
|
24121
|
+
})(ActivityDraftType || {});
|
|
24122
|
+
var getActivityStatusBadgeAction = (status) => getStatusBadgeAction2(status);
|
|
24123
|
+
var ACTIVITY_FILTER_STATUS_OPTIONS = [
|
|
24124
|
+
{ id: "A_VENCER" /* A_VENCER */, name: "A Vencer" },
|
|
24125
|
+
{ id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
|
|
24126
|
+
{ id: "CONCLUIDA" /* CONCLUIDA */, name: "Conclu\xEDda" }
|
|
24127
|
+
];
|
|
24128
|
+
var mapActivityStatusToDisplay = (apiStatus) => mapApiStatusToDisplay(apiStatus);
|
|
24129
|
+
|
|
24130
|
+
// src/components/ActivitiesHistory/config/historyTableColumns.tsx
|
|
24131
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
24132
|
+
var createHistoryTableColumns = (mapSubjectNameToEnum) => [
|
|
24133
|
+
{
|
|
24134
|
+
key: "startDate",
|
|
24135
|
+
label: "In\xEDcio",
|
|
24136
|
+
sortable: true
|
|
24137
|
+
},
|
|
24138
|
+
{
|
|
24139
|
+
key: "deadline",
|
|
24140
|
+
label: "Prazo",
|
|
24141
|
+
sortable: true
|
|
24142
|
+
},
|
|
24143
|
+
{
|
|
24144
|
+
key: "title",
|
|
24145
|
+
label: "T\xEDtulo",
|
|
24146
|
+
sortable: true,
|
|
24147
|
+
className: "max-w-[200px] truncate",
|
|
24148
|
+
render: renderTruncatedText
|
|
24149
|
+
},
|
|
24150
|
+
{
|
|
24151
|
+
key: "school",
|
|
24152
|
+
label: "Escola",
|
|
24153
|
+
sortable: true,
|
|
24154
|
+
className: "max-w-[150px] truncate",
|
|
24155
|
+
render: renderTruncatedText
|
|
24156
|
+
},
|
|
24157
|
+
{
|
|
24158
|
+
key: "year",
|
|
24159
|
+
label: "Ano",
|
|
24160
|
+
sortable: true
|
|
24161
|
+
},
|
|
24162
|
+
{
|
|
24163
|
+
key: "subject",
|
|
24164
|
+
label: "Mat\xE9ria",
|
|
24165
|
+
sortable: true,
|
|
24166
|
+
className: "max-w-[140px]",
|
|
24167
|
+
render: (value) => {
|
|
24168
|
+
const subjectName = typeof value === "string" ? value : "";
|
|
24169
|
+
return renderSubjectCell(subjectName, mapSubjectNameToEnum, false);
|
|
24170
|
+
}
|
|
24171
|
+
},
|
|
24172
|
+
{
|
|
24173
|
+
key: "class",
|
|
24174
|
+
label: "Turma",
|
|
24175
|
+
sortable: true
|
|
24176
|
+
},
|
|
24177
|
+
{
|
|
24178
|
+
key: "status",
|
|
24179
|
+
label: "Status",
|
|
24180
|
+
sortable: true,
|
|
24181
|
+
render: (value) => {
|
|
24182
|
+
const status = typeof value === "string" ? value : "";
|
|
24183
|
+
if (!status) {
|
|
24184
|
+
return /* @__PURE__ */ jsx98(Text_default, { size: "sm", color: "text-text-500", children: "-" });
|
|
24185
|
+
}
|
|
24186
|
+
return /* @__PURE__ */ jsx98(
|
|
24187
|
+
Badge_default,
|
|
24188
|
+
{
|
|
24189
|
+
variant: "solid",
|
|
24190
|
+
action: getActivityStatusBadgeAction(status),
|
|
24191
|
+
size: "small",
|
|
24192
|
+
children: status
|
|
24193
|
+
}
|
|
24194
|
+
);
|
|
24195
|
+
}
|
|
24196
|
+
},
|
|
24197
|
+
{
|
|
24198
|
+
key: "completionPercentage",
|
|
24199
|
+
label: "Conclus\xE3o",
|
|
24200
|
+
sortable: true,
|
|
24201
|
+
render: (value) => /* @__PURE__ */ jsx98(
|
|
24202
|
+
ProgressBar_default,
|
|
24203
|
+
{
|
|
24204
|
+
value: Number(value),
|
|
24205
|
+
variant: "blue",
|
|
24206
|
+
size: "medium",
|
|
24207
|
+
layout: "compact",
|
|
24208
|
+
showPercentage: true,
|
|
24209
|
+
compactWidth: "w-[100px]"
|
|
24210
|
+
}
|
|
24211
|
+
)
|
|
24212
|
+
},
|
|
24213
|
+
{
|
|
24214
|
+
key: "navigation",
|
|
24215
|
+
label: "",
|
|
24216
|
+
sortable: false,
|
|
24217
|
+
className: "w-12",
|
|
24218
|
+
render: () => /* @__PURE__ */ jsx98("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx98(CaretRight11, { size: 20, className: "text-text-600" }) })
|
|
24219
|
+
}
|
|
24220
|
+
];
|
|
24221
|
+
|
|
24222
|
+
// src/components/ActivitiesHistory/config/historyFiltersConfig.ts
|
|
24223
|
+
var createHistoryFiltersConfig = (userData) => [
|
|
24224
|
+
{
|
|
24225
|
+
key: "status",
|
|
24226
|
+
label: "STATUS",
|
|
24227
|
+
categories: [
|
|
24228
|
+
{
|
|
24229
|
+
key: "status",
|
|
24230
|
+
label: "Status da Atividade",
|
|
24231
|
+
selectedIds: [],
|
|
24232
|
+
itens: ACTIVITY_FILTER_STATUS_OPTIONS
|
|
24233
|
+
}
|
|
24234
|
+
]
|
|
24235
|
+
},
|
|
24236
|
+
{
|
|
24237
|
+
key: "academic",
|
|
24238
|
+
label: "DADOS ACAD\xCAMICOS",
|
|
24239
|
+
categories: [
|
|
24240
|
+
{
|
|
24241
|
+
key: "school",
|
|
24242
|
+
label: "Escola",
|
|
24243
|
+
selectedIds: [],
|
|
24244
|
+
itens: getSchoolOptions2(userData)
|
|
24245
|
+
}
|
|
24246
|
+
]
|
|
24247
|
+
},
|
|
24248
|
+
{
|
|
24249
|
+
key: "content",
|
|
24250
|
+
label: "CONTE\xDADO",
|
|
24251
|
+
categories: [
|
|
24252
|
+
{
|
|
24253
|
+
key: "subject",
|
|
24254
|
+
label: "Mat\xE9ria",
|
|
24255
|
+
selectedIds: [],
|
|
24256
|
+
itens: getSubjectOptions2(userData)
|
|
24257
|
+
}
|
|
24258
|
+
]
|
|
24259
|
+
}
|
|
24260
|
+
];
|
|
24261
|
+
|
|
24262
|
+
// src/hooks/useActivitiesHistory.ts
|
|
24263
|
+
import { useState as useState46, useCallback as useCallback23 } from "react";
|
|
24264
|
+
import { z as z6 } from "zod";
|
|
24265
|
+
import dayjs4 from "dayjs";
|
|
24266
|
+
|
|
24267
|
+
// src/utils/hookErrorHandler.ts
|
|
24268
|
+
import { z as z5 } from "zod";
|
|
24269
|
+
var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
|
|
24270
|
+
if (error instanceof z5.ZodError) {
|
|
24271
|
+
console.error(validationErrorMessage, error);
|
|
24272
|
+
return validationErrorMessage;
|
|
24273
|
+
}
|
|
24274
|
+
console.error(genericErrorMessage, error);
|
|
24275
|
+
return genericErrorMessage;
|
|
24276
|
+
};
|
|
24277
|
+
|
|
24278
|
+
// src/hooks/useActivitiesHistory.ts
|
|
24279
|
+
var activityHistoryResponseSchema = z6.object({
|
|
24280
|
+
id: z6.string().uuid(),
|
|
24281
|
+
title: z6.string(),
|
|
24282
|
+
startDate: z6.string().nullable(),
|
|
24283
|
+
finalDate: z6.string().nullable(),
|
|
24284
|
+
status: z6.nativeEnum(GenericApiStatus),
|
|
24285
|
+
completionPercentage: z6.number().min(0).max(100),
|
|
24286
|
+
subjectId: z6.string().uuid(),
|
|
24287
|
+
schoolId: z6.string().optional(),
|
|
24288
|
+
schoolName: z6.string().optional(),
|
|
24289
|
+
year: z6.string().optional(),
|
|
24290
|
+
className: z6.string().optional(),
|
|
24291
|
+
subjectName: z6.string().optional()
|
|
24292
|
+
});
|
|
24293
|
+
var activitiesHistoryApiResponseSchema = z6.object({
|
|
24294
|
+
message: z6.string(),
|
|
24295
|
+
data: z6.object({
|
|
24296
|
+
activities: z6.array(activityHistoryResponseSchema),
|
|
24297
|
+
pagination: z6.object({
|
|
24298
|
+
total: z6.number(),
|
|
24299
|
+
page: z6.number(),
|
|
24300
|
+
limit: z6.number(),
|
|
24301
|
+
totalPages: z6.number()
|
|
24302
|
+
})
|
|
24303
|
+
})
|
|
24304
|
+
});
|
|
24305
|
+
var DEFAULT_ACTIVITIES_PAGINATION = {
|
|
24306
|
+
total: 0,
|
|
24307
|
+
page: 1,
|
|
24308
|
+
limit: 10,
|
|
24309
|
+
totalPages: 0
|
|
24310
|
+
};
|
|
24311
|
+
var transformActivityToTableItem = (activity) => {
|
|
24312
|
+
return {
|
|
24313
|
+
id: activity.id,
|
|
24314
|
+
startDate: activity.startDate ? dayjs4(activity.startDate).format("DD/MM") : "-",
|
|
24315
|
+
deadline: activity.finalDate ? dayjs4(activity.finalDate).format("DD/MM") : "-",
|
|
24316
|
+
title: activity.title,
|
|
24317
|
+
school: activity.schoolName || "-",
|
|
24318
|
+
year: activity.year || "-",
|
|
24319
|
+
subject: activity.subjectName || "-",
|
|
24320
|
+
class: activity.className || "-",
|
|
24321
|
+
status: mapActivityStatusToDisplay(activity.status),
|
|
24322
|
+
completionPercentage: activity.completionPercentage
|
|
24323
|
+
};
|
|
24324
|
+
};
|
|
24325
|
+
var handleActivityFetchError = createFetchErrorHandler(
|
|
24326
|
+
"Erro ao validar dados de hist\xF3rico de atividades",
|
|
24327
|
+
"Erro ao carregar hist\xF3rico de atividades"
|
|
24328
|
+
);
|
|
24329
|
+
var createUseActivitiesHistory = (fetchActivitiesHistory) => {
|
|
24330
|
+
return () => {
|
|
24331
|
+
const [state, setState] = useState46({
|
|
24332
|
+
activities: [],
|
|
24333
|
+
loading: false,
|
|
24334
|
+
error: null,
|
|
24335
|
+
pagination: DEFAULT_ACTIVITIES_PAGINATION
|
|
24336
|
+
});
|
|
24337
|
+
const fetchActivities = useCallback23(
|
|
24338
|
+
async (filters) => {
|
|
24339
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
24340
|
+
try {
|
|
24341
|
+
const responseData = await fetchActivitiesHistory(filters);
|
|
24342
|
+
const validatedData = activitiesHistoryApiResponseSchema.parse(responseData);
|
|
24343
|
+
const tableItems = validatedData.data.activities.map(
|
|
24344
|
+
transformActivityToTableItem
|
|
24345
|
+
);
|
|
24346
|
+
setState({
|
|
24347
|
+
activities: tableItems,
|
|
24348
|
+
loading: false,
|
|
24349
|
+
error: null,
|
|
24350
|
+
pagination: validatedData.data.pagination
|
|
24351
|
+
});
|
|
24352
|
+
} catch (error) {
|
|
24353
|
+
const errorMessage = handleActivityFetchError(error);
|
|
24354
|
+
setState((prev) => ({
|
|
24355
|
+
...prev,
|
|
24356
|
+
loading: false,
|
|
24357
|
+
error: errorMessage
|
|
24358
|
+
}));
|
|
24359
|
+
}
|
|
24360
|
+
},
|
|
24361
|
+
[fetchActivitiesHistory]
|
|
24362
|
+
);
|
|
24363
|
+
return {
|
|
24364
|
+
...state,
|
|
24365
|
+
fetchActivities
|
|
24366
|
+
};
|
|
24367
|
+
};
|
|
24368
|
+
};
|
|
24369
|
+
var createActivitiesHistoryHook = createUseActivitiesHistory;
|
|
24370
|
+
|
|
24371
|
+
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
24372
|
+
import { jsx as jsx99, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
24373
|
+
var HistoryTab = ({
|
|
24374
|
+
fetchActivitiesHistory,
|
|
24375
|
+
onCreateActivity,
|
|
24376
|
+
onRowClick,
|
|
24377
|
+
emptyStateImage,
|
|
24378
|
+
noSearchImage,
|
|
24379
|
+
mapSubjectNameToEnum,
|
|
24380
|
+
userFilterData
|
|
24381
|
+
}) => {
|
|
24382
|
+
const fetchActivitiesHistoryRef = useRef26(fetchActivitiesHistory);
|
|
24383
|
+
fetchActivitiesHistoryRef.current = fetchActivitiesHistory;
|
|
24384
|
+
const useActivitiesHistory = useMemo28(
|
|
24385
|
+
() => createUseActivitiesHistory(
|
|
24386
|
+
(filters) => fetchActivitiesHistoryRef.current(filters)
|
|
24387
|
+
),
|
|
24388
|
+
[]
|
|
24389
|
+
);
|
|
24390
|
+
const {
|
|
24391
|
+
activities,
|
|
24392
|
+
loading,
|
|
24393
|
+
error,
|
|
24394
|
+
pagination,
|
|
24395
|
+
fetchActivities
|
|
24396
|
+
} = useActivitiesHistory();
|
|
24397
|
+
const historyFilterConfigs = useMemo28(
|
|
24398
|
+
() => createHistoryFiltersConfig(userFilterData),
|
|
24399
|
+
[userFilterData]
|
|
24400
|
+
);
|
|
24401
|
+
const historyTableColumns = useMemo28(
|
|
24402
|
+
() => createHistoryTableColumns(mapSubjectNameToEnum),
|
|
24403
|
+
[mapSubjectNameToEnum]
|
|
24404
|
+
);
|
|
24405
|
+
const handleParamsChange = useCallback24(
|
|
24406
|
+
(params) => {
|
|
24407
|
+
const filters = buildHistoryFiltersFromParams(params);
|
|
24408
|
+
fetchActivities(filters);
|
|
24409
|
+
},
|
|
24410
|
+
[fetchActivities]
|
|
24411
|
+
);
|
|
24412
|
+
if (error) {
|
|
24413
|
+
return /* @__PURE__ */ jsx99(ErrorDisplay, { error });
|
|
24414
|
+
}
|
|
24415
|
+
return /* @__PURE__ */ jsx99("div", { className: "w-full", children: /* @__PURE__ */ jsx99(
|
|
24416
|
+
TableProvider,
|
|
24417
|
+
{
|
|
24418
|
+
data: activities,
|
|
24419
|
+
headers: historyTableColumns,
|
|
24420
|
+
loading,
|
|
24421
|
+
variant: "borderless",
|
|
24422
|
+
enableSearch: true,
|
|
24423
|
+
enableFilters: true,
|
|
24424
|
+
enableTableSort: true,
|
|
24425
|
+
enablePagination: true,
|
|
24426
|
+
enableRowClick: true,
|
|
24427
|
+
initialFilters: historyFilterConfigs,
|
|
24428
|
+
paginationConfig: {
|
|
24429
|
+
itemLabel: "atividades",
|
|
24430
|
+
itemsPerPageOptions: [10, 20, 50, 100],
|
|
24431
|
+
defaultItemsPerPage: 10,
|
|
24432
|
+
totalItems: pagination.total,
|
|
24433
|
+
totalPages: pagination.totalPages
|
|
24434
|
+
},
|
|
24435
|
+
searchPlaceholder: "Buscar atividade",
|
|
24436
|
+
noSearchResultState: {
|
|
24437
|
+
image: noSearchImage
|
|
24438
|
+
},
|
|
24439
|
+
emptyState: {
|
|
24440
|
+
component: /* @__PURE__ */ jsx99(
|
|
24441
|
+
EmptyState_default,
|
|
24442
|
+
{
|
|
24443
|
+
image: emptyStateImage,
|
|
24444
|
+
title: "Incentive sua turma ao aprendizado",
|
|
24445
|
+
description: "Crie uma nova atividade e ajude seus alunos a colocarem o conte\xFAdo em pr\xE1tica!",
|
|
24446
|
+
buttonText: "Criar atividade",
|
|
24447
|
+
buttonIcon: /* @__PURE__ */ jsx99(Plus4, { size: 18 }),
|
|
24448
|
+
buttonVariant: "outline",
|
|
24449
|
+
buttonAction: "primary",
|
|
24450
|
+
onButtonClick: onCreateActivity
|
|
24451
|
+
}
|
|
24452
|
+
)
|
|
24453
|
+
},
|
|
24454
|
+
onParamsChange: handleParamsChange,
|
|
24455
|
+
onRowClick,
|
|
24456
|
+
children: (renderProps) => {
|
|
24457
|
+
const {
|
|
24458
|
+
controls,
|
|
24459
|
+
table,
|
|
24460
|
+
pagination: paginationComponent
|
|
24461
|
+
} = renderProps;
|
|
24462
|
+
return /* @__PURE__ */ jsxs79("div", { className: "space-y-4", children: [
|
|
24463
|
+
/* @__PURE__ */ jsxs79("div", { className: "flex items-center justify-between gap-4", children: [
|
|
24464
|
+
/* @__PURE__ */ jsx99(
|
|
24465
|
+
Button_default,
|
|
24466
|
+
{
|
|
24467
|
+
variant: "solid",
|
|
24468
|
+
action: "primary",
|
|
24469
|
+
size: "medium",
|
|
24470
|
+
onClick: onCreateActivity,
|
|
24471
|
+
iconLeft: /* @__PURE__ */ jsx99(Plus4, { size: 18, weight: "bold" }),
|
|
24472
|
+
children: "Criar atividade"
|
|
24473
|
+
}
|
|
24474
|
+
),
|
|
24475
|
+
controls
|
|
24476
|
+
] }),
|
|
24477
|
+
/* @__PURE__ */ jsxs79("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
|
|
24478
|
+
table,
|
|
24479
|
+
paginationComponent
|
|
24480
|
+
] })
|
|
24481
|
+
] });
|
|
24482
|
+
}
|
|
24483
|
+
}
|
|
24484
|
+
) });
|
|
24485
|
+
};
|
|
24486
|
+
|
|
24487
|
+
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
24488
|
+
import { useState as useState48, useCallback as useCallback26, useMemo as useMemo29, useRef as useRef27, useEffect as useEffect45 } from "react";
|
|
24489
|
+
import { Plus as Plus5 } from "phosphor-react";
|
|
24490
|
+
|
|
24491
|
+
// src/components/ActivitiesHistory/config/modelsTableColumns.tsx
|
|
24492
|
+
import { Trash as Trash3, PencilSimple as PencilSimple3, PaperPlaneTilt as PaperPlaneTilt3 } from "phosphor-react";
|
|
24493
|
+
import { jsx as jsx100, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
24494
|
+
var createModelsTableColumns = (mapSubjectNameToEnum, onSendActivity, onEditModel, onDeleteModel) => [
|
|
24495
|
+
{
|
|
24496
|
+
key: "title",
|
|
24497
|
+
label: "T\xEDtulo",
|
|
24498
|
+
sortable: true,
|
|
24499
|
+
className: "max-w-[400px]",
|
|
24500
|
+
render: (value) => {
|
|
24501
|
+
const title = typeof value === "string" ? value : "";
|
|
24502
|
+
return /* @__PURE__ */ jsx100(Text_default, { size: "sm", title, className: "truncate block", children: title });
|
|
24503
|
+
}
|
|
24504
|
+
},
|
|
24505
|
+
{
|
|
24506
|
+
key: "savedAt",
|
|
24507
|
+
label: "Salvo em",
|
|
24508
|
+
sortable: true,
|
|
24509
|
+
className: "w-[120px]"
|
|
24510
|
+
},
|
|
24511
|
+
{
|
|
24512
|
+
key: "subject",
|
|
24513
|
+
label: "Mat\xE9ria",
|
|
24514
|
+
sortable: true,
|
|
24515
|
+
className: "max-w-[160px]",
|
|
24516
|
+
render: (value) => {
|
|
24517
|
+
const subjectName = typeof value === "string" ? value : "";
|
|
24518
|
+
return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
|
|
24519
|
+
}
|
|
24520
|
+
},
|
|
24521
|
+
{
|
|
24522
|
+
key: "actions",
|
|
24523
|
+
label: "",
|
|
24524
|
+
sortable: false,
|
|
24525
|
+
className: "w-[220px]",
|
|
24526
|
+
render: (_value, row) => {
|
|
24527
|
+
const handleSend = (e) => {
|
|
24528
|
+
e.stopPropagation();
|
|
24529
|
+
onSendActivity?.(row);
|
|
24530
|
+
};
|
|
24531
|
+
const handleEdit = (e) => {
|
|
24532
|
+
e.stopPropagation();
|
|
24533
|
+
onEditModel?.(row);
|
|
24534
|
+
};
|
|
24535
|
+
const handleDelete = (e) => {
|
|
24536
|
+
e.stopPropagation();
|
|
24537
|
+
onDeleteModel(row);
|
|
24538
|
+
};
|
|
24539
|
+
return /* @__PURE__ */ jsxs80("div", { className: "flex items-center gap-2 justify-end", children: [
|
|
24540
|
+
onSendActivity && /* @__PURE__ */ jsx100(
|
|
24541
|
+
Button_default,
|
|
24542
|
+
{
|
|
24543
|
+
variant: "outline",
|
|
24544
|
+
action: "primary",
|
|
24545
|
+
size: "small",
|
|
24546
|
+
iconLeft: /* @__PURE__ */ jsx100(PaperPlaneTilt3, { size: 16 }),
|
|
24547
|
+
onClick: handleSend,
|
|
24548
|
+
"aria-label": "Enviar atividade",
|
|
24549
|
+
children: "Enviar atividade"
|
|
24550
|
+
}
|
|
24551
|
+
),
|
|
24552
|
+
/* @__PURE__ */ jsx100(
|
|
24553
|
+
IconButton_default,
|
|
24554
|
+
{
|
|
24555
|
+
icon: /* @__PURE__ */ jsx100(Trash3, { size: 20 }),
|
|
24556
|
+
size: "md",
|
|
24557
|
+
onClick: handleDelete,
|
|
24558
|
+
"aria-label": "Deletar modelo",
|
|
24559
|
+
className: "text-text-600 hover:text-error-500 hover:bg-transparent"
|
|
24560
|
+
}
|
|
24561
|
+
),
|
|
24562
|
+
onEditModel && /* @__PURE__ */ jsx100(
|
|
24563
|
+
IconButton_default,
|
|
24564
|
+
{
|
|
24565
|
+
icon: /* @__PURE__ */ jsx100(PencilSimple3, { size: 20 }),
|
|
24566
|
+
size: "md",
|
|
24567
|
+
onClick: handleEdit,
|
|
24568
|
+
"aria-label": "Editar modelo",
|
|
24569
|
+
className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
|
|
24570
|
+
}
|
|
24571
|
+
)
|
|
24572
|
+
] });
|
|
24573
|
+
}
|
|
24574
|
+
}
|
|
24575
|
+
];
|
|
24576
|
+
|
|
24577
|
+
// src/components/ActivitiesHistory/config/modelsFiltersConfig.ts
|
|
24578
|
+
var createModelsFiltersConfig = (userData) => [
|
|
24579
|
+
{
|
|
24580
|
+
key: "content",
|
|
24581
|
+
label: "CONTE\xDADO",
|
|
24582
|
+
categories: [
|
|
24583
|
+
{
|
|
24584
|
+
key: "subject",
|
|
24585
|
+
label: "Mat\xE9ria",
|
|
24586
|
+
selectedIds: [],
|
|
24587
|
+
itens: getSubjectOptions2(userData)
|
|
24588
|
+
}
|
|
24589
|
+
]
|
|
24590
|
+
}
|
|
24591
|
+
];
|
|
24592
|
+
|
|
24593
|
+
// src/hooks/useActivityModels.ts
|
|
24594
|
+
import { useState as useState47, useCallback as useCallback25 } from "react";
|
|
24595
|
+
import { z as z7 } from "zod";
|
|
24596
|
+
import dayjs5 from "dayjs";
|
|
24597
|
+
var activityDraftFiltersSchema = z7.object({
|
|
24598
|
+
questionTypes: z7.array(z7.string()).optional(),
|
|
24599
|
+
questionBanks: z7.array(z7.string()).optional(),
|
|
24600
|
+
subjects: z7.array(z7.string()).optional(),
|
|
24601
|
+
topics: z7.array(z7.string()).optional(),
|
|
24602
|
+
subtopics: z7.array(z7.string()).optional(),
|
|
24603
|
+
contents: z7.array(z7.string()).optional()
|
|
24604
|
+
}).nullable();
|
|
24605
|
+
var activityModelResponseSchema = z7.object({
|
|
24606
|
+
id: z7.string().uuid(),
|
|
24607
|
+
type: z7.nativeEnum(ActivityDraftType),
|
|
24608
|
+
title: z7.string().nullable(),
|
|
24609
|
+
creatorUserInstitutionId: z7.string().uuid().nullable(),
|
|
24610
|
+
subjectId: z7.string().uuid().nullable(),
|
|
24611
|
+
filters: activityDraftFiltersSchema,
|
|
24612
|
+
createdAt: z7.string(),
|
|
24613
|
+
updatedAt: z7.string()
|
|
24614
|
+
});
|
|
24615
|
+
var activityModelsApiResponseSchema = z7.object({
|
|
24616
|
+
message: z7.string(),
|
|
24617
|
+
data: z7.object({
|
|
24618
|
+
activityDrafts: z7.array(activityModelResponseSchema),
|
|
24619
|
+
total: z7.number()
|
|
24620
|
+
})
|
|
24621
|
+
});
|
|
24622
|
+
var DEFAULT_MODELS_PAGINATION = {
|
|
24623
|
+
total: 0,
|
|
24624
|
+
page: 1,
|
|
24625
|
+
limit: 10,
|
|
24626
|
+
totalPages: 0
|
|
24627
|
+
};
|
|
24628
|
+
var transformModelToTableItem = (model, subjectsMap) => {
|
|
24629
|
+
const subjectName = model.subjectId ? subjectsMap?.get(model.subjectId) || "" : "";
|
|
24630
|
+
return {
|
|
24631
|
+
id: model.id,
|
|
24632
|
+
title: model.title || "Sem t\xEDtulo",
|
|
24633
|
+
savedAt: dayjs5(model.createdAt).format("DD/MM/YYYY"),
|
|
24634
|
+
subject: subjectName,
|
|
24635
|
+
subjectId: model.subjectId
|
|
24636
|
+
};
|
|
24637
|
+
};
|
|
24638
|
+
var handleModelFetchError = createFetchErrorHandler(
|
|
24639
|
+
"Erro ao validar dados de modelos de atividades",
|
|
24640
|
+
"Erro ao carregar modelos de atividades"
|
|
24641
|
+
);
|
|
24642
|
+
var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
24643
|
+
return () => {
|
|
24644
|
+
const [state, setState] = useState47({
|
|
24645
|
+
models: [],
|
|
24646
|
+
loading: false,
|
|
24647
|
+
error: null,
|
|
24648
|
+
pagination: DEFAULT_MODELS_PAGINATION
|
|
24649
|
+
});
|
|
24650
|
+
const fetchModels = useCallback25(
|
|
24651
|
+
async (filters, subjectsMap) => {
|
|
24652
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
24653
|
+
try {
|
|
24654
|
+
const responseData = await fetchActivityModels(filters);
|
|
24655
|
+
const validatedData = activityModelsApiResponseSchema.parse(responseData);
|
|
24656
|
+
const tableItems = validatedData.data.activityDrafts.map(
|
|
24657
|
+
(model) => transformModelToTableItem(model, subjectsMap)
|
|
24658
|
+
);
|
|
24659
|
+
const limit = filters?.limit || 10;
|
|
24660
|
+
const page = filters?.page || 1;
|
|
24661
|
+
const total = validatedData.data.total;
|
|
24662
|
+
const totalPages = Math.ceil(total / limit);
|
|
24663
|
+
setState({
|
|
24664
|
+
models: tableItems,
|
|
24665
|
+
loading: false,
|
|
24666
|
+
error: null,
|
|
24667
|
+
pagination: {
|
|
24668
|
+
total,
|
|
24669
|
+
page,
|
|
24670
|
+
limit,
|
|
24671
|
+
totalPages
|
|
24672
|
+
}
|
|
24673
|
+
});
|
|
24674
|
+
} catch (error) {
|
|
24675
|
+
const errorMessage = handleModelFetchError(error);
|
|
24676
|
+
setState((prev) => ({
|
|
24677
|
+
...prev,
|
|
24678
|
+
loading: false,
|
|
24679
|
+
error: errorMessage
|
|
24680
|
+
}));
|
|
24681
|
+
}
|
|
24682
|
+
},
|
|
24683
|
+
[fetchActivityModels]
|
|
24684
|
+
);
|
|
24685
|
+
const deleteModel = useCallback25(
|
|
24686
|
+
async (id) => {
|
|
24687
|
+
try {
|
|
24688
|
+
await deleteActivityModel(id);
|
|
24689
|
+
return true;
|
|
24690
|
+
} catch (error) {
|
|
24691
|
+
console.error("Erro ao deletar modelo:", error);
|
|
24692
|
+
return false;
|
|
24693
|
+
}
|
|
24694
|
+
},
|
|
24695
|
+
[deleteActivityModel]
|
|
24696
|
+
);
|
|
24697
|
+
return {
|
|
24698
|
+
...state,
|
|
24699
|
+
fetchModels,
|
|
24700
|
+
deleteModel
|
|
24701
|
+
};
|
|
24702
|
+
};
|
|
24703
|
+
};
|
|
24704
|
+
var createActivityModelsHook = createUseActivityModels;
|
|
24705
|
+
|
|
24706
|
+
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
24707
|
+
import { Fragment as Fragment23, jsx as jsx101, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
24708
|
+
var ModelsTab = ({
|
|
24709
|
+
fetchActivityModels,
|
|
24710
|
+
deleteActivityModel,
|
|
24711
|
+
onCreateModel,
|
|
24712
|
+
onSendActivity,
|
|
24713
|
+
onEditModel,
|
|
24714
|
+
emptyStateImage,
|
|
24715
|
+
noSearchImage,
|
|
24716
|
+
mapSubjectNameToEnum,
|
|
24717
|
+
userFilterData,
|
|
24718
|
+
subjectsMap
|
|
24719
|
+
}) => {
|
|
24720
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState48(false);
|
|
24721
|
+
const [modelToDelete, setModelToDelete] = useState48(null);
|
|
24722
|
+
const { addToast } = useToast();
|
|
24723
|
+
const fetchActivityModelsRef = useRef27(fetchActivityModels);
|
|
24724
|
+
fetchActivityModelsRef.current = fetchActivityModels;
|
|
24725
|
+
const deleteActivityModelRef = useRef27(deleteActivityModel);
|
|
24726
|
+
deleteActivityModelRef.current = deleteActivityModel;
|
|
24727
|
+
const subjectsMapRef = useRef27(subjectsMap);
|
|
24728
|
+
subjectsMapRef.current = subjectsMap;
|
|
24729
|
+
const useActivityModels = useMemo29(
|
|
24730
|
+
() => createUseActivityModels(
|
|
24731
|
+
(filters) => fetchActivityModelsRef.current(filters),
|
|
24732
|
+
(id) => deleteActivityModelRef.current(id)
|
|
24733
|
+
),
|
|
24734
|
+
[]
|
|
24735
|
+
);
|
|
24736
|
+
const {
|
|
24737
|
+
models,
|
|
24738
|
+
loading: modelsLoading,
|
|
24739
|
+
error: modelsError,
|
|
24740
|
+
pagination: modelsPagination,
|
|
24741
|
+
fetchModels,
|
|
24742
|
+
deleteModel
|
|
24743
|
+
} = useActivityModels();
|
|
24744
|
+
const modelsFilterConfigs = useMemo29(
|
|
24745
|
+
() => createModelsFiltersConfig(userFilterData),
|
|
24746
|
+
[userFilterData]
|
|
24747
|
+
);
|
|
24748
|
+
const handleDeleteClick = useCallback26((model) => {
|
|
24749
|
+
setModelToDelete(model);
|
|
24750
|
+
setDeleteDialogOpen(true);
|
|
24751
|
+
}, []);
|
|
24752
|
+
const modelsTableColumns = useMemo29(
|
|
24753
|
+
() => createModelsTableColumns(
|
|
24754
|
+
mapSubjectNameToEnum,
|
|
24755
|
+
onSendActivity,
|
|
24756
|
+
onEditModel,
|
|
24757
|
+
handleDeleteClick
|
|
24758
|
+
),
|
|
24759
|
+
[mapSubjectNameToEnum, onSendActivity, onEditModel, handleDeleteClick]
|
|
24760
|
+
);
|
|
24761
|
+
const handleParamsChange = useCallback26(
|
|
24762
|
+
(params) => {
|
|
24763
|
+
const filters = buildModelsFiltersFromParams(params);
|
|
24764
|
+
fetchModels(filters, subjectsMapRef.current);
|
|
24765
|
+
},
|
|
24766
|
+
[fetchModels]
|
|
24767
|
+
);
|
|
24768
|
+
useEffect45(() => {
|
|
24769
|
+
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
24770
|
+
}, [fetchModels]);
|
|
24771
|
+
const handleConfirmDelete = useCallback26(async () => {
|
|
24772
|
+
if (modelToDelete) {
|
|
24773
|
+
const success = await deleteModel(modelToDelete.id);
|
|
24774
|
+
if (success) {
|
|
24775
|
+
addToast({ title: "Modelo deletado com sucesso", action: "success" });
|
|
24776
|
+
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
24777
|
+
} else {
|
|
24778
|
+
addToast({ title: "Erro ao deletar modelo", action: "warning" });
|
|
24779
|
+
}
|
|
24780
|
+
}
|
|
24781
|
+
setDeleteDialogOpen(false);
|
|
24782
|
+
setModelToDelete(null);
|
|
24783
|
+
}, [modelToDelete, deleteModel, fetchModels, addToast]);
|
|
24784
|
+
const handleCancelDelete = useCallback26(() => {
|
|
24785
|
+
setDeleteDialogOpen(false);
|
|
24786
|
+
setModelToDelete(null);
|
|
24787
|
+
}, []);
|
|
24788
|
+
return /* @__PURE__ */ jsxs81(Fragment23, { children: [
|
|
24789
|
+
/* @__PURE__ */ jsx101(Toaster_default, {}),
|
|
24790
|
+
modelsError ? /* @__PURE__ */ jsx101(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ jsx101("div", { className: "w-full", "data-testid": "activity-models-tab", children: /* @__PURE__ */ jsx101(
|
|
24791
|
+
TableProvider,
|
|
24792
|
+
{
|
|
24793
|
+
data: models,
|
|
24794
|
+
headers: modelsTableColumns,
|
|
24795
|
+
loading: modelsLoading,
|
|
24796
|
+
variant: "borderless",
|
|
24797
|
+
enableSearch: true,
|
|
24798
|
+
enableFilters: true,
|
|
24799
|
+
enableTableSort: true,
|
|
24800
|
+
enablePagination: true,
|
|
24801
|
+
initialFilters: modelsFilterConfigs,
|
|
24802
|
+
paginationConfig: {
|
|
24803
|
+
itemLabel: "modelos",
|
|
24804
|
+
itemsPerPageOptions: [10, 20, 50, 100],
|
|
24805
|
+
defaultItemsPerPage: 10,
|
|
24806
|
+
totalItems: modelsPagination.total,
|
|
24807
|
+
totalPages: modelsPagination.totalPages
|
|
24808
|
+
},
|
|
24809
|
+
searchPlaceholder: "Buscar modelo",
|
|
24810
|
+
noSearchResultState: {
|
|
24811
|
+
image: noSearchImage
|
|
24812
|
+
},
|
|
24813
|
+
emptyState: {
|
|
24814
|
+
component: /* @__PURE__ */ jsx101(
|
|
24815
|
+
EmptyState_default,
|
|
24816
|
+
{
|
|
24817
|
+
image: emptyStateImage,
|
|
24818
|
+
title: "Crie modelos para agilizar suas atividades",
|
|
24819
|
+
description: "Salve modelos de atividades para reutilizar e enviar rapidamente para suas turmas!",
|
|
24820
|
+
buttonText: "Criar modelo",
|
|
24821
|
+
buttonIcon: /* @__PURE__ */ jsx101(Plus5, { size: 18 }),
|
|
24822
|
+
buttonVariant: "outline",
|
|
24823
|
+
buttonAction: "primary",
|
|
24824
|
+
onButtonClick: onCreateModel
|
|
24825
|
+
}
|
|
24826
|
+
)
|
|
24827
|
+
},
|
|
24828
|
+
onParamsChange: handleParamsChange,
|
|
24829
|
+
children: (renderProps) => {
|
|
24830
|
+
const {
|
|
24831
|
+
controls,
|
|
24832
|
+
table,
|
|
24833
|
+
pagination: paginationComponent
|
|
24834
|
+
} = renderProps;
|
|
24835
|
+
return /* @__PURE__ */ jsxs81("div", { className: "space-y-4", children: [
|
|
24836
|
+
/* @__PURE__ */ jsxs81("div", { className: "flex items-center justify-between gap-4", children: [
|
|
24837
|
+
/* @__PURE__ */ jsx101(
|
|
24838
|
+
Button_default,
|
|
24839
|
+
{
|
|
24840
|
+
variant: "solid",
|
|
24841
|
+
action: "primary",
|
|
24842
|
+
size: "medium",
|
|
24843
|
+
onClick: onCreateModel,
|
|
24844
|
+
iconLeft: /* @__PURE__ */ jsx101(Plus5, { size: 18, weight: "bold" }),
|
|
24845
|
+
children: "Criar modelo"
|
|
24846
|
+
}
|
|
24847
|
+
),
|
|
24848
|
+
controls
|
|
24849
|
+
] }),
|
|
24850
|
+
/* @__PURE__ */ jsxs81("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
|
|
24851
|
+
table,
|
|
24852
|
+
paginationComponent
|
|
24853
|
+
] })
|
|
24854
|
+
] });
|
|
24855
|
+
}
|
|
24856
|
+
}
|
|
24857
|
+
) }),
|
|
24858
|
+
/* @__PURE__ */ jsx101(
|
|
24859
|
+
AlertDialog,
|
|
24860
|
+
{
|
|
24861
|
+
isOpen: deleteDialogOpen,
|
|
24862
|
+
onChangeOpen: setDeleteDialogOpen,
|
|
24863
|
+
title: "Deletar modelo",
|
|
24864
|
+
description: `Tem certeza que deseja deletar o modelo "${modelToDelete?.title}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
|
|
24865
|
+
submitButtonLabel: "Deletar",
|
|
24866
|
+
cancelButtonLabel: "Cancelar",
|
|
24867
|
+
onSubmit: handleConfirmDelete,
|
|
24868
|
+
onCancel: handleCancelDelete
|
|
24869
|
+
}
|
|
24870
|
+
)
|
|
24871
|
+
] });
|
|
24872
|
+
};
|
|
24873
|
+
|
|
24874
|
+
// src/components/ActivitiesHistory/tabs/DraftsTab.tsx
|
|
24875
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
24876
|
+
var DraftsTab = () => {
|
|
24877
|
+
return /* @__PURE__ */ jsx102("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx102(Text_default, { size: "lg", color: "text-text-600", children: "Rascunhos em desenvolvimento" }) });
|
|
24878
|
+
};
|
|
24879
|
+
|
|
24880
|
+
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
24881
|
+
import { jsx as jsx103, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
24882
|
+
var PAGE_TITLES = {
|
|
24883
|
+
["history" /* HISTORY */]: "Hist\xF3rico de atividades",
|
|
24884
|
+
["drafts" /* DRAFTS */]: "Rascunhos",
|
|
24885
|
+
["models" /* MODELS */]: "Modelos de atividades"
|
|
24886
|
+
};
|
|
24887
|
+
var ActivitiesHistory = ({
|
|
24888
|
+
fetchActivitiesHistory,
|
|
24889
|
+
fetchActivityModels,
|
|
24890
|
+
deleteActivityModel,
|
|
24891
|
+
onCreateActivity,
|
|
24892
|
+
onCreateModel,
|
|
24893
|
+
onRowClick,
|
|
24894
|
+
onSendActivity,
|
|
24895
|
+
onEditModel,
|
|
24896
|
+
emptyStateImage,
|
|
24897
|
+
noSearchImage,
|
|
24898
|
+
mapSubjectNameToEnum,
|
|
24899
|
+
userFilterData,
|
|
24900
|
+
subjectsMap
|
|
24901
|
+
}) => {
|
|
24902
|
+
const [activeTab, setActiveTab] = useState49("history" /* HISTORY */);
|
|
24903
|
+
return /* @__PURE__ */ jsxs82(
|
|
24904
|
+
"div",
|
|
24905
|
+
{
|
|
24906
|
+
"data-testid": "activities-history",
|
|
24907
|
+
className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden",
|
|
24908
|
+
children: [
|
|
24909
|
+
/* @__PURE__ */ jsx103("span", { className: "absolute top-0 left-0 h-[150px] w-full z-0" }),
|
|
24910
|
+
/* @__PURE__ */ jsxs82("div", { className: "flex flex-col w-full h-full max-w-[1350px] mx-auto z-10 lg:px-0 px-4 pt-4 sm:pt-0", children: [
|
|
24911
|
+
/* @__PURE__ */ jsxs82("div", { className: "flex flex-col sm:flex-row w-full mb-6 items-start sm:items-center sm:justify-between gap-0 sm:gap-4", children: [
|
|
24912
|
+
/* @__PURE__ */ jsx103(
|
|
24913
|
+
Text_default,
|
|
24914
|
+
{
|
|
24915
|
+
as: "h1",
|
|
24916
|
+
weight: "bold",
|
|
24917
|
+
className: "leading-[28px] tracking-[0.2px] text-xl lg:text-2xl",
|
|
24918
|
+
children: PAGE_TITLES[activeTab]
|
|
24919
|
+
}
|
|
24920
|
+
),
|
|
24921
|
+
/* @__PURE__ */ jsx103("div", { className: "flex-shrink-0 lg:w-auto self-center sm:self-auto", children: /* @__PURE__ */ jsx103(
|
|
24922
|
+
Menu,
|
|
24923
|
+
{
|
|
24924
|
+
defaultValue: "history" /* HISTORY */,
|
|
24925
|
+
value: activeTab,
|
|
24926
|
+
onValueChange: (value) => setActiveTab(value),
|
|
24927
|
+
variant: "menu2",
|
|
24928
|
+
className: "bg-transparent shadow-none px-0",
|
|
24929
|
+
children: /* @__PURE__ */ jsxs82(
|
|
24930
|
+
MenuContent,
|
|
24931
|
+
{
|
|
24932
|
+
variant: "menu2",
|
|
24933
|
+
className: "w-full lg:w-auto max-w-full min-w-0",
|
|
24934
|
+
children: [
|
|
24935
|
+
/* @__PURE__ */ jsx103(
|
|
24936
|
+
MenuItem,
|
|
24937
|
+
{
|
|
24938
|
+
variant: "menu2",
|
|
24939
|
+
value: "history" /* HISTORY */,
|
|
24940
|
+
"data-testid": "menu-item-history",
|
|
24941
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
24942
|
+
children: "Hist\xF3rico"
|
|
24943
|
+
}
|
|
24944
|
+
),
|
|
24945
|
+
/* @__PURE__ */ jsx103(
|
|
24946
|
+
MenuItem,
|
|
24947
|
+
{
|
|
24948
|
+
variant: "menu2",
|
|
24949
|
+
value: "drafts" /* DRAFTS */,
|
|
24950
|
+
"data-testid": "menu-item-drafts",
|
|
24951
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
24952
|
+
children: "Rascunhos"
|
|
24953
|
+
}
|
|
24954
|
+
),
|
|
24955
|
+
/* @__PURE__ */ jsx103(
|
|
24956
|
+
MenuItem,
|
|
24957
|
+
{
|
|
24958
|
+
variant: "menu2",
|
|
24959
|
+
value: "models" /* MODELS */,
|
|
24960
|
+
"data-testid": "menu-item-models",
|
|
24961
|
+
className: "whitespace-nowrap flex-1 lg:flex-none",
|
|
24962
|
+
children: "Modelos"
|
|
24963
|
+
}
|
|
24964
|
+
)
|
|
24965
|
+
]
|
|
24966
|
+
}
|
|
24967
|
+
)
|
|
24968
|
+
}
|
|
24969
|
+
) })
|
|
24970
|
+
] }),
|
|
24971
|
+
/* @__PURE__ */ jsxs82("div", { className: "flex flex-col items-center w-full min-h-0 flex-1", children: [
|
|
24972
|
+
activeTab === "history" /* HISTORY */ && /* @__PURE__ */ jsx103(
|
|
24973
|
+
HistoryTab,
|
|
24974
|
+
{
|
|
24975
|
+
fetchActivitiesHistory,
|
|
24976
|
+
onCreateActivity,
|
|
24977
|
+
onRowClick,
|
|
24978
|
+
emptyStateImage,
|
|
24979
|
+
noSearchImage,
|
|
24980
|
+
mapSubjectNameToEnum,
|
|
24981
|
+
userFilterData
|
|
24982
|
+
}
|
|
24983
|
+
),
|
|
24984
|
+
activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */ jsx103(DraftsTab, {}),
|
|
24985
|
+
activeTab === "models" /* MODELS */ && /* @__PURE__ */ jsx103(
|
|
24986
|
+
ModelsTab,
|
|
24987
|
+
{
|
|
24988
|
+
fetchActivityModels,
|
|
24989
|
+
deleteActivityModel,
|
|
24990
|
+
onCreateModel,
|
|
24991
|
+
onSendActivity,
|
|
24992
|
+
onEditModel,
|
|
24993
|
+
emptyStateImage,
|
|
24994
|
+
noSearchImage,
|
|
24995
|
+
mapSubjectNameToEnum,
|
|
24996
|
+
userFilterData,
|
|
24997
|
+
subjectsMap
|
|
24998
|
+
}
|
|
24999
|
+
)
|
|
25000
|
+
] })
|
|
25001
|
+
] })
|
|
25002
|
+
]
|
|
25003
|
+
}
|
|
25004
|
+
);
|
|
25005
|
+
};
|
|
23714
25006
|
export {
|
|
23715
25007
|
ACTIVITY_AVAILABILITY,
|
|
25008
|
+
ACTIVITY_FILTER_STATUS_OPTIONS,
|
|
23716
25009
|
ANSWER_STATUS,
|
|
23717
25010
|
AccordionGroup,
|
|
25011
|
+
ActivitiesHistory,
|
|
25012
|
+
GenericApiStatus as ActivityApiStatus,
|
|
25013
|
+
BadgeActionType as ActivityBadgeActionType,
|
|
23718
25014
|
ActivityCardQuestionBanks,
|
|
23719
25015
|
ActivityCardQuestionPreview,
|
|
23720
25016
|
ActivityDetails,
|
|
25017
|
+
GenericDisplayStatus as ActivityDisplayStatus,
|
|
25018
|
+
ActivityDraftType,
|
|
23721
25019
|
ActivityFilters,
|
|
23722
25020
|
ActivityFiltersPopover,
|
|
23723
25021
|
ActivityPreview,
|
|
@@ -23751,6 +25049,8 @@ export {
|
|
|
23751
25049
|
Chips_default as Chips,
|
|
23752
25050
|
CorrectActivityModal_default as CorrectActivityModal,
|
|
23753
25051
|
CreateActivity,
|
|
25052
|
+
DEFAULT_ACTIVITIES_PAGINATION,
|
|
25053
|
+
DEFAULT_MODELS_PAGINATION,
|
|
23754
25054
|
DIFFICULTY_LEVEL_ENUM,
|
|
23755
25055
|
DateTimeInput_default as DateTimeInput,
|
|
23756
25056
|
Divider_default as Divider,
|
|
@@ -23766,9 +25066,9 @@ export {
|
|
|
23766
25066
|
FilterModal,
|
|
23767
25067
|
GOAL_FILTER_STATUS_OPTIONS,
|
|
23768
25068
|
GOAL_STATUS_OPTIONS,
|
|
23769
|
-
GoalApiStatus,
|
|
23770
|
-
GoalBadgeActionType,
|
|
23771
|
-
GoalDisplayStatus,
|
|
25069
|
+
GenericApiStatus as GoalApiStatus,
|
|
25070
|
+
BadgeActionType as GoalBadgeActionType,
|
|
25071
|
+
GenericDisplayStatus as GoalDisplayStatus,
|
|
23772
25072
|
IconButton_default as IconButton,
|
|
23773
25073
|
IconRender_default as IconRender,
|
|
23774
25074
|
IconRoundedButton_default as IconRoundedButton,
|
|
@@ -23849,6 +25149,7 @@ export {
|
|
|
23849
25149
|
StatisticsCard,
|
|
23850
25150
|
Stepper_default as Stepper,
|
|
23851
25151
|
StudentLessonStatus,
|
|
25152
|
+
StudentPerformanceModal,
|
|
23852
25153
|
SubjectEnum,
|
|
23853
25154
|
SubjectInfo,
|
|
23854
25155
|
Support_default as Support,
|
|
@@ -23872,15 +25173,21 @@ export {
|
|
|
23872
25173
|
Toaster_default as Toaster,
|
|
23873
25174
|
VideoPlayer_default as VideoPlayer,
|
|
23874
25175
|
Whiteboard_default as Whiteboard,
|
|
25176
|
+
activitiesHistoryApiResponseSchema,
|
|
25177
|
+
activityModelsApiResponseSchema,
|
|
23875
25178
|
cn,
|
|
23876
25179
|
convertActivityFiltersToQuestionsFilter,
|
|
25180
|
+
createActivitiesHistoryHook,
|
|
23877
25181
|
createActivityFiltersDataHook,
|
|
25182
|
+
createActivityModelsHook,
|
|
23878
25183
|
createNotificationStore,
|
|
23879
25184
|
createNotificationsHook,
|
|
23880
25185
|
createQuestionsListHook,
|
|
23881
25186
|
createRecommendedLessonDetailsHook,
|
|
23882
25187
|
createRecommendedLessonsHistoryHook,
|
|
25188
|
+
createUseActivitiesHistory,
|
|
23883
25189
|
createUseActivityFiltersData,
|
|
25190
|
+
createUseActivityModels,
|
|
23884
25191
|
createUseNotificationStore,
|
|
23885
25192
|
createUseNotifications,
|
|
23886
25193
|
createUseQuestionsList,
|
|
@@ -23896,6 +25203,7 @@ export {
|
|
|
23896
25203
|
formatTimeAgo,
|
|
23897
25204
|
formatTimeSpent,
|
|
23898
25205
|
generateFileId,
|
|
25206
|
+
getActivityStatusBadgeAction,
|
|
23899
25207
|
getCategoryIcon,
|
|
23900
25208
|
getCategoryText,
|
|
23901
25209
|
getDeviceType,
|
|
@@ -23916,12 +25224,15 @@ export {
|
|
|
23916
25224
|
goalApiResponseSchema,
|
|
23917
25225
|
goalDetailsApiResponseSchema,
|
|
23918
25226
|
goalsHistoryApiResponseSchema,
|
|
25227
|
+
handleActivityFetchError,
|
|
23919
25228
|
handleGoalFetchError,
|
|
23920
25229
|
handleLessonDetailsFetchError,
|
|
25230
|
+
handleModelFetchError,
|
|
23921
25231
|
historyApiResponseSchema,
|
|
23922
25232
|
isDeadlinePassed,
|
|
23923
25233
|
isFormValid,
|
|
23924
25234
|
isStepValid,
|
|
25235
|
+
mapActivityStatusToDisplay,
|
|
23925
25236
|
mapApiStatusToInternal,
|
|
23926
25237
|
mapInternalStatusToApi,
|
|
23927
25238
|
mapQuestionTypeToEnum,
|
|
@@ -23931,7 +25242,9 @@ export {
|
|
|
23931
25242
|
syncDropdownState,
|
|
23932
25243
|
toggleArrayItem,
|
|
23933
25244
|
toggleSingleValue,
|
|
25245
|
+
transformActivityToTableItem,
|
|
23934
25246
|
transformGoalToTableItem,
|
|
25247
|
+
transformModelToTableItem,
|
|
23935
25248
|
useAlertFormStore,
|
|
23936
25249
|
useApiConfig,
|
|
23937
25250
|
useAppContent,
|