Files
writer-work-flow/apps/web/app/page.tsx
Yaojia Wang 40cc3fc9e3 style(ui): 收窄宽屏留白——作品库加宽到 max-w-7xl + xl 四列,写作正文 720→768px
- PageContainer wide 档 max-w-6xl→max-w-7xl;作品库改用 wide 档
- 作品库卡片网格 lg 三列基础上加 xl:grid-cols-4,宽屏铺满少留白
- 写作台正文测量 720→768px(约 42 中文字/行,仍舒适),收窄两侧空档
2026-07-12 18:39:01 +02:00

86 lines
3.2 KiB
TypeScript
Raw Permalink 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 Link from "next/link";
import { BookOpen, PenLine, Plus } from "lucide-react";
import { AppShell } from "@/components/AppShell";
import { BackendDownNotice } from "@/components/BackendDownNotice";
import { ProjectLibrary } from "@/components/projects/ProjectLibrary";
import { PageContainer } from "@/components/ui/PageContainer";
import { PageHeader } from "@/components/ui/PageHeader";
import { fetchProjects } from "@/lib/api/server";
import type { ProjectResponse } from "@/lib/api/types";
import { buttonClass } from "@/lib/ui/variants";
// 作品库Dashboard 入口UX §6.1。Server Component 读取。
export default async function DashboardPage() {
let projects: ProjectResponse[] = [];
let loadError = false;
try {
const data = await fetchProjects();
projects = data.projects ?? [];
} catch {
loadError = true;
}
return (
<AppShell>
<PageContainer width="wide">
<PageHeader
title="我的作品"
description="从一个灵感进入正文、设定、审稿与验收闭环。"
actions={
<div className="flex flex-wrap items-center gap-2">
<Link
href="/write"
className={buttonClass({ variant: "primary" })}
>
<PenLine className="h-4 w-4" aria-hidden="true" />
</Link>
<Link
href="/projects/new"
className={buttonClass({ variant: "secondary" })}
>
<Plus className="h-4 w-4" aria-hidden="true" />
</Link>
</div>
}
/>
{loadError ? (
<BackendDownNotice />
) : projects.length === 0 ? (
// 首次进入的暖深色编辑部英雄(对标 DESIGN.md cta-band-dark仅零作品时出现不干扰工作库
<div className="rounded-xl border border-line/50 bg-callout px-8 py-14 text-center shadow-paper sm:px-12 sm:py-20">
<BookOpen className="mx-auto h-9 w-9 text-cinnabar" aria-hidden="true" />
<h2 className="mt-5 font-serif text-display-sm text-on-callout">
</h2>
<p className="mx-auto mt-3 max-w-md text-body leading-7 text-on-callout-soft">
</p>
<div className="mt-7 flex flex-wrap items-center justify-center gap-2">
<Link
href="/write"
className={buttonClass({ variant: "primary", size: "lg" })}
>
<PenLine className="h-4 w-4" aria-hidden="true" />
</Link>
<Link
href="/projects/new"
className={buttonClass({ variant: "secondary", size: "lg" })}
>
<Plus className="h-4 w-4" aria-hidden="true" />
</Link>
</div>
</div>
) : (
<ProjectLibrary projects={projects} />
)}
</PageContainer>
</AppShell>
);
}