14 lines
468 B
TypeScript
14 lines
468 B
TypeScript
import type { ResolvedSection } from "@/api/types";
|
|
|
|
export interface LibrarySectionLayout {
|
|
hero: ResolvedSection | null;
|
|
rows: ResolvedSection[];
|
|
}
|
|
|
|
export function splitLibrarySections(sections: ResolvedSection[]): LibrarySectionLayout {
|
|
const hero = sections.find((section) => section.featured && section.items.length > 0) ?? null;
|
|
const rows = sections.filter((section) => section.items.length > 0 && section.id !== hero?.id);
|
|
|
|
return { hero, rows };
|
|
}
|