style: 切换为现代 SaaS Dashboard 风格(Linear/Vercel/Notion 风)

- 调色板:zinc 中性色 + 冷静蓝色(#3b82f6)+ 卡片阴影 token
- Sidebar:紧凑 60 宽度,加入顶部搜索框,分组导航,圆角 8px
- 卡片:rounded-2xl + shadow-sm/md,留白节奏统一
- 表格:圆角卡片包裹,灰色表头小写大写字母 tracking
- 表单:h-9 输入框,圆角 8px,focus ring 用半透明蓝
- 按钮分级:实心蓝(主操作)/ 边框白底(次操作)/ 暗黑实心(对比强调)
- 状态徽章:ring-1 inset 内边框,色板更柔和

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Script Generator
2026-06-08 12:46:02 +08:00
parent 0099b23a86
commit e0120c470c
9 changed files with 364 additions and 450 deletions

View File

@@ -1,52 +1,47 @@
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500;9..144,600;9..144,700&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=JetBrains+Mono:wght@400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--bg: #f7f4ee;
--bg-elevated: #fbf9f4;
--ink: #1a1814;
--ink-soft: #4a4640;
--ink-muted: #8a847a;
--line: #e6e0d4;
--line-soft: #efeae0;
--accent: #2563eb;
--accent-soft: #dbeafe;
/* Surfaces — zinc neutrals */
--bg: #fafafa;
--bg-card: #ffffff;
--bg-subtle: #f4f4f5;
--bg-hover: #f4f4f5;
/* Text */
--ink: #18181b;
--ink-soft: #52525b;
--ink-muted: #a1a1aa;
/* Borders */
--line: #e4e4e7;
--line-soft: #f4f4f5;
/* Brand — calm blue */
--accent: #3b82f6;
--accent-hover: #2563eb;
--accent-soft: #eff6ff;
--accent-ring: rgba(59, 130, 246, 0.15);
/* Shadow */
--shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
--shadow-md: 0 4px 12px -2px rgba(24, 24, 27, 0.06), 0 2px 4px -1px rgba(24, 24, 27, 0.04);
}
html, body {
background: var(--bg);
color: var(--ink);
font-family: 'DM Sans', system-ui, sans-serif;
font-feature-settings: 'ss01', 'ss02', 'cv11';
font-family: 'Inter', system-ui, sans-serif;
font-feature-settings: 'cv11', 'ss01';
-webkit-font-smoothing: antialiased;
}
.font-display {
font-family: 'Fraunces', Georgia, serif;
font-feature-settings: 'ss01';
font-size: 14px;
}
.font-mono {
font-family: 'JetBrains Mono', monospace;
}
.grain::before {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
opacity: 0.03;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes fade-up {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up {
animation: fade-up 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

View File

@@ -11,9 +11,9 @@ import { RequirementForm } from '@/components/product/RequirementForm';
import { ProductForm } from '@/components/product/ProductForm';
const TABS = [
{ key: 'requirements' as const, label: '需求池', index: '01' },
{ key: 'projects' as const, label: '项目', index: '02' },
{ key: 'versions' as const, label: '版本', index: '03' },
{ key: 'requirements' as const, label: '需求池' },
{ key: 'projects' as const, label: '项目' },
{ key: 'versions' as const, label: '版本' },
];
export default function ProductDetailPage() {
@@ -61,7 +61,7 @@ export default function ProductDetailPage() {
};
const handleDeleteProduct = async () => {
if (confirm('确定删除产品?此操作不可撤销。')) {
if (confirm('确定删除产品?此操作不可撤销。')) {
await deleteProduct(productId);
router.push('/products');
}
@@ -69,133 +69,128 @@ export default function ProductDetailPage() {
if (!currentProduct) {
return (
<div className="flex h-full items-center justify-center">
<p className="font-mono text-xs uppercase tracking-[0.2em] text-[var(--ink-muted)]">Loading...</p>
<div className="flex h-full items-center justify-center text-[13px] text-[var(--ink-muted)]">
</div>
);
}
return (
<div className="relative min-h-full">
<div className="grain pointer-events-none absolute inset-0" />
<div className="relative mx-auto max-w-[1280px] px-12 py-12">
<button
onClick={() => router.push('/products')}
className="mb-8 flex items-center gap-1.5 text-[12px] text-[var(--ink-muted)] transition-colors hover:text-[var(--ink)]"
>
<ChevronLeft className="h-3.5 w-3.5" strokeWidth={2} />
<span></span>
</button>
<div className="flex h-full flex-col">
<header className="flex h-14 shrink-0 items-center justify-between border-b border-[var(--line)] bg-[var(--bg-card)] px-6">
<div className="flex items-center gap-2">
<button
onClick={() => router.push('/products')}
className="flex h-7 items-center gap-1 rounded-md px-1.5 text-[12.5px] text-[var(--ink-muted)] hover:bg-[var(--bg-subtle)] hover:text-[var(--ink)]"
>
<ChevronLeft className="h-3.5 w-3.5" strokeWidth={2} />
</button>
<span className="text-[var(--ink-muted)]">/</span>
<h1 className="text-[15px] font-semibold tracking-tight text-[var(--ink)]">
{currentProduct.name}
</h1>
</div>
<div className="flex gap-1.5">
<button
onClick={() => setEditingProduct(true)}
className="flex h-8 items-center gap-1 rounded-lg border border-[var(--line)] bg-[var(--bg-card)] px-2.5 text-[12.5px] text-[var(--ink-soft)] hover:bg-[var(--bg-subtle)] hover:text-[var(--ink)]"
>
<Pencil className="h-3 w-3" strokeWidth={2} />
</button>
<button
onClick={handleDeleteProduct}
className="flex h-8 items-center gap-1 rounded-lg border border-[var(--line)] bg-[var(--bg-card)] px-2.5 text-[12.5px] text-[var(--ink-soft)] hover:border-red-200 hover:bg-red-50 hover:text-red-600"
>
<Trash2 className="h-3 w-3" strokeWidth={2} />
</button>
</div>
</header>
<header className="mb-12 flex items-end justify-between border-b border-[var(--line)] pb-10">
<div className="flex-1">
<p className="font-mono text-[11px] uppercase tracking-[0.24em] text-[var(--ink-muted)]">
Product
</p>
<h1 className="mt-4 font-display text-[56px] font-medium leading-[1] tracking-[-0.02em] text-[var(--ink)]">
{currentProduct.name}
</h1>
{currentProduct.description && (
<p className="mt-4 max-w-2xl text-[14px] leading-relaxed text-[var(--ink-soft)]">
{currentProduct.description}
</p>
)}
</div>
<div className="flex gap-2">
<button
onClick={() => setEditingProduct(true)}
className="flex items-center gap-1.5 rounded-md border border-[var(--line)] bg-[var(--bg-elevated)] px-3 py-1.5 text-[13px] text-[var(--ink-soft)] hover:border-[var(--ink)] hover:text-[var(--ink)]"
>
<Pencil className="h-3.5 w-3.5" strokeWidth={1.75} />
</button>
<button
onClick={handleDeleteProduct}
className="flex items-center gap-1.5 rounded-md border border-[var(--line)] bg-[var(--bg-elevated)] px-3 py-1.5 text-[13px] text-[var(--ink-soft)] hover:border-[var(--accent)] hover:text-[var(--accent)]"
>
<Trash2 className="h-3.5 w-3.5" strokeWidth={1.75} />
</button>
</div>
</header>
{editingProduct && (
<div className="mb-10 animate-fade-up rounded-xl border border-[var(--line)] bg-[var(--bg-elevated)] p-8">
<p className="mb-4 font-mono text-[10px] uppercase tracking-[0.2em] text-[var(--ink-muted)]"> </p>
<ProductForm
initialData={{ name: currentProduct.name, description: currentProduct.description }}
onSubmit={async (data) => {
await updateProduct(productId, data);
setEditingProduct(false);
await fetchProduct(productId);
}}
onCancel={() => setEditingProduct(false)}
/>
</div>
<div className="border-b border-[var(--line)] bg-[var(--bg-card)] px-6">
{currentProduct.description && (
<p className="line-clamp-2 py-3 text-[13px] text-[var(--ink-soft)]">{currentProduct.description}</p>
)}
<div className="mb-8 flex gap-8 border-b border-[var(--line)]">
<div className="flex gap-1">
{TABS.map((tab) => (
<button
key={tab.key}
onClick={() => setActiveTab(tab.key)}
className={`relative flex items-baseline gap-2 pb-3 transition-colors ${
className={`relative h-9 px-3 text-[13px] transition-colors ${
activeTab === tab.key
? 'text-[var(--ink)]'
: 'text-[var(--ink-muted)] hover:text-[var(--ink-soft)]'
? 'font-medium text-[var(--ink)]'
: 'text-[var(--ink-soft)] hover:text-[var(--ink)]'
}`}
>
<span className="font-mono text-[10px] tabular-nums">{tab.index}</span>
<span className="text-[14px] font-medium tracking-tight">{tab.label}</span>
{tab.label}
{activeTab === tab.key && (
<span className="absolute -bottom-px left-0 right-0 h-px bg-[var(--ink)]" />
<span className="absolute bottom-0 left-2 right-2 h-0.5 rounded-full bg-[var(--accent)]" />
)}
</button>
))}
</div>
</div>
{activeTab === 'requirements' && (
<div className="animate-fade-up">
{(showReqForm || editingReq) && (
<div className="mb-8 rounded-xl border border-[var(--line)] bg-[var(--bg-elevated)] p-8">
<p className="mb-4 font-mono text-[10px] uppercase tracking-[0.2em] text-[var(--ink-muted)]">
{editingReq ? '编辑需求' : '新建需求'}
</p>
<RequirementForm
initialData={editingReq || undefined}
onSubmit={editingReq ? handleUpdateReq : handleCreateReq}
onCancel={() => {
setShowReqForm(false);
setEditingReq(null);
}}
/>
</div>
)}
<RequirementTable
requirements={requirements as any}
statusFilter={statusFilter}
onFilterChange={handleFilterChange}
onEdit={(req) => setEditingReq(req)}
onStatusChange={(id, status) => updateStatus(productId, id, status)}
onDelete={(id) => deleteRequirement(productId, id)}
onCreate={() => setShowReqForm(true)}
/>
</div>
)}
<div className="flex-1 overflow-y-auto">
<div className="mx-auto max-w-[1400px] p-6">
{editingProduct && (
<div className="mb-5 rounded-2xl border border-[var(--line)] bg-[var(--bg-card)] p-6 shadow-[var(--shadow-sm)]">
<h3 className="mb-4 text-[14px] font-semibold text-[var(--ink)]"></h3>
<ProductForm
initialData={{ name: currentProduct.name, description: currentProduct.description }}
onSubmit={async (data) => {
await updateProduct(productId, data);
setEditingProduct(false);
await fetchProduct(productId);
}}
onCancel={() => setEditingProduct(false)}
/>
</div>
)}
{activeTab === 'projects' && (
<div className="animate-fade-up py-24 text-center">
<p className="font-display text-2xl text-[var(--ink-muted)]"></p>
<p className="mt-2 text-[13px] text-[var(--ink-muted)]"> · Coming Soon</p>
</div>
)}
{activeTab === 'requirements' && (
<>
{(showReqForm || editingReq) && (
<div className="mb-5 rounded-2xl border border-[var(--line)] bg-[var(--bg-card)] p-6 shadow-[var(--shadow-sm)]">
<h3 className="mb-4 text-[14px] font-semibold text-[var(--ink)]">
{editingReq ? '编辑需求' : '新建需求'}
</h3>
<RequirementForm
initialData={editingReq || undefined}
onSubmit={editingReq ? handleUpdateReq : handleCreateReq}
onCancel={() => {
setShowReqForm(false);
setEditingReq(null);
}}
/>
</div>
)}
<RequirementTable
requirements={requirements as any}
statusFilter={statusFilter}
onFilterChange={handleFilterChange}
onEdit={(req) => setEditingReq(req)}
onStatusChange={(id, status) => updateStatus(productId, id, status)}
onDelete={(id) => deleteRequirement(productId, id)}
onCreate={() => setShowReqForm(true)}
/>
</>
)}
{activeTab === 'versions' && (
<div className="animate-fade-up py-24 text-center">
<p className="font-display text-2xl text-[var(--ink-muted)]"></p>
<p className="mt-2 text-[13px] text-[var(--ink-muted)]"> · Coming Soon</p>
</div>
)}
{activeTab === 'projects' && (
<div className="rounded-2xl border border-dashed border-[var(--line)] bg-[var(--bg-card)] py-20 text-center text-[13px] text-[var(--ink-muted)]">
</div>
)}
{activeTab === 'versions' && (
<div className="rounded-2xl border border-dashed border-[var(--line)] bg-[var(--bg-card)] py-20 text-center text-[13px] text-[var(--ink-muted)]">
</div>
)}
</div>
</div>
</div>
);

View File

@@ -27,85 +27,67 @@ export default function ProductsPage() {
};
return (
<div className="relative min-h-full">
<div className="grain pointer-events-none absolute inset-0" />
<div className="flex h-full flex-col">
<header className="flex h-14 shrink-0 items-center justify-between border-b border-[var(--line)] bg-[var(--bg-card)] px-6">
<div className="flex items-center gap-2.5">
<h1 className="text-[15px] font-semibold tracking-tight text-[var(--ink)]"></h1>
<span className="rounded-md bg-[var(--bg-subtle)] px-1.5 py-0.5 text-[11px] font-medium tabular-nums text-[var(--ink-soft)]">
{products.length}
</span>
</div>
<button
onClick={() => setShowForm(true)}
className="flex h-8 items-center gap-1.5 rounded-lg bg-[var(--accent)] px-3 text-[13px] font-medium text-white shadow-[var(--shadow-sm)] transition-colors hover:bg-[var(--accent-hover)]"
>
<Plus className="h-3.5 w-3.5" strokeWidth={2.5} />
</button>
</header>
<div className="relative mx-auto max-w-[1280px] px-12 py-16">
<header className="mb-16 flex items-end justify-between border-b border-[var(--line)] pb-10">
<div className="flex-1">
<p className="font-mono text-[11px] uppercase tracking-[0.24em] text-[var(--ink-muted)]">
02 / Products
</p>
<h1 className="mt-4 font-display text-[64px] font-medium leading-[0.95] tracking-[-0.02em] text-[var(--ink)]">
<span className="italic text-[var(--accent)]"></span>
</h1>
<p className="mt-4 max-w-md text-[14px] leading-relaxed text-[var(--ink-soft)]">
</p>
</div>
<div className="flex items-center gap-3">
<div className="relative">
<Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--ink-muted)]" strokeWidth={1.75} />
<div className="flex-1 overflow-y-auto">
<div className="mx-auto max-w-[1400px] p-6">
<div className="mb-5 flex items-center gap-2">
<div className="relative max-w-xs flex-1">
<Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--ink-muted)]" strokeWidth={2} />
<input
value={search}
onChange={(e) => setSearch(e.target.value)}
placeholder="搜索产品"
className="w-56 rounded-md border border-[var(--line)] bg-[var(--bg-elevated)] py-2 pl-9 pr-3 text-[13px] text-[var(--ink)] placeholder:text-[var(--ink-muted)] focus:border-[var(--ink)] focus:outline-none"
placeholder="搜索产品名称"
className="h-9 w-full rounded-lg border border-[var(--line)] bg-[var(--bg-card)] pl-8 pr-3 text-[13px] text-[var(--ink)] placeholder:text-[var(--ink-muted)] focus:border-[var(--accent)] focus:outline-none focus:ring-2 focus:ring-[var(--accent-ring)]"
/>
</div>
<button
onClick={() => setShowForm(true)}
className="flex items-center gap-2 rounded-md bg-[var(--ink)] px-4 py-2 text-[13px] font-medium text-[var(--bg)] transition-all hover:bg-[var(--accent)]"
>
<Plus className="h-4 w-4" strokeWidth={2} />
</button>
</div>
</header>
<div className="mb-8 flex items-baseline gap-4">
<p className="font-mono text-[11px] uppercase tracking-[0.2em] text-[var(--ink-muted)]">
Showing
</p>
<p className="font-display text-[18px] font-semibold tabular-nums text-[var(--ink)]">
{String(filtered.length).padStart(2, '0')}
</p>
<span className="text-[12px] text-[var(--ink-muted)]">/ {String(products.length).padStart(2, '0')} </span>
{showForm && (
<div className="mb-5 rounded-2xl border border-[var(--line)] bg-[var(--bg-card)] p-6 shadow-[var(--shadow-sm)]">
<h2 className="mb-4 text-[14px] font-semibold text-[var(--ink)]"></h2>
<ProductForm onSubmit={handleCreate} onCancel={() => setShowForm(false)} />
</div>
)}
{loading ? (
<div className="py-20 text-center text-[13px] text-[var(--ink-muted)]"></div>
) : filtered.length === 0 ? (
<div className="rounded-2xl border border-dashed border-[var(--line)] bg-[var(--bg-card)] py-20 text-center">
<p className="text-[14px] font-medium text-[var(--ink-soft)]">
{search ? '没有找到匹配的产品' : '尚未创建任何产品'}
</p>
<p className="mt-1.5 text-[12.5px] text-[var(--ink-muted)]">
{search ? '尝试其他关键字' : '点击右上角"新建产品"开始'}
</p>
</div>
) : (
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
{filtered.map((product) => (
<ProductCard
key={product.id}
product={product as any}
onClick={(id) => router.push(`/products/${id}`)}
/>
))}
</div>
)}
</div>
{showForm && (
<div className="mb-10 animate-fade-up rounded-xl border border-[var(--line)] bg-[var(--bg-elevated)] p-8">
<p className="mb-4 font-mono text-[10px] uppercase tracking-[0.2em] text-[var(--ink-muted)]"> </p>
<ProductForm onSubmit={handleCreate} onCancel={() => setShowForm(false)} />
</div>
)}
{loading ? (
<div className="py-32 text-center">
<p className="font-mono text-xs uppercase tracking-[0.2em] text-[var(--ink-muted)]">Loading...</p>
</div>
) : filtered.length === 0 ? (
<div className="py-32 text-center">
<p className="font-display text-2xl text-[var(--ink-muted)]">
{search ? '没有匹配的产品' : '尚未创建任何产品'}
</p>
<p className="mt-2 text-[13px] text-[var(--ink-muted)]">
{search ? '试试其他关键字' : '点击右上角按钮,创建第一个产品'}
</p>
</div>
) : (
<div className="grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3">
{filtered.map((product, idx) => (
<ProductCard
key={product.id}
product={product as any}
index={idx}
onClick={(id) => router.push(`/products/${id}`)}
/>
))}
</div>
)}
</div>
</div>
);