fix: address ui review follow-ups
This commit is contained in:
23
apps/web/lib/review/chapterNav.ts
Normal file
23
apps/web/lib/review/chapterNav.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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} 章`,
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user