From 683105fa3be2729d9799a32e151c1552f3eab8b3 Mon Sep 17 00:00:00 2001 From: gauvainboiche Date: Sat, 1 Aug 2026 18:32:46 +0200 Subject: [PATCH] refacto: Adding i18n support with FR and EN as base --- backend/package.json | 2 +- backend/server.js | 34 ++---------- frontend/css/styles.css | 9 ---- frontend/index.html | 105 ++++++++++++++++++------------------ frontend/js/app.js | 26 ++++++--- frontend/js/calculator.js | 10 +--- frontend/js/chartManager.js | 15 ++---- frontend/js/i18n.js | 46 ++++++++++++++++ frontend/js/pdfExport.js | 57 ++++++++------------ frontend/locales/en.json | 56 +++++++++++++++++++ frontend/locales/fr.json | 56 +++++++++++++++++++ pkCore.js | 74 +++++++++++-------------- 12 files changed, 290 insertions(+), 200 deletions(-) create mode 100644 frontend/js/i18n.js create mode 100644 frontend/locales/en.json create mode 100644 frontend/locales/fr.json diff --git a/backend/package.json b/backend/package.json index 28715a3..4202fa7 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,7 +1,7 @@ { "name": "ketapk-backend", "version": "1.0.0", - "description": "Serveur Backend et API pour KétaPK Web", + "description": "Serveur Backend pour KétaPK Web", "main": "server.js", "type": "commonjs", "scripts": { diff --git a/backend/server.js b/backend/server.js index 46a42f5..9997c5e 100644 --- a/backend/server.js +++ b/backend/server.js @@ -7,41 +7,13 @@ const PORT = process.env.PORT || 3000; app.use(cors()); app.use(express.json()); -// Servir le fichier pkCore.js situé à la racine + +// Service du moteur de calcul situé à la racine app.use('/pkCore.js', express.static(path.join(__dirname, '../pkCore.js'))); -// Servir les fichiers statiques du dossier frontend +// Service des fichiers statiques frontend app.use(express.static(path.join(__dirname, '../frontend'))); -// Base de données temporaire en mémoire pour les sauvegardes -const savedSimulations = []; - -// API : Enregistrer une simulation -app.post('/api/simulations', (req, res) => { - const { patient, mode, inputs, results, timestamp } = req.body; - - if (!inputs || !results) { - return res.status(400).json({ error: 'Données de simulation incomplètes' }); - } - - const newRecord = { - id: Date.now(), - timestamp: timestamp || new Date().toISOString(), - patient, - mode, - inputs, - results - }; - - savedSimulations.push(newRecord); - res.status(201).json({ message: 'Simulation sauvegardée avec succès', id: newRecord.id }); -}); - -// API : Récupérer toutes les sauvegardes -app.get('/api/simulations', (req, res) => { - res.json(savedSimulations); -}); - app.listen(PORT, () => { console.log(`Serveur KétaPK démarré sur http://localhost:${PORT}`); }); \ No newline at end of file diff --git a/frontend/css/styles.css b/frontend/css/styles.css index 7556b5f..9b59bc6 100644 --- a/frontend/css/styles.css +++ b/frontend/css/styles.css @@ -1,10 +1,5 @@ @charset "UTF-8"; -/* ========================================================================== - KétaPK Web - Custom Styles & Adjustments - ========================================================================== */ - -/* 1. Suppression des flèches/spinners par défaut sur les inputs de type number */ input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; @@ -15,7 +10,6 @@ input[type="number"] { -moz-appearance: textfield; } -/* 2. Personnalisation de la barre de défilement pour la grille temporelle */ #timelineGrid::-webkit-scrollbar { height: 8px; } @@ -35,7 +29,6 @@ input[type="number"] { background: rgba(100, 116, 139, 1); } -/* 3. Styles d'animation douces pour les fenêtres modales */ #modalCalc { transition: opacity 0.2s ease-in-out; } @@ -50,7 +43,6 @@ input[type="number"] { pointer-events: auto; } -/* 4. Effets au survol des cellules de la timeline */ #timelineGrid > div { min-width: 80px; transition: border-color 0.15s ease, transform 0.15s ease; @@ -61,7 +53,6 @@ input[type="number"] { box-shadow: 0 0 10px rgba(245, 158, 11, 0.15); } -/* 5. Optimisations Responsive (écrans verticaux et smartphones) */ @media (max-width: 640px) { #pkChart { min-height: 280px; diff --git a/frontend/index.html b/frontend/index.html index 987e9e3..0876de2 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -5,106 +5,114 @@ KétaPK - Simulation Pharmacocinétique - + - + - + - + - +
- +
KétaPK
- Pharmaco Kinetics - v1.00 • Dr Georges Mion + Pharmaco Kinetics + v1.00 • Dr Georges Mion
- +
- -
- +
+
+ 🌐 + +
+
- +
- + - +
- +
- +
-

+

⏱️ Saisie Chronologique Doses & Perfusion (0 - 300 min)

- Défilement horizontal 👉 + Défilement horizontal 👉
- +
@@ -156,32 +164,28 @@
- +