line counts à jour, ajout flow ASCII détaillé, layout repo enrichi (firefox-updates.json + CLAUDE.md)

2026-04-27 05:33:32 +02:00
parent 8a6799e3d2
commit a1d9a80a62
+42 -14
@@ -5,16 +5,18 @@
``` ```
Planification/ Planification/
├── .gitignore ├── .gitignore
├── build.sh # Génère dist/chromium/, dist/firefox/, .zip, .xpi ├── build.sh # Génère dist/chromium/, dist/firefox/, .zip, .xpi, met à jour firefox-updates.json
├── firefox-updates.json # Manifest auto-update Firefox (servi via update_url)
├── CHANGELOG.md ├── CHANGELOG.md
├── LICENSE # MIT ├── LICENSE # MIT
├── README.md ├── README.md
├── CLAUDE.md # Workflow pour Claude Code
└── src/ # Sources de l'extension (chargées par le navigateur) └── src/ # Sources de l'extension (chargées par le navigateur)
├── manifest.json # Manifest V3 (Chrome) + gecko_settings (Firefox) ├── manifest.json # Manifest V3 (Chrome) + browser_specific_settings (Firefox)
├── background.js # Service worker (~1 500 lignes) ├── background.js # Service worker (~1 600 lignes)
├── viewer.html # Interface principale ├── viewer.html # Interface principale
├── viewer.js # Logique (~9 500 lignes) ├── viewer.js # Logique UI (~10 700 lignes)
├── viewer.css # Styles + thèmes clair/sombre ├── viewer.css # Styles + thèmes clair/sombre (~4 800 lignes)
└── icons/ # icon16, icon48, icon128 └── icons/ # icon16, icon48, icon128
``` ```
@@ -54,17 +56,43 @@ Worker de fond responsable de :
## Flux principal ## Flux principal
``` ```
Utilisateur clique sur l'icône ┌────────────────┐ clic icône ┌─────────────────────┐
└─> background.js : ouvre viewer.html │ Navigateur │ ───────────────> │ background.js │
└─> viewer.js : init() │ (Chrome / │ │ (service worker) │
├─> readCache(date) -> render si dispo │ Firefox) │ <─── viewer.html │ │
├─> findEasyVistaSession (via background) └────────────────┘ └──────────┬──────────┘
├─> fetchPlanningXml -> parseXML │ │
├─> Pour chaque intervention : fetchFiche + parseHtml │ chrome.runtime.sendMessage │ findEasyVistaSession()
├─> renderFromData() -> buildCard() x N techs │ {type: "fetchPlanning"} │ ↓
└─> writeCache() ▼ ▼
┌────────────────────────┐ ┌────────────────────┐
│ viewer.js (UI) │ │ EasyVista server │
│ ─ init() │ │ itsma.vd.ch / │
│ ─ loadForDate(iso) │ ◄── XML ── │ etat-de-vaud.ch │
│ ─ parseXML │ fiches │ │
│ ─ buildCard() x N │ │ planning_xhr.php │
│ ─ buildTooltipHTML │ │ index.php (fiches) │
│ ─ renderFromData │ │ etc. │
│ ─ writeCache │ └────────────────────┘
└──────────┬─────────────┘
┌────────────────────────────────────────────────┐
│ chrome.storage.local │
│ ─ admin_config (groupe, équipe, domaines, …) │
│ ─ planning_cache_YYYY-MM-DD (par jour) │
│ localStorage │
│ ─ view_mode (classic / horizontal) │
└────────────────────────────────────────────────┘
``` ```
**Étapes clés** (de `init()` à l'affichage) :
1. `init()` → charge le thème + la config admin + les bornes de la journée + l'équipe.
2. `refreshSessionAndLoad()` → cherche la session EV via `background.js`.
3. `loadForDate(isoDate)` → essaye d'abord le cache local (`readCache`), puis fetche le XML calendar_block via `background.fetchPlanningXml`.
4. Pour chaque intervention présente dans le XML : on en `buildCard()` immédiatement avec les attributs déjà enrichis (contact/lieu/catégorie). Pour les statuts détaillés, on lance des `fetchFiche` séquentiels en arrière-plan qui mettent à jour le DOM au fur et à mesure.
5. À la fin du fetch complet : `writeCache()` sauvegarde tout dans `chrome.storage.local["planning_cache_YYYY-MM-DD"]`.
## Stack technique ## Stack technique
| Élément | Détail | | Élément | Détail |