53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import {
|
|
getBookMeta,
|
|
getIntroSegments,
|
|
getIntroSegment,
|
|
getChapter,
|
|
getContent,
|
|
getSidebarItems,
|
|
type BookMeta,
|
|
type IntroSegment,
|
|
type Chapter,
|
|
type SidebarItem,
|
|
} from "@/lib/books";
|
|
|
|
const CODE = "te";
|
|
|
|
export type TeMeta = BookMeta;
|
|
export type TeEssayEntry = { slug: string; title: string; order: number };
|
|
export type TeIntroSegment = IntroSegment;
|
|
export type TeEssay = Chapter;
|
|
export type TeChapter = Chapter;
|
|
export type TeSidebarItem = SidebarItem;
|
|
|
|
export async function getTeMeta() {
|
|
return getBookMeta(CODE);
|
|
}
|
|
export async function getTeIntroSegments() {
|
|
return getIntroSegments(CODE);
|
|
}
|
|
export async function getTeIntroSegment(slug: string) {
|
|
return getIntroSegment(CODE, slug);
|
|
}
|
|
export async function getTeChapter(slug: string) {
|
|
return getChapter(CODE, slug);
|
|
}
|
|
export async function getTeContent(slug: string) {
|
|
return getContent(CODE, slug);
|
|
}
|
|
export async function getTeSidebarItems() {
|
|
return getSidebarItems(CODE);
|
|
}
|
|
|
|
export async function getTeEssays(): Promise<TeEssay[]> {
|
|
const items = await getIntroSegments(CODE);
|
|
return items as unknown as TeEssay[];
|
|
}
|
|
|
|
export async function getTeEssay(slug: string): Promise<TeEssay | null> {
|
|
const chapter = await getChapter(CODE, slug);
|
|
if (chapter) return chapter;
|
|
const intro = await getIntroSegment(CODE, slug);
|
|
return intro as unknown as TeEssay | null;
|
|
}
|