- Page Next.js utilise iframe pour charger team.html (plus simple) - Utilisation d'awk pour modification Navigation.tsx (plus robuste) - Meilleure gestion des erreurs
74 lines
2.0 KiB
Bash
Executable File
74 lines
2.0 KiB
Bash
Executable File
#!/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 une approche plus robuste avec awk ou perl
|
||
awk '
|
||
/href="\/overview"/ {
|
||
print
|
||
getline
|
||
print
|
||
print " <li className={styles.item}>"
|
||
print " <Link href=\"/team\">"
|
||
print " <span className={styles.label}>👥 Équipe</span>"
|
||
print " </Link>"
|
||
print " </li>"
|
||
next
|
||
}
|
||
{ print }
|
||
' "$NAV_FILE" > "$NAV_FILE.tmp" && mv "$NAV_FILE.tmp" "$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é: $NAV_FILE"
|
||
ls -la "$(dirname "$NAV_FILE")" || echo "Dossier non trouvé"
|
||
fi
|
||
|