diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-02 18:36:09 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-02 18:36:09 +0200 |
| commit | ca921d7536cfe950b5a7d442977bbf900b48faf4 (patch) | |
| tree | 2e8bb3f4b81414ee881c3d92d9bdfed411c569db /src/ts/types/app.ts | |
| parent | 9308a6dce03bd0c616e0ba6fec227473aaa44b33 (diff) | |
chore: fetch posts for rss feed
Diffstat (limited to 'src/ts/types/app.ts')
| -rw-r--r-- | src/ts/types/app.ts | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts new file mode 100644 index 0000000..b09f3d5 --- /dev/null +++ b/src/ts/types/app.ts @@ -0,0 +1,86 @@ +export type AuthorKind = 'page' | 'comment'; + +export type Author<T extends AuthorKind> = { + avatar?: Image; + description?: T extends 'page' ? string | undefined : never; + name: string; + website?: string; +}; + +export type CommentMeta = { + author: Author<'comment'>; + date: string; +}; + +export type Comment = { + approved: boolean; + content: string; + id: number; + meta: CommentMeta; + parentId: number; + replies: Comment[]; +}; + +export type Dates = { + publication: string; + update: string; +}; + +export type Image = { + alt: string; + height: number; + src: string; + title?: string; + width: number; +}; + +export type Repos = { + github?: string; + gitlab?: string; +}; + +export type SEO = { + description: string; + title: string; +}; + +export type PageKind = 'article' | 'project' | 'thematic' | 'topic'; + +export type Meta<T extends PageKind> = { + articles?: T extends 'thematic' | 'topic' ? Article[] : never; + author: Author<'page'>; + commentsCount?: T extends 'article' ? number : never; + cover?: Image; + dates: Dates; + license?: T extends 'projects' ? string : never; + readingTime: number; + repos?: T extends 'projects' ? Repos : never; + seo: SEO; + technologies?: T extends 'projects' ? string[] : never; + thematics?: T extends 'article' | 'topic' ? PageLink[] : never; + topics?: T extends 'article' | 'thematic' ? PageLink[] : never; + website?: T extends 'topic' ? string : never; + wordsCount: number; +}; + +export type Page<T extends PageKind> = { + content: string; + id: number; + intro: string; + meta?: Meta<T>; + slug: string; + title: string; +}; + +export type PageLink = { + id: number; + name: string; + slug: string; +}; + +export type Article = Page<'article'>; +export type ArticleCard = Pick<Article, 'id' | 'slug' | 'title'> & + Pick<Meta<'article'>, 'cover' | 'dates'>; +export type Project = Page<'project'>; +export type Thematic = Page<'thematic'>; +export type Topic = Page<'topic'>; |
