feat: création page Next.js /team et modification Navigation
- Script create-team-page.sh pour créer team.tsx et modifier Navigation - Page Next.js qui charge team.html dynamiquement - Lien Équipe ajouté directement dans le composant Navigation React - Plus fiable que l'injection JavaScript
This commit is contained in:
@@ -71,6 +71,10 @@ RUN mkdir -p .techradar/data && \
|
||||
echo "Fichiers public copiés" && \
|
||||
ls -la .techradar/public/ | grep -E "(team\.html|team-visualization)" || echo "Vérification fichiers team"
|
||||
|
||||
# Créer la page Next.js /team et modifier Navigation
|
||||
RUN chmod +x scripts/create-team-page.sh && \
|
||||
./scripts/create-team-page.sh || echo "⚠️ Échec de la création de la page team"
|
||||
|
||||
# Builder l'application en mode production pour éviter Fast Refresh
|
||||
# Utiliser WORKDIR pour changer de répertoire de manière fiable
|
||||
WORKDIR /app/.techradar
|
||||
|
||||
88
scripts/create-team-page.sh
Executable file
88
scripts/create-team-page.sh
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script pour créer la page Next.js /team et modifier Navigation
|
||||
|
||||
TECHRADAR_DIR=".techradar"
|
||||
TEAM_PAGE="$TECHRADAR_DIR/src/pages/team.tsx"
|
||||
NAV_FILE="$TECHRADAR_DIR/src/components/Navigation/Navigation.tsx"
|
||||
|
||||
# Créer la page team.tsx
|
||||
if [ ! -f "$TEAM_PAGE" ]; then
|
||||
mkdir -p "$(dirname "$TEAM_PAGE")"
|
||||
cat > "$TEAM_PAGE" << 'EOF'
|
||||
import Head from "next/head";
|
||||
import { useEffect } from "react";
|
||||
import { CustomPage } from "@/pages/_app";
|
||||
|
||||
const TeamPage: CustomPage = () => {
|
||||
useEffect(() => {
|
||||
// Charger le contenu de team.html dans cette page
|
||||
const loadTeamPage = async () => {
|
||||
try {
|
||||
const response = await fetch('/team.html');
|
||||
if (response.ok) {
|
||||
const html = await response.text();
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(html, 'text/html');
|
||||
const content = doc.body.innerHTML;
|
||||
const container = document.getElementById('team-container');
|
||||
if (container) {
|
||||
container.innerHTML = content;
|
||||
// Réexécuter les scripts
|
||||
const scripts = container.querySelectorAll('script');
|
||||
scripts.forEach(oldScript => {
|
||||
const newScript = document.createElement('script');
|
||||
Array.from(oldScript.attributes).forEach(attr => {
|
||||
newScript.setAttribute(attr.name, attr.value);
|
||||
});
|
||||
newScript.textContent = oldScript.textContent;
|
||||
oldScript.parentNode?.replaceChild(newScript, oldScript);
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erreur lors du chargement de team.html:', error);
|
||||
}
|
||||
};
|
||||
loadTeamPage();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Équipe & Technologies - Laplank</title>
|
||||
</Head>
|
||||
<div id="team-container" style={{ minHeight: '100vh' }}>
|
||||
<div style={{ textAlign: 'center', padding: '40px' }}>
|
||||
<p>Chargement de la page Équipe...</p>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default TeamPage;
|
||||
EOF
|
||||
echo "✅ Page team.tsx créée"
|
||||
else
|
||||
echo "ℹ️ Page team.tsx existe déjà"
|
||||
fi
|
||||
|
||||
# Modifier Navigation.tsx pour ajouter le lien
|
||||
if [ -f "$NAV_FILE" ]; then
|
||||
if ! grep -q 'href="/team"' "$NAV_FILE"; then
|
||||
# Ajouter le lien après Overview
|
||||
sed -i '/href="\/overview"/a\
|
||||
<li className={styles.item}>\
|
||||
<Link href="/team">\
|
||||
<span className={styles.label}>👥 Équipe</span>\
|
||||
</Link>\
|
||||
</li>' "$NAV_FILE"
|
||||
echo "✅ Lien Équipe ajouté au composant Navigation"
|
||||
else
|
||||
echo "ℹ️ Lien Équipe déjà présent dans Navigation"
|
||||
fi
|
||||
else
|
||||
echo "⚠️ Navigation.tsx non trouvé"
|
||||
fi
|
||||
|
||||
27
scripts/patch-navigation.sh
Executable file
27
scripts/patch-navigation.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script pour patcher le composant Navigation et ajouter le lien Équipe
|
||||
|
||||
NAV_FILE=".techradar/src/components/Navigation/Navigation.tsx"
|
||||
|
||||
if [ ! -f "$NAV_FILE" ]; then
|
||||
echo "⚠️ $NAV_FILE non trouvé"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Vérifier si le lien existe déjà
|
||||
if grep -q "href=\"/team\"" "$NAV_FILE"; then
|
||||
echo "ℹ️ Lien Équipe déjà présent dans Navigation.tsx"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Ajouter le lien après le lien Overview
|
||||
sed -i '/href="\/overview"/a\
|
||||
<li className={styles.item}>\
|
||||
<Link href="/team">\
|
||||
<span className={styles.label}>👥 Équipe</span>\
|
||||
</Link>\
|
||||
</li>' "$NAV_FILE"
|
||||
|
||||
echo "✅ Lien Équipe ajouté au composant Navigation"
|
||||
|
||||
Reference in New Issue
Block a user