mobile optimizations

This commit is contained in:
2026-04-06 14:33:30 -07:00
parent 1a445548f2
commit 16f271c1c9
5 changed files with 10 additions and 6 deletions

View File

@@ -12,8 +12,9 @@ export default function Intro() {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const inView = rect.top < window.innerHeight && rect.bottom > 0; const inView = rect.top < window.innerHeight && rect.bottom > 0;
const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload"; const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload";
const isSpaNav = !!(window as any).__astroNavigation;
if (inView && isReload) { if (inView && (isReload || isSpaNav)) {
setVisible(true); setVisible(true);
return; return;
} }

View File

@@ -28,8 +28,9 @@ const Stats = () => {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const inView = rect.top < window.innerHeight && rect.bottom > 0; const inView = rect.top < window.innerHeight && rect.bottom > 0;
const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload"; const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload";
const isSpaNav = !!(window as any).__astroNavigation;
if (inView && isReload) { if (inView && (isReload || isSpaNav)) {
setSkipAnim(true); setSkipAnim(true);
setIsVisible(true); setIsVisible(true);
return; return;

View File

@@ -35,8 +35,9 @@ const DetailedStats = () => {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const inView = rect.top < window.innerHeight && rect.bottom > 0; const inView = rect.top < window.innerHeight && rect.bottom > 0;
const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload"; const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload";
const isSpaNav = !!(window as any).__astroNavigation;
if (inView && isReload) { if (inView && (isReload || isSpaNav)) {
setSkipAnim(true); setSkipAnim(true);
setVisible(true); setVisible(true);
return; return;

View File

@@ -51,8 +51,9 @@ function TimelineCard({ item, index }: { item: (typeof timelineItems)[number]; i
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const inView = rect.top < window.innerHeight && rect.bottom > 0; const inView = rect.top < window.innerHeight && rect.bottom > 0;
const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload"; const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload";
const isSpaNav = !!(window as any).__astroNavigation;
if (inView && isReload) { if (inView && (isReload || isSpaNav)) {
setSkip(true); setSkip(true);
setVisible(true); setVisible(true);
return; return;

View File

@@ -74,8 +74,8 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg";
}); });
document.addEventListener('astro:after-swap', function() { document.addEventListener('astro:after-swap', function() {
var m = getMask(); var m = getMask();
// Wait for React to hydrate before revealing // Wait longer for canvas + overlays to hydrate on index page
setTimeout(function() { m.classList.remove('active'); }, 50); setTimeout(function() { m.classList.remove('active'); }, 150);
}); });
// Mark SPA navigations so AnimateIn can detect them // Mark SPA navigations so AnimateIn can detect them
document.addEventListener('astro:after-swap', function() { document.addEventListener('astro:after-swap', function() {