feat: 路由转场+详情页+自定义滚动条+常显网格线+邮箱修复

- 新增 FullscreenTransitionProvider + RouteTransitionOverlay:
  cover(0.8s b1 遮罩 wipe) → push → reveal 状态机(原 73475/34841 移植),
  Work 卡片与详情页链接全部走 startNavigation(同路径点击回顶部)
- 新增 app/work/[slug] 详情页:content/workArticles.ts 从原站 6 个详情页
  1:1 提取(MDX 文章+Metadata+iframe 预览+Links),/2026 锁定时渲染解锁屏
- 新增 CustomScrollbar:桌面右缘 SVG 轨道+拖拽 thumb(188 轨道/min20)、
  点击跳转、2s 自动隐藏;移动端底部进度环回顶按钮(原 72443 移植)
- BackgroundGrid 重写为原版算法(3 行十字/12px 缺口/12 列内分数纵线,
  主页 loading 时隐藏其余时间常显);层叠改为原版结构:canvas z-auto
  最前 → grid z-20 → DOM 内容,移除各 section 的 z-30
- 修复 BGM:持久化开启时首次手势自动恢复播放(autoplay 策略被拒后
  pointerdown/keydown/touchstart 重试),enabled 闭包改用 ref
- 页脚邮箱改为 chenchun@virtheart.com
This commit is contained in:
2026-09-01 20:33:36 +08:00
parent 8ce5471c25
commit a844b26250
15 changed files with 1325 additions and 84 deletions
+4 -2
View File
@@ -112,10 +112,12 @@ export function HeroScene() {
}, []);
return (
// z-30 keeps it above the BackgroundGrid (z-20) to prevent mix-blend-difference from making it gray
// 1:1 original stacking: z-auto fixed host BEFORE the grid/main in DOM.
// The z-20 BackgroundGrid (rendered after this element) paints above the
// canvas with mix-blend-difference — same as the original site.
<div
ref={hostRef}
className="z-30 fixed inset-0 w-full h-full pointer-events-none"
className="fixed inset-0 w-full h-full pointer-events-none"
>
<Canvas
dpr={[1, 2]}
+77 -49
View File
@@ -1,9 +1,26 @@
'use client';
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { usePathname } from 'next/navigation';
import { loadingBus } from '@/lib/loadingBus';
/**
* Background grid — 1:1 port of the original (chunk 2689132c4e070b68.js):
*
* - Three cross junctions at thirds of the viewport height (y = h/3 - 12,
* y = h/3 + 12 + i + 24), i.e. rows at h/3-12 and 2h/3+12, with 12px gaps
* around the crosses and 12px notches where lines meet the frame.
* - 2 columns (<1280) / 3 columns of vertical lines between the px paddings
* (16 mobile / 56 lg), fractions of the inner width.
* - Whole overlay hidden while the home loading gate is up
* (`"/"===pathname && !readyToLoadHeavy`); visible at all other times —
* that is why the original keeps the crosses on screen while scrolling.
*/
const LINE = 'rgba(255, 255, 255, 0.1)';
export default function BackgroundGrid() {
const [size, setSize] = useState({ w: 375, h: 812 });
const pathname = usePathname();
const [size, setSize] = useState({ w: 0, h: 0 });
useEffect(() => {
const updateSize = () => {
@@ -14,60 +31,71 @@ export default function BackgroundGrid() {
return () => window.removeEventListener('resize', updateSize);
}, []);
// useHomeLoadingGate (original module 97839): "/" && !readyToLoadHeavy.
// Our equivalent heavy-ready signal is the loading curtain (loadingBus).
const [heavyReady, setHeavyReady] = useState(pathname !== '/');
useEffect(() => {
if (pathname !== '/') {
setHeavyReady(true);
return;
}
setHeavyReady(loadingBus.getSnapshot().ready);
return loadingBus.subscribe(() => {
setHeavyReady(loadingBus.getSnapshot().ready);
});
}, [pathname]);
const { w, h } = size;
// Calculate grid lines
// Responsive padding: lg is px-14 (56px), mobile is px-4 (16px)
const isDesktop = w >= 1024;
const paddingX = isDesktop ? 56 : 16;
const edgeOffset = paddingX + 0.5; // +0.5 for crisp SVG rendering
const loadingGate = pathname === '/' && !heavyReady;
const cols = 3; // Left, Center, Right
const rows = Math.ceil(h / 450) + 1;
const vLines = Array.from({ length: cols }).map((_, i) => {
if (i === 0) return edgeOffset;
if (i === cols - 1) return w - edgeOffset;
return w / 2;
});
const hLines = Array.from({ length: rows }).map((_, i) => (i + 1) * 442);
const { verticalPath, horizontalPath, crossPath } = useMemo(() => {
if (w <= 0 || h <= 0) return { verticalPath: '', horizontalPath: '', crossPath: '' };
const n = w < 1024 ? 16 : 56;
const innerW = Math.max(0, w - 2 * n);
const i = Math.max(0, h / 3 - 12);
const s = i + 24;
const a = s + i;
const cols = w < 1280 ? 2 : 3;
const xs = Array.from({ length: cols + 1 }, (_, k) => n + (k / cols) * innerW).map(
(x) => Math.round(x) + 0.5
);
const rows = [
{ startY: 0, endY: i },
{ startY: s, endY: a },
{ startY: a + 24, endY: h },
];
const u = [i + 12, a + 12];
const verticalPath = rows
.map(({ startY, endY }) => xs.map((x) => `M${x} ${startY}V${endY}`).join(''))
.join('');
const horizontalPath = u
.map((y) => {
if (xs.length < 2) return '';
const first = xs[0];
const last = xs[xs.length - 1];
const mids = xs.slice(0, -1)
.map((x, k) => `M${x + 12} ${y}H${xs[k + 1] - 12}`)
.join('');
return [`M0 ${y}H${first - 12}`, mids, `M${last + 12} ${y}H${w}`].join('');
})
.join('');
const crossPath = xs
.flatMap((x) => u.flatMap((y) => [`M${x} ${y - 6}V${y + 6}`, `M${x - 6} ${y}H${x + 6}`]))
.join('');
return { verticalPath, horizontalPath, crossPath };
}, [w, h]);
// Generate paths
let vPath = '';
let hPath = '';
let crossPath = '';
const crossSize = 6; // 12px total width/height for the cross
vLines.forEach(x => {
hLines.forEach((y, i) => {
const startY = i === 0 ? 0 : hLines[i - 1] + 12;
const endY = y - 12;
vPath += `M${x} ${startY}V${endY} `;
crossPath += `M${x} ${y - crossSize}V${y + crossSize} `;
crossPath += `M${x - crossSize} ${y}H${x + crossSize} `;
});
const lastY = hLines[hLines.length - 1] + 12;
vPath += `M${x} ${lastY}V${h} `;
});
hLines.forEach(y => {
vLines.forEach((x, i) => {
const startX = i === 0 ? 0 : vLines[i - 1] + 12;
const endX = x - 12;
hPath += `M${startX} ${y}H${endX} `;
});
const lastX = vLines[vLines.length - 1] + 12;
hPath += `M${lastX} ${y}H${w} `;
});
if (loadingGate) return null;
return (
<div className="z-20 fixed inset-0 w-full h-full pointer-events-none mix-blend-difference">
<svg viewBox={`0 0 ${w} ${h}`} className="block shape-rendering-crispEdges w-full h-full">
<path d={vPath} stroke="rgba(255, 255, 255, 0.1)" strokeWidth="1" fill="none" />
<path d={hPath} stroke="rgba(255, 255, 255, 0.1)" strokeWidth="1" fill="none" />
<svg
viewBox={`0 0 ${w} ${h}`}
className="block shape-rendering-crispEdges w-full h-full"
>
<path d={verticalPath} stroke={LINE} strokeWidth="1" fill="none" />
<path d={horizontalPath} stroke={LINE} strokeWidth="1" fill="none" />
<path d={crossPath} stroke="#FFFFFF" strokeWidth="1" fill="none" opacity="0.4" />
</svg>
</div>
+273
View File
@@ -0,0 +1,273 @@
"use client";
/**
* Custom scrollbar — 1:1 port of the original (chunk 2689132c4e070b68.js
* module 72443):
*
* - Desktop (lg+): a right-edge fixed 32×200 SVG track + draggable thumb.
* Thumb geometry = progress mapping with min length 20 of a 188 track
* (max(20, 188·clientH/totalH), start 6+progress·(188-len)). Clicking the
* track jumps; dragging the thumb scrubs (lenisScrollTo immediate).
* - Mobile: a 24px circular "Scroll to top" button with a progress ring.
* - Auto-hides after 2s without scroll activity (o), shows on hover / drag.
*/
import { useCallback, useEffect, useRef, useState } from "react";
import { scrollEnv } from "@/lib/scrollEnv";
const RING_CIRCUMFERENCE = 2 * Math.PI * 12;
const HIDE_AFTER_MS = 2000;
const clamp = (v: number, min: number, max: number) =>
Math.min(max, Math.max(min, v));
export default function CustomScrollbar({ hidden = false }: { hidden?: boolean }) {
const thumbRef = useRef<SVGPathElement | null>(null);
const ringRef = useRef<SVGCircleElement | null>(null);
const draggingRef = useRef(false);
const dragStart = useRef({ startY: 0, startScrollTop: 0 });
const abortRef = useRef<AbortController | null>(null);
const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
const rafRef = useRef<number | null>(null);
const [visible, setVisible] = useState(false);
const [transitioning, setTransitioning] = useState(false);
const [mounted, setMounted] = useState(false);
const [nearBottom, setNearBottom] = useState(false);
const [progress, setProgress] = useState(0);
const scheduleHide = useCallback((delay = HIDE_AFTER_MS) => {
setVisible(true);
if (hideTimer.current) clearTimeout(hideTimer.current);
hideTimer.current = setTimeout(() => setVisible(false), delay);
}, []);
const update = useCallback(() => {
const container = scrollEnv.getContainerEl();
const scrollTop = scrollEnv.getScrollTopPx();
const near = Math.max(0, (container?.scrollHeight ?? document.documentElement.scrollHeight) - scrollTop) <= window.innerHeight * clamp(nearBottomRatio(), 0, 1);
setNearBottom((prev) => (prev === near ? prev : near));
const totalH = Math.max(1, container?.scrollHeight ?? document.documentElement.scrollHeight);
const clientH = Math.max(1, container?.clientHeight ?? window.innerHeight);
const p = clamp(scrollTop / Math.max(1, totalH - clientH), 0, 1);
setProgress(p);
const thumbLen = Math.max(20, 188 * clamp(clientH / totalH, 0, 1));
const start = 6 + p * (188 - thumbLen);
thumbRef.current?.setAttribute("d", `M 16 ${start} V ${start + thumbLen}`);
ringRef.current?.setAttribute("stroke-dashoffset", String(RING_CIRCUMFERENCE * (1 - p)));
// nearBottom threshold (original useNearBottom(.5)): keep simple ratio hook
void near;
}, []);
useEffect(() => {
const container = scrollEnv.getContainerEl();
if (!container) return;
setMounted(true);
scheduleHide(3000);
// First-paint show (original x flag via rAF).
if (!rafRef.current) {
rafRef.current = requestAnimationFrame(() => setTransitioning(true));
}
const onScroll = () => {
update();
scheduleHide();
};
update();
const ro = new ResizeObserver(update);
ro.observe(container);
const firstChild = container.firstElementChild;
if (firstChild instanceof HTMLElement) ro.observe(firstChild);
const rafs: number[] = [];
let n = 3;
const tick = () => {
update();
if (--n > 0) rafs.push(requestAnimationFrame(tick));
};
rafs.push(requestAnimationFrame(tick));
const onLoad = () => update();
window.addEventListener("load", onLoad, { passive: true });
window.addEventListener("scroll", onScroll, { passive: true });
return () => {
if (hideTimer.current) clearTimeout(hideTimer.current);
if (rafRef.current) cancelAnimationFrame(rafRef.current);
for (const r of rafs) cancelAnimationFrame(r);
ro.disconnect();
window.removeEventListener("load", onLoad);
window.removeEventListener("scroll", onScroll);
};
}, [scheduleHide, update]);
const measure = useCallback(() => {
const container = scrollEnv.getContainerEl();
const totalH = container?.scrollHeight ?? Math.max(document.documentElement.scrollHeight, document.body.scrollHeight, 1);
const clientH = container?.clientHeight ?? Math.max(1, window.innerHeight || document.documentElement.clientHeight || 1);
return { el: container, totalH, clientH, validH: Math.max(1, totalH - clientH) };
}, []);
const onDragMove = useCallback(
(e: MouseEvent) => {
if (!draggingRef.current) return;
const dy = e.clientY - dragStart.current.startY;
const { totalH, clientH, validH } = measure();
const trackLen = 188 - Math.max(20, 188 * (totalH > 0 ? clamp(clientH / totalH, 0, 1) : 1));
if (trackLen <= 0) return;
const target = dragStart.current.startScrollTop + (validH / trackLen) * dy;
scrollEnv.lenisScrollTo(target, { immediate: true });
},
[measure]
);
const onDragEnd = useCallback(() => {
draggingRef.current = false;
abortRef.current?.abort();
abortRef.current = null;
document.body.style.userSelect = "";
if (hideTimer.current) clearTimeout(hideTimer.current);
hideTimer.current = setTimeout(() => setVisible(false), HIDE_AFTER_MS);
}, []);
const onThumbDown = useCallback(
(e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
draggingRef.current = true;
dragStart.current = {
startY: e.clientY,
startScrollTop: scrollEnv.getScrollTopPx(),
};
if (hideTimer.current) clearTimeout(hideTimer.current);
setVisible(true);
document.body.style.userSelect = "none";
abortRef.current?.abort();
abortRef.current = new AbortController();
const signal = abortRef.current.signal;
document.addEventListener("mousemove", onDragMove, { signal });
document.addEventListener("mouseup", onDragEnd, { signal });
},
[onDragEnd, onDragMove]
);
const desktopCls = [
"pointer-events-auto top-1/2 right-0 bottom-0 z-30 fixed w-14 px-3 h-50 -translate-y-1/2 hidden lg:block",
transitioning ? "transition-opacity duration-500" : "",
visible ? "opacity-100" : "opacity-0",
hidden ? " hidden!" : "",
]
.filter(Boolean)
.join(" ");
return (
<>
{mounted && (
<div
className={desktopCls}
aria-hidden={hidden}
onMouseEnter={() => {
setVisible(true);
if (hideTimer.current) clearTimeout(hideTimer.current);
}}
onMouseLeave={() => {
if (hideTimer.current) clearTimeout(hideTimer.current);
hideTimer.current = setTimeout(() => setVisible(false), HIDE_AFTER_MS);
}}
>
<svg
width="32"
height="200"
viewBox="0 0 32 200"
fill="none"
xmlns="http://www.w3.org/2000/svg"
onClick={(e) => {
const rect = e.currentTarget.getBoundingClientRect();
const y = clamp((e.clientY - rect.top) * (200 / rect.height), 6, 194);
const ratio = (y - 6) / 188;
const { validH } = measure();
scrollEnv.lenisScrollTo(ratio * validH, { immediate: false });
}}
>
<path
d="M 16 6 V 194"
stroke="currentColor"
strokeOpacity={0.2}
strokeWidth="6"
strokeLinejoin="round"
strokeLinecap="round"
/>
<path
ref={thumbRef}
d="M 16 6 V 6"
stroke="currentColor"
strokeWidth="6"
strokeLinejoin="round"
strokeLinecap="round"
onMouseDown={onThumbDown}
onClick={(e) => e.stopPropagation()}
/>
</svg>
</div>
)}
{mounted && (
<div
className="pointer-events-auto lg:hidden right-0 bottom-0 z-30 fixed flex justify-center items-center px-6 py-6"
role="button"
tabIndex={hidden ? -1 : 0}
aria-label="Scroll to top"
aria-hidden={hidden}
onClick={() => scrollEnv.scrollToTop("smooth")}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
scrollEnv.scrollToTop("smooth");
}
}}
>
<svg
width="24px"
height="24px"
viewBox="0 0 32 32"
className={`${nearBottom ? "scale-100" : "scale-50"} transition-all duration-[0.66s] ease-66 pointer-events-none`}
>
<circle
r="12"
cy="16"
cx="16"
fill="none"
strokeLinejoin="round"
strokeLinecap="round"
strokeWidth={nearBottom ? 4 : 8}
stroke="currentColor"
strokeOpacity={nearBottom ? 0.2 : 1}
transform="rotate(-90 16 16)"
style={{
transition:
"stroke-opacity 0.66s cubic-bezier(0.66, 0, 0.01, 1), stroke-width 0.66s cubic-bezier(0.66, 0, 0.01, 1)",
}}
/>
<circle
ref={ringRef}
r="12"
cy="16"
cx="16"
fill="none"
strokeLinejoin="round"
strokeLinecap="round"
strokeWidth={nearBottom ? 4 : 8}
strokeDashoffset={RING_CIRCUMFERENCE * (1 - progress)}
strokeDasharray={RING_CIRCUMFERENCE}
transform="rotate(-90 16 16)"
style={{
transition:
"stroke-opacity 0.66s cubic-bezier(0.66, 0, 0.01, 1), stroke-width 0.66s cubic-bezier(0.66, 0, 0.01, 1)",
}}
/>
</svg>
</div>
)}
</>
);
}
/** Original useNearBottom(.5) ratio. */
function nearBottomRatio() {
return 0.5;
}
+11 -12
View File
@@ -6,20 +6,21 @@ import ScrambleReveal from "@/components/dom/ScrambleReveal";
* #contact footer — 1:1 port of the original footer (chunk 2689132c4e070b68.js
* module 28192):
*
* - `<footer id="contact">` fills the last viewport (h-dvh / lg:h-screen),
* z-10 (below the fixed canvas at z-30, above the grid) and carries
* `data-section="footer"` — SmoothScroller's sP f2 factor and PostFX's
* bright-source gating both read this attribute.
* - `<footer id="contact">` fills the last viewport (h-dvh / lg:h-screen)
* and carries `data-section="footer"` — SmoothScroller's sP f2 factor and
* PostFX's bright-source gating both read this attribute.
* - Headline: three 12-col grid rows at 6svw, "Let's / Create / Something /
* Extraordinary"; "Create" and "Extraordinary" use reverse reveal (chars
* run last→first).
* - Bottom bar: mailto + Twitter/X / Figma / GitHub links with the dotted
* hover border.
*
* NOTE: contact targets are placeholders — swap in VIRTHEART's real email
* and social URLs.
* NOTE: contact email is chenchun@virtheart.com (user-provided); social
* URLs are still placeholders.
*/
const CONTACT_EMAIL = "chenchun@virtheart.com";
const dottedLink =
"block before:absolute relative before:inset-0 p-2 lg:hover:before:border-l1 before:border-2 before:border-transparent active:before:border-l1 before:border-dotted uppercase before:content-[''] before:transition-colors before:duration-200 cursor-pointer pointer-events-auto before:pointer-events-none";
@@ -34,7 +35,7 @@ export default function FooterSection() {
<footer
id="contact"
data-section="footer"
className="z-30 relative flex flex-col justify-center p-6 lg:p-16 w-full h-dvh lg:h-screen pointer-events-none"
className="relative flex flex-col justify-center p-6 lg:p-16 w-full h-dvh lg:h-screen pointer-events-none"
>
<div
className="gap-2 grid grid-cols-12 font-bold text-[7.2svw] lg:text-[6svw] 2xl:text-[5svw] xl:text-[5.6svw] uppercase leading-none"
@@ -79,17 +80,15 @@ export default function FooterSection() {
</div>
<div className="absolute inset-0 flex flex-col justify-end px-4 lg:px-14 py-18 lg:py-24 font-mono-2 text-sm lg:text-base">
<div className="flex lg:flex-row flex-col justify-between w-full">
{/* TODO: replace with the real VIRTHEART contact address. */}
<a className={dottedLink} href="mailto:hello@virtheart.com">
<a className={dottedLink} href={`mailto:${CONTACT_EMAIL}`}>
<ScrambleReveal
text="hello@virtheart.com"
text={CONTACT_EMAIL}
startDelayMs={300}
scrambleColors={false}
/>
</a>
<div className="flex flex-row items-center gap-2 lg:gap-4">
{/* TODO: replace with the real VIRTHEART social URLs. */}
{SOCIALS.map(({ href, label }) => (
{/* TODO: replace with the real VIRTHEART social URLs. */}{SOCIALS.map(({ href, label }) => (
<a
key={label}
className={dottedLink}
+1 -1
View File
@@ -549,7 +549,7 @@ export default function HyperSpaceSection() {
getLayerTarget("hyper-space").current = el;
void el;
}}
className={`relative z-30 ${ARROW_FULLSCREEN_DOM_COLOR_TRANSITION} ${
className={`relative ${ARROW_FULLSCREEN_DOM_COLOR_TRANSITION} ${
pastThreshold ? "text-white" : "text-l1"
}`}
style={{ height: `${8 * viewportH}px` }}
+164
View File
@@ -0,0 +1,164 @@
"use client";
/**
* RouteTransitionOverlay — 1:1 port of the original orchestrator (chunk
* 3c6cc5b2fcccdee5.js `function M`, module 34841), simplified to the pixel
* wipe without the WebGL mask material:
*
* startNavigation(href)
* → phase "cover" : b1-colored fixed layer wipes IN over the page
* (0.8s, cubic-bezier(0.66, 0, 0.01, 1)); on complete → router.push
* (or replace) to the target href.
* → phase "wait" : new page mounts; heavy assets may still load.
* → phase "reveal" : layer wipes OUT (same easing), then → idle and
* the overlay unmounts; scramble lines re-enabled 100ms in.
*
* The b1 background matches the page body so the wipe reads as the page
* turning into a blank sheet — the original achieves the same look via the
* WebGL mask + grid colors.
*/
import { useEffect, useMemo, useRef, useState } from "react";
import { usePathname, useRouter } from "next/navigation";
import { useRouteTransitionController } from "@/lib/routeTransition";
type Phase = "wait" | "cover" | "reveal";
type Mode = "idle" | "entry" | "route";
const DURATION_MS = 800;
const EASING = "cubic-bezier(0.66, 0, 0.01, 1)";
const BG = "var(--color-b1)";
export default function RouteTransitionOverlay() {
const router = useRouter();
const pathname = usePathname();
const { targetHref, navigationReplace, clearNavigation, setAllowScrambleLines } =
useRouteTransitionController();
const routeFrom = useRef<{ path: string | null; coverDone: boolean }>({
path: null,
coverDone: false,
});
const [mode, setMode] = useState<Mode>("idle");
const [phase, setPhase] = useState<Phase>("wait");
const navigateRef = useRef<() => void>(() => {});
navigateRef.current = () => {
if (mode === "route" && phase === "cover") {
routeFrom.current.coverDone = true;
setAllowScrambleLines(false);
if (targetHref) {
if (navigationReplace) router.replace(targetHref);
else router.push(targetHref);
}
setPhase("wait");
}
};
const targetPath = useMemo(() => {
if (!targetHref) return null;
if (targetHref.startsWith("/")) {
const [p] = targetHref.split("?");
return p || "/";
}
try {
return new URL(targetHref, window.location.origin).pathname || "/";
} catch {
return null;
}
}, [targetHref]);
// Intent → start cover.
useEffect(() => {
if (targetHref && mode === "idle") {
routeFrom.current.path = pathname;
routeFrom.current.coverDone = false;
setMode("route");
setPhase("cover");
}
}, [targetHref, mode, pathname]);
// New page mounted → reveal.
useEffect(() => {
if (
mode === "route" &&
phase === "wait" &&
routeFrom.current.coverDone &&
routeFrom.current.path &&
pathname !== routeFrom.current.path
) {
setPhase("reveal");
}
}, [mode, phase, pathname]);
// Reveal finished → idle.
const onRevealComplete = () => {
if (mode !== "idle" && phase === "reveal") {
setMode("idle");
clearNavigation();
routeFrom.current.path = null;
routeFrom.current.coverDone = false;
}
};
// Scramble lines gate (original: idle → true immediately; 100ms after
// a reveal starts).
useEffect(() => {
if (mode === "idle") {
setAllowScrambleLines(true);
return;
}
if (phase !== "reveal") return;
const t = window.setTimeout(() => setAllowScrambleLines(true), 100);
return () => window.clearTimeout(t);
}, [mode, phase, setAllowScrambleLines]);
const overlayVisible = mode !== "idle" && phase !== "wait";
const wipeIn = phase === "cover";
return (
<div
aria-hidden={!overlayVisible}
style={{
position: "fixed",
inset: 0,
zIndex: 60,
background: BG,
pointerEvents: overlayVisible ? "auto" : "none",
opacity: overlayVisible ? 1 : 0,
visibility: overlayVisible ? "visible" : "hidden",
transition: overlayVisible
? `opacity 80ms linear`
: `opacity 200ms linear`,
clipPath: overlayVisible
? wipeIn
? "inset(0 0 100% 0)"
: "inset(0 0 0 0)"
: "inset(0 0 100% 0)",
...(overlayVisible
? {
animation: `route-wipe ${DURATION_MS}ms ${EASING} forwards`,
animationDirection: wipeIn ? "normal" : "reverse",
}
: {}),
}}
onAnimationEnd={(e) => {
if (e.animationName !== "route-wipe") return;
if (wipeIn) navigateRef.current();
else onRevealComplete();
}}
>
<style>{`@keyframes route-wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }`}</style>
{/* 16px checker texture (original pixelSize:16 maskCells) */}
<div
className="absolute inset-0 pointer-events-none"
style={{
opacity: 0.05,
backgroundImage:
"repeating-conic-gradient(var(--color-l1) 0% 25%, transparent 0% 50%)",
backgroundSize: "32px 32px",
}}
/>
</div>
);
}
+26 -4
View File
@@ -11,7 +11,9 @@ import {
setLayerDef,
touchLayerRegistry,
} from "@/lib/imageLayers";
import { usePasscodeAccessLookup } from "@/components/dom/PasscodeAccess";
import { usePasscodeAllowed, usePasscodeAccessLookup } from "@/components/dom/PasscodeAccess";
import { buildPasscodeUnlockHref } from "@/lib/passcode";
import { useRouteTransitionController } from "@/lib/routeTransition";
/**
* Selected Work grid — 1:1 port of the original section `h` (chunk
@@ -124,6 +126,8 @@ function WorkCard({ item, ratio }: { item: WorkItem; ratio?: string }) {
const cls = "group block space-y-3 p-2";
const label = `${item.name} - ${item.year}${external ? " (external)" : ""}`;
const target = getLayerTarget(item.href);
const { startNavigation } = useRouteTransitionController();
const allowed = usePasscodeAllowed(item.href);
const body = (
<>
<div
@@ -171,13 +175,31 @@ function WorkCard({ item, ratio }: { item: WorkItem; ratio?: string }) {
{body}
</a>
) : (
// Internal detail routes (/reunimos, /inspire_mono, …) are not ported
// yet — keep the anchor for markup parity but don't navigate to a 404.
// Internal detail routes (/reunimos, /inspire_mono, …) navigate
// through the fullscreen cover/reveal transition (original Link
// wrapper module 80894: preventDefault + startNavigation; same-path
// clicks scroll back to top).
<a
href={item.href}
className={cls}
aria-label={label}
onClick={(e) => e.preventDefault()}
onClick={(e) => {
if (e.defaultPrevented) return;
if (e.button !== 0 || e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
return;
e.preventDefault();
if (!allowed) {
const scope = item.href.replace(/^\//, "");
window.location.assign(
buildPasscodeUnlockHref(scope, item.href)
);
return;
}
const detail = item.href.startsWith("/2026")
? item.href
: `/work${item.href}`;
startNavigation(detail);
}}
>
{body}
</a>