From 3352651d33580b031cc6e18aee10d872e63f6808 Mon Sep 17 00:00:00 2001 From: franck Date: Tue, 8 Sep 2026 19:52:29 +0400 Subject: [PATCH] =?UTF-8?q?Corrige=20l'overlay=20de=20chargement=20bloqu?= =?UTF-8?q?=C3=A9=20en=20navigation,=20l'ajoute=20au=20CV?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - L'intro se rendait puis se retirait selon le pathname, laissant un overlay opaque figé au retour vers l'accueil depuis /cv - Overlay conservé sur / et /cv : le nœud DOM persiste, le display:none posé par GSAP tient - L'animation d'intro (F + barre + balayage) se joue aussi sur /cv Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01T3hzMzvei419MwkKFZkvMX --- app/intro.tsx | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/app/intro.tsx b/app/intro.tsx index 63537d2..a2f711f 100644 --- a/app/intro.tsx +++ b/app/intro.tsx @@ -4,6 +4,9 @@ import { useEffect } from "react"; import { usePathname } from "next/navigation"; import gsap from "gsap"; +// Pages qui ont l'écran de chargement (avec/sans slash final selon la config). +const WITH_INTRO = new Set(["/", "/cv", "/cv/"]); + export default function Intro() { const pathname = usePathname(); @@ -12,17 +15,18 @@ export default function Intro() { const reveal = gsap.utils.toArray("[data-reveal]"); const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches; - // No reveal targets (e.g. error / not-found pages) or reduced motion: skip the intro. - if (reduce || reveal.length === 0) { + if (reduce) { gsap.set(overlay, { display: "none" }); return; } - gsap.set(reveal, { autoAlpha: 0, y: 12 }); + if (reveal.length) gsap.set(reveal, { autoAlpha: 0, y: 12 }); const tl = gsap.timeline({ defaults: { ease: "power3.out" }, - onComplete: () => gsap.set(reveal, { clearProps: "all" }), + onComplete: () => { + if (reveal.length) gsap.set(reveal, { clearProps: "all" }); + }, }); tl.to("[data-intro-mark]", { autoAlpha: 1, scale: 1, duration: 0.45, ease: "power2.out" }, 0) @@ -32,17 +36,16 @@ export default function Intro() { { scaleX: 1, duration: 0.85, ease: "power2.inOut" }, 0.1, ) - .to(overlay, { yPercent: -100, duration: 0.5, ease: "power3.inOut" }, ">-0.1") - .to(reveal, { autoAlpha: 1, y: 0, duration: 0.5, stagger: 0.07 }, "<0.2") - .set(overlay, { display: "none" }); + .to(overlay, { yPercent: -100, duration: 0.5, ease: "power3.inOut" }, ">-0.1"); - return () => { - tl.kill(); - gsap.set(reveal, { clearProps: "all" }); - }; + if (reveal.length) { + tl.to(reveal, { autoAlpha: 1, y: 0, duration: 0.5, stagger: 0.07 }, "<0.2"); + } + + tl.set(overlay, { display: "none" }); }, []); - if (pathname !== "/") return null; + if (!WITH_INTRO.has(pathname)) return null; return (