diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-23 00:20:08 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-23 00:24:39 +0100 |
| commit | 368fbbf83b913b90cef9dfbe4288e148d589d033 (patch) | |
| tree | e86d6006dec67ffe485cbab5141609759ce7d501 /src/ts | |
| parent | 6d514259dd5e60af83b42f938ea9f6b017b7377f (diff) | |
refactor: rename all subject occurrences into topic
I change the name in graphql endpoint, so I decided to repercute this
change here.
Diffstat (limited to 'src/ts')
| -rw-r--r-- | src/ts/types/app.ts | 16 | ||||
| -rw-r--r-- | src/ts/types/articles.ts | 16 | ||||
| -rw-r--r-- | src/ts/types/taxonomies.ts | 32 |
3 files changed, 30 insertions, 34 deletions
diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts index b2a5cd6..60dd4b8 100644 --- a/src/ts/types/app.ts +++ b/src/ts/types/app.ts @@ -1,16 +1,16 @@ import { NextPage } from 'next'; import { AppProps } from 'next/app'; -import { ComponentType, ReactElement, ReactNode } from 'react'; +import { ReactElement, ReactNode } from 'react'; import { PostBy } from './articles'; import { AllPostsSlug, RawPostsList } from './blog'; import { CommentData, CreateComment } from './comments'; import { ContactData, SendEmail } from './contact'; import { - AllSubjects, - AllSubjectsSlug, + AllTopics, + AllTopicsSlug, AllThematics, AllThematicsSlug, - SubjectBy, + TopicBy, ThematicBy, } from './taxonomies'; @@ -30,7 +30,7 @@ export type AppPropsWithLayout = AppProps & { // API //============================================================================== -export type VariablesType<T> = T extends PostBy | SubjectBy | ThematicBy +export type VariablesType<T> = T extends PostBy | TopicBy | ThematicBy ? Slug : T extends RawPostsList ? CursorPagination @@ -42,13 +42,13 @@ export type VariablesType<T> = T extends PostBy | SubjectBy | ThematicBy export type RequestType = | AllPostsSlug - | AllSubjects - | AllSubjectsSlug + | AllTopics + | AllTopicsSlug | AllThematics | AllThematicsSlug | CreateComment | PostBy - | SubjectBy + | TopicBy | ThematicBy | RawPostsList | SendEmail; diff --git a/src/ts/types/articles.ts b/src/ts/types/articles.ts index 1fb3ec5..da86e10 100644 --- a/src/ts/types/articles.ts +++ b/src/ts/types/articles.ts @@ -2,11 +2,7 @@ import { ContentParts, Dates } from './app'; import { Comment, CommentsNode } from './comments'; import { Cover, RawCover } from './cover'; import { SEO } from './seo'; -import { - RawSubjectPreview, - SubjectPreview, - ThematicPreview, -} from './taxonomies'; +import { RawTopicPreview, TopicPreview, ThematicPreview } from './taxonomies'; export type ArticleAuthor = { firstName: string; @@ -15,12 +11,12 @@ export type ArticleAuthor = { }; export type RawACFPosts = { - postsInSubject: RawSubjectPreview[] | null; + postsInTopic: RawTopicPreview[] | null; postsInThematic: ThematicPreview[] | null; }; export type ACFPosts = { - postsInSubject: SubjectPreview[] | null; + postsInTopic: TopicPreview[] | null; postsInThematic: ThematicPreview[] | null; }; @@ -28,7 +24,7 @@ export type ArticleMeta = { author?: ArticleAuthor; commentCount?: number; dates?: Dates; - subjects?: SubjectPreview[]; + topics?: TopicPreview[]; thematics?: ThematicPreview[]; website?: string; }; @@ -44,7 +40,7 @@ export type Article = { id: string; intro: string; seo: SEO; - subjects: SubjectPreview[] | []; + topics: TopicPreview[] | []; thematics: ThematicPreview[] | []; title: string; }; @@ -64,7 +60,7 @@ export type RawArticle = Pick< export type ArticlePreview = Pick< Article, - 'commentCount' | 'dates' | 'id' | 'intro' | 'subjects' | 'thematics' | 'title' + 'commentCount' | 'dates' | 'id' | 'intro' | 'topics' | 'thematics' | 'title' > & { featuredImage: Cover; slug: string }; export type RawArticlePreview = Pick< diff --git a/src/ts/types/taxonomies.ts b/src/ts/types/taxonomies.ts index a0aaa5e..7d4ad3b 100644 --- a/src/ts/types/taxonomies.ts +++ b/src/ts/types/taxonomies.ts @@ -23,32 +23,32 @@ type TaxonomyPreview = Pick<Taxonomy, 'databaseId' | 'id' | 'seo' | 'title'> & { }; //============================================================================== -// Subjects +// Topics //============================================================================== -export type Subject = Taxonomy & { +export type Topic = Taxonomy & { featuredImage: Cover; officialWebsite: string; }; -export type RawSubjectPreview = TaxonomyPreview & { +export type RawTopicPreview = TaxonomyPreview & { featuredImage: RawCover; }; -export type SubjectPreview = TaxonomyPreview & { +export type TopicPreview = TaxonomyPreview & { featuredImage: Cover; }; -export type AllSubjects = { - subjects: { - nodes: SubjectPreview[]; +export type AllTopics = { + topics: { + nodes: TopicPreview[]; }; }; -export type RawSubject = SubjectPreview & { - acfSubjects: { +export type RawTopic = TopicPreview & { + acfTopics: { officialWebsite: string; - postsInSubject: RawArticlePreview[]; + postsInTopic: RawArticlePreview[]; }; contentParts: ContentParts; date: string; @@ -56,18 +56,18 @@ export type RawSubject = SubjectPreview & { modified: string; }; -export type SubjectBy = { - subjectBy: RawSubject; +export type TopicBy = { + topicBy: RawTopic; }; -export type AllSubjectsSlug = { - subjects: { +export type AllTopicsSlug = { + topics: { nodes: Slug[]; }; }; -export type SubjectProps = { - subject: Subject; +export type TopicProps = { + topic: Topic; }; //============================================================================== |
