Files
TechradarDev/scripts/create-team-page.sh
syoul 74519f7e41 fix: correction script create-team-page avec Python pour Navigation
- Utilisation de Python au lieu de sed/awk pour modification précise
- Insertion correcte du lien Équipe après Overview
- Page team.tsx avec iframe pour charger team.html
2025-12-06 22:15:56 +01:00

76 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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 qui charge team.html via iframe (plus simple et fiable)
if [ ! -f "$TEAM_PAGE" ]; then
mkdir -p "$(dirname "$TEAM_PAGE")"
cat > "$TEAM_PAGE" << 'EOF'
import Head from "next/head";
import { CustomPage } from "@/pages/_app";
const TeamPage: CustomPage = () => {
return (
<>
<Head>
<title>Équipe & Technologies - Laplank</title>
</Head>
<div style={{ width: '100%', height: '100vh', border: 'none', margin: 0, padding: 0 }}>
<iframe
src="/team.html"
style={{
width: '100%',
height: '100%',
border: 'none',
margin: 0,
padding: 0
}}
title="Équipe & Technologies"
/>
</div>
</>
);
};
export default TeamPage;
EOF
echo "✅ Page team.tsx créée (iframe)"
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, avant le commentaire
# Utiliser Python pour une modification plus précise
python3 << PYTHON_SCRIPT
import re
with open("$NAV_FILE", 'r') as f:
content = f.read()
# Trouver la fin du lien Overview et insérer le nouveau lien avant le commentaire
pattern = r'(</Link>\s*</li>\s*)(\{/\*)'
replacement = r'\1 <li className={styles.item}>\n <Link href="/team">\n <span className={styles.label}>👥 Équipe</span>\n </Link>\n </li>\n \2'
new_content = re.sub(pattern, replacement, content)
with open("$NAV_FILE", 'w') as f:
f.write(new_content)
PYTHON_SCRIPT
echo "✅ Lien Équipe ajouté au composant Navigation"
else
echo " Lien Équipe déjà présent dans Navigation"
fi
else
echo "⚠️ Navigation.tsx non trouvé: $NAV_FILE"
ls -la "$(dirname "$NAV_FILE")" || echo "Dossier non trouvé"
fi