Files
writer-work-flow/apps/web/lib/review/chapterNav.ts
2026-06-29 12:06:04 +02:00

24 lines
692 B
TypeScript

import type { ChapterEntry } from "@/lib/workbench/chapter";
import { buildChapterEntries } from "@/lib/workbench/chapter";
export interface ReviewChapterOption {
no: number;
label: string;
}
export function reviewChapterHref(projectId: string, chapterNo: number): string {
return `/projects/${projectId}/review?chapter=${chapterNo}`;
}
export function reviewChapterOptions(
chapters: readonly ChapterEntry[],
currentChapterNo: number,
): ReviewChapterOption[] {
return buildChapterEntries(chapters, currentChapterNo).map((chapter) => ({
no: chapter.no,
label: chapter.title
? `${chapter.no} 章 · ${chapter.title}`
: `${chapter.no}`,
}));
}