UNPKG

analytica-frontend-lib

Version:

Repositório público dos componentes utilizados nas plataformas da Analytica Ensino

125 lines (122 loc) 4.93 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/types/recommendedLessons.ts var recommendedLessons_exports = {}; __export(recommendedLessons_exports, { GOAL_FILTER_STATUS_OPTIONS: () => GOAL_FILTER_STATUS_OPTIONS, GOAL_STATUS_OPTIONS: () => GOAL_STATUS_OPTIONS, GoalApiStatus: () => GenericApiStatus, GoalBadgeActionType: () => BadgeActionType, GoalDisplayStatus: () => GenericDisplayStatus, StudentLessonStatus: () => StudentLessonStatus, deriveStudentStatus: () => deriveStudentStatus, formatDaysToComplete: () => formatDaysToComplete, getGoalStatusBadgeAction: () => getGoalStatusBadgeAction, getStudentStatusBadgeAction: () => getStudentStatusBadgeAction, isDeadlinePassed: () => isDeadlinePassed }); module.exports = __toCommonJS(recommendedLessons_exports); // src/types/common.ts var GenericApiStatus = /* @__PURE__ */ ((GenericApiStatus2) => { GenericApiStatus2["A_VENCER"] = "A_VENCER"; GenericApiStatus2["VENCIDA"] = "VENCIDA"; GenericApiStatus2["CONCLUIDA"] = "CONCLUIDA"; return GenericApiStatus2; })(GenericApiStatus || {}); var GenericDisplayStatus = /* @__PURE__ */ ((GenericDisplayStatus3) => { GenericDisplayStatus3["ATIVA"] = "ATIVA"; GenericDisplayStatus3["VENCIDA"] = "VENCIDA"; GenericDisplayStatus3["CONCLUIDA"] = "CONCLU\xCDDA"; return GenericDisplayStatus3; })(GenericDisplayStatus || {}); var BadgeActionType = /* @__PURE__ */ ((BadgeActionType3) => { BadgeActionType3["SUCCESS"] = "success"; BadgeActionType3["WARNING"] = "warning"; BadgeActionType3["ERROR"] = "error"; return BadgeActionType3; })(BadgeActionType || {}); var getStatusBadgeAction = (status) => { const actionMap = { ["CONCLU\xCDDA" /* CONCLUIDA */]: "success" /* SUCCESS */, ["ATIVA" /* ATIVA */]: "warning" /* WARNING */, ["VENCIDA" /* VENCIDA */]: "error" /* ERROR */ }; return actionMap[status] ?? "warning" /* WARNING */; }; // src/types/recommendedLessons.ts var getGoalStatusBadgeAction = (status) => getStatusBadgeAction(status); var GOAL_FILTER_STATUS_OPTIONS = [ { id: "VENCIDA" /* VENCIDA */, name: "Vencida" }, { id: "A_VENCER" /* A_VENCER */, name: "Ativa" } ]; var GOAL_STATUS_OPTIONS = [ { id: "A_VENCER" /* A_VENCER */, name: "A Vencer" }, { id: "VENCIDA" /* VENCIDA */, name: "Vencida" }, { id: "CONCLUIDA" /* CONCLUIDA */, name: "Conclu\xEDda" } ]; var StudentLessonStatus = /* @__PURE__ */ ((StudentLessonStatus2) => { StudentLessonStatus2["A_INICIAR"] = "A INICIAR"; StudentLessonStatus2["EM_ANDAMENTO"] = "EM ANDAMENTO"; StudentLessonStatus2["NAO_FINALIZADO"] = "N\xC3O FINALIZADO"; StudentLessonStatus2["CONCLUIDO"] = "CONCLU\xCDDO"; return StudentLessonStatus2; })(StudentLessonStatus || {}); var getStudentStatusBadgeAction = (status) => { const actionMap = { ["CONCLU\xCDDO" /* CONCLUIDO */]: "success", ["EM ANDAMENTO" /* EM_ANDAMENTO */]: "info", ["A INICIAR" /* A_INICIAR */]: "warning", ["N\xC3O FINALIZADO" /* NAO_FINALIZADO */]: "error" }; return actionMap[status] ?? "warning"; }; var isDeadlinePassed = (deadline) => { if (!deadline) return false; return new Date(deadline) < /* @__PURE__ */ new Date(); }; var deriveStudentStatus = (progress, completedAt, deadline) => { if (completedAt) return "CONCLU\xCDDO" /* CONCLUIDO */; if (progress === 100) return "CONCLU\xCDDO" /* CONCLUIDO */; if (isDeadlinePassed(deadline ?? null) && progress < 100) { return "N\xC3O FINALIZADO" /* NAO_FINALIZADO */; } if (progress === 0) return "A INICIAR" /* A_INICIAR */; if (progress > 0) return "EM ANDAMENTO" /* EM_ANDAMENTO */; return "A INICIAR" /* A_INICIAR */; }; var formatDaysToComplete = (daysToComplete) => { if (daysToComplete === null) return null; if (daysToComplete === 1) return "1 dia"; return `${daysToComplete} dias`; }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { GOAL_FILTER_STATUS_OPTIONS, GOAL_STATUS_OPTIONS, GoalApiStatus, GoalBadgeActionType, GoalDisplayStatus, StudentLessonStatus, deriveStudentStatus, formatDaysToComplete, getGoalStatusBadgeAction, getStudentStatusBadgeAction, isDeadlinePassed }); //# sourceMappingURL=index.js.map