Skip to content
File

Blob: src/sites/types.ts

typescript64 lines
1import type { ReactNode } from "react";
2 
3import type { PageMentionPresentationProps } from "@/shared/editor/presentation/page-mention";
4import type { OutlineItem } from "@/shared/editor/presentation/outline";
5import type { EditorTextMetrics } from "@/shared/editor/schema/metrics";
6 
7export interface SiteIdentity {
8 workspaceName: string;
9 workspaceIcon: string | null;
10 currentIsHome: boolean;
11 homeHref: string;
12}
13 
14export interface SiteNotFoundIdentity {
15 workspaceName: string;
16 workspaceIcon: string | null;
17 homeHref: string;
18}
19 
20export interface SiteDocumentAssets {
21 stylesheetHref: string;
22 fontStylesheetHref: string;
23 scriptSrc: string | null;
24 modulePreloadHrefs: string[];
25}
26 
27export interface SitePageRenderState {
28 title: string;
29 icon: string | null;
30 coverUrl: string | null;
31 ogImage: SiteOgImage | null;
32 outline: OutlineItem[];
33 metrics: EditorTextMetrics;
34 description?: string | null;
35 site: SiteIdentity;
36 canonicalUrl: string;
37}
38 
39export interface SitePageDocumentProps {
40 children: ReactNode;
41}
42 
43export interface SiteOgImage {
44 url: string;
45 type: string;
46 width: number;
47 height: number;
48}
49 
50export interface NotFoundDocumentProps {
51 site: SiteNotFoundIdentity | null;
52 assets: SiteDocumentAssets;
53}
54 
55export interface ApexDocumentProps {
56 assets: SiteDocumentAssets;
57}
58 
59export type SitesPageMentionRenderInfo = Pick<PageMentionPresentationProps, "ariaLabel" | "href" | "icon" | "kind"> & {
60 label: string;
61};
62 
63export type SitesPageMentionResolver = (pageId: string) => SitesPageMentionRenderInfo;