analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
111 lines (109 loc) • 2.57 kB
JavaScript
import {
renderTextCell
} from "./chunk-RL26IDPE.mjs";
import {
ProgressBar_default
} from "./chunk-LDBWF6EA.mjs";
import {
Badge_default
} from "./chunk-OEW3ST4F.mjs";
// src/components/ExamPageLayout/examsTableConfig.tsx
import { CaretRightIcon } from "@phosphor-icons/react/dist/csr/CaretRight";
import { jsx } from "react/jsx-runtime";
var getExamStatusBadgeAction = (status) => {
const actionMap = {
["Agendada" /* AGENDADA */]: "info",
["Em andamento" /* EM_ANDAMENTO */]: "warning",
["Finalizada" /* FINALIZADA */]: "success",
["Cancelada" /* CANCELADA */]: "error"
};
return actionMap[status] || "info";
};
var examsTableColumns = [
{
key: "startDate",
label: "Data da Prova",
sortable: true
},
{
key: "title",
label: "T\xEDtulo",
sortable: true,
className: "max-w-[200px] truncate",
render: renderTextCell
},
{
key: "school",
label: "Escola",
sortable: true,
className: "max-w-[150px] truncate",
render: renderTextCell
},
{
key: "class",
label: "Turma",
sortable: true,
className: "max-w-[120px]",
render: renderTextCell
},
{
key: "status",
label: "Status",
sortable: true,
render: (value) => {
const status = value;
return /* @__PURE__ */ jsx(
Badge_default,
{
variant: "solid",
action: getExamStatusBadgeAction(status),
size: "small",
children: status
}
);
}
},
{
key: "questionCount",
label: "Quest\xF5es",
sortable: true,
className: "text-center"
},
{
key: "createdAt",
label: "Criada em",
sortable: true
},
{
key: "completionPercentage",
label: "Conclus\xE3o",
sortable: true,
render: (value) => {
const numValue = Number(value);
const safeValue = Number.isFinite(numValue) ? Math.max(0, Math.min(100, numValue)) : 0;
return /* @__PURE__ */ jsx(
ProgressBar_default,
{
value: safeValue,
variant: "blue",
size: "medium",
layout: "compact",
showPercentage: true,
compactWidth: "w-[100px]"
}
);
}
},
{
key: "navigation",
label: "",
sortable: false,
className: "w-12",
render: () => /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(CaretRightIcon, { size: 20, className: "text-text-600" }) })
}
];
export {
getExamStatusBadgeAction,
examsTableColumns
};
//# sourceMappingURL=chunk-5SP2WHVJ.mjs.map