From dfa894b76ee3584bf169710c78c57330c5d6ee67 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 29 Nov 2023 12:28:03 +0100 Subject: fix(pages,services): make thematics & topics pages usable again When I refactored the fetchers and convertors in #f111685 I forgot to convert WPThematicPreview and WPTopicPreview so the thematics and topics pages was broken. I also: * removed the ToC added by error in #70b4f63 * fix heading styles * fix website url in topics pages --- .../graphql/helpers/convert-taxonomy-to-page-link.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/services/graphql/helpers/convert-taxonomy-to-page-link.ts') 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 2294fb7..9b42eea 100644 --- a/src/services/graphql/helpers/convert-taxonomy-to-page-link.ts +++ b/src/services/graphql/helpers/convert-taxonomy-to-page-link.ts @@ -3,9 +3,10 @@ import type { WPThematicPreview, WPTopicPreview, } from '../../../types'; +import { ROUTES } from '../../../utils/constants'; import { convertWPImgToImg } from './convert-wp-image-to-img'; -export const convertTaxonomyToPageLink = ({ +const convertTaxonomyToPageLink = ({ databaseId, slug, title, @@ -21,3 +22,19 @@ export const convertTaxonomyToPageLink = ({ url: slug, }; }; + +export const convertWPThematicPreviewToPageLink = ( + thematic: WPThematicPreview +): PageLink => + convertTaxonomyToPageLink({ + ...thematic, + slug: `${ROUTES.THEMATICS.INDEX}/${thematic.slug}`, + }); + +export const convertWPTopicPreviewToPageLink = ( + topic: WPTopicPreview +): PageLink => + convertTaxonomyToPageLink({ + ...topic, + slug: `${ROUTES.TOPICS}/${topic.slug}`, + }); -- cgit v1.2.3