UNPKG

analytica-frontend-lib

Version:

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

75 lines (66 loc) 2.92 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _chunkYFHORWTNjs = require('./chunk-YFHORWTN.js'); // src/utils/activityDetailsUtils.ts var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs); var getStatusBadgeConfig = (status) => { const configs = { [_chunkYFHORWTNjs.STUDENT_ACTIVITY_STATUS.CONCLUIDO]: { label: "Conclu\xEDdo", bgColor: "bg-green-50", textColor: "text-green-800" }, [_chunkYFHORWTNjs.STUDENT_ACTIVITY_STATUS.AGUARDANDO_CORRECAO]: { label: "Aguardando Corre\xE7\xE3o", bgColor: "bg-yellow-50", textColor: "text-yellow-800" }, [_chunkYFHORWTNjs.STUDENT_ACTIVITY_STATUS.AGUARDANDO_RESPOSTA]: { label: "Aguardando Resposta", bgColor: "bg-blue-50", textColor: "text-blue-800" }, [_chunkYFHORWTNjs.STUDENT_ACTIVITY_STATUS.NAO_ENTREGUE]: { label: "N\xE3o Entregue", bgColor: "bg-red-50", textColor: "text-red-800" }, [_chunkYFHORWTNjs.STUDENT_ACTIVITY_STATUS.AWAITING_ANSWER_SHEET]: { label: "Aguardando Gabarito", bgColor: "bg-sky-50", textColor: "text-sky-700" }, [_chunkYFHORWTNjs.STUDENT_ACTIVITY_STATUS.ANSWER_SHEET_RECEIVED]: { label: "Gabarito Recebido", bgColor: "bg-emerald-50", textColor: "text-emerald-800" } }; return _nullishCoalesce(configs[status], () => ( { label: status, bgColor: "bg-gray-50", textColor: "text-gray-700" })); }; var formatTimeSpent = (seconds) => { const totalSeconds = Math.floor(Math.abs(seconds)); const hours = Math.floor(totalSeconds / 3600); const minutes = Math.floor(totalSeconds % 3600 / 60); const secs = totalSeconds % 60; return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(secs).padStart(2, "0")}`; }; var formatQuestionNumbers = (numbers) => { if (numbers.length === 0) return "-"; return numbers.map((n) => String(n).padStart(2, "0")).join(", "); }; var formatDateToBrazilian = (dateString) => { const date = new Date(dateString); const day = String(date.getUTCDate()).padStart(2, "0"); const month = String(date.getUTCMonth() + 1).padStart(2, "0"); const year = date.getUTCFullYear(); return `${day}/${month}/${year}`; }; var formatActivityDateToBrazilian = (dateString) => { return _dayjs2.default.call(void 0, dateString).format("DD/MM/YYYY"); }; exports.getStatusBadgeConfig = getStatusBadgeConfig; exports.formatTimeSpent = formatTimeSpent; exports.formatQuestionNumbers = formatQuestionNumbers; exports.formatDateToBrazilian = formatDateToBrazilian; exports.formatActivityDateToBrazilian = formatActivityDateToBrazilian; //# sourceMappingURL=chunk-DNGOIXIW.js.map