analytica-frontend-lib 1.2.78 → 1.2.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivitiesHistory/index.js +485 -418
- package/dist/ActivitiesHistory/index.js.map +1 -1
- package/dist/ActivitiesHistory/index.mjs +478 -411
- package/dist/ActivitiesHistory/index.mjs.map +1 -1
- package/dist/RecommendedLessonsHistory/index.d.ts +1 -1
- package/dist/RecommendedLessonsHistory/index.d.ts.map +1 -1
- package/dist/RecommendedLessonsHistory/index.js +1183 -381
- package/dist/RecommendedLessonsHistory/index.js.map +1 -1
- package/dist/RecommendedLessonsHistory/index.mjs +1176 -372
- package/dist/RecommendedLessonsHistory/index.mjs.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.d.ts.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.js +4261 -4117
- package/dist/SendActivityModal/SendActivityModal.js.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.mjs +4282 -4139
- package/dist/SendActivityModal/SendActivityModal.mjs.map +1 -1
- package/dist/SendActivityModal/hooks/useSendActivityModal.d.ts.map +1 -1
- package/dist/SendActivityModal/hooks/useSendActivityModal.js +16 -18
- package/dist/SendActivityModal/hooks/useSendActivityModal.js.map +1 -1
- package/dist/SendActivityModal/hooks/useSendActivityModal.mjs +16 -18
- package/dist/SendActivityModal/hooks/useSendActivityModal.mjs.map +1 -1
- package/dist/SendActivityModal/index.js +1285 -1141
- package/dist/SendActivityModal/index.js.map +1 -1
- package/dist/SendActivityModal/index.mjs +1164 -1021
- package/dist/SendActivityModal/index.mjs.map +1 -1
- package/dist/hooks/useGoalModels.d.ts +171 -0
- package/dist/hooks/useGoalModels.d.ts.map +1 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1864 -1716
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1896 -1765
- package/dist/index.mjs.map +1 -1
- package/dist/types/recommendedLessons/index.d.ts +61 -0
- package/dist/types/recommendedLessons/index.d.ts.map +1 -1
- package/dist/types/recommendedLessons/index.js +7 -0
- package/dist/types/recommendedLessons/index.js.map +1 -1
- package/dist/types/recommendedLessons/index.mjs +6 -0
- package/dist/types/recommendedLessons/index.mjs.map +1 -1
- package/dist/types/recommendedLessons.d.ts +61 -0
- package/dist/types/recommendedLessons.d.ts.map +1 -1
- package/dist/utils/extractStudentsFromCategories.d.ts +15 -0
- package/dist/utils/extractStudentsFromCategories.d.ts.map +1 -0
- package/dist/utils/renderSubjectCell.d.ts +11 -0
- package/dist/utils/renderSubjectCell.d.ts.map +1 -0
- package/package.json +3 -2
|
@@ -295,8 +295,8 @@ var injectStore = (children, store) => Children.map(children, (child) => {
|
|
|
295
295
|
});
|
|
296
296
|
|
|
297
297
|
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
298
|
-
import { useCallback as
|
|
299
|
-
import { Plus } from "phosphor-react";
|
|
298
|
+
import { useCallback as useCallback6, useMemo as useMemo7, useRef as useRef8 } from "react";
|
|
299
|
+
import { Plus as Plus2 } from "phosphor-react";
|
|
300
300
|
|
|
301
301
|
// src/components/Button/Button.tsx
|
|
302
302
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -403,7 +403,7 @@ var EmptyState = ({
|
|
|
403
403
|
var EmptyState_default = EmptyState;
|
|
404
404
|
|
|
405
405
|
// src/components/TableProvider/TableProvider.tsx
|
|
406
|
-
import { useState as
|
|
406
|
+
import { useState as useState15, useEffect as useEffect15, useMemo as useMemo6, useCallback as useCallback5 } from "react";
|
|
407
407
|
|
|
408
408
|
// src/components/Table/Table.tsx
|
|
409
409
|
import {
|
|
@@ -2524,7 +2524,7 @@ Search.displayName = "Search";
|
|
|
2524
2524
|
var Search_default = Search;
|
|
2525
2525
|
|
|
2526
2526
|
// src/components/CheckBoxGroup/CheckBoxGroup.tsx
|
|
2527
|
-
import { useEffect as
|
|
2527
|
+
import { useEffect as useEffect14, useMemo as useMemo5, useRef as useRef7, useState as useState14 } from "react";
|
|
2528
2528
|
|
|
2529
2529
|
// src/components/Badge/Badge.tsx
|
|
2530
2530
|
import { Bell } from "phosphor-react";
|
|
@@ -5538,8 +5538,320 @@ var mapApiStatusToDisplay = (apiStatus) => {
|
|
|
5538
5538
|
return statusMap[apiStatus];
|
|
5539
5539
|
};
|
|
5540
5540
|
|
|
5541
|
+
// src/components/shared/ModelsTabBase/ModelsTabBase.tsx
|
|
5542
|
+
import { useState as useState11, useCallback as useCallback2, useMemo as useMemo4, useRef as useRef6, useEffect as useEffect13 } from "react";
|
|
5543
|
+
import { Plus } from "phosphor-react";
|
|
5544
|
+
|
|
5545
|
+
// src/components/ActivitiesHistory/components/ErrorDisplay.tsx
|
|
5546
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
5547
|
+
var ErrorDisplay = ({ error }) => /* @__PURE__ */ jsx33("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx33(Text_default, { size: "lg", color: "text-error-500", children: error }) });
|
|
5548
|
+
|
|
5549
|
+
// src/components/shared/ModelsTabBase/ModelsTabBase.tsx
|
|
5550
|
+
import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5551
|
+
var ModelsTabBase = ({
|
|
5552
|
+
fetchModels: fetchModelsProp,
|
|
5553
|
+
deleteModel: deleteModelProp,
|
|
5554
|
+
onCreateModel,
|
|
5555
|
+
onSend,
|
|
5556
|
+
onEditModel,
|
|
5557
|
+
emptyStateImage,
|
|
5558
|
+
noSearchImage,
|
|
5559
|
+
mapSubjectNameToEnum,
|
|
5560
|
+
userFilterData,
|
|
5561
|
+
subjectsMap,
|
|
5562
|
+
config,
|
|
5563
|
+
createTableColumns,
|
|
5564
|
+
createFiltersConfig,
|
|
5565
|
+
buildFiltersFromParams,
|
|
5566
|
+
createUseModels
|
|
5567
|
+
}) => {
|
|
5568
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState11(false);
|
|
5569
|
+
const [modelToDelete, setModelToDelete] = useState11(null);
|
|
5570
|
+
const { addToast } = useToast();
|
|
5571
|
+
const fetchModelsRef = useRef6(fetchModelsProp);
|
|
5572
|
+
fetchModelsRef.current = fetchModelsProp;
|
|
5573
|
+
const deleteModelRef = useRef6(deleteModelProp);
|
|
5574
|
+
deleteModelRef.current = deleteModelProp;
|
|
5575
|
+
const subjectsMapRef = useRef6(subjectsMap);
|
|
5576
|
+
subjectsMapRef.current = subjectsMap;
|
|
5577
|
+
const useModels = useMemo4(
|
|
5578
|
+
() => createUseModels(
|
|
5579
|
+
(filters) => fetchModelsRef.current(filters),
|
|
5580
|
+
(id) => deleteModelRef.current(id)
|
|
5581
|
+
),
|
|
5582
|
+
[createUseModels]
|
|
5583
|
+
);
|
|
5584
|
+
const {
|
|
5585
|
+
models,
|
|
5586
|
+
loading: modelsLoading,
|
|
5587
|
+
error: modelsError,
|
|
5588
|
+
pagination: modelsPagination,
|
|
5589
|
+
fetchModels,
|
|
5590
|
+
deleteModel
|
|
5591
|
+
} = useModels();
|
|
5592
|
+
const modelsFilterConfigs = useMemo4(
|
|
5593
|
+
() => createFiltersConfig(userFilterData),
|
|
5594
|
+
[createFiltersConfig, userFilterData]
|
|
5595
|
+
);
|
|
5596
|
+
const handleDeleteClick = useCallback2((model) => {
|
|
5597
|
+
setModelToDelete(model);
|
|
5598
|
+
setDeleteDialogOpen(true);
|
|
5599
|
+
}, []);
|
|
5600
|
+
const modelsTableColumns = useMemo4(
|
|
5601
|
+
() => createTableColumns(
|
|
5602
|
+
mapSubjectNameToEnum,
|
|
5603
|
+
onSend,
|
|
5604
|
+
onEditModel,
|
|
5605
|
+
handleDeleteClick
|
|
5606
|
+
),
|
|
5607
|
+
[
|
|
5608
|
+
createTableColumns,
|
|
5609
|
+
mapSubjectNameToEnum,
|
|
5610
|
+
onSend,
|
|
5611
|
+
onEditModel,
|
|
5612
|
+
handleDeleteClick
|
|
5613
|
+
]
|
|
5614
|
+
);
|
|
5615
|
+
const handleParamsChange = useCallback2(
|
|
5616
|
+
(params) => {
|
|
5617
|
+
const filters = buildFiltersFromParams(params);
|
|
5618
|
+
fetchModels(filters, subjectsMapRef.current);
|
|
5619
|
+
},
|
|
5620
|
+
[buildFiltersFromParams, fetchModels]
|
|
5621
|
+
);
|
|
5622
|
+
useEffect13(() => {
|
|
5623
|
+
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
5624
|
+
}, [fetchModels]);
|
|
5625
|
+
const handleConfirmDelete = useCallback2(async () => {
|
|
5626
|
+
if (modelToDelete) {
|
|
5627
|
+
const success = await deleteModel(modelToDelete.id);
|
|
5628
|
+
if (success) {
|
|
5629
|
+
addToast({ title: "Modelo deletado com sucesso", action: "success" });
|
|
5630
|
+
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
5631
|
+
} else {
|
|
5632
|
+
addToast({ title: "Erro ao deletar modelo", action: "warning" });
|
|
5633
|
+
}
|
|
5634
|
+
}
|
|
5635
|
+
setDeleteDialogOpen(false);
|
|
5636
|
+
setModelToDelete(null);
|
|
5637
|
+
}, [modelToDelete, deleteModel, fetchModels, addToast]);
|
|
5638
|
+
const handleCancelDelete = useCallback2(() => {
|
|
5639
|
+
setDeleteDialogOpen(false);
|
|
5640
|
+
setModelToDelete(null);
|
|
5641
|
+
}, []);
|
|
5642
|
+
return /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
5643
|
+
/* @__PURE__ */ jsx34(Toaster_default, {}),
|
|
5644
|
+
modelsError ? /* @__PURE__ */ jsx34(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ jsx34("div", { className: "w-full", "data-testid": config.testId, children: /* @__PURE__ */ jsx34(
|
|
5645
|
+
TableProvider,
|
|
5646
|
+
{
|
|
5647
|
+
data: models,
|
|
5648
|
+
headers: modelsTableColumns,
|
|
5649
|
+
loading: modelsLoading,
|
|
5650
|
+
variant: "borderless",
|
|
5651
|
+
enableSearch: true,
|
|
5652
|
+
enableFilters: true,
|
|
5653
|
+
enableTableSort: true,
|
|
5654
|
+
enablePagination: true,
|
|
5655
|
+
initialFilters: modelsFilterConfigs,
|
|
5656
|
+
paginationConfig: {
|
|
5657
|
+
itemLabel: "modelos",
|
|
5658
|
+
itemsPerPageOptions: [10, 20, 50, 100],
|
|
5659
|
+
defaultItemsPerPage: 10,
|
|
5660
|
+
totalItems: modelsPagination.total,
|
|
5661
|
+
totalPages: modelsPagination.totalPages
|
|
5662
|
+
},
|
|
5663
|
+
searchPlaceholder: config.searchPlaceholder,
|
|
5664
|
+
noSearchResultState: {
|
|
5665
|
+
image: noSearchImage
|
|
5666
|
+
},
|
|
5667
|
+
emptyState: {
|
|
5668
|
+
component: /* @__PURE__ */ jsx34(
|
|
5669
|
+
EmptyState_default,
|
|
5670
|
+
{
|
|
5671
|
+
image: emptyStateImage,
|
|
5672
|
+
title: config.emptyStateTitle,
|
|
5673
|
+
description: config.emptyStateDescription,
|
|
5674
|
+
buttonText: "Criar modelo",
|
|
5675
|
+
buttonIcon: /* @__PURE__ */ jsx34(Plus, { size: 18 }),
|
|
5676
|
+
buttonVariant: "outline",
|
|
5677
|
+
buttonAction: "primary",
|
|
5678
|
+
onButtonClick: onCreateModel
|
|
5679
|
+
}
|
|
5680
|
+
)
|
|
5681
|
+
},
|
|
5682
|
+
onParamsChange: handleParamsChange,
|
|
5683
|
+
children: (renderProps) => {
|
|
5684
|
+
const {
|
|
5685
|
+
controls,
|
|
5686
|
+
table,
|
|
5687
|
+
pagination: paginationComponent
|
|
5688
|
+
} = renderProps;
|
|
5689
|
+
return /* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
|
|
5690
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between gap-4", children: [
|
|
5691
|
+
/* @__PURE__ */ jsx34(
|
|
5692
|
+
Button_default,
|
|
5693
|
+
{
|
|
5694
|
+
variant: "solid",
|
|
5695
|
+
action: "primary",
|
|
5696
|
+
size: "medium",
|
|
5697
|
+
onClick: onCreateModel,
|
|
5698
|
+
iconLeft: /* @__PURE__ */ jsx34(Plus, { size: 18, weight: "bold" }),
|
|
5699
|
+
children: "Criar modelo"
|
|
5700
|
+
}
|
|
5701
|
+
),
|
|
5702
|
+
controls
|
|
5703
|
+
] }),
|
|
5704
|
+
/* @__PURE__ */ jsxs22("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
|
|
5705
|
+
table,
|
|
5706
|
+
paginationComponent
|
|
5707
|
+
] })
|
|
5708
|
+
] });
|
|
5709
|
+
}
|
|
5710
|
+
}
|
|
5711
|
+
) }),
|
|
5712
|
+
/* @__PURE__ */ jsx34(
|
|
5713
|
+
AlertDialog,
|
|
5714
|
+
{
|
|
5715
|
+
isOpen: deleteDialogOpen,
|
|
5716
|
+
onChangeOpen: setDeleteDialogOpen,
|
|
5717
|
+
title: "Deletar modelo",
|
|
5718
|
+
description: `Tem certeza que deseja deletar o modelo "${modelToDelete?.title}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
|
|
5719
|
+
submitButtonLabel: "Deletar",
|
|
5720
|
+
cancelButtonLabel: "Cancelar",
|
|
5721
|
+
onSubmit: handleConfirmDelete,
|
|
5722
|
+
onCancel: handleCancelDelete
|
|
5723
|
+
}
|
|
5724
|
+
)
|
|
5725
|
+
] });
|
|
5726
|
+
};
|
|
5727
|
+
|
|
5728
|
+
// src/components/shared/ModelsTabBase/createModelsTableColumnsBase.tsx
|
|
5729
|
+
import { Trash, PencilSimple, PaperPlaneTilt } from "phosphor-react";
|
|
5730
|
+
|
|
5731
|
+
// src/utils/renderSubjectCell.tsx
|
|
5732
|
+
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5733
|
+
var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
|
|
5734
|
+
if (!subjectName) {
|
|
5735
|
+
return showEmptyDash ? /* @__PURE__ */ jsx35(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
|
|
5736
|
+
}
|
|
5737
|
+
const subjectEnum = mapSubjectNameToEnum?.(subjectName);
|
|
5738
|
+
if (!subjectEnum) {
|
|
5739
|
+
return /* @__PURE__ */ jsx35(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
|
|
5740
|
+
}
|
|
5741
|
+
const subjectInfo = getSubjectInfo(subjectEnum);
|
|
5742
|
+
return /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2", title: subjectName, children: [
|
|
5743
|
+
/* @__PURE__ */ jsx35(
|
|
5744
|
+
"span",
|
|
5745
|
+
{
|
|
5746
|
+
className: cn(
|
|
5747
|
+
"w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
|
|
5748
|
+
subjectInfo.colorClass
|
|
5749
|
+
),
|
|
5750
|
+
children: subjectInfo.icon
|
|
5751
|
+
}
|
|
5752
|
+
),
|
|
5753
|
+
/* @__PURE__ */ jsx35(Text_default, { size: "sm", className: "truncate", children: subjectName })
|
|
5754
|
+
] });
|
|
5755
|
+
};
|
|
5756
|
+
|
|
5757
|
+
// src/components/shared/ModelsTabBase/createModelsTableColumnsBase.tsx
|
|
5758
|
+
import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5759
|
+
var createModelsTableColumnsBase = (mapSubjectNameToEnum, onSend, onEdit, onDelete, config) => [
|
|
5760
|
+
{
|
|
5761
|
+
key: "title",
|
|
5762
|
+
label: "T\xEDtulo",
|
|
5763
|
+
sortable: true,
|
|
5764
|
+
className: "max-w-[400px]",
|
|
5765
|
+
render: (value) => {
|
|
5766
|
+
const title = typeof value === "string" ? value : "";
|
|
5767
|
+
return /* @__PURE__ */ jsx36(Text_default, { size: "sm", title, className: "truncate block", children: title });
|
|
5768
|
+
}
|
|
5769
|
+
},
|
|
5770
|
+
{
|
|
5771
|
+
key: "savedAt",
|
|
5772
|
+
label: "Salvo em",
|
|
5773
|
+
sortable: true,
|
|
5774
|
+
className: "w-[120px]"
|
|
5775
|
+
},
|
|
5776
|
+
{
|
|
5777
|
+
key: "subject",
|
|
5778
|
+
label: "Mat\xE9ria",
|
|
5779
|
+
sortable: true,
|
|
5780
|
+
className: "max-w-[160px]",
|
|
5781
|
+
render: (value) => {
|
|
5782
|
+
const subjectName = typeof value === "string" ? value : "";
|
|
5783
|
+
return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
|
|
5784
|
+
}
|
|
5785
|
+
},
|
|
5786
|
+
{
|
|
5787
|
+
key: "actions",
|
|
5788
|
+
label: "",
|
|
5789
|
+
sortable: false,
|
|
5790
|
+
className: "w-[220px]",
|
|
5791
|
+
render: (_value, row) => {
|
|
5792
|
+
const handleSend = (e) => {
|
|
5793
|
+
e.stopPropagation();
|
|
5794
|
+
onSend?.(row);
|
|
5795
|
+
};
|
|
5796
|
+
const handleEdit = (e) => {
|
|
5797
|
+
e.stopPropagation();
|
|
5798
|
+
onEdit?.(row);
|
|
5799
|
+
};
|
|
5800
|
+
const handleDelete = (e) => {
|
|
5801
|
+
e.stopPropagation();
|
|
5802
|
+
onDelete(row);
|
|
5803
|
+
};
|
|
5804
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 justify-end", children: [
|
|
5805
|
+
onSend && /* @__PURE__ */ jsx36(
|
|
5806
|
+
Button_default,
|
|
5807
|
+
{
|
|
5808
|
+
variant: "outline",
|
|
5809
|
+
action: "primary",
|
|
5810
|
+
size: "small",
|
|
5811
|
+
iconLeft: /* @__PURE__ */ jsx36(PaperPlaneTilt, { size: 16 }),
|
|
5812
|
+
onClick: handleSend,
|
|
5813
|
+
"aria-label": config.sendButtonAriaLabel,
|
|
5814
|
+
children: config.sendButtonLabel
|
|
5815
|
+
}
|
|
5816
|
+
),
|
|
5817
|
+
/* @__PURE__ */ jsx36(
|
|
5818
|
+
IconButton_default,
|
|
5819
|
+
{
|
|
5820
|
+
icon: /* @__PURE__ */ jsx36(Trash, { size: 20 }),
|
|
5821
|
+
size: "md",
|
|
5822
|
+
onClick: handleDelete,
|
|
5823
|
+
"aria-label": config.deleteButtonAriaLabel,
|
|
5824
|
+
className: "text-text-600 hover:text-error-500 hover:bg-transparent"
|
|
5825
|
+
}
|
|
5826
|
+
),
|
|
5827
|
+
onEdit && /* @__PURE__ */ jsx36(
|
|
5828
|
+
IconButton_default,
|
|
5829
|
+
{
|
|
5830
|
+
icon: /* @__PURE__ */ jsx36(PencilSimple, { size: 20 }),
|
|
5831
|
+
size: "md",
|
|
5832
|
+
onClick: handleEdit,
|
|
5833
|
+
"aria-label": config.editButtonAriaLabel,
|
|
5834
|
+
className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
|
|
5835
|
+
}
|
|
5836
|
+
)
|
|
5837
|
+
] });
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
];
|
|
5841
|
+
|
|
5842
|
+
// src/utils/hookErrorHandler.ts
|
|
5843
|
+
import { z } from "zod";
|
|
5844
|
+
var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
|
|
5845
|
+
if (error instanceof z.ZodError) {
|
|
5846
|
+
console.error(validationErrorMessage, error);
|
|
5847
|
+
return validationErrorMessage;
|
|
5848
|
+
}
|
|
5849
|
+
console.error(genericErrorMessage, error);
|
|
5850
|
+
return genericErrorMessage;
|
|
5851
|
+
};
|
|
5852
|
+
|
|
5541
5853
|
// src/hooks/useActivitiesHistory.ts
|
|
5542
|
-
import { useState as
|
|
5854
|
+
import { useState as useState12, useCallback as useCallback3 } from "react";
|
|
5543
5855
|
import { z as z2 } from "zod";
|
|
5544
5856
|
import dayjs from "dayjs";
|
|
5545
5857
|
|
|
@@ -5557,17 +5869,6 @@ var ACTIVITY_FILTER_STATUS_OPTIONS = [
|
|
|
5557
5869
|
];
|
|
5558
5870
|
var mapActivityStatusToDisplay = (apiStatus) => mapApiStatusToDisplay(apiStatus);
|
|
5559
5871
|
|
|
5560
|
-
// src/utils/hookErrorHandler.ts
|
|
5561
|
-
import { z } from "zod";
|
|
5562
|
-
var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
|
|
5563
|
-
if (error instanceof z.ZodError) {
|
|
5564
|
-
console.error(validationErrorMessage, error);
|
|
5565
|
-
return validationErrorMessage;
|
|
5566
|
-
}
|
|
5567
|
-
console.error(genericErrorMessage, error);
|
|
5568
|
-
return genericErrorMessage;
|
|
5569
|
-
};
|
|
5570
|
-
|
|
5571
5872
|
// src/hooks/useActivitiesHistory.ts
|
|
5572
5873
|
var activityHistoryResponseSchema = z2.object({
|
|
5573
5874
|
id: z2.string().uuid(),
|
|
@@ -5625,13 +5926,13 @@ var handleActivityFetchError = createFetchErrorHandler(
|
|
|
5625
5926
|
);
|
|
5626
5927
|
var createUseActivitiesHistory = (fetchActivitiesHistory) => {
|
|
5627
5928
|
return () => {
|
|
5628
|
-
const [state, setState] =
|
|
5929
|
+
const [state, setState] = useState12({
|
|
5629
5930
|
activities: [],
|
|
5630
5931
|
loading: false,
|
|
5631
5932
|
error: null,
|
|
5632
5933
|
pagination: DEFAULT_ACTIVITIES_PAGINATION
|
|
5633
5934
|
});
|
|
5634
|
-
const fetchActivities =
|
|
5935
|
+
const fetchActivities = useCallback3(
|
|
5635
5936
|
async (filters) => {
|
|
5636
5937
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
5637
5938
|
try {
|
|
@@ -5665,7 +5966,7 @@ var createUseActivitiesHistory = (fetchActivitiesHistory) => {
|
|
|
5665
5966
|
};
|
|
5666
5967
|
|
|
5667
5968
|
// src/hooks/useActivityModels.ts
|
|
5668
|
-
import { useState as
|
|
5969
|
+
import { useState as useState13, useCallback as useCallback4 } from "react";
|
|
5669
5970
|
import { z as z3 } from "zod";
|
|
5670
5971
|
import dayjs2 from "dayjs";
|
|
5671
5972
|
var activityDraftFiltersSchema = z3.object({
|
|
@@ -5715,13 +6016,13 @@ var handleModelFetchError = createFetchErrorHandler(
|
|
|
5715
6016
|
);
|
|
5716
6017
|
var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
5717
6018
|
return () => {
|
|
5718
|
-
const [state, setState] =
|
|
6019
|
+
const [state, setState] = useState13({
|
|
5719
6020
|
models: [],
|
|
5720
6021
|
loading: false,
|
|
5721
6022
|
error: null,
|
|
5722
6023
|
pagination: DEFAULT_MODELS_PAGINATION
|
|
5723
6024
|
});
|
|
5724
|
-
const fetchModels =
|
|
6025
|
+
const fetchModels = useCallback4(
|
|
5725
6026
|
async (filters, subjectsMap) => {
|
|
5726
6027
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
5727
6028
|
try {
|
|
@@ -5756,7 +6057,7 @@ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
|
|
|
5756
6057
|
},
|
|
5757
6058
|
[fetchActivityModels]
|
|
5758
6059
|
);
|
|
5759
|
-
const deleteModel =
|
|
6060
|
+
const deleteModel = useCallback4(
|
|
5760
6061
|
async (id) => {
|
|
5761
6062
|
try {
|
|
5762
6063
|
await deleteActivityModel(id);
|
|
@@ -5858,7 +6159,7 @@ var calculateFormattedItemsForAutoSelection = (category, allCategories) => {
|
|
|
5858
6159
|
};
|
|
5859
6160
|
|
|
5860
6161
|
// src/components/CheckBoxGroup/CheckBoxGroup.tsx
|
|
5861
|
-
import { jsx as
|
|
6162
|
+
import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5862
6163
|
var CheckboxGroup = ({
|
|
5863
6164
|
categories,
|
|
5864
6165
|
onCategoriesChange,
|
|
@@ -5866,14 +6167,14 @@ var CheckboxGroup = ({
|
|
|
5866
6167
|
showDivider = true,
|
|
5867
6168
|
showSingleItem = false
|
|
5868
6169
|
}) => {
|
|
5869
|
-
const [openAccordion, setOpenAccordion] =
|
|
5870
|
-
const autoSelectionAppliedRef =
|
|
5871
|
-
const onCategoriesChangeRef =
|
|
5872
|
-
const previousCategoriesRef =
|
|
5873
|
-
|
|
6170
|
+
const [openAccordion, setOpenAccordion] = useState14("");
|
|
6171
|
+
const autoSelectionAppliedRef = useRef7(false);
|
|
6172
|
+
const onCategoriesChangeRef = useRef7(onCategoriesChange);
|
|
6173
|
+
const previousCategoriesRef = useRef7(categories);
|
|
6174
|
+
useEffect14(() => {
|
|
5874
6175
|
onCategoriesChangeRef.current = onCategoriesChange;
|
|
5875
6176
|
}, [onCategoriesChange]);
|
|
5876
|
-
const categoriesWithAutoSelection =
|
|
6177
|
+
const categoriesWithAutoSelection = useMemo5(() => {
|
|
5877
6178
|
return categories.map((category) => {
|
|
5878
6179
|
const filteredItems = calculateFormattedItemsForAutoSelection(
|
|
5879
6180
|
category,
|
|
@@ -5888,7 +6189,7 @@ var CheckboxGroup = ({
|
|
|
5888
6189
|
return category;
|
|
5889
6190
|
});
|
|
5890
6191
|
}, [categories]);
|
|
5891
|
-
|
|
6192
|
+
useEffect14(() => {
|
|
5892
6193
|
const categoriesChanged = categories !== previousCategoriesRef.current;
|
|
5893
6194
|
if (!categoriesChanged && autoSelectionAppliedRef.current) {
|
|
5894
6195
|
return;
|
|
@@ -6006,7 +6307,7 @@ var CheckboxGroup = ({
|
|
|
6006
6307
|
);
|
|
6007
6308
|
return groupedItems.length ? groupedItems : [{ itens: [] }];
|
|
6008
6309
|
};
|
|
6009
|
-
const formattedItemsMap =
|
|
6310
|
+
const formattedItemsMap = useMemo5(() => {
|
|
6010
6311
|
const formattedItemsMap2 = {};
|
|
6011
6312
|
for (const category of categories) {
|
|
6012
6313
|
const formattedItems = calculateFormattedItems(category.key);
|
|
@@ -6161,7 +6462,7 @@ var CheckboxGroup = ({
|
|
|
6161
6462
|
};
|
|
6162
6463
|
const renderCheckboxItem = (item, categoryKey) => {
|
|
6163
6464
|
const uniqueId = `${categoryKey}-${item.id}`;
|
|
6164
|
-
return /* @__PURE__ */
|
|
6465
|
+
return /* @__PURE__ */ jsxs25(
|
|
6165
6466
|
"div",
|
|
6166
6467
|
{
|
|
6167
6468
|
className: "flex items-center gap-3 px-2",
|
|
@@ -6171,7 +6472,7 @@ var CheckboxGroup = ({
|
|
|
6171
6472
|
onMouseUp: (e) => e.stopPropagation(),
|
|
6172
6473
|
onKeyDown: (e) => e.stopPropagation(),
|
|
6173
6474
|
children: [
|
|
6174
|
-
/* @__PURE__ */
|
|
6475
|
+
/* @__PURE__ */ jsx37(
|
|
6175
6476
|
CheckBox_default,
|
|
6176
6477
|
{
|
|
6177
6478
|
id: uniqueId,
|
|
@@ -6179,7 +6480,7 @@ var CheckboxGroup = ({
|
|
|
6179
6480
|
onChange: () => toggleItem(categoryKey, item.id)
|
|
6180
6481
|
}
|
|
6181
6482
|
),
|
|
6182
|
-
/* @__PURE__ */
|
|
6483
|
+
/* @__PURE__ */ jsx37(
|
|
6183
6484
|
"label",
|
|
6184
6485
|
{
|
|
6185
6486
|
htmlFor: uniqueId,
|
|
@@ -6192,12 +6493,12 @@ var CheckboxGroup = ({
|
|
|
6192
6493
|
item.id
|
|
6193
6494
|
);
|
|
6194
6495
|
};
|
|
6195
|
-
const renderFormattedGroup = (formattedGroup, idx, categoryKey) => /* @__PURE__ */
|
|
6496
|
+
const renderFormattedGroup = (formattedGroup, idx, categoryKey) => /* @__PURE__ */ jsxs25(
|
|
6196
6497
|
"div",
|
|
6197
6498
|
{
|
|
6198
6499
|
className: "flex flex-col gap-3",
|
|
6199
6500
|
children: [
|
|
6200
|
-
"groupLabel" in formattedGroup && formattedGroup.groupLabel && /* @__PURE__ */
|
|
6501
|
+
"groupLabel" in formattedGroup && formattedGroup.groupLabel && /* @__PURE__ */ jsx37(Text_default, { size: "sm", className: "mt-2", weight: "semibold", children: formattedGroup.groupLabel }),
|
|
6201
6502
|
formattedGroup.itens?.map(
|
|
6202
6503
|
(item) => renderCheckboxItem(item, categoryKey)
|
|
6203
6504
|
)
|
|
@@ -6205,9 +6506,9 @@ var CheckboxGroup = ({
|
|
|
6205
6506
|
},
|
|
6206
6507
|
formattedGroup.groupLabel || `group-${idx}`
|
|
6207
6508
|
);
|
|
6208
|
-
const renderAccordionTrigger = (category, isEnabled) => /* @__PURE__ */
|
|
6209
|
-
/* @__PURE__ */
|
|
6210
|
-
/* @__PURE__ */
|
|
6509
|
+
const renderAccordionTrigger = (category, isEnabled) => /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between w-full p-2", children: [
|
|
6510
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-3", children: [
|
|
6511
|
+
/* @__PURE__ */ jsx37(
|
|
6211
6512
|
CheckBox_default,
|
|
6212
6513
|
{
|
|
6213
6514
|
checked: isMinimalOneCheckBoxIsSelected(category.key),
|
|
@@ -6216,7 +6517,7 @@ var CheckboxGroup = ({
|
|
|
6216
6517
|
onChange: () => toggleAllInCategory(category.key)
|
|
6217
6518
|
}
|
|
6218
6519
|
),
|
|
6219
|
-
/* @__PURE__ */
|
|
6520
|
+
/* @__PURE__ */ jsx37(
|
|
6220
6521
|
Text_default,
|
|
6221
6522
|
{
|
|
6222
6523
|
size: "sm",
|
|
@@ -6226,7 +6527,7 @@ var CheckboxGroup = ({
|
|
|
6226
6527
|
}
|
|
6227
6528
|
)
|
|
6228
6529
|
] }),
|
|
6229
|
-
(openAccordion === category.key || isEnabled) && /* @__PURE__ */
|
|
6530
|
+
(openAccordion === category.key || isEnabled) && /* @__PURE__ */ jsx37(Badge_default, { variant: "solid", action: "info", children: getBadgeText2(category) })
|
|
6230
6531
|
] });
|
|
6231
6532
|
const renderCompactSingleItem = (category) => {
|
|
6232
6533
|
const formattedItems = getFormattedItems(category.key);
|
|
@@ -6235,13 +6536,13 @@ var CheckboxGroup = ({
|
|
|
6235
6536
|
return null;
|
|
6236
6537
|
}
|
|
6237
6538
|
const singleItem = allItems[0];
|
|
6238
|
-
return /* @__PURE__ */
|
|
6539
|
+
return /* @__PURE__ */ jsxs25(
|
|
6239
6540
|
"div",
|
|
6240
6541
|
{
|
|
6241
6542
|
className: "flex items-center justify-between w-full px-3 py-2",
|
|
6242
6543
|
children: [
|
|
6243
|
-
/* @__PURE__ */
|
|
6244
|
-
/* @__PURE__ */
|
|
6544
|
+
/* @__PURE__ */ jsx37(Text_default, { size: "sm", weight: "bold", className: "text-text-800", children: category.label }),
|
|
6545
|
+
/* @__PURE__ */ jsx37(Text_default, { size: "sm", className: "text-text-950", children: singleItem.name })
|
|
6245
6546
|
]
|
|
6246
6547
|
},
|
|
6247
6548
|
category.key
|
|
@@ -6257,16 +6558,16 @@ var CheckboxGroup = ({
|
|
|
6257
6558
|
const allItems = formattedItems.flatMap((group) => group.itens || []);
|
|
6258
6559
|
const hasOnlyOneAvailableItem = allItems.length === 1;
|
|
6259
6560
|
if (compactSingleItem && hasOnlyOneAvailableItem && isEnabled) {
|
|
6260
|
-
return /* @__PURE__ */
|
|
6561
|
+
return /* @__PURE__ */ jsxs25("div", { children: [
|
|
6261
6562
|
renderCompactSingleItem(category),
|
|
6262
|
-
showDivider && /* @__PURE__ */
|
|
6563
|
+
showDivider && /* @__PURE__ */ jsx37(Divider_default, {})
|
|
6263
6564
|
] }, category.key);
|
|
6264
6565
|
}
|
|
6265
6566
|
const hasNoItems = formattedItems.every(
|
|
6266
6567
|
(group) => !group.itens || group.itens.length === 0
|
|
6267
6568
|
);
|
|
6268
|
-
return /* @__PURE__ */
|
|
6269
|
-
/* @__PURE__ */
|
|
6569
|
+
return /* @__PURE__ */ jsxs25("div", { children: [
|
|
6570
|
+
/* @__PURE__ */ jsx37(
|
|
6270
6571
|
CardAccordation,
|
|
6271
6572
|
{
|
|
6272
6573
|
value: category.key,
|
|
@@ -6276,15 +6577,15 @@ var CheckboxGroup = ({
|
|
|
6276
6577
|
openAccordion === category.key && "bg-background-50 border-none"
|
|
6277
6578
|
),
|
|
6278
6579
|
trigger: renderAccordionTrigger(category, isEnabled),
|
|
6279
|
-
children: /* @__PURE__ */
|
|
6580
|
+
children: /* @__PURE__ */ jsx37("div", { className: "flex flex-col gap-3 pt-2", children: hasNoItems && isEnabled ? /* @__PURE__ */ jsx37("div", { className: "px-2 py-4", children: /* @__PURE__ */ jsx37(Text_default, { size: "sm", className: "text-text-500 text-center", children: "Sem dados" }) }) : formattedItems.map(
|
|
6280
6581
|
(formattedGroup, idx) => renderFormattedGroup(formattedGroup, idx, category.key)
|
|
6281
6582
|
) })
|
|
6282
6583
|
}
|
|
6283
6584
|
),
|
|
6284
|
-
openAccordion !== category.key && showDivider && /* @__PURE__ */
|
|
6585
|
+
openAccordion !== category.key && showDivider && /* @__PURE__ */ jsx37(Divider_default, {})
|
|
6285
6586
|
] }, category.key);
|
|
6286
6587
|
};
|
|
6287
|
-
|
|
6588
|
+
useEffect14(() => {
|
|
6288
6589
|
if (!openAccordion) return;
|
|
6289
6590
|
const category = categories.find((c) => c.key === openAccordion);
|
|
6290
6591
|
if (!category) return;
|
|
@@ -6295,7 +6596,7 @@ var CheckboxGroup = ({
|
|
|
6295
6596
|
}, 0);
|
|
6296
6597
|
}
|
|
6297
6598
|
}, [categories, openAccordion]);
|
|
6298
|
-
return /* @__PURE__ */
|
|
6599
|
+
return /* @__PURE__ */ jsx37(
|
|
6299
6600
|
AccordionGroup,
|
|
6300
6601
|
{
|
|
6301
6602
|
type: "single",
|
|
@@ -6308,7 +6609,7 @@ var CheckboxGroup = ({
|
|
|
6308
6609
|
};
|
|
6309
6610
|
|
|
6310
6611
|
// src/components/Filter/FilterModal.tsx
|
|
6311
|
-
import { jsx as
|
|
6612
|
+
import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6312
6613
|
var FilterModal = ({
|
|
6313
6614
|
isOpen,
|
|
6314
6615
|
onClose,
|
|
@@ -6336,20 +6637,20 @@ var FilterModal = ({
|
|
|
6336
6637
|
const handleClear = () => {
|
|
6337
6638
|
onClear();
|
|
6338
6639
|
};
|
|
6339
|
-
return /* @__PURE__ */
|
|
6640
|
+
return /* @__PURE__ */ jsx38(
|
|
6340
6641
|
Modal_default,
|
|
6341
6642
|
{
|
|
6342
6643
|
isOpen,
|
|
6343
6644
|
onClose,
|
|
6344
6645
|
title,
|
|
6345
6646
|
size,
|
|
6346
|
-
footer: /* @__PURE__ */
|
|
6347
|
-
/* @__PURE__ */
|
|
6348
|
-
/* @__PURE__ */
|
|
6647
|
+
footer: /* @__PURE__ */ jsxs26("div", { className: "flex gap-3 justify-end w-full", children: [
|
|
6648
|
+
/* @__PURE__ */ jsx38(Button_default, { variant: "outline", onClick: handleClear, children: clearLabel }),
|
|
6649
|
+
/* @__PURE__ */ jsx38(Button_default, { onClick: handleApply, children: applyLabel })
|
|
6349
6650
|
] }),
|
|
6350
|
-
children: /* @__PURE__ */
|
|
6351
|
-
/* @__PURE__ */
|
|
6352
|
-
config.key === "academic" && /* @__PURE__ */
|
|
6651
|
+
children: /* @__PURE__ */ jsx38("div", { className: "flex flex-col gap-6", children: filterConfigs.map((config, index) => /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4", children: [
|
|
6652
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 text-text-400 text-sm font-medium uppercase", children: [
|
|
6653
|
+
config.key === "academic" && /* @__PURE__ */ jsxs26(
|
|
6353
6654
|
"svg",
|
|
6354
6655
|
{
|
|
6355
6656
|
width: "16",
|
|
@@ -6359,7 +6660,7 @@ var FilterModal = ({
|
|
|
6359
6660
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6360
6661
|
className: "text-text-400",
|
|
6361
6662
|
children: [
|
|
6362
|
-
/* @__PURE__ */
|
|
6663
|
+
/* @__PURE__ */ jsx38(
|
|
6363
6664
|
"path",
|
|
6364
6665
|
{
|
|
6365
6666
|
d: "M8 2L2 5.33333L8 8.66667L14 5.33333L8 2Z",
|
|
@@ -6369,7 +6670,7 @@ var FilterModal = ({
|
|
|
6369
6670
|
strokeLinejoin: "round"
|
|
6370
6671
|
}
|
|
6371
6672
|
),
|
|
6372
|
-
/* @__PURE__ */
|
|
6673
|
+
/* @__PURE__ */ jsx38(
|
|
6373
6674
|
"path",
|
|
6374
6675
|
{
|
|
6375
6676
|
d: "M2 10.6667L8 14L14 10.6667",
|
|
@@ -6379,7 +6680,7 @@ var FilterModal = ({
|
|
|
6379
6680
|
strokeLinejoin: "round"
|
|
6380
6681
|
}
|
|
6381
6682
|
),
|
|
6382
|
-
/* @__PURE__ */
|
|
6683
|
+
/* @__PURE__ */ jsx38(
|
|
6383
6684
|
"path",
|
|
6384
6685
|
{
|
|
6385
6686
|
d: "M2 8L8 11.3333L14 8",
|
|
@@ -6392,7 +6693,7 @@ var FilterModal = ({
|
|
|
6392
6693
|
]
|
|
6393
6694
|
}
|
|
6394
6695
|
),
|
|
6395
|
-
config.key === "content" && /* @__PURE__ */
|
|
6696
|
+
config.key === "content" && /* @__PURE__ */ jsxs26(
|
|
6396
6697
|
"svg",
|
|
6397
6698
|
{
|
|
6398
6699
|
width: "16",
|
|
@@ -6402,7 +6703,7 @@ var FilterModal = ({
|
|
|
6402
6703
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6403
6704
|
className: "text-text-400",
|
|
6404
6705
|
children: [
|
|
6405
|
-
/* @__PURE__ */
|
|
6706
|
+
/* @__PURE__ */ jsx38(
|
|
6406
6707
|
"path",
|
|
6407
6708
|
{
|
|
6408
6709
|
d: "M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z",
|
|
@@ -6412,7 +6713,7 @@ var FilterModal = ({
|
|
|
6412
6713
|
strokeLinejoin: "round"
|
|
6413
6714
|
}
|
|
6414
6715
|
),
|
|
6415
|
-
/* @__PURE__ */
|
|
6716
|
+
/* @__PURE__ */ jsx38(
|
|
6416
6717
|
"path",
|
|
6417
6718
|
{
|
|
6418
6719
|
d: "M2 6H14",
|
|
@@ -6422,7 +6723,7 @@ var FilterModal = ({
|
|
|
6422
6723
|
strokeLinejoin: "round"
|
|
6423
6724
|
}
|
|
6424
6725
|
),
|
|
6425
|
-
/* @__PURE__ */
|
|
6726
|
+
/* @__PURE__ */ jsx38(
|
|
6426
6727
|
"path",
|
|
6427
6728
|
{
|
|
6428
6729
|
d: "M6 2V14",
|
|
@@ -6435,9 +6736,9 @@ var FilterModal = ({
|
|
|
6435
6736
|
]
|
|
6436
6737
|
}
|
|
6437
6738
|
),
|
|
6438
|
-
/* @__PURE__ */
|
|
6739
|
+
/* @__PURE__ */ jsx38("span", { children: config.label })
|
|
6439
6740
|
] }),
|
|
6440
|
-
/* @__PURE__ */
|
|
6741
|
+
/* @__PURE__ */ jsx38(
|
|
6441
6742
|
CheckboxGroup,
|
|
6442
6743
|
{
|
|
6443
6744
|
categories: config.categories,
|
|
@@ -6451,7 +6752,7 @@ var FilterModal = ({
|
|
|
6451
6752
|
|
|
6452
6753
|
// src/components/TableProvider/TableProvider.tsx
|
|
6453
6754
|
import { Funnel } from "phosphor-react";
|
|
6454
|
-
import { Fragment as
|
|
6755
|
+
import { Fragment as Fragment8, jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6455
6756
|
function TableProvider({
|
|
6456
6757
|
data,
|
|
6457
6758
|
headers,
|
|
@@ -6475,7 +6776,7 @@ function TableProvider({
|
|
|
6475
6776
|
containerClassName,
|
|
6476
6777
|
children
|
|
6477
6778
|
}) {
|
|
6478
|
-
const [searchQuery, setSearchQuery] =
|
|
6779
|
+
const [searchQuery, setSearchQuery] = useState15("");
|
|
6479
6780
|
const sortResultRaw = useTableSort(data, { syncWithUrl: true });
|
|
6480
6781
|
const sortResult = enableTableSort ? sortResultRaw : {
|
|
6481
6782
|
sortedData: data,
|
|
@@ -6486,7 +6787,7 @@ function TableProvider({
|
|
|
6486
6787
|
};
|
|
6487
6788
|
const { sortedData, sortColumn, sortDirection, handleSort } = sortResult;
|
|
6488
6789
|
const filterResultRaw = useTableFilter(initialFilters, { syncWithUrl: true });
|
|
6489
|
-
const disabledFilterResult =
|
|
6790
|
+
const disabledFilterResult = useMemo6(
|
|
6490
6791
|
() => ({
|
|
6491
6792
|
filterConfigs: [],
|
|
6492
6793
|
activeFilters: {},
|
|
@@ -6516,10 +6817,10 @@ function TableProvider({
|
|
|
6516
6817
|
totalItems,
|
|
6517
6818
|
totalPages
|
|
6518
6819
|
} = paginationConfig;
|
|
6519
|
-
const [currentPage, setCurrentPage] =
|
|
6520
|
-
const [itemsPerPage, setItemsPerPage] =
|
|
6521
|
-
const [isFilterModalOpen, setIsFilterModalOpen] =
|
|
6522
|
-
const combinedParams =
|
|
6820
|
+
const [currentPage, setCurrentPage] = useState15(1);
|
|
6821
|
+
const [itemsPerPage, setItemsPerPage] = useState15(defaultItemsPerPage);
|
|
6822
|
+
const [isFilterModalOpen, setIsFilterModalOpen] = useState15(false);
|
|
6823
|
+
const combinedParams = useMemo6(() => {
|
|
6523
6824
|
const params = {
|
|
6524
6825
|
page: currentPage,
|
|
6525
6826
|
limit: itemsPerPage
|
|
@@ -6546,26 +6847,26 @@ function TableProvider({
|
|
|
6546
6847
|
enableFilters,
|
|
6547
6848
|
enableTableSort
|
|
6548
6849
|
]);
|
|
6549
|
-
|
|
6850
|
+
useEffect15(() => {
|
|
6550
6851
|
onParamsChange?.(combinedParams);
|
|
6551
6852
|
}, [combinedParams]);
|
|
6552
|
-
const handleSearchChange =
|
|
6853
|
+
const handleSearchChange = useCallback5((value) => {
|
|
6553
6854
|
setSearchQuery(value);
|
|
6554
6855
|
setCurrentPage(1);
|
|
6555
6856
|
}, []);
|
|
6556
|
-
const handleFilterApply =
|
|
6857
|
+
const handleFilterApply = useCallback5(() => {
|
|
6557
6858
|
applyFilters();
|
|
6558
6859
|
setIsFilterModalOpen(false);
|
|
6559
6860
|
setCurrentPage(1);
|
|
6560
6861
|
}, [applyFilters]);
|
|
6561
|
-
const handlePageChange =
|
|
6862
|
+
const handlePageChange = useCallback5((page) => {
|
|
6562
6863
|
setCurrentPage(page);
|
|
6563
6864
|
}, []);
|
|
6564
|
-
const handleItemsPerPageChange =
|
|
6865
|
+
const handleItemsPerPageChange = useCallback5((items) => {
|
|
6565
6866
|
setItemsPerPage(items);
|
|
6566
6867
|
setCurrentPage(1);
|
|
6567
6868
|
}, []);
|
|
6568
|
-
const handleRowClickInternal =
|
|
6869
|
+
const handleRowClickInternal = useCallback5(
|
|
6569
6870
|
(row, index) => {
|
|
6570
6871
|
if (enableRowClick && onRowClick) {
|
|
6571
6872
|
onRowClick(row, index);
|
|
@@ -6573,7 +6874,7 @@ function TableProvider({
|
|
|
6573
6874
|
},
|
|
6574
6875
|
[enableRowClick, onRowClick]
|
|
6575
6876
|
);
|
|
6576
|
-
const useInternalPagination =
|
|
6877
|
+
const useInternalPagination = useMemo6(
|
|
6577
6878
|
() => enablePagination && !onParamsChange && totalItems === void 0 && totalPages === void 0,
|
|
6578
6879
|
[enablePagination, onParamsChange, totalItems, totalPages]
|
|
6579
6880
|
);
|
|
@@ -6581,7 +6882,7 @@ function TableProvider({
|
|
|
6581
6882
|
(totalItems ?? (useInternalPagination ? sortedData.length : data.length)) / itemsPerPage
|
|
6582
6883
|
);
|
|
6583
6884
|
const calculatedTotalItems = totalItems ?? (useInternalPagination ? sortedData.length : data.length);
|
|
6584
|
-
const displayData =
|
|
6885
|
+
const displayData = useMemo6(() => {
|
|
6585
6886
|
if (!useInternalPagination) {
|
|
6586
6887
|
return sortedData;
|
|
6587
6888
|
}
|
|
@@ -6592,21 +6893,21 @@ function TableProvider({
|
|
|
6592
6893
|
const showLoading = loading;
|
|
6593
6894
|
const showNoSearchResult = !loading && data.length === 0 && searchQuery.trim() !== "";
|
|
6594
6895
|
const showEmpty = !loading && data.length === 0 && searchQuery.trim() === "";
|
|
6595
|
-
const controls = (enableSearch || enableFilters) && /* @__PURE__ */
|
|
6596
|
-
enableFilters && /* @__PURE__ */
|
|
6896
|
+
const controls = (enableSearch || enableFilters) && /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-4", children: [
|
|
6897
|
+
enableFilters && /* @__PURE__ */ jsxs27(
|
|
6597
6898
|
Button_default,
|
|
6598
6899
|
{
|
|
6599
6900
|
variant: "outline",
|
|
6600
6901
|
size: "medium",
|
|
6601
6902
|
onClick: () => setIsFilterModalOpen(true),
|
|
6602
6903
|
children: [
|
|
6603
|
-
/* @__PURE__ */
|
|
6904
|
+
/* @__PURE__ */ jsx39(Funnel, { size: 20 }),
|
|
6604
6905
|
"Filtros",
|
|
6605
|
-
hasActiveFilters && /* @__PURE__ */
|
|
6906
|
+
hasActiveFilters && /* @__PURE__ */ jsx39("span", { className: "ml-2 rounded-full bg-primary-500 px-2 py-0.5 text-xs text-white", children: Object.keys(activeFilters).length })
|
|
6606
6907
|
]
|
|
6607
6908
|
}
|
|
6608
6909
|
),
|
|
6609
|
-
enableSearch && /* @__PURE__ */
|
|
6910
|
+
enableSearch && /* @__PURE__ */ jsx39("div", { className: "flex-1", children: /* @__PURE__ */ jsx39(
|
|
6610
6911
|
Search_default,
|
|
6611
6912
|
{
|
|
6612
6913
|
value: searchQuery,
|
|
@@ -6617,11 +6918,11 @@ function TableProvider({
|
|
|
6617
6918
|
}
|
|
6618
6919
|
) })
|
|
6619
6920
|
] });
|
|
6620
|
-
const headerSection = (headerContent || controls) && /* @__PURE__ */
|
|
6621
|
-
headerContent && /* @__PURE__ */
|
|
6622
|
-
controls && /* @__PURE__ */
|
|
6921
|
+
const headerSection = (headerContent || controls) && /* @__PURE__ */ jsxs27("div", { className: "flex flex-col md:flex-row items-stretch md:items-center justify-between gap-4", children: [
|
|
6922
|
+
headerContent && /* @__PURE__ */ jsx39("div", { children: headerContent }),
|
|
6923
|
+
controls && /* @__PURE__ */ jsx39("div", { className: "flex-1 md:flex-none", children: controls })
|
|
6623
6924
|
] });
|
|
6624
|
-
const table = /* @__PURE__ */
|
|
6925
|
+
const table = /* @__PURE__ */ jsx39("div", { className: "w-full overflow-x-auto", children: /* @__PURE__ */ jsxs27(
|
|
6625
6926
|
Table_default,
|
|
6626
6927
|
{
|
|
6627
6928
|
variant,
|
|
@@ -6632,11 +6933,11 @@ function TableProvider({
|
|
|
6632
6933
|
showEmpty,
|
|
6633
6934
|
emptyState,
|
|
6634
6935
|
children: [
|
|
6635
|
-
/* @__PURE__ */
|
|
6936
|
+
/* @__PURE__ */ jsx39("thead", { children: /* @__PURE__ */ jsx39(
|
|
6636
6937
|
TableRow,
|
|
6637
6938
|
{
|
|
6638
6939
|
variant: variant === "borderless" ? "defaultBorderless" : "default",
|
|
6639
|
-
children: headers.map((header, index) => /* @__PURE__ */
|
|
6940
|
+
children: headers.map((header, index) => /* @__PURE__ */ jsx39(
|
|
6640
6941
|
TableHead,
|
|
6641
6942
|
{
|
|
6642
6943
|
sortable: enableTableSort && header.sortable,
|
|
@@ -6650,7 +6951,7 @@ function TableProvider({
|
|
|
6650
6951
|
))
|
|
6651
6952
|
}
|
|
6652
6953
|
) }),
|
|
6653
|
-
/* @__PURE__ */
|
|
6954
|
+
/* @__PURE__ */ jsx39(TableBody, { children: loading ? /* @__PURE__ */ jsx39(TableRow, { children: /* @__PURE__ */ jsx39(TableCell, { colSpan: headers.length, className: "text-center py-8", children: /* @__PURE__ */ jsx39("span", { className: "text-text-400 text-sm", children: "Carregando..." }) }) }) : displayData.map((row, rowIndex) => {
|
|
6654
6955
|
const effectiveIndex = useInternalPagination ? (currentPage - 1) * itemsPerPage + rowIndex : rowIndex;
|
|
6655
6956
|
const rowKeyValue = rowKey ? (() => {
|
|
6656
6957
|
const keyValue = row[rowKey];
|
|
@@ -6662,7 +6963,7 @@ function TableProvider({
|
|
|
6662
6963
|
}
|
|
6663
6964
|
return String(keyValue);
|
|
6664
6965
|
})() : `row-${effectiveIndex}`;
|
|
6665
|
-
return /* @__PURE__ */
|
|
6966
|
+
return /* @__PURE__ */ jsx39(
|
|
6666
6967
|
TableRow,
|
|
6667
6968
|
{
|
|
6668
6969
|
variant: variant === "borderless" ? "defaultBorderless" : "default",
|
|
@@ -6683,7 +6984,7 @@ function TableProvider({
|
|
|
6683
6984
|
}
|
|
6684
6985
|
}
|
|
6685
6986
|
const content = header.render ? header.render(value, row, effectiveIndex) : defaultContent;
|
|
6686
|
-
return /* @__PURE__ */
|
|
6987
|
+
return /* @__PURE__ */ jsx39(
|
|
6687
6988
|
TableCell,
|
|
6688
6989
|
{
|
|
6689
6990
|
className: header.className,
|
|
@@ -6702,7 +7003,7 @@ function TableProvider({
|
|
|
6702
7003
|
]
|
|
6703
7004
|
}
|
|
6704
7005
|
) });
|
|
6705
|
-
const pagination = enablePagination && !isEmpty && /* @__PURE__ */
|
|
7006
|
+
const pagination = enablePagination && !isEmpty && /* @__PURE__ */ jsx39("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx39(
|
|
6706
7007
|
TablePagination_default,
|
|
6707
7008
|
{
|
|
6708
7009
|
currentPage,
|
|
@@ -6716,13 +7017,13 @@ function TableProvider({
|
|
|
6716
7017
|
}
|
|
6717
7018
|
) });
|
|
6718
7019
|
if (children) {
|
|
6719
|
-
return /* @__PURE__ */
|
|
7020
|
+
return /* @__PURE__ */ jsxs27(Fragment8, { children: [
|
|
6720
7021
|
children({
|
|
6721
7022
|
controls: headerSection || controls || null,
|
|
6722
7023
|
table,
|
|
6723
7024
|
pagination
|
|
6724
7025
|
}),
|
|
6725
|
-
enableFilters && /* @__PURE__ */
|
|
7026
|
+
enableFilters && /* @__PURE__ */ jsx39(
|
|
6726
7027
|
FilterModal,
|
|
6727
7028
|
{
|
|
6728
7029
|
isOpen: isFilterModalOpen,
|
|
@@ -6736,11 +7037,11 @@ function TableProvider({
|
|
|
6736
7037
|
] });
|
|
6737
7038
|
}
|
|
6738
7039
|
const wrapperClassName = containerClassName || "w-full space-y-4";
|
|
6739
|
-
return /* @__PURE__ */
|
|
7040
|
+
return /* @__PURE__ */ jsxs27("div", { className: wrapperClassName, children: [
|
|
6740
7041
|
headerSection,
|
|
6741
7042
|
table,
|
|
6742
7043
|
pagination,
|
|
6743
|
-
enableFilters && /* @__PURE__ */
|
|
7044
|
+
enableFilters && /* @__PURE__ */ jsx39(
|
|
6744
7045
|
FilterModal,
|
|
6745
7046
|
{
|
|
6746
7047
|
isOpen: isFilterModalOpen,
|
|
@@ -6754,44 +7055,14 @@ function TableProvider({
|
|
|
6754
7055
|
] });
|
|
6755
7056
|
}
|
|
6756
7057
|
|
|
6757
|
-
// src/components/ActivitiesHistory/components/ErrorDisplay.tsx
|
|
6758
|
-
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
6759
|
-
var ErrorDisplay = ({ error }) => /* @__PURE__ */ jsx36("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx36(Text_default, { size: "lg", color: "text-error-500", children: error }) });
|
|
6760
|
-
|
|
6761
7058
|
// src/components/ActivitiesHistory/config/historyTableColumns.tsx
|
|
6762
7059
|
import { CaretRight as CaretRight6 } from "phosphor-react";
|
|
6763
7060
|
|
|
6764
|
-
// src/components/ActivitiesHistory/utils/renderSubjectCell.tsx
|
|
6765
|
-
import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6766
|
-
var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
|
|
6767
|
-
if (!subjectName) {
|
|
6768
|
-
return showEmptyDash ? /* @__PURE__ */ jsx37(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
|
|
6769
|
-
}
|
|
6770
|
-
const subjectEnum = mapSubjectNameToEnum?.(subjectName);
|
|
6771
|
-
if (!subjectEnum) {
|
|
6772
|
-
return /* @__PURE__ */ jsx37(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
|
|
6773
|
-
}
|
|
6774
|
-
const subjectInfo = getSubjectInfo(subjectEnum);
|
|
6775
|
-
return /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", title: subjectName, children: [
|
|
6776
|
-
/* @__PURE__ */ jsx37(
|
|
6777
|
-
"span",
|
|
6778
|
-
{
|
|
6779
|
-
className: cn(
|
|
6780
|
-
"w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
|
|
6781
|
-
subjectInfo.colorClass
|
|
6782
|
-
),
|
|
6783
|
-
children: subjectInfo.icon
|
|
6784
|
-
}
|
|
6785
|
-
),
|
|
6786
|
-
/* @__PURE__ */ jsx37(Text_default, { size: "sm", className: "truncate", children: subjectName })
|
|
6787
|
-
] });
|
|
6788
|
-
};
|
|
6789
|
-
|
|
6790
7061
|
// src/components/ActivitiesHistory/utils/renderTruncatedText.tsx
|
|
6791
|
-
import { jsx as
|
|
7062
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
6792
7063
|
var renderTruncatedText = (value) => {
|
|
6793
7064
|
const text = typeof value === "string" ? value : "";
|
|
6794
|
-
return /* @__PURE__ */
|
|
7065
|
+
return /* @__PURE__ */ jsx40(Text_default, { size: "sm", title: text, children: text });
|
|
6795
7066
|
};
|
|
6796
7067
|
|
|
6797
7068
|
// src/components/ActivitiesHistory/utils/filterBuilders.ts
|
|
@@ -6847,7 +7118,7 @@ var getSubjectOptions = (data) => {
|
|
|
6847
7118
|
};
|
|
6848
7119
|
|
|
6849
7120
|
// src/components/ActivitiesHistory/config/historyTableColumns.tsx
|
|
6850
|
-
import { jsx as
|
|
7121
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
6851
7122
|
var createHistoryTableColumns = (mapSubjectNameToEnum) => [
|
|
6852
7123
|
{
|
|
6853
7124
|
key: "startDate",
|
|
@@ -6900,9 +7171,9 @@ var createHistoryTableColumns = (mapSubjectNameToEnum) => [
|
|
|
6900
7171
|
render: (value) => {
|
|
6901
7172
|
const status = typeof value === "string" ? value : "";
|
|
6902
7173
|
if (!status) {
|
|
6903
|
-
return /* @__PURE__ */
|
|
7174
|
+
return /* @__PURE__ */ jsx41(Text_default, { size: "sm", color: "text-text-500", children: "-" });
|
|
6904
7175
|
}
|
|
6905
|
-
return /* @__PURE__ */
|
|
7176
|
+
return /* @__PURE__ */ jsx41(
|
|
6906
7177
|
Badge_default,
|
|
6907
7178
|
{
|
|
6908
7179
|
variant: "solid",
|
|
@@ -6917,7 +7188,7 @@ var createHistoryTableColumns = (mapSubjectNameToEnum) => [
|
|
|
6917
7188
|
key: "completionPercentage",
|
|
6918
7189
|
label: "Conclus\xE3o",
|
|
6919
7190
|
sortable: true,
|
|
6920
|
-
render: (value) => /* @__PURE__ */
|
|
7191
|
+
render: (value) => /* @__PURE__ */ jsx41(
|
|
6921
7192
|
ProgressBar_default,
|
|
6922
7193
|
{
|
|
6923
7194
|
value: Number(value),
|
|
@@ -6934,7 +7205,7 @@ var createHistoryTableColumns = (mapSubjectNameToEnum) => [
|
|
|
6934
7205
|
label: "",
|
|
6935
7206
|
sortable: false,
|
|
6936
7207
|
className: "w-12",
|
|
6937
|
-
render: () => /* @__PURE__ */
|
|
7208
|
+
render: () => /* @__PURE__ */ jsx41("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx41(CaretRight6, { size: 20, className: "text-text-600" }) })
|
|
6938
7209
|
}
|
|
6939
7210
|
];
|
|
6940
7211
|
|
|
@@ -6979,7 +7250,7 @@ var createHistoryFiltersConfig = (userData) => [
|
|
|
6979
7250
|
];
|
|
6980
7251
|
|
|
6981
7252
|
// src/components/ActivitiesHistory/tabs/HistoryTab.tsx
|
|
6982
|
-
import { jsx as
|
|
7253
|
+
import { jsx as jsx42, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6983
7254
|
var HistoryTab = ({
|
|
6984
7255
|
fetchActivitiesHistory,
|
|
6985
7256
|
onCreateActivity,
|
|
@@ -6989,9 +7260,9 @@ var HistoryTab = ({
|
|
|
6989
7260
|
mapSubjectNameToEnum,
|
|
6990
7261
|
userFilterData
|
|
6991
7262
|
}) => {
|
|
6992
|
-
const fetchActivitiesHistoryRef =
|
|
7263
|
+
const fetchActivitiesHistoryRef = useRef8(fetchActivitiesHistory);
|
|
6993
7264
|
fetchActivitiesHistoryRef.current = fetchActivitiesHistory;
|
|
6994
|
-
const useActivitiesHistory =
|
|
7265
|
+
const useActivitiesHistory = useMemo7(
|
|
6995
7266
|
() => createUseActivitiesHistory(
|
|
6996
7267
|
(filters) => fetchActivitiesHistoryRef.current(filters)
|
|
6997
7268
|
),
|
|
@@ -7004,15 +7275,15 @@ var HistoryTab = ({
|
|
|
7004
7275
|
pagination,
|
|
7005
7276
|
fetchActivities
|
|
7006
7277
|
} = useActivitiesHistory();
|
|
7007
|
-
const historyFilterConfigs =
|
|
7278
|
+
const historyFilterConfigs = useMemo7(
|
|
7008
7279
|
() => createHistoryFiltersConfig(userFilterData),
|
|
7009
7280
|
[userFilterData]
|
|
7010
7281
|
);
|
|
7011
|
-
const historyTableColumns =
|
|
7282
|
+
const historyTableColumns = useMemo7(
|
|
7012
7283
|
() => createHistoryTableColumns(mapSubjectNameToEnum),
|
|
7013
7284
|
[mapSubjectNameToEnum]
|
|
7014
7285
|
);
|
|
7015
|
-
const handleParamsChange =
|
|
7286
|
+
const handleParamsChange = useCallback6(
|
|
7016
7287
|
(params) => {
|
|
7017
7288
|
const filters = buildHistoryFiltersFromParams(params);
|
|
7018
7289
|
fetchActivities(filters);
|
|
@@ -7020,9 +7291,9 @@ var HistoryTab = ({
|
|
|
7020
7291
|
[fetchActivities]
|
|
7021
7292
|
);
|
|
7022
7293
|
if (error) {
|
|
7023
|
-
return /* @__PURE__ */
|
|
7294
|
+
return /* @__PURE__ */ jsx42(ErrorDisplay, { error });
|
|
7024
7295
|
}
|
|
7025
|
-
return /* @__PURE__ */
|
|
7296
|
+
return /* @__PURE__ */ jsx42("div", { className: "w-full", children: /* @__PURE__ */ jsx42(
|
|
7026
7297
|
TableProvider,
|
|
7027
7298
|
{
|
|
7028
7299
|
data: activities,
|
|
@@ -7047,14 +7318,14 @@ var HistoryTab = ({
|
|
|
7047
7318
|
image: noSearchImage
|
|
7048
7319
|
},
|
|
7049
7320
|
emptyState: {
|
|
7050
|
-
component: /* @__PURE__ */
|
|
7321
|
+
component: /* @__PURE__ */ jsx42(
|
|
7051
7322
|
EmptyState_default,
|
|
7052
7323
|
{
|
|
7053
7324
|
image: emptyStateImage,
|
|
7054
7325
|
title: "Incentive sua turma ao aprendizado",
|
|
7055
7326
|
description: "Crie uma nova atividade e ajude seus alunos a colocarem o conte\xFAdo em pr\xE1tica!",
|
|
7056
7327
|
buttonText: "Criar atividade",
|
|
7057
|
-
buttonIcon: /* @__PURE__ */
|
|
7328
|
+
buttonIcon: /* @__PURE__ */ jsx42(Plus2, { size: 18 }),
|
|
7058
7329
|
buttonVariant: "outline",
|
|
7059
7330
|
buttonAction: "primary",
|
|
7060
7331
|
onButtonClick: onCreateActivity
|
|
@@ -7069,22 +7340,22 @@ var HistoryTab = ({
|
|
|
7069
7340
|
table,
|
|
7070
7341
|
pagination: paginationComponent
|
|
7071
7342
|
} = renderProps;
|
|
7072
|
-
return /* @__PURE__ */
|
|
7073
|
-
/* @__PURE__ */
|
|
7074
|
-
/* @__PURE__ */
|
|
7343
|
+
return /* @__PURE__ */ jsxs28("div", { className: "space-y-4", children: [
|
|
7344
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between gap-4", children: [
|
|
7345
|
+
/* @__PURE__ */ jsx42(
|
|
7075
7346
|
Button_default,
|
|
7076
7347
|
{
|
|
7077
7348
|
variant: "solid",
|
|
7078
7349
|
action: "primary",
|
|
7079
7350
|
size: "medium",
|
|
7080
7351
|
onClick: onCreateActivity,
|
|
7081
|
-
iconLeft: /* @__PURE__ */
|
|
7352
|
+
iconLeft: /* @__PURE__ */ jsx42(Plus2, { size: 18, weight: "bold" }),
|
|
7082
7353
|
children: "Criar atividade"
|
|
7083
7354
|
}
|
|
7084
7355
|
),
|
|
7085
7356
|
controls
|
|
7086
7357
|
] }),
|
|
7087
|
-
/* @__PURE__ */
|
|
7358
|
+
/* @__PURE__ */ jsxs28("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
|
|
7088
7359
|
table,
|
|
7089
7360
|
paginationComponent
|
|
7090
7361
|
] })
|
|
@@ -7094,96 +7365,6 @@ var HistoryTab = ({
|
|
|
7094
7365
|
) });
|
|
7095
7366
|
};
|
|
7096
7367
|
|
|
7097
|
-
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
7098
|
-
import { useState as useState15, useCallback as useCallback6, useMemo as useMemo7, useRef as useRef8, useEffect as useEffect15 } from "react";
|
|
7099
|
-
import { Plus as Plus2 } from "phosphor-react";
|
|
7100
|
-
|
|
7101
|
-
// src/components/ActivitiesHistory/config/modelsTableColumns.tsx
|
|
7102
|
-
import { Trash, PencilSimple, PaperPlaneTilt } from "phosphor-react";
|
|
7103
|
-
import { jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7104
|
-
var createModelsTableColumns = (mapSubjectNameToEnum, onSendActivity, onEditModel, onDeleteModel) => [
|
|
7105
|
-
{
|
|
7106
|
-
key: "title",
|
|
7107
|
-
label: "T\xEDtulo",
|
|
7108
|
-
sortable: true,
|
|
7109
|
-
className: "max-w-[400px]",
|
|
7110
|
-
render: (value) => {
|
|
7111
|
-
const title = typeof value === "string" ? value : "";
|
|
7112
|
-
return /* @__PURE__ */ jsx41(Text_default, { size: "sm", title, className: "truncate block", children: title });
|
|
7113
|
-
}
|
|
7114
|
-
},
|
|
7115
|
-
{
|
|
7116
|
-
key: "savedAt",
|
|
7117
|
-
label: "Salvo em",
|
|
7118
|
-
sortable: true,
|
|
7119
|
-
className: "w-[120px]"
|
|
7120
|
-
},
|
|
7121
|
-
{
|
|
7122
|
-
key: "subject",
|
|
7123
|
-
label: "Mat\xE9ria",
|
|
7124
|
-
sortable: true,
|
|
7125
|
-
className: "max-w-[160px]",
|
|
7126
|
-
render: (value) => {
|
|
7127
|
-
const subjectName = typeof value === "string" ? value : "";
|
|
7128
|
-
return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
|
|
7129
|
-
}
|
|
7130
|
-
},
|
|
7131
|
-
{
|
|
7132
|
-
key: "actions",
|
|
7133
|
-
label: "",
|
|
7134
|
-
sortable: false,
|
|
7135
|
-
className: "w-[220px]",
|
|
7136
|
-
render: (_value, row) => {
|
|
7137
|
-
const handleSend = (e) => {
|
|
7138
|
-
e.stopPropagation();
|
|
7139
|
-
onSendActivity?.(row);
|
|
7140
|
-
};
|
|
7141
|
-
const handleEdit = (e) => {
|
|
7142
|
-
e.stopPropagation();
|
|
7143
|
-
onEditModel?.(row);
|
|
7144
|
-
};
|
|
7145
|
-
const handleDelete = (e) => {
|
|
7146
|
-
e.stopPropagation();
|
|
7147
|
-
onDeleteModel(row);
|
|
7148
|
-
};
|
|
7149
|
-
return /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 justify-end", children: [
|
|
7150
|
-
onSendActivity && /* @__PURE__ */ jsx41(
|
|
7151
|
-
Button_default,
|
|
7152
|
-
{
|
|
7153
|
-
variant: "outline",
|
|
7154
|
-
action: "primary",
|
|
7155
|
-
size: "small",
|
|
7156
|
-
iconLeft: /* @__PURE__ */ jsx41(PaperPlaneTilt, { size: 16 }),
|
|
7157
|
-
onClick: handleSend,
|
|
7158
|
-
"aria-label": "Enviar atividade",
|
|
7159
|
-
children: "Enviar atividade"
|
|
7160
|
-
}
|
|
7161
|
-
),
|
|
7162
|
-
/* @__PURE__ */ jsx41(
|
|
7163
|
-
IconButton_default,
|
|
7164
|
-
{
|
|
7165
|
-
icon: /* @__PURE__ */ jsx41(Trash, { size: 20 }),
|
|
7166
|
-
size: "md",
|
|
7167
|
-
onClick: handleDelete,
|
|
7168
|
-
"aria-label": "Deletar modelo",
|
|
7169
|
-
className: "text-text-600 hover:text-error-500 hover:bg-transparent"
|
|
7170
|
-
}
|
|
7171
|
-
),
|
|
7172
|
-
onEditModel && /* @__PURE__ */ jsx41(
|
|
7173
|
-
IconButton_default,
|
|
7174
|
-
{
|
|
7175
|
-
icon: /* @__PURE__ */ jsx41(PencilSimple, { size: 20 }),
|
|
7176
|
-
size: "md",
|
|
7177
|
-
onClick: handleEdit,
|
|
7178
|
-
"aria-label": "Editar modelo",
|
|
7179
|
-
className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
|
|
7180
|
-
}
|
|
7181
|
-
)
|
|
7182
|
-
] });
|
|
7183
|
-
}
|
|
7184
|
-
}
|
|
7185
|
-
];
|
|
7186
|
-
|
|
7187
7368
|
// src/components/ActivitiesHistory/config/modelsFiltersConfig.ts
|
|
7188
7369
|
var createModelsFiltersConfig = (userData) => [
|
|
7189
7370
|
{
|
|
@@ -7201,7 +7382,21 @@ var createModelsFiltersConfig = (userData) => [
|
|
|
7201
7382
|
];
|
|
7202
7383
|
|
|
7203
7384
|
// src/components/ActivitiesHistory/tabs/ModelsTab.tsx
|
|
7204
|
-
import {
|
|
7385
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
7386
|
+
var ACTIVITY_MODELS_CONFIG = {
|
|
7387
|
+
entityName: "atividade",
|
|
7388
|
+
entityNamePlural: "atividades",
|
|
7389
|
+
testId: "activity-models-tab",
|
|
7390
|
+
emptyStateTitle: "Crie modelos para agilizar suas atividades",
|
|
7391
|
+
emptyStateDescription: "Salve modelos de atividades para reutilizar e enviar rapidamente para suas turmas!",
|
|
7392
|
+
searchPlaceholder: "Buscar modelo"
|
|
7393
|
+
};
|
|
7394
|
+
var ACTIVITY_COLUMNS_CONFIG = {
|
|
7395
|
+
sendButtonLabel: "Enviar atividade",
|
|
7396
|
+
sendButtonAriaLabel: "Enviar atividade",
|
|
7397
|
+
deleteButtonAriaLabel: "Deletar modelo",
|
|
7398
|
+
editButtonAriaLabel: "Editar modelo"
|
|
7399
|
+
};
|
|
7205
7400
|
var ModelsTab = ({
|
|
7206
7401
|
fetchActivityModels,
|
|
7207
7402
|
deleteActivityModel,
|
|
@@ -7213,169 +7408,41 @@ var ModelsTab = ({
|
|
|
7213
7408
|
mapSubjectNameToEnum,
|
|
7214
7409
|
userFilterData,
|
|
7215
7410
|
subjectsMap
|
|
7216
|
-
}) =>
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
)
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
error: modelsError,
|
|
7237
|
-
pagination: modelsPagination,
|
|
7238
|
-
fetchModels,
|
|
7239
|
-
deleteModel
|
|
7240
|
-
} = useActivityModels();
|
|
7241
|
-
const modelsFilterConfigs = useMemo7(
|
|
7242
|
-
() => createModelsFiltersConfig(userFilterData),
|
|
7243
|
-
[userFilterData]
|
|
7244
|
-
);
|
|
7245
|
-
const handleDeleteClick = useCallback6((model) => {
|
|
7246
|
-
setModelToDelete(model);
|
|
7247
|
-
setDeleteDialogOpen(true);
|
|
7248
|
-
}, []);
|
|
7249
|
-
const modelsTableColumns = useMemo7(
|
|
7250
|
-
() => createModelsTableColumns(
|
|
7251
|
-
mapSubjectNameToEnum,
|
|
7252
|
-
onSendActivity,
|
|
7253
|
-
onEditModel,
|
|
7254
|
-
handleDeleteClick
|
|
7411
|
+
}) => /* @__PURE__ */ jsx43(
|
|
7412
|
+
ModelsTabBase,
|
|
7413
|
+
{
|
|
7414
|
+
fetchModels: fetchActivityModels,
|
|
7415
|
+
deleteModel: deleteActivityModel,
|
|
7416
|
+
onCreateModel,
|
|
7417
|
+
onSend: onSendActivity,
|
|
7418
|
+
onEditModel,
|
|
7419
|
+
emptyStateImage,
|
|
7420
|
+
noSearchImage,
|
|
7421
|
+
mapSubjectNameToEnum,
|
|
7422
|
+
userFilterData,
|
|
7423
|
+
subjectsMap,
|
|
7424
|
+
config: ACTIVITY_MODELS_CONFIG,
|
|
7425
|
+
createTableColumns: (mapSubject, send, edit, del) => createModelsTableColumnsBase(
|
|
7426
|
+
mapSubject,
|
|
7427
|
+
send,
|
|
7428
|
+
edit,
|
|
7429
|
+
del,
|
|
7430
|
+
ACTIVITY_COLUMNS_CONFIG
|
|
7255
7431
|
),
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
fetchModels(filters, subjectsMapRef.current);
|
|
7262
|
-
},
|
|
7263
|
-
[fetchModels]
|
|
7264
|
-
);
|
|
7265
|
-
useEffect15(() => {
|
|
7266
|
-
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
7267
|
-
}, [fetchModels]);
|
|
7268
|
-
const handleConfirmDelete = useCallback6(async () => {
|
|
7269
|
-
if (modelToDelete) {
|
|
7270
|
-
const success = await deleteModel(modelToDelete.id);
|
|
7271
|
-
if (success) {
|
|
7272
|
-
addToast({ title: "Modelo deletado com sucesso", action: "success" });
|
|
7273
|
-
fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
|
|
7274
|
-
} else {
|
|
7275
|
-
addToast({ title: "Erro ao deletar modelo", action: "warning" });
|
|
7276
|
-
}
|
|
7277
|
-
}
|
|
7278
|
-
setDeleteDialogOpen(false);
|
|
7279
|
-
setModelToDelete(null);
|
|
7280
|
-
}, [modelToDelete, deleteModel, fetchModels, addToast]);
|
|
7281
|
-
const handleCancelDelete = useCallback6(() => {
|
|
7282
|
-
setDeleteDialogOpen(false);
|
|
7283
|
-
setModelToDelete(null);
|
|
7284
|
-
}, []);
|
|
7285
|
-
return /* @__PURE__ */ jsxs28(Fragment8, { children: [
|
|
7286
|
-
/* @__PURE__ */ jsx42(Toaster_default, {}),
|
|
7287
|
-
modelsError ? /* @__PURE__ */ jsx42(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ jsx42("div", { className: "w-full", "data-testid": "activity-models-tab", children: /* @__PURE__ */ jsx42(
|
|
7288
|
-
TableProvider,
|
|
7289
|
-
{
|
|
7290
|
-
data: models,
|
|
7291
|
-
headers: modelsTableColumns,
|
|
7292
|
-
loading: modelsLoading,
|
|
7293
|
-
variant: "borderless",
|
|
7294
|
-
enableSearch: true,
|
|
7295
|
-
enableFilters: true,
|
|
7296
|
-
enableTableSort: true,
|
|
7297
|
-
enablePagination: true,
|
|
7298
|
-
initialFilters: modelsFilterConfigs,
|
|
7299
|
-
paginationConfig: {
|
|
7300
|
-
itemLabel: "modelos",
|
|
7301
|
-
itemsPerPageOptions: [10, 20, 50, 100],
|
|
7302
|
-
defaultItemsPerPage: 10,
|
|
7303
|
-
totalItems: modelsPagination.total,
|
|
7304
|
-
totalPages: modelsPagination.totalPages
|
|
7305
|
-
},
|
|
7306
|
-
searchPlaceholder: "Buscar modelo",
|
|
7307
|
-
noSearchResultState: {
|
|
7308
|
-
image: noSearchImage
|
|
7309
|
-
},
|
|
7310
|
-
emptyState: {
|
|
7311
|
-
component: /* @__PURE__ */ jsx42(
|
|
7312
|
-
EmptyState_default,
|
|
7313
|
-
{
|
|
7314
|
-
image: emptyStateImage,
|
|
7315
|
-
title: "Crie modelos para agilizar suas atividades",
|
|
7316
|
-
description: "Salve modelos de atividades para reutilizar e enviar rapidamente para suas turmas!",
|
|
7317
|
-
buttonText: "Criar modelo",
|
|
7318
|
-
buttonIcon: /* @__PURE__ */ jsx42(Plus2, { size: 18 }),
|
|
7319
|
-
buttonVariant: "outline",
|
|
7320
|
-
buttonAction: "primary",
|
|
7321
|
-
onButtonClick: onCreateModel
|
|
7322
|
-
}
|
|
7323
|
-
)
|
|
7324
|
-
},
|
|
7325
|
-
onParamsChange: handleParamsChange,
|
|
7326
|
-
children: (renderProps) => {
|
|
7327
|
-
const {
|
|
7328
|
-
controls,
|
|
7329
|
-
table,
|
|
7330
|
-
pagination: paginationComponent
|
|
7331
|
-
} = renderProps;
|
|
7332
|
-
return /* @__PURE__ */ jsxs28("div", { className: "space-y-4", children: [
|
|
7333
|
-
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between gap-4", children: [
|
|
7334
|
-
/* @__PURE__ */ jsx42(
|
|
7335
|
-
Button_default,
|
|
7336
|
-
{
|
|
7337
|
-
variant: "solid",
|
|
7338
|
-
action: "primary",
|
|
7339
|
-
size: "medium",
|
|
7340
|
-
onClick: onCreateModel,
|
|
7341
|
-
iconLeft: /* @__PURE__ */ jsx42(Plus2, { size: 18, weight: "bold" }),
|
|
7342
|
-
children: "Criar modelo"
|
|
7343
|
-
}
|
|
7344
|
-
),
|
|
7345
|
-
controls
|
|
7346
|
-
] }),
|
|
7347
|
-
/* @__PURE__ */ jsxs28("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
|
|
7348
|
-
table,
|
|
7349
|
-
paginationComponent
|
|
7350
|
-
] })
|
|
7351
|
-
] });
|
|
7352
|
-
}
|
|
7353
|
-
}
|
|
7354
|
-
) }),
|
|
7355
|
-
/* @__PURE__ */ jsx42(
|
|
7356
|
-
AlertDialog,
|
|
7357
|
-
{
|
|
7358
|
-
isOpen: deleteDialogOpen,
|
|
7359
|
-
onChangeOpen: setDeleteDialogOpen,
|
|
7360
|
-
title: "Deletar modelo",
|
|
7361
|
-
description: `Tem certeza que deseja deletar o modelo "${modelToDelete?.title}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
|
|
7362
|
-
submitButtonLabel: "Deletar",
|
|
7363
|
-
cancelButtonLabel: "Cancelar",
|
|
7364
|
-
onSubmit: handleConfirmDelete,
|
|
7365
|
-
onCancel: handleCancelDelete
|
|
7366
|
-
}
|
|
7367
|
-
)
|
|
7368
|
-
] });
|
|
7369
|
-
};
|
|
7432
|
+
createFiltersConfig: createModelsFiltersConfig,
|
|
7433
|
+
buildFiltersFromParams: buildModelsFiltersFromParams,
|
|
7434
|
+
createUseModels: createUseActivityModels
|
|
7435
|
+
}
|
|
7436
|
+
);
|
|
7370
7437
|
|
|
7371
7438
|
// src/components/ActivitiesHistory/tabs/DraftsTab.tsx
|
|
7372
|
-
import { jsx as
|
|
7439
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
7373
7440
|
var DraftsTab = () => {
|
|
7374
|
-
return /* @__PURE__ */
|
|
7441
|
+
return /* @__PURE__ */ jsx44("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ jsx44(Text_default, { size: "lg", color: "text-text-600", children: "Rascunhos em desenvolvimento" }) });
|
|
7375
7442
|
};
|
|
7376
7443
|
|
|
7377
7444
|
// src/components/ActivitiesHistory/ActivitiesHistory.tsx
|
|
7378
|
-
import { jsx as
|
|
7445
|
+
import { jsx as jsx45, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7379
7446
|
var PAGE_TITLES = {
|
|
7380
7447
|
["history" /* HISTORY */]: "Hist\xF3rico de atividades",
|
|
7381
7448
|
["drafts" /* DRAFTS */]: "Rascunhos",
|
|
@@ -7403,10 +7470,10 @@ var ActivitiesHistory = ({
|
|
|
7403
7470
|
"data-testid": "activities-history",
|
|
7404
7471
|
className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden",
|
|
7405
7472
|
children: [
|
|
7406
|
-
/* @__PURE__ */
|
|
7473
|
+
/* @__PURE__ */ jsx45("span", { className: "absolute top-0 left-0 h-[150px] w-full z-0" }),
|
|
7407
7474
|
/* @__PURE__ */ jsxs29("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: [
|
|
7408
7475
|
/* @__PURE__ */ jsxs29("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: [
|
|
7409
|
-
/* @__PURE__ */
|
|
7476
|
+
/* @__PURE__ */ jsx45(
|
|
7410
7477
|
Text_default,
|
|
7411
7478
|
{
|
|
7412
7479
|
as: "h1",
|
|
@@ -7415,7 +7482,7 @@ var ActivitiesHistory = ({
|
|
|
7415
7482
|
children: PAGE_TITLES[activeTab]
|
|
7416
7483
|
}
|
|
7417
7484
|
),
|
|
7418
|
-
/* @__PURE__ */
|
|
7485
|
+
/* @__PURE__ */ jsx45("div", { className: "flex-shrink-0 lg:w-auto self-center sm:self-auto", children: /* @__PURE__ */ jsx45(
|
|
7419
7486
|
Menu,
|
|
7420
7487
|
{
|
|
7421
7488
|
defaultValue: "history" /* HISTORY */,
|
|
@@ -7429,7 +7496,7 @@ var ActivitiesHistory = ({
|
|
|
7429
7496
|
variant: "menu2",
|
|
7430
7497
|
className: "w-full lg:w-auto max-w-full min-w-0",
|
|
7431
7498
|
children: [
|
|
7432
|
-
/* @__PURE__ */
|
|
7499
|
+
/* @__PURE__ */ jsx45(
|
|
7433
7500
|
MenuItem,
|
|
7434
7501
|
{
|
|
7435
7502
|
variant: "menu2",
|
|
@@ -7439,7 +7506,7 @@ var ActivitiesHistory = ({
|
|
|
7439
7506
|
children: "Hist\xF3rico"
|
|
7440
7507
|
}
|
|
7441
7508
|
),
|
|
7442
|
-
/* @__PURE__ */
|
|
7509
|
+
/* @__PURE__ */ jsx45(
|
|
7443
7510
|
MenuItem,
|
|
7444
7511
|
{
|
|
7445
7512
|
variant: "menu2",
|
|
@@ -7449,7 +7516,7 @@ var ActivitiesHistory = ({
|
|
|
7449
7516
|
children: "Rascunhos"
|
|
7450
7517
|
}
|
|
7451
7518
|
),
|
|
7452
|
-
/* @__PURE__ */
|
|
7519
|
+
/* @__PURE__ */ jsx45(
|
|
7453
7520
|
MenuItem,
|
|
7454
7521
|
{
|
|
7455
7522
|
variant: "menu2",
|
|
@@ -7466,7 +7533,7 @@ var ActivitiesHistory = ({
|
|
|
7466
7533
|
) })
|
|
7467
7534
|
] }),
|
|
7468
7535
|
/* @__PURE__ */ jsxs29("div", { className: "flex flex-col items-center w-full min-h-0 flex-1", children: [
|
|
7469
|
-
activeTab === "history" /* HISTORY */ && /* @__PURE__ */
|
|
7536
|
+
activeTab === "history" /* HISTORY */ && /* @__PURE__ */ jsx45(
|
|
7470
7537
|
HistoryTab,
|
|
7471
7538
|
{
|
|
7472
7539
|
fetchActivitiesHistory,
|
|
@@ -7478,8 +7545,8 @@ var ActivitiesHistory = ({
|
|
|
7478
7545
|
userFilterData
|
|
7479
7546
|
}
|
|
7480
7547
|
),
|
|
7481
|
-
activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */
|
|
7482
|
-
activeTab === "models" /* MODELS */ && /* @__PURE__ */
|
|
7548
|
+
activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */ jsx45(DraftsTab, {}),
|
|
7549
|
+
activeTab === "models" /* MODELS */ && /* @__PURE__ */ jsx45(
|
|
7483
7550
|
ModelsTab,
|
|
7484
7551
|
{
|
|
7485
7552
|
fetchActivityModels,
|