未載入 Skill9717 tokens · 123668 ms
ダイビズのスキルは読み込みました。ただし今回は plan mode かつ利用できるツールが Skill のみのため、**`scripts/validate_palette.js` は実行していません**し、参照ファイル群(`references/palette.md` 等)も開いていません。以下の色は「未検証のプレースホルダ」です。ブランド色に差し替えたうえで validator を light / dark 両方で回してから確定してください。同様に、計画ファイルの作成やファイル編集も行っていません(書き込み系ツールが手元にありません)。
---
## 前提として固定した設計判断(3案共通)
- **フォームを先に決め、色は最後。** 3案はそれぞれ「データの仕事」が違うので、色ではなく**形**で差別化しています。
- **二重軸は使わない。** signups と churned はスケールが1桁違うので、同一プロットに重ねず、ファセット分割か列内正規化で処理します。
- 系列2つ以上ならレジェンド必須/1系列ならタイトルが名前を兼ねるのでレジェンドなし。
- 値のテキストは ink トークン、系列色は隣のマークだけが持つ。
- **初回利用=データが1〜2点しかない状態**が本題なので、`?rows=1` で行数を絞れる仕込みを入れてあります(各案がスカスカのときどう崩れるかを見るため)。
---
## 3つの方向性(`?view=` で切替)
### A. `?view=headline` — 答え先出し(ヒーロー数値中心)
- **問い**:「で、いま良いの?悪いの?」
- **形**:ヒーロー数値1つ+前期比デルタ、補助スタットタイル2つ、スパークライン1本(1系列=レジェンドなし)。チャートらしいチャートは実質ゼロ。
- **初回の見え方**:データ1点でも成立する唯一の案。デルタが出せないときは「基準期間なし」と明示するだけで済む。
- **試したい仮説**:初回ユーザーは探索したいのではなく、**まず1文の結論**が欲しい。
### B. `?view=explore` — 台帳先出し(表+セル内バー)
- **問い**:「元の数字はどうなってる?」
- **形**:期間×指標のテーブル。各セルに列内で正規化した細いバーを重ねて、走査しながら大小が分かるようにする。チャートは1つも置かない。
- **初回の見え方**:1行でも「表として正しい」ので破綻しない。逆に「まだ何も分からない」感が最も強く出る。
- **試したい仮説**:レポートの初回価値は**生データへの信頼**であって、要約ではない。
### C. `?view=trend` — スモールマルチプル(指標ごとに1枚ずつ)
- **問い**:「どう動いてきた?指標間で形は違う?」
- **形**:指標ごとに独立スケールの折れ線を3枚並置。1枚1系列なのでレジェンド不要、二重軸問題も回避。
- **初回の見え方**:**最も壊れやすい**。点が1〜2個だと線が引けないので、点+「傾向は3期分から」の注記にフォールバックする挙動込みで検証する価値がある。
- **試したい仮説**:初回でも時間軸を見せた方が「続けて使う理由」が立つ。
---
## `app/reports/page.tsx`(骨格・そのまま動く)
依存なし(`next/link` のみ)。全部サーバーコンポーネント、状態は URL だけ、データはモジュール内定数。
```tsx
// app/reports/page.tsx
import Link from "next/link";
/* ---------- in-memory data (プロトタイプ限定) ---------- */
type Row = { month: string; signups: number; activated: number; churned: number };
const DATA: Row[] = [
{ month: "3月", signups: 412, activated: 250, churned: 38 },
{ month: "4月", signups: 468, activated: 301, churned: 41 },
{ month: "5月", signups: 501, activated: 318, churned: 52 },
{ month: "6月", signups: 559, activated: 372, churned: 47 },
{ month: "7月", signups: 604, activated: 430, churned: 61 },
{ month: "8月", signups: 652, activated: 489, churned: 58 },
];
/* 未検証プレースホルダ。ブランド色に差し替え後、validate_palette.js を light/dark で実行すること */
const SERIES = [
{ key: "activated", label: "有効化", color: "#3B6FD4" },
{ key: "signups", label: "新規登録", color: "#137A63" },
{ key: "churned", label: "解約", color: "#9A4EA3" },
] as const;
const VIEWS = [
{ id: "headline", label: "結論" },
{ id: "explore", label: "台帳" },
{ id: "trend", label: "推移" },
] as const;
type ViewId = (typeof VIEWS)[number]["id"];
/* ---------- page ---------- */
export default async function Page({
searchParams,
}: {
// Next.js 14 なら Promise を外して await も削る
searchParams: Promise<{ view?: string; rows?: string }>;
}) {
const sp = await searchParams;
const view = (VIEWS.find((v) => v.id === sp.view)?.id ?? "headline") as ViewId;
const n = Math.min(Math.max(Number(sp.rows) || DATA.length, 1), DATA.length);
const rows = DATA.slice(-n); // ?rows=1 で初回状態を再現
return (
<main style={S.page}>
<header style={S.header}>
<h1 style={S.h1}>成長レポート</h1>
<p style={S.sub}>
直近 {rows.length} か月 ・ {VIEWS.find((v) => v.id === view)!.label}案
</p>
</header>
{view === "headline" && <Headline rows={rows} />}
{view === "explore" && <Explore rows={rows} />}
{view === "trend" && <Trend rows={rows} />}
<SwitchBar current={view} rows={sp.rows} />
</main>
);
}
/* ---------- A. headline ---------- */
function Headline({ rows }: { rows: Row[] }) {
const last = rows.at(-1)!;
const prev = rows.length > 1 ? rows.at(-2)! : null;
const delta = prev ? ((last.activated - prev.activated) / prev.activated) * 100 : null;
return (
<section style={S.stack}>
<div style={S.hero}>
<div style={S.heroLabel}>有効化ユーザー ・ {last.month}</div>
<div style={S.heroNum}>{last.activated.toLocaleString()}</div>
<div style={S.heroDelta}>
{delta === null
? "比較できる前期間がありません"
: `前月比 ${delta >= 0 ? "+" : ""}${delta.toFixed(1)}%`}
</div>
{rows.length > 1 && (
<Sparkline values={rows.map((r) => r.activated)} color={SERIES[0].color} />
)}
</div>
<div style={S.tileRow}>
<Tile label="新規登録" value={last.signups} color={SERIES[1].color} />
<Tile label="解約" value={last.churned} color={SERIES[2].color} />
</div>
</section>
);
}
function Tile({ label, value, color }: { label: string; value: number; color: string }) {
return (
<div style={S.tile}>
<div style={S.tileHead}>
<span style={{ ...S.swatch, background: color }} />
<span style={S.tileLabel}>{label}</span>
</div>
<div style={S.tileNum}>{value.toLocaleString()}</div>
</div>
);
}
/* ---------- B. explore ---------- */
function Explore({ rows }: { rows: Row[] }) {
const max = Object.fromEntries(
SERIES.map((s) => [s.key, Math.max(...rows.map((r) => r[s.key]))])
) as Record<(typeof SERIES)[number]["key"], number>;
return (
<table style={S.table}>
<caption style={S.caption}>月次実績(各列は列内最大値で正規化)</caption>
<thead>
<tr>
<th style={{ ...S.th, textAlign: "left" }}>期間</th>
{SERIES.map((s) => (
<th key={s.key} style={S.th}>
<span style={{ ...S.swatch, background: s.color }} /> {s.label}
</th>
))}
</tr>
</thead>
<tbody>
{rows.map((r) => (
<tr key={r.month}>
<td style={{ ...S.td, color: "var(--ink)" }}>{r.month}</td>
{SERIES.map((s) => (
<td key={s.key} style={S.td}>
<div style={S.cellWrap}>
<span style={S.cellNum}>{r[s.key].toLocaleString()}</span>
<span style={S.barTrack}>
<span
style={{
...S.barFill,
width: `${(r[s.key] / max[s.key]) * 100}%`,
background: s.color,
}}
/>
</span>
</div>
</td>
))}
</tr>
))}
</tbody>
</table>
);
}
/* ---------- C. trend (small multiples) ---------- */
function Trend({ rows }: { rows: Row[] }) {
return (
<section style={S.facetGrid}>
{SERIES.map((s) => (
<figure key={s.key} style={S.facet}>
<figcaption style={S.facetTitle}>{s.label}</figcaption>
{rows.length < 3 ? (
<p style={S.note}>推移は3期分から表示されます(現在 {rows.length} 期)</p>
) : (
<LineChart
points={rows.map((r) => ({ x: r.month, y: r[s.key] }))}
color={s.color}
/>
)}
</figure>
))}
</section>
);
}
/* ---------- primitives ---------- */
function Sparkline({ values, color }: { values: number[]; color: string }) {
const w = 280, h = 48, pad = 6;
const min = Math.min(...values), max = Math.max(...values);
const x = (i: number) => (i / (values.length - 1)) * (w - pad * 2) + pad;
const y = (v: number) => h - pad - ((v - min) / (max - min || 1)) * (h - pad * 2);
const d = values.map((v, i) => `${i ? "L" : "M"}${x(i)} ${y(v)}`).join(" ");
return (
<svg width={w} height={h} aria-hidden style={{ display: "block", marginTop: 12 }}>
<path d={d} fill="none" stroke={color} strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
<circle cx={x(values.length - 1)} cy={y(values.at(-1)!)} r={4}
fill={color} stroke="var(--surface)" strokeWidth={2} />
</svg>
);
}
function LineChart({ points, color }: { points: { x: string; y: number }[]; color: string }) {
const w = 300, h = 150, l = 8, r = 8, t = 10, b = 22;
const min = 0, max = Math.max(...points.map((p) => p.y));
const px = (i: number) => l + (i / (points.length - 1)) * (w - l - r);
const py = (v: number) => h - b - ((v - min) / (max - min || 1)) * (h - t - b);
const d = points.map((p, i) => `${i ? "L" : "M"}${px(i)} ${py(p.y)}`).join(" ");
return (
<svg viewBox={`0 0 ${w} ${h}`} width="100%" role="img"
aria-label={`${points.length}期分の推移。最新値 ${points.at(-1)!.y}`}>
<line x1={l} y1={h - b} x2={w - r} y2={h - b} stroke="var(--rule)" strokeWidth={1} />
<path d={d} fill="none" stroke={color} strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
{points.map((p, i) => (
<circle key={p.x} cx={px(i)} cy={py(p.y)} r={4}
fill={color} stroke="var(--surface)" strokeWidth={2}>
<title>{`${p.x}: ${p.y.toLocaleString()}`}</title>
</circle>
))}
{/* 直接ラベルは最新値のみ(全点に数字を置かない) */}
<text x={px(points.length - 1)} y={py(points.at(-1)!.y) - 10}
textAnchor="end" style={S.svgLabel}>{points.at(-1)!.y.toLocaleString()}</text>
<text x={l} y={h - 6} style={S.svgAxis}>{points[0].x}</text>
<text x={w - r} y={h - 6} textAnchor="end" style={S.svgAxis}>{points.at(-1)!.x}</text>
</svg>
);
}
/* ---------- bottom switch bar ---------- */
function SwitchBar({ current, rows }: { current: ViewId; rows?: string }) {
return (
<nav style={S.bar} aria-label="プロトタイプ切替">
{VIEWS.map((v) => {
const on = v.id === current;
const qs = new URLSearchParams({ view: v.id, ...(rows ? { rows } : {}) });
return (
<Link key={v.id} href={`/reports?${qs}`} aria-current={on ? "page" : undefined}
style={{ ...S.pill, ...(on ? S.pillOn : null) }}>
{v.label}
</Link>
);
})}
</nav>
);
}
/* ---------- styles ---------- */
const S: Record<string, React.CSSProperties> = {
page: { "--surface": "#FFFFFF", "--ink": "#16181D", "--ink2": "#5A6070",
"--rule": "#E3E6EC", "--chip": "#F4F6F9",
background: "var(--surface)", color: "var(--ink)", minHeight: "100dvh",
padding: "40px 24px 96px", maxWidth: 960, margin: "0 auto",
font: "400 15px/1.5 ui-sans-serif, system-ui, sans-serif" } as React.CSSProperties,
header: { marginBottom: 28 },
h1: { font: "600 24px/1.2 inherit", margin: 0 },
sub: { color: "var(--ink2)", fontSize: 13, margin: "6px 0 0" },
stack: { display: "grid", gap: 16 },
hero: { border: "1px solid var(--rule)", borderRadius: 12, padding: 24 },
heroLabel: { color: "var(--ink2)", fontSize: 13 },
heroNum: { font: "600 56px/1.05 inherit", letterSpacing: "-0.02em", marginTop: 8 },
heroDelta: { color: "var(--ink2)", fontSize: 14, marginTop: 8 },
tileRow: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 },
tile: { border: "1px solid var(--rule)", borderRadius: 12, padding: 20 },
tileHead: { display: "flex", alignItems: "center", gap: 8 },
tileLabel: { color: "var(--ink2)", fontSize: 13 },
tileNum: { font: "600 28px/1.2 inherit", marginTop: 6 },
swatch: { width: 10, height: 10, borderRadius: 3, display: "inline-block" },
table: { width: "100%", borderCollapse: "collapse" },
caption: { textAlign: "left", color: "var(--ink2)", fontSize: 13, paddingBottom: 12 },
th: { textAlign: "right", fontSize: 12, fontWeight: 500, color: "var(--ink2)",
padding: "8px 12px", borderBottom: "1px solid var(--rule)", whiteSpace: "nowrap" },
td: { padding: "10px 12px", borderBottom: "1px solid var(--rule)", fontSize: 14 },
cellWrap: { display: "grid", gap: 5, justifyItems: "end" },
cellNum: { color: "var(--ink)", fontVariantNumeric: "tabular-nums" },
barTrack: { width: 96, height: 6, background: "var(--chip)", borderRadius: 4, overflow: "hidden" },
barFill: { display: "block", height: "100%", borderRadius: 4 },
facetGrid: { display: "grid", gridTemplateColumns: "repeat(auto-fit,minmax(260px,1fr))", gap: 20 },
facet: { margin: 0, border: "1px solid var(--rule)", borderRadius: 12, padding: 16 },
facetTitle: { fontSize: 13, color: "var(--ink2)", marginBottom: 8 },
note: { fontSize: 13, color: "var(--ink2)", margin: "24px 0" },
svgLabel: { fill: "var(--ink)", font: "500 12px ui-sans-serif, system-ui, sans-serif" },
svgAxis: { fill: "var(--ink2)", font: "400 11px ui-sans-serif, system-ui, sans-serif" },
bar: { position: "fixed", left: "50%", bottom: 20, transform: "translateX(-50%)",
display: "flex", gap: 4, padding: 4, borderRadius: 999,
background: "var(--surface)", border: "1px solid var(--rule)",
boxShadow: "0 6px 24px rgba(0,0,0,.08)" },
pill: { padding: "8px 16px", borderRadius: 999, fontSize: 13,
color: "var(--ink2)", textDecoration: "none" },
pillOn: { background: "var(--chip)", color: "var(--ink)", fontWeight: 500 },
};
```
**使い方**:`/reports`(既定=A)→ 下部バーで B / C。初回状態は `/reports?view=trend&rows=1` のように行数を絞って確認します。
---
## 意図的に外した点(プロトタイプの既知の穴)
- **ホバー層が最小限**:SVG の `<title>` だけで、スキルが既定とするクロスヘア+ツールチップではありません。方向性が1つに絞れた時点でクライアントコンポーネント化してください。
- **ダークモード未対応**:色は light サーフェス前提。ダークは自動反転ではなく別ステップを選び直し、`--mode dark` で再検証が必要です。
- **パレット未検証**:3色は仮置き。CVD の Delta E とコントラストは必ず `node scripts/validate_palette.js "#3B6FD4,#137A63,#9A4EA3" --mode light` で確認してください(今回は実行していません)。
- テクスチャ/テーブルビューへの切替(B案が実質その役なので当面は代替可)、フィルタ行は未実装です。
已載入 Skill +8519 tokens · 111037 ms
我無法在這個工作階段實際讀檔或寫檔(本輪只有 Skill 工具可用),所以以下是**提案內容,尚未寫入 `app/reports/page.tsx`**,也**沒有跑過 dataviz 的 `validate_palette.js`**——色票那段是待驗證的。
---
## 一、三個方向(刻意互斥,不是同一版的三種配色)
每個方向賭的是「使用者第一次打開報表時想知道的第一件事」不同。
| `?v=` | 名稱 | 回答的問題 | 版面賭注 | 什麼情況下它是錯的 |
|---|---|---|---|---|
| `hero` | 頭條數字 | 「現在到底好不好?」 | 一個巨大數字 + 一條 sparkline + 三行佐證,其餘全部藏起來 | 使用者其實沒有單一北極星指標,或需要同時看多個平權指標 |
| `grid` | 指標牆(小倍數) | 「有哪裡不對勁?」 | 4–6 張等權重卡片,每張自帶迷你圖,掃描優先、深入次之 | 指標之間其實有主從關係,等權重會讓人抓不到重點 |
| `table` | 明細優先 | 「是誰造成的?」 | 表格是主角,數字可對齊、可掃欄,圖只是欄內的內嵌長條 | 使用者是主管而非分析師,看到表格就關掉 |
三者共用同一份記憶體資料,差別純粹在資訊層級(hierarchy),這樣切換時比較的才是「版面主張」,不是「資料不同」。
## 二、`app/reports/page.tsx` 骨架
```tsx
// PROTOTYPE — 拋棄式。切換:/reports?v=hero | grid | table
// 資料全在記憶體;無 API、無測試、無錯誤處理。
import Link from "next/link";
/* ---------- 記憶體資料 ---------- */
const SERIES = [
{ key: "direct", label: "直客", color: "#3b6fd4" },
{ key: "partner", label: "通路", color: "#c2681f" },
{ key: "self", label: "自助", color: "#3f8f66" },
{ key: "other", label: "其他", color: "#7d5ba6" },
] as const;
type Key = (typeof SERIES)[number]["key"];
type Row = { w: string } & Record<Key, number>;
const DATA: Row[] = [
{ w: "W26", direct: 141, partner: 88, self: 40, other: 19 },
{ w: "W27", direct: 155, partner: 84, self: 45, other: 21 },
{ w: "W28", direct: 149, partner: 97, self: 52, other: 18 },
{ w: "W29", direct: 168, partner: 91, self: 55, other: 23 },
{ w: "W30", direct: 174, partner: 103, self: 58, other: 22 },
{ w: "W31", direct: 182, partner: 96, self: 61, other: 24 },
{ w: "W32", direct: 176, partner: 112, self: 66, other: 26 },
{ w: "W33", direct: 195, partner: 108, self: 71, other: 25 },
];
const MAX = 420;
const total = (r: Row) => SERIES.reduce((s, x) => s + r[x.key], 0);
const last = DATA[DATA.length - 1];
const prev = DATA[DATA.length - 2];
const delta = (total(last) - total(prev)) / total(prev);
const nf = (n: number) => n.toLocaleString("zh-TW");
/* ---------- 圖元 ---------- */
function Stacked({ rows, h = 130 }: { rows: Row[]; h?: number }) {
const BW = 26, GAP = 12;
return (
<svg width={rows.length * (BW + GAP)} height={h + 20} role="img"
aria-label="每週營收,依通路堆疊">
{rows.map((r, i) => {
let acc = 0;
return (
<g key={r.w} transform={`translate(${i * (BW + GAP)},0)`}>
{SERIES.map((s, si) => {
const px = (r[s.key] / MAX) * h;
const y = h - acc - px;
acc += px;
return (
// 段間留 2px 底色縫;只有堆疊頂端做圓角
<rect key={s.key} x={0} y={y} width={BW}
height={Math.max(px - 2, 0)} fill={s.color}
rx={si === SERIES.length - 1 ? 3 : 0}>
<title>{`${r.w} · ${s.label}:${nf(r[s.key])}`}</title>
</rect>
);
})}
<text x={BW / 2} y={h + 14} fontSize={10} textAnchor="middle" fill="#6b7280">{r.w}</text>
</g>
);
})}
</svg>
);
}
function Spark({ vals, color = "#3b6fd4" }: { vals: number[]; color?: string }) {
const W = 260, H = 56, lo = Math.min(...vals), hi = Math.max(...vals);
const pt = (v: number, i: number) =>
`${(i / (vals.length - 1)) * W},${H - ((v - lo) / (hi - lo || 1)) * (H - 8) - 4}`;
return (
<svg width={W} height={H} role="img" aria-label="總營收趨勢">
<polyline fill="none" stroke={color} strokeWidth={2}
strokeLinecap="round" strokeLinejoin="round"
points={vals.map(pt).join(" ")} />
<circle cx={W} cy={pt(vals[vals.length - 1], vals.length - 1).split(",")[1]}
r={4} fill={color} stroke="#fff" strokeWidth={2} />
</svg>
);
}
function Legend() {
return (
<div style={{ display: "flex", gap: 16, flexWrap: "wrap", fontSize: 12, color: "#4b5563" }}>
{SERIES.map((s) => (
<span key={s.key} style={{ display: "flex", alignItems: "center", gap: 6 }}>
<i style={{ width: 10, height: 10, borderRadius: 2, background: s.color }} />
{s.label}
</span>
))}
</div>
);
}
const card: React.CSSProperties = {
border: "1px solid #e5e7eb", borderRadius: 10, padding: 16, background: "#fff",
};
/* ---------- 三個方向 ---------- */
function Hero() {
return (
<section style={{ display: "grid", gap: 24, maxWidth: 560 }}>
<div>
<div style={{ fontSize: 13, color: "#6b7280" }}>本週總營收(W33)</div>
<div style={{ fontSize: 64, fontWeight: 650, lineHeight: 1.05, letterSpacing: -1 }}>
{nf(total(last))}
</div>
<div style={{ fontSize: 14, color: delta >= 0 ? "#2f7a56" : "#b3261e" }}>
{delta >= 0 ? "▲" : "▼"} {(Math.abs(delta) * 100).toFixed(1)}% vs 上週
</div>
</div>
<Spark vals={DATA.map(total)} />
<dl style={{ display: "grid", gap: 8, margin: 0, fontSize: 14 }}>
{SERIES.map((s) => (
<div key={s.key} style={{ display: "flex", justifyContent: "space-between",
borderTop: "1px solid #f3f4f6", paddingTop: 8 }}>
<dt style={{ color: "#4b5563" }}>{s.label}</dt>
<dd style={{ margin: 0, fontVariantNumeric: "tabular-nums" }}>{nf(last[s.key])}</dd>
</div>
))}
</dl>
</section>
);
}
function Grid() {
return (
<section style={{ display: "grid", gap: 16 }}>
<div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit,minmax(200px,1fr))", gap: 16 }}>
{SERIES.map((s) => {
const cur = last[s.key], pre = prev[s.key];
const d = (cur - pre) / pre;
return (
<div key={s.key} style={card}>
<div style={{ display: "flex", alignItems: "center", gap: 6, fontSize: 13, color: "#4b5563" }}>
<i style={{ width: 10, height: 10, borderRadius: 2, background: s.color }} />
{s.label}
</div>
<div style={{ fontSize: 30, fontWeight: 600, marginTop: 4 }}>{nf(cur)}</div>
<div style={{ fontSize: 12, color: d >= 0 ? "#2f7a56" : "#b3261e", marginBottom: 8 }}>
{d >= 0 ? "▲" : "▼"} {(Math.abs(d) * 100).toFixed(1)}%
</div>
<Spark vals={DATA.map((r) => r[s.key])} color={s.color} />
</div>
);
})}
</div>
<div style={card}>
<div style={{ fontSize: 14, fontWeight: 600, marginBottom: 4 }}>每週營收(依通路)</div>
<Legend />
<div style={{ marginTop: 12, overflowX: "auto" }}><Stacked rows={DATA} /></div>
</div>
</section>
);
}
function Table() {
return (
<section style={{ ...card, padding: 0, overflow: "hidden" }}>
<table style={{ width: "100%", borderCollapse: "collapse", fontSize: 14,
fontVariantNumeric: "tabular-nums" }}>
<thead>
<tr style={{ background: "#f9fafb", textAlign: "right" }}>
<th style={{ textAlign: "left", padding: 10 }}>週</th>
{SERIES.map((s) => <th key={s.key} style={{ padding: 10 }}>{s.label}</th>)}
<th style={{ padding: 10 }}>合計</th>
<th style={{ textAlign: "left", padding: 10, width: 200 }}>分佈</th>
</tr>
</thead>
<tbody>
{[...DATA].reverse().map((r) => {
const t = total(r);
return (
<tr key={r.w} style={{ borderTop: "1px solid #f3f4f6", textAlign: "right" }}>
<td style={{ textAlign: "left", padding: 10 }}>{r.w}</td>
{SERIES.map((s) => <td key={s.key} style={{ padding: 10 }}>{nf(r[s.key])}</td>)}
<td style={{ padding: 10, fontWeight: 600 }}>{nf(t)}</td>
<td style={{ padding: 10 }}>
<div style={{ display: "flex", gap: 2, height: 10, borderRadius: 3, overflow: "hidden" }}>
{SERIES.map((s) => (
<div key={s.key} title={`${s.label}:${nf(r[s.key])}`}
style={{ width: `${(r[s.key] / t) * 100}%`, background: s.color }} />
))}
</div>
</td>
</tr>
);
})}
</tbody>
</table>
<div style={{ padding: 10, borderTop: "1px solid #f3f4f6" }}><Legend /></div>
</section>
);
}
/* ---------- 頁面 + 底部切換列 ---------- */
const VARIANTS = [
{ id: "hero", label: "A · 頭條數字" },
{ id: "grid", label: "B · 指標牆" },
{ id: "table", label: "C · 明細優先" },
] as const;
export default async function ReportsPrototype({
searchParams,
}: {
searchParams: Promise<{ v?: string }>; // Next 14 請改成同步物件並拿掉 async/await
}) {
const { v } = await searchParams;
const active = VARIANTS.some((x) => x.id === v) ? v! : "hero";
return (
<main style={{ padding: "32px 24px 96px", fontFamily: "system-ui, sans-serif", color: "#111827" }}>
<header style={{ marginBottom: 24 }}>
<div style={{ fontSize: 12, letterSpacing: 1, color: "#9ca3af" }}>PROTOTYPE · 資料為假資料</div>
<h1 style={{ fontSize: 22, margin: "4px 0 0" }}>資料報表</h1>
</header>
{active === "hero" && <Hero />}
{active === "grid" && <Grid />}
{active === "table" && <Table />}
{/* 底部切換列 */}
<nav style={{ position: "fixed", left: "50%", bottom: 20, transform: "translateX(-50%)",
display: "flex", gap: 4, padding: 4, borderRadius: 999,
background: "#111827", boxShadow: "0 6px 24px rgba(0,0,0,.25)" }}>
{VARIANTS.map((x) => (
<Link key={x.id} href={`/reports?v=${x.id}`} scroll={false}
style={{ padding: "8px 14px", borderRadius: 999, fontSize: 13, textDecoration: "none",
color: active === x.id ? "#111827" : "#e5e7eb",
background: active === x.id ? "#fff" : "transparent" }}>
{x.label}
</Link>
))}
<span style={{ padding: "8px 12px", fontSize: 12, color: "#9ca3af" }}>?v={active}</span>
</nav>
</main>
);
}
```
跑法:`pnpm dev` 後開 `/reports`、`/reports?v=grid`、`/reports?v=table`。全部是 Server Component,沒有 client JS。
## 三、刻意省略的東西(以及一個待驗證項)
- **無 API、無測試、無錯誤處理、無抽象**:`v` 不合法就 fallback 到 `hero`,就這樣。
- **互動只有原生 tooltip**(`<title>` / `title=`)。dataviz 的規範是 line/area 要 crosshair + tooltip、bar/cell 要逐標記 tooltip;原型階段先用原生的,如果評審時「看不出某週某通路的值」變成阻礙,再補。
- **色票尚未驗證**:`SERIES` 的四個 hex 是暫定值,我沒有跑 `scripts/validate_palette.js`。定案任何方向之前應該跑一次 light 與 dark 兩種模式,確認亮度帶、彩度下限、相鄰色對的 CVD ΔE ≥ 8 與一般視覺 ΔE ≥ 15;沒過就換階,不要用眼睛判斷。
- **深色模式沒做**:規範要求深色是「另外選階」而非自動反轉,不屬於這次要回答的問題。
- 堆疊長條只有頂端圓角、段間 2px 縫,符合規範;但沒有格線與 y 軸刻度,靠 tooltip 與表格視圖補足。
## 四、收掉的方式
選定方向後,把決定折進真正的 `app/reports/page.tsx`,然後把這支原型丟到拋棄分支(例如 `proto/reports-first-screen`),在實作 issue 上留分支指標,並把結論寫清楚:**問題是什麼、選了哪個方向、為什麼**。main 只留驗證過的決定。