From 7de7d19bd18a869030ab5cbbb22fb992f6765ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Rebours?= Date: Tue, 5 Mar 2024 11:00:18 +0100 Subject: [PATCH] lint and repair git merge.. --- src/pages/[lang]/blog/[slug].astro | 30 ++------------------ src/pages/[lang]/blog/index.astro | 45 ------------------------------ 2 files changed, 2 insertions(+), 73 deletions(-) diff --git a/src/pages/[lang]/blog/[slug].astro b/src/pages/[lang]/blog/[slug].astro index b67cf69..d91ffba 100644 --- a/src/pages/[lang]/blog/[slug].astro +++ b/src/pages/[lang]/blog/[slug].astro @@ -38,21 +38,12 @@ const t = useTranslations(lang) const truncatedPost = sanitizeHtml(await convertMDXToHTML(post.body, 297), { allowedTags: [] }) -<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug].astro -const imageFilePath = (post.data.image != null && Object.hasOwn(post.data.image, 'fsPath')) ? (post.data.image as unknown as { - fsPath: string -}).fsPath : '' -======= -<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug]/index.astro -const imageFilePath = (post.data.image != null && Object.hasOwn(post.data.image, 'fsPath')) ? (post.data.image as unknown as { fsPath: string }).fsPath : '' -======= const imageFilePath = (post.data.image != null && Object.hasOwn(post.data.image, 'fsPath')) ? (post.data.image as unknown as { fsPath: string }).fsPath : '' ->>>>>>> Stashed changes:src/pages/[lang]/blog/[slug].astro ->>>>>>> Stashed changes:src/pages/[lang]/blog/[slug]/index.astro + const image = imageFilePath != null ? await readFile(imageFilePath) : undefined const date = DateTime.fromJSDate(post.data.date).setLocale(languages[lang].code) @@ -64,31 +55,14 @@ const formattedAbsoluteDate = date.toLocaleString(DateTime.DATE_FULL) { (image != null) -<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug].astro - ? - >>>>>> Stashed changes:src/pages/[lang]/blog/[slug]/index.astro - description={post.data.description ?? truncatedPost} - author="Timothée Rebours" - date={post.data.date} - dateFormat={lang} - image={image} -<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug].astro -======= ->>>>>>> Stashed changes:src/pages/[lang]/blog/[slug].astro ->>>>>>> Stashed changes:src/pages/[lang]/blog/[slug]/index.astro /> - : - <> + : <> }
diff --git a/src/pages/[lang]/blog/index.astro b/src/pages/[lang]/blog/index.astro index 7cb1a13..83e6f02 100644 --- a/src/pages/[lang]/blog/index.astro +++ b/src/pages/[lang]/blog/index.astro @@ -22,59 +22,14 @@ const localizePath = useTranslatedPath(lang) const blogPosts = (await getCollection('blog', ({ id }) => id.split('/')[0] === lang)) .sort((a, b) => b.data.date.getTime() - a.data.date.getTime()) -<<<<<<< Updated upstream -const formatDate = (jSDate: Date, lang: string): { formatted: string, absolute: string } => { - const date = DateTime.fromJSDate(jSDate).setLocale(lang) - - const delta = Math.abs(date.diffNow().as('days')) - - const formattedAbsoluteDate = date.toLocaleString(DateTime.DATE_FULL) - const formattedRelativeDate = date.toRelative() - - if (delta <= 7) { - return { - formatted: formattedRelativeDate, - absolute: formattedAbsoluteDate - } - } - - if (delta <= 30) { - return { - formatted: `${formattedRelativeDate} (${formattedAbsoluteDate})`, - absolute: formattedAbsoluteDate - } - } - - return { - formatted: formattedAbsoluteDate, - absolute: formattedAbsoluteDate - } -} - -const renderedBlogPosts = await Promise.all(blogPosts.map(async post => { - const { formatted, absolute } = formatDate(post.data.date, languages[lang].code) - return ({ - ...post, - formattedAbsoluteDate: absolute, - formattedDate: formatted, -======= -<<<<<<< Updated upstream -const renderedBlogPosts = await Promise.all(blogPosts.map(async post => ({ ...post, html: `${await convertMDXToHTML(post.body, 100)}...` }))) -const formatDate = useFormatDate(lang) -======= const renderedBlogPosts = await Promise.all(blogPosts.map(async post => { return ({ ...post, formattedAbsoluteDate: DateTime.fromJSDate(post.data.date).setLocale(languages[lang].code).toLocaleString(DateTime.DATE_FULL), ->>>>>>> Stashed changes html: `${await convertMDXToHTML(post.body, 100)}...` }) })) -<<<<<<< Updated upstream -======= ->>>>>>> Stashed changes ->>>>>>> Stashed changes ---