diff --git a/src/App.jsx b/src/App.jsx index 12067c7..7feb932 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -935,7 +935,7 @@ export default function App({ edpFetch }) { subjectDatas[periodCode][subjectCode].push({ value: newGrade.value, coef: newGrade.coef, scale: newGrade.scale, isSignificant: newGrade.isSignificant, classAverage: newGrade.classAverage }); const nbSubjectGrades = periods[periodCode].subjects[subjectCode]?.grades.filter((el) => el.isSignificant).length ?? 0; const subjectAverage = periods[periodCode].subjects[subjectCode].average; - const oldGeneralAverage = isNaN(periods[periodCode].generalAverage) ? 10 : periods[periodCode].generalAverage; + const oldGeneralAverage = isNaN(periods[periodCode]?.generalAverage) ? 10 : periods[periodCode]?.generalAverage; const average = calcAverage(subjectDatas[periodCode][subjectCode]); const classAverage = calcClassAverage(subjectDatas[periodCode][subjectCode]); diff --git a/src/components/app/Account/Account.jsx b/src/components/app/Account/Account.jsx index 8cad48c..053beee 100644 --- a/src/components/app/Account/Account.jsx +++ b/src/components/app/Account/Account.jsx @@ -244,7 +244,7 @@ export default function Account({ schoolLife, fetchSchoolLife, fetchAdministrati )} {module?.params?.DocumentsAdministratifActif === "1" && documents?.administratifs?.length > 0 && (
-

Documents Administratifs

+

Documents administratifs

{documents.administratifs.map(file => (
@@ -266,7 +266,7 @@ export default function Account({ schoolLife, fetchSchoolLife, fetchAdministrati )} {module?.params?.DocumentsVSActif === "1" && documents?.viescolaire?.length > 0 && (
-

Vie Scolaire

+

Vie scolaire

{documents.viescolaire.map(file => (
@@ -277,7 +277,7 @@ export default function Account({ schoolLife, fetchSchoolLife, fetchAdministrati )} {module?.params?.DocumentsEntrepriseActif === "1" && documents?.entreprises?.length > 0 && (
-

Documents Entreprise

+

Documents entreprise

{documents.entreprises.map(file => (
diff --git a/src/components/app/Grades/MobileResults.jsx b/src/components/app/Grades/MobileResults.jsx index 0772fa1..47333f4 100644 --- a/src/components/app/Grades/MobileResults.jsx +++ b/src/components/app/Grades/MobileResults.jsx @@ -110,7 +110,7 @@ export default function Results({ activeAccount, sortedGrades, selectedPeriod, s {sortedGrades && sortedGrades[selectedPeriod] - ? + ? : : sortedGrades && sortedGrades[selectedPeriod] - ? + ? : {sortedGrades && sortedGrades[selectedPeriod] - ? + ? : : sortedGrades && sortedGrades[selectedPeriod] - ? + ? : handleKeyDown(e, task.date, task.id)} onClick={() => handleClick(task.date, task.id)} className={`upcoming-assignments ${currentSortedHomeworks[task.date][task.index].isDone ? "done" : ""}`} + ?
handleKeyDown(e, task.date, task.id)} onClick={() => handleClick(task.date, task.id)} className={`upcoming-assignments ${currentSortedHomeworks[task.date][task.index]?.isDone ? "done" : ""}`} style={{ "--subject-main-color": actualDisplayTheme === "dark" ? `hsl(${taskColor[0]}, ${taskColor[1]}%, ${taskColor[2]}%)` : `hsl(${taskColor[0]}, ${taskColor[1] - 20}%, ${taskColor[2] - 30}%)`, "--subject-bg-color": actualDisplayTheme === "dark" ? `hsla(${taskColor[0]}, ${taskColor[1]}%, ${taskColor[2]}%, .2)` : `hsla(${taskColor[0]}, ${taskColor[1] - 20}%, ${taskColor[2] - 30}%, .2)`, // "--text-color-task": `hsl(${taskColor[0]}, ${taskColor[1] - 20}%, ${taskColor[2] - 20}%)`, // "--background-color-task": `hsl(${taskColor[0]}, ${taskColor[1] - 5}%, ${taskColor[2] - 5}%)`, }}> - { checkTask(task.date, task.index) }} ref={taskCheckboxRef} checked={currentSortedHomeworks[task.date][task.index].isDone} id={`${task.id}-upcoming-assignments"`} onMouseEnter={() => isMouseInCheckBoxRef.current = true} onMouseLeave={() => isMouseInCheckBoxRef.current = false} style={{ "backgroundImage": currentSortedHomeworks[task.date][task.index].isDone ? `url("data:image/svg+xml,%3Csvg width='126' height='90' viewBox='0 0 126 90' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.00999 29.4982L4.7539 27.7442C8.77118 23.7036 15.3475 23.8312 19.205 28.0246L47.306 58.5723C48.849 60.2496 51.4795 60.3007 53.0864 58.6844L108.318 3.13256C112.228 -0.799963 118.591 -0.799963 122.501 3.13256L122.99 3.62419C126.868 7.5247 126.868 13.8249 122.99 17.7254L52.9741 88.147C51.4102 89.72 48.8649 89.72 47.301 88.147L3.00999 43.5994C-0.868052 39.6989 -0.868055 33.3987 3.00999 29.4982Z' fill='hsl(${taskColor[0]}, ${taskColor[1]}%, ${taskColor[2]}%)'/%3E%3C/svg%3E")` : "" }} /> + { checkTask(task.date, task.index) }} ref={taskCheckboxRef} checked={currentSortedHomeworks[task.date][task.index]?.isDone} id={`${task.id}-upcoming-assignments"`} onMouseEnter={() => isMouseInCheckBoxRef.current = true} onMouseLeave={() => isMouseInCheckBoxRef.current = false} style={{ "backgroundImage": currentSortedHomeworks[task.date][task.index]?.isDone ? `url("data:image/svg+xml,%3Csvg width='126' height='90' viewBox='0 0 126 90' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.00999 29.4982L4.7539 27.7442C8.77118 23.7036 15.3475 23.8312 19.205 28.0246L47.306 58.5723C48.849 60.2496 51.4795 60.3007 53.0864 58.6844L108.318 3.13256C112.228 -0.799963 118.591 -0.799963 122.501 3.13256L122.99 3.62419C126.868 7.5247 126.868 13.8249 122.99 17.7254L52.9741 88.147C51.4102 89.72 48.8649 89.72 47.301 88.147L3.00999 43.5994C-0.868052 39.6989 -0.868055 33.3987 3.00999 29.4982Z' fill='hsl(${taskColor[0]}, ${taskColor[1]}%, ${taskColor[2]}%)'/%3E%3C/svg%3E")` : "" }} /> {task.subject} {formatDateRelative(new Date(task.date))}
diff --git a/src/utils/date.js b/src/utils/date.js index d2477f1..7416823 100644 --- a/src/utils/date.js +++ b/src/utils/date.js @@ -29,6 +29,14 @@ export function formatDateRelative(date, short=true) { } } +export function isValidDateFormat(dateString) { + if (!dateString) { + return false; + } + const regex = /^\d{4}-\d{2}-\d{2}$/; // Matches YYYY-MM-DD format + return regex.test(dateString); +} + export function getCurrentSchoolYear() { /** * return an array: