feat(ui): 报告中心改行式列表,阅读页并入外壳并把目录挪到右侧常驻
报告中心原来是卡片方阵,状态只靠三块底色区分;报告一多,扫读成本
按卡片数线性涨。现在一列一行:带色点的状态 chip、标题、创建时间 ·
深度 · 主题,操作靠右。失败原因从右边一小块挪进行内,能完整读到。
chip 里原来的 StatusIcon(generating 转圈、ready 打勾、failed 警告)
换成 5px 色点——原型如此,且列表是轮询不是演出。失败行不加「重新
生成」,顶栏已经有唯一的生成入口。
行内小字只写接口真给的东西。GET /api/reports 不返回节数和盘数,所以
不写「9 节 · 22 张盘」(VOICE.md 第 2 条),原型图上那行是 mock。
/reports/[reportId] 是最后一个脱离外壳的全屏路由,九个 phase 全部并进
SecondaryShell,根节点从 <main> 改成 <div>(外壳自己就是 main)。
任务书 E10「没有目录」已过期:目录在 cfcd369d 就存在。本轮把它从左栏
挪到正文右侧并定稿视觉,位置用 grid-column 显式指定而不是靠 DOM 次序,
这样窄屏抽屉仍能排在源码最前面,不会掉到全文末尾。860px 以下常驻栏
消失、折叠抽屉保留——删掉抽屉等于窄屏彻底失去章节定位。
挂外壳带出一个真实风险:window.print() 打的是整篇,而 .chat-app /
.chat-panel 是 height:100%;overflow:hidden,会把九节报告裁成一页。阅读
页因此多挂一条 media="print" 样式,把外壳既隐藏又解锁。放组件里而不是
globals.css:它只在阅读页挂载期存在,对话页的打印不受影响,也不用
:has() 去够祖先,更不越界到并行轮次的 CSS 区段。
纸面三个 token 一个没动,--report-accent 仍是 #85432f;目录栏用应用
调色板,因为它是 chrome 不是纸。report-chart-grid-rehype.ts 一行未动,
新增断言守住它仍然接线(BUG-616/617)。
tsc 0 错;lint 0 error / 118 warning(未增);3350→3355 条,0 条既有
断言被改,31 条无 Docker 失败与基线逐条一致;四个路由渲染标记不变,
/ 首屏 gzip −0.58%。
「20 张盘以上不重叠、滚动不卡」与「挂外壳后的打印真实输出」无真机做
不了,已写成环境缺口,清单在 docs/testing/cend-report-20260916.md。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0193vBv6w5MV2cifdTUu9H5P
This commit is contained in:
co-authored by
Claude Opus 5
parent
c3bcddb652
commit
a1a78c7ebc
@@ -3444,19 +3444,28 @@ button.nav-rail-identity:hover { background: var(--sidebar-accent); }
|
||||
font-size: var(--type-body-sm);
|
||||
}
|
||||
.report-center-section-heading button:hover { color: var(--color-action); }
|
||||
.report-center-list { display: grid; gap: var(--space-3); }
|
||||
.report-center-card {
|
||||
/* Row list, not a card grid. A card grid costs one scan per card; past five or
|
||||
six reports the status is what the reader is looking for, and a single column
|
||||
of rows puts every status chip on the same x. D12. */
|
||||
.report-center-list {
|
||||
display: grid;
|
||||
gap: 1px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-lg);
|
||||
/* The 1px gap shows this through: one hairline per row, no double borders. */
|
||||
background: var(--color-border);
|
||||
}
|
||||
.report-center-row {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: var(--space-6);
|
||||
padding: var(--space-5);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-lg);
|
||||
gap: var(--space-5);
|
||||
padding: var(--space-4) var(--space-5);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
.report-center-card-body { min-width: 0; display: grid; gap: var(--space-1); }
|
||||
.report-center-row-main { min-width: 0; display: grid; gap: var(--space-1); }
|
||||
.report-center-status {
|
||||
width: fit-content;
|
||||
display: inline-flex;
|
||||
@@ -3469,33 +3478,53 @@ button.nav-rail-identity:hover { background: var(--sidebar-accent); }
|
||||
font-size: var(--type-caption);
|
||||
font-weight: 500;
|
||||
}
|
||||
/* The status dot. It carries the state at a glance; the three chips used to be
|
||||
told apart only by their fill, which is a weak signal at caption size. */
|
||||
.report-center-status::before {
|
||||
content: "";
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
}
|
||||
.report-center-status.is-ready { background: var(--color-success-muted); color: var(--color-success); }
|
||||
.report-center-status.is-generating { background: var(--color-action-soft); color: var(--color-action); }
|
||||
.report-center-status.is-failed,
|
||||
.report-center-failure { background: var(--color-danger-muted); color: var(--color-danger); }
|
||||
/* The failure reason reads inside the row now, under the meta line, instead of
|
||||
being a right-hand block competing with the row's action. */
|
||||
.report-center-failure {
|
||||
max-width: 220px;
|
||||
padding: 8px 12px;
|
||||
width: fit-content;
|
||||
max-width: 100%;
|
||||
margin: var(--space-1) 0 0;
|
||||
padding: 6px 10px;
|
||||
border-radius: var(--radius-sm);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--type-caption);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.report-center-card h3 {
|
||||
.report-center-row h3 {
|
||||
margin: 0;
|
||||
color: var(--color-ink);
|
||||
font-family: var(--font-body);
|
||||
font-size: var(--type-title-md);
|
||||
font-weight: 500;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.report-center-card p {
|
||||
.report-center-row-meta {
|
||||
margin: 0;
|
||||
color: var(--color-ink-tertiary);
|
||||
font-size: var(--type-caption);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.report-center-row-note {
|
||||
max-width: 62ch;
|
||||
margin: 0;
|
||||
color: var(--color-ink-secondary);
|
||||
font-size: var(--type-body-sm);
|
||||
line-height: 1.55;
|
||||
}
|
||||
.report-center-card small { color: var(--color-ink-tertiary); font-size: var(--type-caption); }
|
||||
.report-center-card-actions {
|
||||
.report-center-row-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
@@ -3564,10 +3593,8 @@ button.nav-rail-identity:hover { background: var(--sidebar-accent); }
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.report-center-hero { grid-template-columns: 1fr; align-items: start; gap: var(--space-6); padding-block: var(--space-8) var(--space-6); }
|
||||
.report-center-card { grid-template-columns: 1fr; gap: var(--space-4); }
|
||||
.report-center-card-actions,
|
||||
.report-center-card > a,
|
||||
.report-center-card > button,
|
||||
.report-center-row { grid-template-columns: 1fr; gap: var(--space-3); }
|
||||
.report-center-row-actions { justify-content: flex-start; justify-self: start; }
|
||||
.report-center-failure { justify-self: start; }
|
||||
.report-center-export-error { text-align: left; }
|
||||
.report-center-section-heading { align-items: center; }
|
||||
@@ -3595,23 +3622,33 @@ button.nav-rail-identity:hover { background: var(--sidebar-accent); }
|
||||
background: var(--color-canvas-soft);
|
||||
}
|
||||
.personal-report-reader-body { width: min(1120px, 100%); margin: 0 auto; padding: 0 var(--space-6) var(--space-16); }
|
||||
/* The rail sits to the right of the paper, and stays there: a report is nine
|
||||
sections and twenty-odd charts, so the reader needs to see where they are
|
||||
without scrolling back. Placement is explicit rather than DOM-ordered, so the
|
||||
narrow-screen drawer can keep coming first in the source. D11. */
|
||||
.personal-report-md-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
|
||||
grid-template-columns: minmax(0, 1fr) minmax(11rem, 15rem);
|
||||
gap: var(--space-6);
|
||||
align-items: start;
|
||||
}
|
||||
.personal-report-md-article { grid-column: 1; grid-row: 1; }
|
||||
.personal-report-toc {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
position: sticky;
|
||||
/* The report's own action bar is sticky at the top of the same scroller and
|
||||
runs ~54px tall; 72px clears it. */
|
||||
top: 72px;
|
||||
max-height: calc(100vh - 96px);
|
||||
/* The shell's 46px header is outside the scroller, so the rail's cap has to
|
||||
allow for it on top of the action bar it is already clearing. */
|
||||
max-height: calc(100vh - 150px);
|
||||
overflow: auto;
|
||||
padding: var(--space-3);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--color-canvas);
|
||||
padding: var(--space-2) 0 var(--space-3);
|
||||
}
|
||||
.personal-report-toc ol {
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
@@ -3619,18 +3656,30 @@ button.nav-rail-identity:hover { background: var(--sidebar-accent); }
|
||||
.personal-report-toc li[data-level="3"] { padding-left: var(--space-3); }
|
||||
.personal-report-toc a {
|
||||
display: block;
|
||||
padding: 4px 0;
|
||||
padding: 6px var(--space-2);
|
||||
border-left: 2px solid transparent;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--color-ink-secondary);
|
||||
font-size: var(--type-caption);
|
||||
line-height: 1.45;
|
||||
text-decoration: none;
|
||||
}
|
||||
.personal-report-toc a.is-current,
|
||||
/* The rail is app chrome, not paper, so it reads in the app palette. The three
|
||||
--report-* tokens stay off it by design (D11/D3). */
|
||||
.personal-report-toc a.is-current {
|
||||
border-left-color: var(--color-action);
|
||||
background: var(--color-canvas-muted);
|
||||
color: var(--color-ink);
|
||||
}
|
||||
.personal-report-toc a:hover { color: var(--color-ink); }
|
||||
.personal-report-toc-drawer { display: none; }
|
||||
.personal-report-toc-desktop p {
|
||||
margin: 0 0 var(--space-2);
|
||||
padding: 0 var(--space-2);
|
||||
color: var(--color-ink-tertiary);
|
||||
font-size: var(--type-caption);
|
||||
font-weight: 600;
|
||||
font-weight: 500;
|
||||
letter-spacing: .08em;
|
||||
}
|
||||
.personal-report-md-article {
|
||||
min-width: 0;
|
||||
@@ -3688,7 +3737,19 @@ button.nav-rail-identity:hover { background: var(--sidebar-accent); }
|
||||
body. 860 is the content width of that rail, not a device cut. */
|
||||
@media (max-width: 860px) {
|
||||
.personal-report-md-layout { grid-template-columns: 1fr; }
|
||||
.personal-report-toc { position: static; max-height: none; }
|
||||
.personal-report-md-article { grid-column: auto; grid-row: auto; }
|
||||
/* The persistent rail is gone below this width; what is left is the collapsed
|
||||
drawer, which needs the box the rail no longer draws. */
|
||||
.personal-report-toc {
|
||||
grid-column: auto;
|
||||
grid-row: auto;
|
||||
position: static;
|
||||
max-height: none;
|
||||
padding: var(--space-3);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
.personal-report-toc-desktop { display: none; }
|
||||
.personal-report-toc-drawer { display: block; }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { Check, Clock3, FileText, RefreshCw, TriangleAlert } from "lucide-react";
|
||||
import { Clock3, FileText, RefreshCw } from "lucide-react";
|
||||
import { InlineSpinner } from "@/components/inline-spinner";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
@@ -87,10 +87,14 @@ function formatDate(value: string): string {
|
||||
}).format(date);
|
||||
}
|
||||
|
||||
function StatusIcon({ status }: { status: ReportListItem["status"] }) {
|
||||
if (status === "generating") return <InlineSpinner size={16} />;
|
||||
if (status === "ready") return <Check aria-hidden="true" className="size-4" />;
|
||||
return <TriangleAlert aria-hidden="true" className="size-4" />;
|
||||
/**
|
||||
* One row's quiet second line. Only what the list endpoint actually returns:
|
||||
* `GET /api/reports` carries no section or chart counts, so the row says the
|
||||
* creation time, the depth and the requested themes and nothing more. Inventing
|
||||
* 「9 节 · 22 张盘」 on the client would be a made-up number (VOICE.md 第 2 条).
|
||||
*/
|
||||
function rowMeta(report: ReportListItem): string {
|
||||
return `${formatDate(report.createdAt)} · ${report.depth} · ${report.themes.join(" / ") || "综合主题"}`;
|
||||
}
|
||||
|
||||
export function PersonalReportCenter() {
|
||||
@@ -219,21 +223,29 @@ export function PersonalReportCenter() {
|
||||
<div className="report-center-list">
|
||||
{state.reports.map((report) => {
|
||||
const copy = STATUS_COPY[report.status];
|
||||
const note = report.status === "ready"
|
||||
? report.cardSummary
|
||||
: report.status === "generating"
|
||||
? copy.description
|
||||
: null;
|
||||
return (
|
||||
<article className="report-center-card" key={report.id}>
|
||||
<div className="report-center-card-body">
|
||||
<div className={`report-center-status is-${report.status}`} role={report.status === "generating" ? "status" : undefined}>
|
||||
<StatusIcon status={report.status} />{copy.label}
|
||||
</div>
|
||||
<article className={`report-center-row is-${report.status}`} key={report.id}>
|
||||
<div className="report-center-row-main">
|
||||
<span
|
||||
className={`report-center-status is-${report.status}`}
|
||||
role={report.status === "generating" ? "status" : undefined}
|
||||
>
|
||||
{copy.label}
|
||||
</span>
|
||||
<h3>{report.reportType === "personal_thematic" ? "个人主题报告" : "个人完整报告"}</h3>
|
||||
<p>{report.status === "ready" && report.cardSummary ? report.cardSummary : copy.description}</p>
|
||||
<small>{formatDate(report.createdAt)} · {report.depth} · {report.themes.join(" / ") || "综合主题"}</small>
|
||||
<p className="report-center-row-meta">{rowMeta(report)}</p>
|
||||
{note ? <p className="report-center-row-note">{note}</p> : null}
|
||||
{report.status === "failed" ? (
|
||||
<p className="report-center-failure">{report.failureSummary ?? report.failureCode ?? "生成失败"}</p>
|
||||
) : null}
|
||||
</div>
|
||||
{report.status === "ready" ? (
|
||||
<div className="report-center-card-actions">
|
||||
<Button render={<Link href={`/reports/${encodeURIComponent(report.id)}`} />} nativeButton={false} variant="outline">
|
||||
查看报告
|
||||
</Button>
|
||||
<div className="report-center-row-actions">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
@@ -243,6 +255,9 @@ export function PersonalReportCenter() {
|
||||
{exportingReportId === report.id ? <InlineSpinner size={14} /> : null}
|
||||
{PERSONAL_REPORT_EXPORT_LABEL}
|
||||
</Button>
|
||||
<Button render={<Link href={`/reports/${encodeURIComponent(report.id)}`} />} nativeButton={false} variant="outline">
|
||||
查看报告
|
||||
</Button>
|
||||
{exportError?.reportId === report.id ? (
|
||||
<span className="report-center-export-error" role="alert">
|
||||
{exportError.message}
|
||||
@@ -250,12 +265,12 @@ export function PersonalReportCenter() {
|
||||
) : null}
|
||||
</div>
|
||||
) : report.status === "generating" ? (
|
||||
<Button render={<Link href={`/reports/${encodeURIComponent(report.id)}`} />} nativeButton={false} variant="ghost">
|
||||
查看进度
|
||||
</Button>
|
||||
) : (
|
||||
<span className="report-center-failure">{report.failureSummary ?? report.failureCode ?? "生成失败"}</span>
|
||||
)}
|
||||
<div className="report-center-row-actions">
|
||||
<Button render={<Link href={`/reports/${encodeURIComponent(report.id)}`} />} nativeButton={false} variant="outline">
|
||||
查看进度
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Clock3, TriangleAlert } from "lucide-react";
|
||||
|
||||
import { InlineSpinner } from "@/components/inline-spinner";
|
||||
|
||||
import { SecondaryShell } from "@/components/secondary-shell";
|
||||
import { ReportActions } from "./report-actions";
|
||||
import { PersonalReportMarkdownView } from "./personal-report-markdown-view";
|
||||
import { PersonalReportProgressPanel } from "./personal-report-progress-panel";
|
||||
@@ -169,6 +170,23 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The reader renders inside the app shell now (nav rail + 46px header), the same
|
||||
* one /chart, /ephemeris and /reports carry. Printing takes the whole document,
|
||||
* so the shell has to be neutralised on paper — not only hidden but unlocked:
|
||||
* `.chat-app` and `.chat-panel` are `height: 100%; overflow: hidden`, which would
|
||||
* clip a nine-section report down to one page.
|
||||
*
|
||||
* It lives here rather than in globals.css on purpose. This style tag exists only
|
||||
* while the reader is mounted, so the chat page's own print behaviour is
|
||||
* untouched and no other surface has to know about it.
|
||||
*/
|
||||
const REPORT_SHELL_PRINT_CSS = ".chat-app, .chat-panel, [data-slot='sidebar-inset']"
|
||||
+ " { display: block !important; width: auto !important; height: auto !important;"
|
||||
+ " min-height: 0 !important; overflow: visible !important; }"
|
||||
+ " [data-slot='sidebar'], [data-slot='sidebar-rail'], [data-slot='sidebar-scrim'], .chat-header"
|
||||
+ " { display: none !important; }";
|
||||
|
||||
/** Wall-clock budget for one uninterrupted wait: 8 minutes, then we stop and say so. */
|
||||
export const POLL_BUDGET_MS = 8 * 60 * 1000;
|
||||
const POLL_TICK_MS = 1000;
|
||||
@@ -298,137 +316,156 @@ export function PersonalReportPage({ reportId }: { reportId: string }) {
|
||||
: null;
|
||||
const writing = progress?.stage === "writing";
|
||||
return (
|
||||
<main className="personal-report-state">
|
||||
{writing ? null : <InlineSpinner className="text-primary" size={32} />}
|
||||
<p role="status" className={writing ? "personal-report-progress-headline" : undefined}>
|
||||
{generating ? (progress?.headline ?? PERSONAL_REPORT_GENERATING_COPY) : "正在加载报告…"}
|
||||
</p>
|
||||
{progress && writing && <PersonalReportProgressPanel progress={progress} />}
|
||||
{generating && (
|
||||
<>
|
||||
<p>已等待 {formatWaitedDuration(waitedMs)}</p>
|
||||
<p>生成完成后页面会自动显示;你也可以返回报告中心,后台会继续处理。</p>
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="ghost">返回报告中心</Button>
|
||||
</>
|
||||
)}
|
||||
</main>
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-state">
|
||||
{writing ? null : <InlineSpinner className="text-primary" size={32} />}
|
||||
<p role="status" className={writing ? "personal-report-progress-headline" : undefined}>
|
||||
{generating ? (progress?.headline ?? PERSONAL_REPORT_GENERATING_COPY) : "正在加载报告…"}
|
||||
</p>
|
||||
{progress && writing && <PersonalReportProgressPanel progress={progress} />}
|
||||
{generating && (
|
||||
<>
|
||||
<p>已等待 {formatWaitedDuration(waitedMs)}</p>
|
||||
<p>生成完成后页面会自动显示;你也可以返回报告中心,后台会继续处理。</p>
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="ghost">返回报告中心</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (state.phase === "timed-out") {
|
||||
return (
|
||||
<main className="personal-report-state">
|
||||
<Clock3 aria-hidden="true" className="size-8 text-ink-secondary" />
|
||||
<h1>生成时间超出预期</h1>
|
||||
<p>已等待 {formatWaitedDuration(waitedMs)},页面已暂停自动刷新。</p>
|
||||
<p>报告仍在后台生成,不会因为你离开而中断。你可以继续等待,也可以稍后回到报告中心查看结果。</p>
|
||||
<div className="flex flex-wrap items-center justify-center gap-3">
|
||||
<Button type="button" variant="default" onClick={() => keepWaiting()}>
|
||||
继续等待
|
||||
</Button>
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="outline">
|
||||
返回报告中心
|
||||
</Button>
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-state">
|
||||
<Clock3 aria-hidden="true" className="size-8 text-ink-secondary" />
|
||||
<h1>生成时间超出预期</h1>
|
||||
<p>已等待 {formatWaitedDuration(waitedMs)},页面已暂停自动刷新。</p>
|
||||
<p>报告仍在后台生成,不会因为你离开而中断。你可以继续等待,也可以稍后回到报告中心查看结果。</p>
|
||||
<div className="flex flex-wrap items-center justify-center gap-3">
|
||||
<Button type="button" variant="default" onClick={() => keepWaiting()}>
|
||||
继续等待
|
||||
</Button>
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="outline">
|
||||
返回报告中心
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (state.phase === "unauthorized") {
|
||||
return (
|
||||
<main className="personal-report-state">
|
||||
<h1>请先登录</h1>
|
||||
<p>个人报告仅对登录用户开放。请登录后重试。</p>
|
||||
<Button render={<Link href="/login" />} nativeButton={false} variant="default">
|
||||
去登录
|
||||
</Button>
|
||||
</main>
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-state">
|
||||
<h1>请先登录</h1>
|
||||
<p>个人报告仅对登录用户开放。请登录后重试。</p>
|
||||
<Button render={<Link href="/login" />} nativeButton={false} variant="default">
|
||||
去登录
|
||||
</Button>
|
||||
</div>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (state.phase === "not-found") {
|
||||
return (
|
||||
<main className="personal-report-state">
|
||||
<h1>报告不存在</h1>
|
||||
<p>该报告不存在、已删除,或不属于当前账号。</p>
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="outline">
|
||||
返回报告中心
|
||||
</Button>
|
||||
</main>
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-state">
|
||||
<h1>报告不存在</h1>
|
||||
<p>该报告不存在、已删除,或不属于当前账号。</p>
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="outline">
|
||||
返回报告中心
|
||||
</Button>
|
||||
</div>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (state.phase === "failed") {
|
||||
return (
|
||||
<main className="personal-report-state">
|
||||
<TriangleAlert aria-hidden="true" className="size-8 text-warning" />
|
||||
<h1>报告生成失败</h1>
|
||||
<p>{state.failureSummary ?? "生成过程中出现问题,未产出可用报告。请稍后重试。"}</p>
|
||||
{state.failureCode && (
|
||||
<p>错误码:{state.failureCode}</p>
|
||||
)}
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="outline">
|
||||
返回报告中心重新生成
|
||||
</Button>
|
||||
</main>
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-state">
|
||||
<TriangleAlert aria-hidden="true" className="size-8 text-warning" />
|
||||
<h1>报告生成失败</h1>
|
||||
<p>{state.failureSummary ?? "生成过程中出现问题,未产出可用报告。请稍后重试。"}</p>
|
||||
{state.failureCode && (
|
||||
<p>错误码:{state.failureCode}</p>
|
||||
)}
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="outline">
|
||||
返回报告中心重新生成
|
||||
</Button>
|
||||
</div>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (state.phase === "invalid" || state.phase === "network-error") {
|
||||
return (
|
||||
<main className="personal-report-state">
|
||||
<TriangleAlert aria-hidden="true" className="size-8 text-danger" />
|
||||
<h1>报告暂时无法显示</h1>
|
||||
<p>
|
||||
{state.phase === "invalid"
|
||||
? `报告数据未通过校验(${state.message}),已停止渲染。`
|
||||
: "网络连接失败,请检查网络后重试。"}
|
||||
</p>
|
||||
<Button type="button" variant="outline" onClick={() => void reload()}>
|
||||
重新加载
|
||||
</Button>
|
||||
</main>
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-state">
|
||||
<TriangleAlert aria-hidden="true" className="size-8 text-danger" />
|
||||
<h1>报告暂时无法显示</h1>
|
||||
<p>
|
||||
{state.phase === "invalid"
|
||||
? `报告数据未通过校验(${state.message}),已停止渲染。`
|
||||
: "网络连接失败,请检查网络后重试。"}
|
||||
</p>
|
||||
<Button type="button" variant="outline" onClick={() => void reload()}>
|
||||
重新加载
|
||||
</Button>
|
||||
</div>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (state.phase === "legacy-unavailable") {
|
||||
return (
|
||||
<main className="personal-report-state">
|
||||
<TriangleAlert aria-hidden="true" className="size-8 text-warning" />
|
||||
<h1>旧版本报告</h1>
|
||||
<p>{PERSONAL_REPORT_LEGACY_PLACEHOLDER}</p>
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="outline">
|
||||
返回报告中心重新生成
|
||||
</Button>
|
||||
</main>
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-state">
|
||||
<TriangleAlert aria-hidden="true" className="size-8 text-warning" />
|
||||
<h1>旧版本报告</h1>
|
||||
<p>{PERSONAL_REPORT_LEGACY_PLACEHOLDER}</p>
|
||||
<Button render={<Link href="/reports" />} nativeButton={false} variant="outline">
|
||||
返回报告中心重新生成
|
||||
</Button>
|
||||
</div>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (state.phase !== "markdown-ready") {
|
||||
return (
|
||||
<main className="personal-report-state">
|
||||
<TriangleAlert aria-hidden="true" className="size-8 text-danger" />
|
||||
<h1>报告暂时无法显示</h1>
|
||||
<p>报告状态无法识别。</p>
|
||||
<Button type="button" variant="outline" onClick={() => void reload()}>
|
||||
重新加载
|
||||
</Button>
|
||||
</main>
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-state">
|
||||
<TriangleAlert aria-hidden="true" className="size-8 text-danger" />
|
||||
<h1>报告暂时无法显示</h1>
|
||||
<p>报告状态无法识别。</p>
|
||||
<Button type="button" variant="outline" onClick={() => void reload()}>
|
||||
重新加载
|
||||
</Button>
|
||||
</div>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="personal-report-reader">
|
||||
<style media="print">{"@page { size: A4; margin: 13mm 12mm 14mm; }"}</style>
|
||||
<ReportActions
|
||||
reportId={state.reportId || reportId}
|
||||
reportTitle="个人报告"
|
||||
markdown={state.markdown}
|
||||
reportDate={state.createdAt}
|
||||
/>
|
||||
<div className="personal-report-reader-body">
|
||||
<PersonalReportMarkdownView markdown={state.markdown} />
|
||||
<SecondaryShell title="个人报告">
|
||||
<div className="personal-report-reader">
|
||||
<style media="print">{"@page { size: A4; margin: 13mm 12mm 14mm; }"}</style>
|
||||
<style media="print">{REPORT_SHELL_PRINT_CSS}</style>
|
||||
<ReportActions
|
||||
reportId={state.reportId || reportId}
|
||||
reportTitle="个人报告"
|
||||
markdown={state.markdown}
|
||||
reportDate={state.createdAt}
|
||||
/>
|
||||
<div className="personal-report-reader-body">
|
||||
<PersonalReportMarkdownView markdown={state.markdown} />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</SecondaryShell>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user