From d363306235f2a48f16e488f20f73e2233ddcf281 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 29 Nov 2023 18:07:20 +0100 Subject: refactor(pages): improve Homepage * move custom homepage components that does not require props to the MDX file (links should not need to be translated here but where they are defined) * move SEO title and meta desc to MDX file * make Page component the wrapper instead of using a React fragment * fix MDX module types --- src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts | 2 +- src/services/graphql/helpers/convert-taxonomy-to-page-link.ts | 2 +- src/services/graphql/helpers/convert-wp-thematic-to-thematic.test.ts | 2 +- src/services/graphql/helpers/convert-wp-thematic-to-thematic.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/services/graphql') diff --git a/src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts b/src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts index 54a62ad..f923850 100644 --- a/src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts +++ b/src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts @@ -18,7 +18,7 @@ describe('convert-taxonomy-to-page-link', () => { expect(result.id).toBe(thematic.databaseId); expect(result.logo).toBeUndefined(); expect(result.name).toBe(thematic.title); - expect(result.url).toBe(`${ROUTES.THEMATICS.INDEX}/${thematic.slug}`); + expect(result.url).toBe(`${ROUTES.THEMATICS}/${thematic.slug}`); }); it('can convert a WPTopicPreview object to a Topic object', () => { diff --git a/src/services/graphql/helpers/convert-taxonomy-to-page-link.ts b/src/services/graphql/helpers/convert-taxonomy-to-page-link.ts index 9b42eea..ca86a1e 100644 --- a/src/services/graphql/helpers/convert-taxonomy-to-page-link.ts +++ b/src/services/graphql/helpers/convert-taxonomy-to-page-link.ts @@ -28,7 +28,7 @@ export const convertWPThematicPreviewToPageLink = ( ): PageLink => convertTaxonomyToPageLink({ ...thematic, - slug: `${ROUTES.THEMATICS.INDEX}/${thematic.slug}`, + slug: `${ROUTES.THEMATICS}/${thematic.slug}`, }); export const convertWPTopicPreviewToPageLink = ( diff --git a/src/services/graphql/helpers/convert-wp-thematic-to-thematic.test.ts b/src/services/graphql/helpers/convert-wp-thematic-to-thematic.test.ts index e535a21..435489d 100644 --- a/src/services/graphql/helpers/convert-wp-thematic-to-thematic.test.ts +++ b/src/services/graphql/helpers/convert-wp-thematic-to-thematic.test.ts @@ -42,7 +42,7 @@ describe('convert-wp-thematic-to-thematic', () => { expect(result.meta.seo.description).toBe(thematic.seo.metaDesc); expect(result.meta.seo.title).toBe(thematic.seo.title); expect(result.meta.relatedTopics).toBeUndefined(); - expect(result.slug).toBe(`${ROUTES.THEMATICS.INDEX}/${thematic.slug}`); + expect(result.slug).toBe(`${ROUTES.THEMATICS}/${thematic.slug}`); expect(result.title).toBe(thematic.title); }); /* eslint-enable max-statements */ diff --git a/src/services/graphql/helpers/convert-wp-thematic-to-thematic.ts b/src/services/graphql/helpers/convert-wp-thematic-to-thematic.ts index cabfa18..9aa1896 100644 --- a/src/services/graphql/helpers/convert-wp-thematic-to-thematic.ts +++ b/src/services/graphql/helpers/convert-wp-thematic-to-thematic.ts @@ -54,7 +54,7 @@ export const convertWPThematicToThematic = (thematic: WPThematic): Thematic => { ? getRelatedTopicsFrom(thematic.acfThematics.postsInThematic) : undefined, }, - slug: `${ROUTES.THEMATICS.INDEX}/${thematic.slug}`, + slug: `${ROUTES.THEMATICS}/${thematic.slug}`, title: thematic.title, }; }; -- cgit v1.2.3