Files
personal/app/(site)/page.tsx
T
virtheart 520fbb1480 fix: Header 跨页锚点导航 + 后台移除固定 URL 编辑项
- Header 作品/联系:首页内直接平滑滚动;在 /services、/work/* 等
  非首页时写入 hq:pendingScrollAnchor 后经路由过渡回首页,
  SmoothScroller 消费并滚动到位(修复其它页面点击无反应)
- 服务按钮在 /services 页自身不再重复导航
- PENDING_SCROLL_ANCHOR_SESSION_KEY 收敛到 lib/scrollEnv 单一来源,
  work 页与 SmoothScroller 共用,消除三处魔法字符串
- 后台「关于」组移除 about_p2_link_href(站内结构性锚点 #selected-work
  不可配,只保留链接文字可编辑);seed/settings/类型同步清理
2026-09-02 20:10:05 +08:00

133 lines
6.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import ScrambleReveal from "@/components/dom/ScrambleReveal";
import AboutMedia from "@/components/dom/AboutMedia";
import FooterSection from "@/components/dom/FooterSection";
import WorkSection from "@/components/dom/WorkSection";
import HyperSpaceSection from "@/components/dom/HyperSpaceSection";
import PasscodeRevealText from "@/components/dom/PasscodeRevealText";
import { PersonJsonLd } from "@/components/dom/PersonJsonLd";
import { getSiteConfig, listWorks } from "@/lib/siteConfig";
import type { WorkItem } from "@/lib/workItems";
/**
* 首页 — 结构复刻原站(haoqi_body.html),文案全部来自 site_config
*(/virtheart 后台「配置」可改,保存即生效);作品来自 works 表。
*/
export default async function Home() {
const config = getSiteConfig();
const items: WorkItem[] = listWorks(true)
.filter((w) => w.name && (w.image_url || w.href))
.map((w) => ({
name: w.name,
imageUrl: w.image_url,
hoverImageUrl: w.hover_image_url,
href: w.href || `/work/${w.slug}`,
year: w.year,
type: w.type,
gridClass: w.grid_class || "col-span-12 lg:col-span-6 xl:col-span-4",
codingProject: w.coding_project === 1,
passcodeProtected: w.passcode_protected === 1,
}));
return (
// NOTE: the original scrolls INSIDE <main> (its Lenis wraps the main
// container), which is what lets its position:sticky children pin. Our
// Lenis is window-level, so main must NOT be a scroll container —
// otherwise sticky (hyper-space section) never pins.
<main className="w-full">
{/* 结构化数据:个人实体(SEO 富结果) */}
<PersonJsonLd />
<div>
{/* Banner Section */}
<div
data-section="banner"
className="grid grid-cols-12 grid-rows-[auto_1fr] px-4 lg:px-14 py-18 lg:py-24 w-full h-dvh lg:h-screen"
>
<div className="flex flex-col order-2 lg:order-1 lg:grid lg:grid-cols-12 col-span-12 font-mono text-base">
<span className="hidden lg:block lg:col-span-3 xl:col-span-2 lg:col-start-1 xl:col-start-1 p-2 font-sans font-medium text-[4svw] sm:text-2xl lg:text-3xl leading-tight">
<ScrambleReveal text={config.hero_line1} startDelayMs={300} letterDelayMs={10} />
<br />
<ScrambleReveal text={config.hero_line2} startDelayMs={300} letterDelayMs={10} />
</span>
<ScrambleReveal
className="hidden lg:block lg:col-span-3 xl:col-span-2 lg:col-start-4 xl:col-start-5 p-2 text-balance"
text={config.hero_tagline}
startDelayMs={300}
letterDelayMs={10}
/>
<PasscodeRevealText
className="col-span-12 lg:col-span-6 xl:col-span-4 lg:col-start-7 xl:col-start-9 mt-auto lg:mt-0 p-2"
prefix={config.intro_prefix}
suffix={config.intro_suffix}
brandName={config.brand_name}
/>
</div>
<div
className="flex flex-col self-end order-1 lg:order-2 col-span-12 px-2 font-bold text-[7.2svw] lg:text-[6svw] 2xl:text-[5svw] xl:text-[5.6svw] uppercase leading-none"
style={{ fontVariationSettings: '"wdth" 120' }}
>
<ScrambleReveal text={config.hero_big_1} startDelayMs={300} />
<ScrambleReveal text={config.hero_big_2} startDelayMs={500} />
<ScrambleReveal text={config.hero_big_3} startDelayMs={700} />
</div>
</div>
{/* Signature / About Section */}
<div className="grid grid-cols-12 px-4 lg:px-14 py-18 lg:py-24 lg:pb-28 w-full">
<AboutMedia />
<div className="flex flex-col justify-start items-start gap-6 col-span-12 sm:col-span-7 lg:col-span-8 sm:col-start-6 lg:col-start-5 text-base lg:text-xl leading-none">
<p
className="p-2 w-full text-l1 md:text-[4.2svw] text-xl leading-[1.3] md:leading-none select-text"
style={{
fontFamily:
'var(--font-tiktok), "MiSans", sans-serif',
}}
>
<span className="select-text">{config.about_p1}</span>
</p>
<p
className="p-2 w-full text-l2 md:text-[4.2svw] text-xl leading-[1.3] md:leading-none select-text"
style={{
fontFamily:
'var(--font-tiktok), "MiSans", sans-serif',
}}
>
<span className="select-text">
{config.about_p2}
<a
href="#selected-work" // 站内结构性锚点,固定不可配
className="inline text-l1 underline underline-offset-[0.08em] decoration-solid decoration-(--label-3) transition-[text-decoration-color] duration-150 ease-out lg:[@media(hover:hover)]:hover:decoration-(--label-1)"
>
{config.about_p2_link_label}
</a>
{config.about_p2.endsWith(";") || config.about_p2.endsWith(",")
? "里记录了这些探索的痕迹。"
: ""}
</span>
</p>
</div>
</div>
{/* Selected Work grid (id="selected-work", WebGL image layers) */}
<WorkSection
items={items}
emptyText={{
headline: config.work_empty_headline,
note: config.work_empty_note,
ctaPrefix: config.work_empty_cta_prefix,
ctaSuffix: config.work_empty_cta_suffix,
ctaAction: config.work_empty_cta_action,
}}
contactEmail={config.contact_email}
/>
{/* Hyper-space scroll section (id="hyper-space"): the WebGL
hyperspace arrow (cursor.glb stripes) tracks this section's
screen rect and engulfs the viewport mid-scroll. */}
<HyperSpaceSection />
{/* Contact / Footer Section (#contact, data-section="footer") */}
<FooterSection contactEmail={config.contact_email} icpBeian={config.icp_beian} />
</div>
</main>
);
}