diff --git a/package-lock.json b/package-lock.json index 162bd32..f1bf4f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ecole-directe-plus", - "version": "0.4.0", + "version": "0.4.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ecole-directe-plus", - "version": "0.4.0", + "version": "0.4.1", "dependencies": { "@floating-ui/react": "^0.25.4", "@vitejs/plugin-basic-ssl": "^1.0.1", @@ -19,7 +19,7 @@ "react-content-loader": "^6.2.1", "react-router-dom": "^6.16.0", "uuid": "^9.0.1", - "vite": "^4.4.9" + "vite": "^4.5.5" } }, "node_modules/@ampproject/remapping": { @@ -960,9 +960,10 @@ } }, "node_modules/dompurify": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.0.tgz", - "integrity": "sha512-yoU4rhgPKCo+p5UrWWWNKiIq+ToGqmVVhk0PmMYBK4kRsR3/qhemNFL8f6CFmBd4gMwm3F4T7HBoydP5uY07fA==" + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz", + "integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==", + "license": "(MPL-2.0 OR Apache-2.0)" }, "node_modules/electron-to-chromium": { "version": "1.4.570", @@ -1349,9 +1350,10 @@ } }, "node_modules/vite": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", - "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz", + "integrity": "sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==", + "license": "MIT", "dependencies": { "esbuild": "^0.18.10", "postcss": "^8.4.27", @@ -1975,9 +1977,9 @@ } }, "dompurify": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.0.tgz", - "integrity": "sha512-yoU4rhgPKCo+p5UrWWWNKiIq+ToGqmVVhk0PmMYBK4kRsR3/qhemNFL8f6CFmBd4gMwm3F4T7HBoydP5uY07fA==" + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz", + "integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==" }, "electron-to-chromium": { "version": "1.4.570", @@ -2218,9 +2220,9 @@ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" }, "vite": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", - "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz", + "integrity": "sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==", "requires": { "esbuild": "^0.18.10", "fsevents": "~2.3.2", diff --git a/package.json b/package.json index 50d10a0..8338437 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ecole-directe-plus", - "version": "0.4.0", + "version": "0.4.1", "type": "module", "description": "Ecole Directe plus is a React web app that is designed to replace and improve EcoleDirecte", "dependencies": { @@ -15,7 +15,7 @@ "react-content-loader": "^6.2.1", "react-router-dom": "^6.16.0", "uuid": "^9.0.1", - "vite": "^4.4.9" + "vite": "^4.5.5" }, "scripts": { "dev": "vite", diff --git a/src/App.jsx b/src/App.jsx index 9ecf179..c5aa8c9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -70,7 +70,7 @@ function consoleLogEDPLogo() { consoleLogEDPLogo(); -const currentEDPVersion = "0.4.0"; +const currentEDPVersion = "0.4.1"; const apiVersion = "4.64.0"; // secret webhooks @@ -112,7 +112,8 @@ const defaultSettings = { shareSettings: true, negativeBadges: false, allowAnonymousReports: true, - isDevChannel: false + isDevChannel: false, + selectedChart: 0 } const browserExtensionDownloadLink = { @@ -168,6 +169,10 @@ function initSettings(accountList) { value: getSetting("displayMode", i), values: ["quality", "balanced", "performance"] }, + selectedChart: { + value: getSetting("selectedChart", i), + values: [0, 1, 2] + }, isSepiaEnabled: { value: getSetting("isSepiaEnabled", i), }, @@ -391,7 +396,7 @@ export default function App({ edpFetch }) { > Value of displayTheme of current user - You can pass the setting you wan in arguments of useUserSettings + You can pass the setting you want in arguments of useUserSettings EX : userDisplayTheme = useUserSettings("displayTheme") @@ -644,6 +649,12 @@ export default function App({ edpFetch }) { document.documentElement.style.fontSize = newFontSize + "em"; } } + } else if (window.innerHeight < 900) { + if (window.innerHeight >= 650) { + document.documentElement.style.zoom = (.35 / 350) * window.innerHeight + .1; + } else { + document.documentElement.style.zoom = .75; + } } else { document.documentElement.style.fontSize = ""; document.documentElement.style.zoom = ""; @@ -2754,4 +2765,4 @@ export default function App({ edpFetch }) { ); -} \ No newline at end of file +} diff --git a/src/components/Root.jsx b/src/components/Root.jsx index 4aed95b..5a04d19 100644 --- a/src/components/Root.jsx +++ b/src/components/Root.jsx @@ -93,6 +93,7 @@ export default function Root({ currentEDPVersion, token, accountsList, fakeLogin return 0; } else { localStorage.clear(); + localStorage.setItem("EDPVersion", currentEDPVersion); } } @@ -103,7 +104,6 @@ export default function Root({ currentEDPVersion, token, accountsList, fakeLogin setIsNewUser(true); } else { localStorage.setItem("EDPVersion", currentEDPVersion); - setIsNewEDPVersion(true); necessaryResets(localStorage.getItem("EDPVersion")); } } else { diff --git a/src/components/app/Grades/Charts.jsx b/src/components/app/Grades/Charts.jsx index b47e42a..3faa0f8 100644 --- a/src/components/app/Grades/Charts.jsx +++ b/src/components/app/Grades/Charts.jsx @@ -1,13 +1,10 @@ - import { useState, useEffect, useRef, useContext } from "react"; // import { Chart } from 'chart.js'; import { applyZoom, getZoomedBoudingClientRect } from "../../../utils/zoom"; - import "./Charts.css"; import DropDownMenu from "../../generic/UserInputs/DropDownMenu"; - import { AppContext } from "../../../App"; export default function Charts({ selectedPeriod }) { @@ -18,8 +15,12 @@ export default function Charts({ selectedPeriod }) { * 2: Subjects average | radar */ - // States - const [chartType, setChartType] = useState(0); + // States + + const { useUserSettings } = useContext(AppContext); + + const settings = useUserSettings() + const [selectedChart, setSelectedChart] = useState(settings.get("selectedChart")); const chartContainerRef = useRef(null); const canvasContainerRef = useRef(null); @@ -40,7 +41,6 @@ export default function Charts({ selectedPeriod }) { } useEffect(() => { - window.addEventListener("resize", resizeChart); resizeChart(); @@ -49,16 +49,15 @@ export default function Charts({ selectedPeriod }) { } }, []) - function getChartData() { /** - * return the appropriate dataset according to the chartType + * return the appropriate dataset according to the selectedChart */ const userData = useUserData(); const minMaxEnabled = userData.get("gradesEnabledFeatures")?.moyenneMin && userData.get("gradesEnabledFeatures")?.moyenneMax; - switch (chartType) { + switch (selectedChart) { case 0: // General average + streak history | line chartOptions.current = { @@ -71,17 +70,17 @@ export default function Charts({ selectedPeriod }) { suggestedMax: 20 }, // y1: { - // type: 'linear', - // display: true, - // position: 'right', - // suggestedMax: 20 + // type: 'linear', + // display: true, + // position: 'right', + // suggestedMax: 20 // } // xAxes: [{ - // type: 'time', - // ticks: { - // autoSkip: true, - // maxTicksLimit: 20 - // } + // type: 'time', + // ticks: { + // autoSkip: true, + // maxTicksLimit: 20 + // } // }] }, interaction: { @@ -179,24 +178,24 @@ export default function Charts({ selectedPeriod }) { order: 1, }, // { - // type: "line", - // label: "Moyennes max classe", - // data: subjectsComparativeInformation[selectedPeriod].map((subject) => subject.maxAverage), - // borderColor: 'rgb(53, 162, 235)', - // backgroundColor: 'rgba(53, 162, 235, 0.5)', - // tension: 0.2, - // // yAxisID: "y1" - // order: 2, + // type: "line", + // label: "Moyennes max classe", + // data: subjectsComparativeInformation[selectedPeriod].map((subject) => subject.maxAverage), + // borderColor: 'rgb(53, 162, 235)', + // backgroundColor: 'rgba(53, 162, 235, 0.5)', + // tension: 0.2, + // // yAxisID: "y1" + // order: 2, // }, // { - // type: "line", - // label: "Moyennes min classe", - // data: subjectsComparativeInformation[selectedPeriod].map((subject) => subject.minAverage), - // borderColor: 'rgb(53, 162, 235)', - // backgroundColor: 'rgba(53, 162, 235, 0.5)', - // tension: 0.2, - // // yAxisID: "y1" - // order: 3, + // type: "line", + // label: "Moyennes min classe", + // data: subjectsComparativeInformation[selectedPeriod].map((subject) => subject.minAverage), + // borderColor: 'rgb(53, 162, 235)', + // backgroundColor: 'rgba(53, 162, 235, 0.5)', + // tension: 0.2, + // // yAxisID: "y1" + // order: 3, // }, ], }; @@ -214,7 +213,7 @@ export default function Charts({ selectedPeriod }) { beginAtZero: true, suggestedMax: 20, grid: { - color: actualDisplayTheme == "dark" ? "rgba(180, 180, 240, .4)" : "rgba(76, 76, 184, .4)" + color: actualDisplayTheme == "dark" ? "rgba(180, 180, 240, .4)" : "rgba(76, 76, 184, .4)" } } }, @@ -308,9 +307,9 @@ export default function Charts({ selectedPeriod }) { } useEffect(() => { - console.log(chartType); refreshChart(); - }, [chartType, activeAccount, selectedPeriod]); + useUserSettings("selectedChart").set(selectedChart); + }, [selectedChart, activeAccount, selectedPeriod]); useEffect(() => { const script = document.createElement("script"); @@ -330,7 +329,15 @@ export default function Charts({ selectedPeriod }) { return (
+ Les messages c'est bien, mais les dossiers c'est mieux ! Non ? Eh bien on les a quand même fait pour vous. +
+La messagerie fait son arrivée ! Vous pouvez dès à présent consulter les messages passionnants de vos profs et éducateurs sans aucune distraction. @@ -78,7 +139,7 @@ export default function PatchNotes({ currentEDPVersion, onClose }) {
Attention : ce service n'est PAS affilié à EcoleDirecte ou Aplim, il s'agit d'un projet indépendant et communautaire.