"use client"; /** * About-paragraph passcode easter egg — ported from the original components * `c9` + `c2` (chunk 4d3f3b68dbbde33a.js),品牌标签国内化为「小红书」: * * - Locked: the brand label slot scrambles as "■■" (each char wrapped, * PASSCODE_LOCKED_CHAR_CLASS); clicking navigates through the route * transition to /unlock/2026?return=%2F. * - Unlocked: the slot settles to the "小红书" button span — long-press * (500ms) or context-menu re-locks (confirm + reload). * - The reveal sequence (ScrambleReveal) treats the label as a slot part, so * its characters participate in the per-char scramble timing. */ import { useCallback, useRef } from "react"; import { useRouter } from "next/navigation"; import ScrambleReveal from "@/components/dom/ScrambleReveal"; import { logoutPasscodeAccess, usePasscodeAllowed, } from "@/components/dom/PasscodeAccess"; import { PASSCODE_LOCKED_CHAR_CLASS, PASSCODE_LOCKED_SCRAMBLE_CLASS, buildPasscodeUnlockHref, passcodeLockedPlaceholderText, primaryPasscodePath, revealBrandLabel, revealBrandLabelLength, } from "@/lib/passcode"; const SCOPE = primaryPasscodePath(); // "/2026" const BRAND = revealBrandLabel(); // "小红书" const BRAND_LEN = revealBrandLabelLength(); // 2 function RevealLabelButton() { const allowed = usePasscodeAllowed(SCOPE); const router = useRouter(); const timerRef = useRef | null>(null); const clearTimer = useCallback(() => { if (timerRef.current) { clearTimeout(timerRef.current); timerRef.current = null; } }, []); const relock = useCallback(async () => { if ( window.confirm("要重新锁定受保护的内容吗?再次查看需要输入口令。") ) { await logoutPasscodeAccess({ reload: true }); } }, []); if (!allowed) { // TODO(route-system): go through useRouteTransitionController().startNavigation const go = () => { router.push(buildPasscodeUnlockHref(SCOPE, "/")); }; return ( { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } }} > {passcodeLockedPlaceholderText() .split("") .map((ch, i) => ( ))} ); } return ( { clearTimer(); timerRef.current = setTimeout(() => void relock(), 500); }} onPointerUp={clearTimer} onPointerLeave={clearTimer} onPointerCancel={clearTimer} onContextMenu={(e) => { e.preventDefault(); void relock(); }} > {BRAND} ); } export default function PasscodeRevealText({ className, startDelayMs = 300, letterDelayMs = 10, }: { className?: string; startDelayMs?: number; letterDelayMs?: number; }) { const allowed = usePasscodeAllowed(SCOPE); const parts = [ "我是北极新一,一名横跨设计与工程的全栈开发者:Web 前端与后端、Flutter 客户端、AI 应用开发都有实践,也从产品设计一路做到工程落地。工作之外,我常在 ", { length: BRAND_LEN, scramble: allowed ? BRAND : passcodeLockedPlaceholderText(), className: allowed ? undefined : PASSCODE_LOCKED_SCRAMBLE_CLASS, settled: , }, " 上记录与分享这些探索。", ]; return ( ); }