From 16f271c1c9f755048e9e01c5a4ca908ad26d3be4 Mon Sep 17 00:00:00 2001 From: Timothy Pidashev Date: Mon, 6 Apr 2026 14:33:30 -0700 Subject: [PATCH] mobile optimizations --- src/components/about/intro.tsx | 3 ++- src/components/about/stats-alltime.tsx | 3 ++- src/components/about/stats-detailed.tsx | 3 ++- src/components/about/timeline.tsx | 3 ++- src/layouts/index.astro | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/about/intro.tsx b/src/components/about/intro.tsx index 432581d..6bde038 100644 --- a/src/components/about/intro.tsx +++ b/src/components/about/intro.tsx @@ -12,8 +12,9 @@ export default function Intro() { const rect = el.getBoundingClientRect(); const inView = rect.top < window.innerHeight && rect.bottom > 0; const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload"; + const isSpaNav = !!(window as any).__astroNavigation; - if (inView && isReload) { + if (inView && (isReload || isSpaNav)) { setVisible(true); return; } diff --git a/src/components/about/stats-alltime.tsx b/src/components/about/stats-alltime.tsx index d78c47a..d7cfd35 100644 --- a/src/components/about/stats-alltime.tsx +++ b/src/components/about/stats-alltime.tsx @@ -28,8 +28,9 @@ const Stats = () => { const rect = el.getBoundingClientRect(); const inView = rect.top < window.innerHeight && rect.bottom > 0; const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload"; + const isSpaNav = !!(window as any).__astroNavigation; - if (inView && isReload) { + if (inView && (isReload || isSpaNav)) { setSkipAnim(true); setIsVisible(true); return; diff --git a/src/components/about/stats-detailed.tsx b/src/components/about/stats-detailed.tsx index 484d0e5..0cebf68 100644 --- a/src/components/about/stats-detailed.tsx +++ b/src/components/about/stats-detailed.tsx @@ -35,8 +35,9 @@ const DetailedStats = () => { const rect = el.getBoundingClientRect(); const inView = rect.top < window.innerHeight && rect.bottom > 0; const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload"; + const isSpaNav = !!(window as any).__astroNavigation; - if (inView && isReload) { + if (inView && (isReload || isSpaNav)) { setSkipAnim(true); setVisible(true); return; diff --git a/src/components/about/timeline.tsx b/src/components/about/timeline.tsx index 30b1230..02d35b4 100644 --- a/src/components/about/timeline.tsx +++ b/src/components/about/timeline.tsx @@ -51,8 +51,9 @@ function TimelineCard({ item, index }: { item: (typeof timelineItems)[number]; i const rect = el.getBoundingClientRect(); const inView = rect.top < window.innerHeight && rect.bottom > 0; const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload"; + const isSpaNav = !!(window as any).__astroNavigation; - if (inView && isReload) { + if (inView && (isReload || isSpaNav)) { setSkip(true); setVisible(true); return; diff --git a/src/layouts/index.astro b/src/layouts/index.astro index 7bc87b5..f8926a3 100644 --- a/src/layouts/index.astro +++ b/src/layouts/index.astro @@ -74,8 +74,8 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg"; }); document.addEventListener('astro:after-swap', function() { var m = getMask(); - // Wait for React to hydrate before revealing - setTimeout(function() { m.classList.remove('active'); }, 50); + // Wait longer for canvas + overlays to hydrate on index page + setTimeout(function() { m.classList.remove('active'); }, 150); }); // Mark SPA navigations so AnimateIn can detect them document.addEventListener('astro:after-swap', function() {