24 lines
692 B
TypeScript
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} 章`,
|
|
}));
|
|
}
|