Files
eu/lib/pages/types.ts
T

56 lines
1.5 KiB
TypeScript

export const PAGE_TYPES = ["NEWS"] as const;
export type PageType = typeof PAGE_TYPES[number];
export const PAGE_STATUSES = ["DRAFT", "PUBLISHED", "ARCHIVED"] as const;
export type PageStatus = typeof PAGE_STATUSES[number];
export type PageMeta = {
tags?: string[];
location?: string;
}
export type Page = {
id: string;
slug: string;
title: string;
type: PageType;
status: PageStatus;
meta: PageMeta;
createdAt: Date;
updatedAt: Date;
publishedAt: Date | null;
createdBy: string;
}
export const BLOCK_TYPES = ["PARAGRAPH", "HEADING", "IMAGE", "FILE", "QUOTE", "DIVIDER", "TABLE", "CALLOUT", "LIST", "LINK"] as const;
export type BlockType = typeof BLOCK_TYPES[number];
export type BlockContent =
| { type: "PARAGRAPH"; text: string }
| { type: "HEADING"; text: string; level: 1 | 2 | 3 }
| { type: "IMAGE"; url: string; caption?: string }
| { type: "FILE"; url: string; name: string }
| { type: "QUOTE"; text: string; author?: string }
| { type: "DIVIDER" }
| { type: "TABLE"; headers: string[]; rows: string[][] }
| { type: "CALLOUT"; text: string; icon?: string; color?: string }
| { type: "LIST"; style: "BULLET" | "NUMBERED"; items: string[] }
| { type: "LINK"; text?: string; url: string };
export type Block = {
id: string;
pageId: string;
parentId: string | null;
type: BlockType;
position: number;
content: BlockContent;
}
export type PageVersion = {
id: string;
pageId: string;
title: string;
blocks: Block[];
createdAt: Date;
createdBy: string;
};