From 86d70a6343b6d8ed2a1dbeadec10348de87fcf49 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 29 Nov 2023 18:42:58 +0100 Subject: refactor(pages): refine CV page * reduce the number of statements by grouping the messages * remove LinkedIn from the widget (it is obviously not a repo and my CV is already here, no need to link to an external site) --- src/pages/cv.tsx | 124 +++++++++++++++++++++++++++---------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'src/pages') diff --git a/src/pages/cv.tsx b/src/pages/cv.tsx index edf267d..edff59f 100644 --- a/src/pages/cv.tsx +++ b/src/pages/cv.tsx @@ -31,65 +31,71 @@ import { import { loadTranslation } from '../utils/helpers/server'; import { useBreadcrumb, useHeadingsTree } from '../utils/hooks'; +const DownloadLink = (chunks: ReactNode) => ( + + {chunks} + +); + /** * CV page. */ const CVPage: NextPageWithLayout = () => { const intl = useIntl(); const { ref, tree } = useHeadingsTree({ fromLevel: 2 }); - const { file, image } = data; const { dates, intro, seo, title } = meta; const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({ title, url: ROUTES.CV, }); - - const imageWidgetTitle = intl.formatMessage({ - defaultMessage: 'Others formats', - description: 'CVPage: cv preview widget title', - id: 'B9OCyV', - }); - const socialMediaTitle = intl.formatMessage({ - defaultMessage: 'Open-source projects', - description: 'CVPage: social media widget title', - id: '+Dre5J', - }); - const tocTitle = intl.formatMessage({ - defaultMessage: 'Table of Contents', - description: 'PageLayout: table of contents title', - id: 'eys2uX', - }); - - const cvCaption = intl.formatMessage( - { - defaultMessage: 'Download the CV in PDF', - id: 'fN04AJ', - description: 'CVPage: download CV in PDF text', - }, - { - link: (chunks: ReactNode) => ( - - {chunks} - + const messages = { + image: { + caption: intl.formatMessage( + { + defaultMessage: 'Download the CV in PDF', + id: 'fN04AJ', + description: 'CVPage: download CV in PDF text', + }, + { + link: DownloadLink, + } ), - } - ); - - const githubLabel = intl.formatMessage({ - defaultMessage: 'Github profile', - description: 'CVPage: Github profile link', - id: 'Jm0a6H', - }); - const gitlabLabel = intl.formatMessage({ - defaultMessage: 'Gitlab profile', - description: 'CVPage: Gitlab profile link', - id: '++U2Hm', - }); - const linkedinLabel = intl.formatMessage({ - defaultMessage: 'LinkedIn profile', - description: 'CVPage: LinkedIn profile link', - id: 'Sm2wCk', - }); + title: intl.formatMessage({ + defaultMessage: 'Others formats', + description: 'CVPage: cv preview widget title', + id: 'B9OCyV', + }), + }, + socialMedia: { + github: intl.formatMessage({ + defaultMessage: 'Github profile', + description: 'CVPage: Github profile link', + id: 'Jm0a6H', + }), + gitlab: intl.formatMessage({ + defaultMessage: 'Gitlab profile', + description: 'CVPage: Gitlab profile link', + id: '++U2Hm', + }), + linkedin: intl.formatMessage({ + defaultMessage: 'LinkedIn profile', + description: 'CVPage: LinkedIn profile link', + id: 'Sm2wCk', + }), + title: intl.formatMessage({ + defaultMessage: 'Open-source projects', + description: 'CVPage: social media widget title', + id: '+Dre5J', + }), + }, + toc: { + title: intl.formatMessage({ + defaultMessage: 'Table of Contents', + description: 'PageLayout: table of contents title', + id: 'eys2uX', + }), + }, + }; const { asPath } = useRouter(); const webpageSchema = getWebPageSchema({ @@ -100,7 +106,7 @@ const CVPage: NextPageWithLayout = () => { updateDate: dates.update, }); const cvSchema = getSinglePageSchema({ - cover: image.src, + cover: data.image.src, dates, description: intro, id: 'cv', @@ -126,7 +132,7 @@ const CVPage: NextPageWithLayout = () => { - +