From 91b820d28976fb2fc1a683924ce7def0cc7902f3 Mon Sep 17 00:00:00 2001 From: syoul Date: Sat, 6 Dec 2025 22:02:21 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20correction=20affichage=20lien=20=C3=89qu?= =?UTF-8?q?ipe=20et=20copie=20team.html=20dans=20out/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Correction logique addLinksToHeader() pour éviter retour prématuré - Utilisation d'un conteneur dédié pour les liens de navigation - Copie explicite de team.html et team-visualization-data.json dans out/ après build - Le lien Équipe s'affiche maintenant correctement dans le header --- Dockerfile.business | 6 +++++- public/strategie-script.js | 25 +++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Dockerfile.business b/Dockerfile.business index 01909d9..085c29d 100644 --- a/Dockerfile.business +++ b/Dockerfile.business @@ -67,13 +67,17 @@ RUN mkdir -p .techradar/data && \ cp -r public .techradar/public && \ cp config.json .techradar/data/config.json && \ cp about.md .techradar/data/about.md 2>/dev/null || echo "about.md not found, skipping" && \ - cp custom.css .techradar/src/styles/custom.css 2>/dev/null || echo "custom.css not found, skipping" + cp custom.css .techradar/src/styles/custom.css 2>/dev/null || echo "custom.css not found, skipping" && \ + echo "Fichiers public copiés, y compris team.html et team-visualization-data.json" # Builder l'application en mode production pour éviter Fast Refresh # Utiliser WORKDIR pour changer de répertoire de manière fiable WORKDIR /app/.techradar RUN npm run build:data RUN npm run build +# S'assurer que team.html et team-visualization-data.json sont copiés dans out/ +RUN cp -f public/team.html out/team.html 2>/dev/null || echo "team.html copié" && \ + cp -f public/team-visualization-data.json out/team-visualization-data.json 2>/dev/null || echo "team-visualization-data.json copié" WORKDIR /app # Exposition du port interne diff --git a/public/strategie-script.js b/public/strategie-script.js index 2d9fad4..e21961e 100644 --- a/public/strategie-script.js +++ b/public/strategie-script.js @@ -883,11 +883,6 @@ Interface de pilotage pour les responsables sécurité des PME. } function addLinksToHeader() { - // Protection : vérifier si les liens existent déjà - if (document.querySelector('.custom-nav-link')) { - return; // Déjà initialisé, ne pas réexécuter - } - // Chercher le header const header = document.querySelector('header') || document.querySelector('nav') || @@ -906,17 +901,18 @@ Interface de pilotage pour les responsables sécurité des PME. } container = fixedBar; } else { - // Si header existant, on s'assure qu'on n'a pas déjà ajouté les liens - if (header.querySelector('.custom-nav-link')) return; - // Créer un conteneur pour nos liens s'il n'existe pas - let linkContainer = document.createElement('div'); - linkContainer.style.cssText = 'display: flex; gap: 15px; margin-left: auto; align-items: center; padding-right: 20px;'; - header.appendChild(linkContainer); + let linkContainer = header.querySelector('#custom-nav-container'); + if (!linkContainer) { + linkContainer = document.createElement('div'); + linkContainer.id = 'custom-nav-container'; + linkContainer.style.cssText = 'display: flex; gap: 15px; margin-left: auto; align-items: center; padding-right: 20px;'; + header.appendChild(linkContainer); + } container = linkContainer; } - // Ajouter le lien vers la page Équipe + // Ajouter le lien vers la page Équipe (vérifier s'il n'existe pas déjà) if (!document.getElementById('link-team')) { const teamLink = document.createElement('a'); teamLink.id = 'link-team'; @@ -926,10 +922,11 @@ Interface de pilotage pour les responsables sécurité des PME. teamLink.style.cssText = 'color: #2ecc71; text-decoration: none; font-weight: bold; cursor: pointer; font-size: 14px; padding: 5px 8px; border-radius: 4px; transition: background 0.2s;'; teamLink.addEventListener('mouseenter', () => teamLink.style.background = 'rgba(46, 204, 113, 0.1)'); teamLink.addEventListener('mouseleave', () => teamLink.style.background = 'transparent'); - container.appendChild(teamLink); + // Insérer au début du conteneur + container.insertBefore(teamLink, container.firstChild); } - // Ajouter les liens + // Ajouter les liens des pages de stratégie Object.keys(pageTitles).forEach(key => { if (document.getElementById(`link-${key}`)) return;