diff --git a/src/components/Card.tsx b/src/components/Card.tsx index 32d8709..6e7ec0c 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -11,10 +11,10 @@ export interface Props { export default function Card({ href, frontmatter, secHeading = true }: Props) { const { title, pubDatetime, modDatetime, description, author } = frontmatter; - const ylink = "https://www.youtube.com/watch?v=" + frontmatter.youtube; + const mlink = "https://meet.google.com/" + frontmatter.googlemeet; const maplink = "https://maps.app.goo.gl/" + frontmatter.googlemap; - const lumalink = "https://lu.ma/" + frontmatter.luma; + //Astro.props; const headerProps = { @@ -41,12 +41,15 @@ export default function Card({ href, frontmatter, secHeading = true }: Props) { )} - {pubDatetime && ( - + {(frontmatter.luma || frontmatter.youtube) && ( + )} - - {frontmatter.googlemeet && (

{" "} diff --git a/src/components/Datetime.tsx b/src/components/Datetime.tsx index 07e436e..d29aede 100644 --- a/src/components/Datetime.tsx +++ b/src/components/Datetime.tsx @@ -1,11 +1,9 @@ import { LOCALE, SITE } from "@config"; import type { CollectionEntry } from "astro:content"; -import LinkButton from "@components/LinkButton.astro"; interface DatetimesProps { pubDatetime: string | Date; modDatetime: string | Date | undefined | null; - luma: string | undefined | null; } interface EditPostProps { @@ -16,6 +14,8 @@ interface EditPostProps { interface Props extends DatetimesProps, EditPostProps { size?: "sm" | "lg"; className?: string; + luma?: string; + youtube?: string; } export default function Datetime({ @@ -28,35 +28,33 @@ export default function Datetime({ editPost, postId, }: Props) { - var smsize = "scale-100"; + let smsize = "scale-100"; if (size === "sm") { smsize = "scale-90"; } - const lumalink = "https://lu.ma/"+luma + const lumalink = "https://lu.ma/" + luma; const ylink = "https://www.youtube.com/watch?v=" + youtube; return (

- - - - {Date.now() < new Date(pubDatetime).getTime() && luma ? ( - - - + + + {Date.now() < new Date(pubDatetime).getTime() && luma ? ( + + + ) : (

- )} - - + )} {modDatetime && modDatetime > pubDatetime ? ( @@ -67,24 +65,24 @@ export default function Datetime({ )} - {Date.now() < new Date(pubDatetime).getTime() && luma ? ( - - - - - ) : ( - + {Date.now() < new Date(pubDatetime).getTime() && luma ? ( + + + + ) : ( - )} - {youtube && ( + )} + {youtube && ( - )} - - + )} {size === "lg" && } diff --git a/src/content/config.ts b/src/content/config.ts index 2eaefb6..8afa0fa 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -8,7 +8,7 @@ const blog = defineCollection({ schema: ({ image }) => z.object({ author: z.string().default(SITE.author), - pubDatetime: z.date().optional().nullable(), + pubDatetime: z.date(), modDatetime: z.date().optional().nullable(), title: z.string(), featured: z.boolean().optional(), diff --git a/src/layouts/PostDetails.astro b/src/layouts/PostDetails.astro index 1074939..bddddfd 100644 --- a/src/layouts/PostDetails.astro +++ b/src/layouts/PostDetails.astro @@ -10,7 +10,7 @@ import { slugifyStr } from "@utils/slugify"; import ShareLinks from "@components/ShareLinks.astro"; import { SITE } from "@config"; -import { render } from 'astro:content'; +import { render } from "astro:content"; export interface Props { post: CollectionEntry<"blog">; @@ -42,8 +42,8 @@ const ogUrl = new URL( Astro.url.origin ).href; -const ylink = "https://www.youtube.com/embed/"+youtube; -const mlink = "https://meet.google.com/"+googlemeet; +const ylink = "https://www.youtube.com/embed/" + youtube; +const mlink = "https://meet.google.com/" + googlemeet; const layoutProps = { title: `${title} | ${SITE.title}`, @@ -51,6 +51,7 @@ const layoutProps = { description, pubDatetime, modDatetime, + luma, canonicalURL, ogImage: ogUrl, scrollSmooth: true, @@ -58,9 +59,9 @@ const layoutProps = { /* ========== Prev/Next Posts ========== */ -const allPosts = posts.map((post) => ({ - slug:post.id, - title:post.data.title, +const allPosts = posts.map(post => ({ + slug: post.id, + title: post.data.title, })); const currentPostIndex = allPosts.findIndex(a => a.slug === post.id); @@ -98,28 +99,68 @@ const nextPost = postId={post.id} /> - { + { googlemeet && ( -

- - - - - - - - - Google Meet -

) - } +

+ {" "} + + + + + + + + + + Google Meet{" "} + +

+ ) + }
{ - youtube && ( -

儘量上字幕, 沒有太多後製, 麻煩大家進youtube 開字幕, 直接跳轉有興趣部分, 部分private影片, 由於講者或研討會有考量, 可以私訊 Shawn 加權限

-
- -
) + youtube && ( + <> +

+ {" "} + 儘量上字幕, 沒有太多後製, 麻煩大家進youtube 開字幕, + 直接跳轉有興趣部分, 部分private影片, 由於講者或研討會有考量, + 可以私訊 Shawn 加權限 +

+
+ +
@@ -151,7 +154,6 @@ const description = "KaLUG - Kaohsiung Linux User Group: 由一群熱愛 Linux /
-