import type { StaticImageData } from 'next/image'; import type { Nullable } from './generics'; import type { GraphQLNode } from './gql'; export type SlugNode = { slug: string; }; //=========================================================================== // Data from WordPress //=========================================================================== type WPSeo = { metaDesc: string; title: string; }; type WPCommentAuthorAvatar = { height: number; url: string; width: number; }; type WPCommentAuthor = { avatar: Nullable; name: string; url: Nullable; }; export type WPCommentStatus = 'APPROVE' | 'HOLD' | 'SPAM' | 'TRASH'; export type WPComment = { approved: boolean; author: GraphQLNode; content: string; databaseId: number; date: string; parentDatabaseId: number; status: WPCommentStatus; }; type WPContentParts = { afterMore: string; beforeMore: string; }; export type WPImage = { altText: Nullable; mediaDetails: { height: number; width: number; }; sourceUrl: string; title: Nullable; }; type WPInfo = { wordsCount: number }; type WPContent = { contentParts: WPContentParts; databaseId: number; date: string; featuredImage: Nullable>; modified: string; seo: WPSeo; slug: string; title: string; }; export type WPPage = WPContent & { info: WPInfo; }; type WPPostAuthor = { name: string }; type WPAcfPosts = { postsInThematic: Nullable; postsInTopic: Nullable; }; export type WPPost = WPContent & { acfPosts: Nullable>; author: GraphQLNode; commentCount: Nullable; info: WPInfo; }; export type WPPostPreview = Pick< WPPost, | 'commentCount' | 'databaseId' | 'date' | 'featuredImage' | 'info' | 'modified' | 'slug' | 'title' > & { acfPosts: | Nullable> | Nullable>; contentParts: Pick; }; export type RecentWPPost = Pick< WPPost, 'date' | 'featuredImage' | 'slug' | 'title' > & { databaseId: number; }; type WPAcfThematics = { postsInThematic: Nullable; }; export type WPThematic = WPContent & { acfThematics: Nullable; }; export type WPThematicPreview = Pick< WPThematic, 'databaseId' | 'slug' | 'title' >; type WPAcfTopics = { officialWebsite: string; postsInTopic: Nullable; }; export type WPTopic = WPContent & { acfTopics: Nullable; }; export type WPTopicPreview = Pick< WPTopic, 'databaseId' | 'featuredImage' | 'slug' | 'title' >; //=========================================================================== // Data from MDX files //=========================================================================== export type MDXData = { file: string; image: MDXImage; }; export type MDXImage = StaticImageData & { alt: string; title?: string; }; export type MDXPageMeta = Omit & { intro: string; title: string; }; export type MDXProjectMeta = Omit & { intro: string; title: string; }; //=========================================================================== // Data used in this application //=========================================================================== export type Dates = { publication: string; update?: string; }; export type SEO = { description: string; title: string; }; export type Img = { alt: string; height: number; src: string; title?: string; width: number; }; export type CommentAuthor = { avatar?: Omit; name: string; website?: string; }; export type CommentMeta = { author: CommentAuthor; date: string; }; export type SingleComment = { content: string; id: number; isApproved: boolean; meta: CommentMeta; parentId?: number; replies: SingleComment[]; }; export type PageMeta = { cover?: Img; dates: Dates; seo: SEO; wordsCount: number; }; export type Page = { content: string; intro: string; slug: string; title: string; }; export type PageLink = { id: number; logo?: Img; name: string; url: string; }; type ArticleMeta = PageMeta & { author?: string; commentsCount?: number; thematics?: PageLink[]; topics?: PageLink[]; }; export type Article = Page & { id: number; meta: ArticleMeta; }; export type ArticlePreview = Pick & { id: number; meta: Omit; }; export type RecentArticle = Pick & Pick & { id: number; publicationDate: string; }; export type Repos = { github?: string; gitlab?: string; }; export type ProjectMeta = Omit & { license?: string; repos?: Repos; tagline?: string; technologies?: string[]; }; export type Project = Omit & { id: string; meta: ProjectMeta; }; export type ProjectPreview = Omit & { meta: Omit; }; export type ThematicMeta = PageMeta & { articles?: ArticlePreview[]; topics?: PageLink[]; }; export type Thematic = Page & { meta: ThematicMeta; }; export type TopicMeta = PageMeta & { articles?: ArticlePreview[]; thematics?: PageLink[]; website?: string; }; export type Topic = Page & { meta: TopicMeta; };