From faacb4cfc5ffc5116b4146d7d370e2d91a268466 Mon Sep 17 00:00:00 2001 From: Cyrus Yiu Date: Tue, 8 Oct 2024 21:29:37 -0400 Subject: [PATCH] Fix build errors --- src/components/Blog/Post/Post.tsx | 106 --------------------------- src/components/Blog/Post/Preview.tsx | 100 ------------------------- 2 files changed, 206 deletions(-) delete mode 100644 src/components/Blog/Post/Post.tsx delete mode 100644 src/components/Blog/Post/Preview.tsx diff --git a/src/components/Blog/Post/Post.tsx b/src/components/Blog/Post/Post.tsx deleted file mode 100644 index a855638..0000000 --- a/src/components/Blog/Post/Post.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import React from "react"; -import { formatDateAndTime } from "@/scripts/Utils/DateAndTime/Format"; -import { PostQuery } from "../../../../tina/__generated__/types"; -import { - RichTextSectionRenderer, - ShortAuthorRenderer, -} from "@/components/Blog/Elements"; -import Comments from "@/components/Blog/Post/Comments"; -import ContextualEditingPostAssist from "@/components/Blog/Post/ContextualEditingMode/PostAssist"; -import HeroImage from "@/components/Images/HeroImage"; -import { ShareButton } from "@/components/Linkable/ShareButton"; -import { getReadingTime } from "@/scripts/Utils/Calculate/readingTime"; -import getElement from "@/scripts/Utils/Element"; -import { AnalyticEvents } from "@/components/Analytics"; - -export default function BlogPost({ - data, -}: { - data: PostQuery; -}): React.ReactNode { - const [showTitleActions, setShowTitleActions] = React.useState(false); - - const [readingTime, setReadingTime] = React.useState(null); - React.useEffect(() => { - setReadingTime( - getReadingTime( - (getElement(`blogPostBody${data.post.title}`) as HTMLDivElement) - .innerText, - ), - ); - }, [data.post.title]); - - return ( -
-

{ - setShowTitleActions(true); - }} - onMouseLeave={() => { - setShowTitleActions(false); - }} - > - {data.post.title}{" "} - {showTitleActions && ( - <> - { - AnalyticEvents.sendShare("blog", data.post.title); - }} - classNames="ms-1 btn btn-link m-0 p-0" - /> - - )} -

-

- Written by -
- {data.post.createdAt != null ? ( - <> - Posted on {formatDateAndTime(new Date(data.post.createdAt))}. - {data.post.lastUpdated != null - ? ` (last updated ${formatDateAndTime(new Date(data.post.lastUpdated))})` - : null} - - ) : null} -
- {readingTime != null ? ( - readingTime - ) : ( - - )}{" "} - minute read -

- {data.post.heroImage && ( - - )} -

{data.post.description}

-
- -
- -
- {data.post.title !== "TESTING" ? ( - - ) : null} - -

- {(data.post.tags?.length ?? 0) > 0 ? ( - <> - Tags: {(data.post.tags ?? []).join(", ")} - - ) : ( - No tags on this blog post. - )} -

-
-
- ); -} diff --git a/src/components/Blog/Post/Preview.tsx b/src/components/Blog/Post/Preview.tsx deleted file mode 100644 index a3ab1be..0000000 --- a/src/components/Blog/Post/Preview.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import React from "react"; -import { ShortAuthorRenderer } from "@/components/Blog/Elements"; -import { formatDateAndTime } from "@/scripts/Utils/DateAndTime/Format"; -import Link from "next/link"; -import { ShareButton } from "@/components/Linkable/ShareButton"; -import { AnalyticEvents } from "@/components/Analytics"; -import { motion } from "framer-motion"; - -export type BlogPostPreview = { - title: string; - heroImage: string | null; - author: string; - description: string; - createdAt: string | null; - lastUpdated: string | null; - link: string; -}; - -export default function BlogPostPreviewRenderer({ - preview, -}: { - preview: BlogPostPreview; -}): React.ReactNode { - const [showCardActions, setShowCardActions] = React.useState(false); - - return ( -
- - {preview.heroImage && ( - // eslint-disable-next-line @next/next/no-img-element - {`Hero - )} -
-
{ - setShowCardActions(true); - }} - onMouseLeave={() => { - setShowCardActions(false); - }} - > - {preview.title} - {showCardActions ? ( - <> - { - AnalyticEvents.sendShare("blog preview", preview.title); - }} - /> - - ) : undefined} -
-
- {preview.createdAt !== null ? ( - <> - Posted by on{" "} - {formatDateAndTime(new Date(preview.createdAt))}. - {preview.lastUpdated !== null - ? ` (last updated ${formatDateAndTime(new Date(preview.lastUpdated))})` - : null} - - ) : ( - - )} -
-

{preview.description}

- - View post - -
-
-
- ); -}