fix(web): 审稿页支持切换章节并打通验收后审下一章

This commit is contained in:
Yaojia Wang
2026-06-29 16:52:43 +02:00
parent a2849bf6b7
commit ab3f9e17b1
3 changed files with 83 additions and 14 deletions

View File

@@ -2,6 +2,7 @@
import { useEffect, useMemo, useRef, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import {
AlertTriangle,
CheckCircle2,
@@ -12,6 +13,9 @@ import {
import { AppShell } from "@/components/AppShell";
import { Badge } from "@/components/ui/Badge";
import { Button } from "@/components/ui/Button";
import { Select } from "@/components/ui/Select";
import { reviewChapterHref, reviewChapterOptions } from "@/lib/review/chapterNav";
import type { ChapterEntry } from "@/lib/workbench/chapter";
import type { ProjectResponse, ReviewHistoryItem } from "@/lib/api/types";
import { friendlyError } from "@/lib/errors/messages";
import {
@@ -62,6 +66,8 @@ interface ReviewReportProps {
chapterNo: number;
initialReview: ReviewHistoryItem | undefined;
initialDraft: string;
// 章节导航目录(大纲章节):用于报告头部的「切换审稿章节」选择器。
chapters?: ChapterEntry[];
}
// 审稿报告页主体UX §6.4 / §8.3 / §9
@@ -72,7 +78,9 @@ export function ReviewReport({
chapterNo,
initialReview,
initialDraft,
chapters,
}: ReviewReportProps) {
const router = useRouter();
const review = useReviewStream();
const accept = useAccept();
const conflictFix = useRefine(); // 采纳无补丁冲突时,临时调 AI 重写定位段
@@ -403,6 +411,23 @@ export function ReviewReport({
<h1 className="min-w-0 flex-1 truncate font-serif text-lg text-ink">
{chapterNo} 稿
</h1>
<Select
controlSize="sm"
aria-label="切换审稿章节"
className="hidden max-w-[12rem] shrink-0 sm:block"
value={chapterNo}
onChange={(e) =>
router.push(
reviewChapterHref(project.id, Number(e.target.value)),
)
}
>
{reviewChapterOptions(chapters ?? [], chapterNo).map((opt) => (
<option key={opt.no} value={opt.no}>
{opt.label}
</option>
))}
</Select>
<span className="hidden shrink-0 font-mono text-xs text-ink-soft sm:inline">
{conflictCount}
</span>