38 lines
891 B
TypeScript
38 lines
891 B
TypeScript
|
|
import type { ChapterViewModel } from './types';
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 与后端 `CHAPTER_ORDER` / `CHAPTER_CATEGORIES` 顺序一致;对应 i18n `memoir.frameworkChapters.*`。
|
|||
|
|
*/
|
|||
|
|
export const FRAMEWORK_CHAPTER_KEYS = [
|
|||
|
|
'chapter1',
|
|||
|
|
'chapter2',
|
|||
|
|
'chapter3',
|
|||
|
|
'chapter4',
|
|||
|
|
'chapter5',
|
|||
|
|
'chapter6',
|
|||
|
|
'chapter7',
|
|||
|
|
'chapter8',
|
|||
|
|
] as const;
|
|||
|
|
|
|||
|
|
export type FrameworkChapterKey = (typeof FRAMEWORK_CHAPTER_KEYS)[number];
|
|||
|
|
|
|||
|
|
export function buildFrameworkChapterPlaceholders(
|
|||
|
|
tr: (key: string) => string,
|
|||
|
|
): ChapterViewModel[] {
|
|||
|
|
return FRAMEWORK_CHAPTER_KEYS.map((key, orderIndex) => ({
|
|||
|
|
id: `framework:${key}`,
|
|||
|
|
title: tr(`frameworkChapters.${key}`),
|
|||
|
|
category: '',
|
|||
|
|
orderIndex,
|
|||
|
|
isEmpty: true,
|
|||
|
|
isNew: false,
|
|||
|
|
hasImages: false,
|
|||
|
|
allImagesReady: false,
|
|||
|
|
pendingImageCount: 0,
|
|||
|
|
failedImageCount: 0,
|
|||
|
|
coverImageUrl: null,
|
|||
|
|
updatedAt: null,
|
|||
|
|
wordCount: 0,
|
|||
|
|
}));
|
|||
|
|
}
|