支持浏览器侧素材快照撰写、拒绝报告读时修复、Mermaid PNG 导出与 Word 导出加固。 Co-authored-by: Cursor <cursoragent@cursor.com>
78 lines
3.0 KiB
TypeScript
78 lines
3.0 KiB
TypeScript
"use client";
|
|
|
|
import { ArrowLeft, FileText, MessageSquarePlus, Square } from "lucide-react";
|
|
|
|
import type { PagePhase } from "@/report-collaboration/state/selectors";
|
|
|
|
const PHASE_BADGES: Record<PagePhase, { label: string; color: string; bg: string }> = {
|
|
empty: { label: "新会话", color: "var(--rc-text-secondary)", bg: "transparent" },
|
|
clarifying: { label: "澄清需求", color: "var(--rc-waiting)", bg: "rgba(217, 119, 6, 0.1)" },
|
|
planning: { label: "生成方案", color: "var(--rc-running)", bg: "rgba(37, 99, 235, 0.1)" },
|
|
proposal_ready: { label: "待确认方案", color: "var(--rc-accent)", bg: "rgb(var(--rc-accent-rgb) / 10%)" },
|
|
running: { label: "协作中", color: "var(--rc-running)", bg: "rgba(37, 99, 235, 0.1)" },
|
|
awaiting_input: { label: "等待输入", color: "var(--rc-waiting)", bg: "rgba(217, 119, 6, 0.1)" },
|
|
reviewing: { label: "审稿中", color: "var(--rc-running)", bg: "rgba(37, 99, 235, 0.1)" },
|
|
completed: { label: "已完成", color: "var(--rc-success)", bg: "rgba(22, 163, 74, 0.1)" },
|
|
failed: { label: "失败", color: "var(--rc-danger)", bg: "rgba(220, 38, 38, 0.1)" },
|
|
cancelled: { label: "已取消", color: "var(--rc-text-secondary)", bg: "transparent" },
|
|
};
|
|
|
|
interface ReportCollaborationHeaderProps {
|
|
title: string;
|
|
phase: PagePhase;
|
|
onBack: () => void;
|
|
onNewSession: () => void;
|
|
onOpenReport: () => void;
|
|
hasReport: boolean;
|
|
running: boolean;
|
|
onCancelRun: () => void;
|
|
extra?: React.ReactNode;
|
|
}
|
|
|
|
/** 顶栏:返回 / 标题+状态 / 报告 / 停止 / 新建(右侧由布局注入窄屏切换等)。 */
|
|
export function ReportCollaborationHeader({
|
|
title,
|
|
phase,
|
|
onBack,
|
|
onNewSession,
|
|
onOpenReport,
|
|
hasReport,
|
|
running,
|
|
onCancelRun,
|
|
extra,
|
|
}: ReportCollaborationHeaderProps) {
|
|
const badge = PHASE_BADGES[phase] ?? PHASE_BADGES.empty;
|
|
return (
|
|
<header className="rc-header">
|
|
<div className="flex min-w-0 items-center gap-2">
|
|
<button type="button" className="rc-btn !min-h-8 !px-2" onClick={onBack} aria-label="返回工作台">
|
|
<ArrowLeft className="size-4" />
|
|
</button>
|
|
<span className="rc-header-title" title={title}>
|
|
报告协作 / {title}
|
|
</span>
|
|
<span className="rc-chip" style={{ background: badge.bg, color: badge.color }}>
|
|
{badge.label}
|
|
</span>
|
|
</div>
|
|
<div className="flex shrink-0 items-center gap-2">
|
|
{extra}
|
|
<button type="button" className="rc-btn" onClick={onOpenReport} disabled={!hasReport}>
|
|
<FileText className="size-3.5" aria-hidden />
|
|
报告
|
|
</button>
|
|
{running ? (
|
|
<button type="button" className="rc-btn rc-btn-danger" onClick={onCancelRun}>
|
|
<Square className="size-3.5" aria-hidden />
|
|
停止
|
|
</button>
|
|
) : null}
|
|
<button type="button" className="rc-btn" onClick={onNewSession}>
|
|
<MessageSquarePlus className="size-3.5" aria-hidden />
|
|
新建
|
|
</button>
|
|
</div>
|
|
</header>
|
|
);
|
|
}
|