Skip to content

Commit

Permalink
fix build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn111 committed Dec 26, 2024
1 parent 476d638 commit 51fa8be
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 122 deletions.
15 changes: 9 additions & 6 deletions src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -41,12 +41,15 @@ export default function Card({ href, frontmatter, secHeading = true }: Props) {
</h3>
)}
</a>
{pubDatetime && (
<Datetime pubDatetime={pubDatetime} modDatetime={modDatetime} luma={frontmatter.luma} youtube={frontmatter.youtube}/>
{(frontmatter.luma || frontmatter.youtube) && (
<Datetime
pubDatetime={pubDatetime}
modDatetime={modDatetime}
luma={frontmatter.luma}
youtube={frontmatter.youtube}
/>
)}



{frontmatter.googlemeet && (
<p>
{" "}
Expand Down
70 changes: 33 additions & 37 deletions src/components/Datetime.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -16,6 +14,8 @@ interface EditPostProps {
interface Props extends DatetimesProps, EditPostProps {
size?: "sm" | "lg";
className?: string;
luma?: string;
youtube?: string;
}

export default function Datetime({
Expand All @@ -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 (
<div
className={`flex items-center space-x-2 opacity-80 ${className}`.trim()}
>

<svg xmlns="http://www.w3.org/2000/svg"
className={`${smsize} inline-block h-6 w-6 min-w-[1.375rem] fill-skin-base`}
aria-hidden="true"
>
<path d="M7 11h2v2H7zm0 4h2v2H7zm4-4h2v2h-2zm0 4h2v2h-2zm4-4h2v2h-2zm0 4h2v2h-2z"></path>
<path d="M5 22h14c1.103 0 2-.897 2-2V6c0-1.103-.897-2-2-2h-2V2h-2v2H9V2H7v2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2zM19 8l.001 12H5V8h14z"></path>
</svg>

{Date.now() < new Date(pubDatetime).getTime() && luma ? (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 724 264">
<path d="M38.53 260.65H.43V27.86h38.1zm86.46 2.77c-42.25 0-66.48-22.96-66.48-63V89.33h38.1v108.28c0 23.61 8.7 32.39 32.12 32.39 30.35 0 42.73-14.54 42.73-50.17v-90.5h38.1v171.33h-36.54v-29.91c-4.99 22.98-27.12 32.67-48.03 32.67zm347.2-2.77H434.4V149.87c0-22.5-7.01-30.87-25.88-30.87-24.28 0-37.11 14.45-37.11 41.79v99.86h-37.79V149.87c0-21.93-7.23-30.87-24.94-30.87-31.59 0-38.05 32.96-38.05 41.79v99.86h-38.1V89.33h36.54v29.96c6.49-21.02 27.02-33.71 47.72-33.71 20.69 0 38.09 7.9 45.64 33.71 10.13-26.76 28.35-33.71 50.15-33.71 37.88 0 59.61 18.88 59.61 51.81v123.26h0zm76.65 2.77c-52.62 0-61.55-33.45-61.55-50.52 0-20.1 8.83-38.21 27.93-45.55 8.41-3.11 16.52-5.43 24.84-7.1 7.33-1.47 18.64-3.03 26.91-4.17l2.73-.38c14.38-2 29.67-9.21 29.67-18.62 0-16-20.51-18.39-32.74-18.39-13.87 0-23.64 3.57-27.53 10.05-3.49 6.46-3.73 7.97-4.62 13.6l-.62 4.43h-38.1l.68-5.61c1.35-11.14 3.41-19.03 6.48-24.83 10.54-20.39 31.77-30.75 63.08-30.75 26.11 0 44.63 8.23 53.26 15.94 5.31 4.6 9.1 9.84 11.89 16.46 5.84 12.36 6.32 20.63 6.32 29.4v86.43c0 8.07.78 14.97 2.31 20.5l1.76 6.35h-38.91l-.7-4.19c-.5-2.96-.67-19.75-.88-26.23-8.99 23.61-28.27 33.18-52.21 33.18zm50.53-93.72c-7.97 6.11-20.47 9.6-38.62 13.23-31.27 5.78-36.54 13.06-36.54 27.22 0 12.5 10.63 20.26 27.75 20.26 33.23 0 47.41-15.48 47.41-51.77v-8.94zm124.2-105.51C688.46 64.19 660 35.73 660 .62c0 35.11-28.46 63.57-63.57 63.57h0c35.11 0 63.57 28.46 63.57 63.57h0c0-35.11 28.46-63.57 63.57-63.57z"/></svg>

<svg
xmlns="http://www.w3.org/2000/svg"
className={`${smsize} inline-block h-6 w-6 min-w-[1.375rem] fill-skin-base`}
aria-hidden="true"
>
<path d="M7 11h2v2H7zm0 4h2v2H7zm4-4h2v2h-2zm0 4h2v2h-2zm4-4h2v2h-2zm0 4h2v2h-2z"></path>
<path d="M5 22h14c1.103 0 2-.897 2-2V6c0-1.103-.897-2-2-2h-2V2h-2v2H9V2H7v2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2zM19 8l.001 12H5V8h14z"></path>
</svg>

{Date.now() < new Date(pubDatetime).getTime() && luma ? (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 724 264">
<path d="M38.53 260.65H.43V27.86h38.1zm86.46 2.77c-42.25 0-66.48-22.96-66.48-63V89.33h38.1v108.28c0 23.61 8.7 32.39 32.12 32.39 30.35 0 42.73-14.54 42.73-50.17v-90.5h38.1v171.33h-36.54v-29.91c-4.99 22.98-27.12 32.67-48.03 32.67zm347.2-2.77H434.4V149.87c0-22.5-7.01-30.87-25.88-30.87-24.28 0-37.11 14.45-37.11 41.79v99.86h-37.79V149.87c0-21.93-7.23-30.87-24.94-30.87-31.59 0-38.05 32.96-38.05 41.79v99.86h-38.1V89.33h36.54v29.96c6.49-21.02 27.02-33.71 47.72-33.71 20.69 0 38.09 7.9 45.64 33.71 10.13-26.76 28.35-33.71 50.15-33.71 37.88 0 59.61 18.88 59.61 51.81v123.26h0zm76.65 2.77c-52.62 0-61.55-33.45-61.55-50.52 0-20.1 8.83-38.21 27.93-45.55 8.41-3.11 16.52-5.43 24.84-7.1 7.33-1.47 18.64-3.03 26.91-4.17l2.73-.38c14.38-2 29.67-9.21 29.67-18.62 0-16-20.51-18.39-32.74-18.39-13.87 0-23.64 3.57-27.53 10.05-3.49 6.46-3.73 7.97-4.62 13.6l-.62 4.43h-38.1l.68-5.61c1.35-11.14 3.41-19.03 6.48-24.83 10.54-20.39 31.77-30.75 63.08-30.75 26.11 0 44.63 8.23 53.26 15.94 5.31 4.6 9.1 9.84 11.89 16.46 5.84 12.36 6.32 20.63 6.32 29.4v86.43c0 8.07.78 14.97 2.31 20.5l1.76 6.35h-38.91l-.7-4.19c-.5-2.96-.67-19.75-.88-26.23-8.99 23.61-28.27 33.18-52.21 33.18zm50.53-93.72c-7.97 6.11-20.47 9.6-38.62 13.23-31.27 5.78-36.54 13.06-36.54 27.22 0 12.5 10.63 20.26 27.75 20.26 33.23 0 47.41-15.48 47.41-51.77v-8.94zm124.2-105.51C688.46 64.19 660 35.73 660 .62c0 35.11-28.46 63.57-63.57 63.57h0c35.11 0 63.57 28.46 63.57 63.57h0c0-35.11 28.46-63.57 63.57-63.57z" />
</svg>
) : (
<p />
)}


)}

{modDatetime && modDatetime > pubDatetime ? (
<span className={`italic ${size === "sm" ? "text-sm" : "text-base"}`}>
Expand All @@ -67,24 +65,24 @@ export default function Datetime({
)}

<span className={`italic ${size === "sm" ? "text-sm" : "text-base"}`}>
{Date.now() < new Date(pubDatetime).getTime() && luma ? (

<a href={lumalink} target="_blank"
className="hover:underline hover:opacity-75"
>
<FormattedDatetime
pubDatetime={pubDatetime}
modDatetime={modDatetime}
/>
</a>
) : (

{Date.now() < new Date(pubDatetime).getTime() && luma ? (
<a
href={lumalink}
target="_blank"
className="hover:underline hover:opacity-75"
>
<FormattedDatetime
pubDatetime={pubDatetime}
modDatetime={modDatetime}
/>
</a>
) : (
<FormattedDatetime
pubDatetime={pubDatetime}
modDatetime={modDatetime}
/>
)}
{youtube && (
)}
{youtube && (
<a href={ylink} target="_blank">
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -99,9 +97,7 @@ export default function Datetime({
<polygon points="9.75 15.02 15.5 11.75 9.75 8.48 9.75 15.02"></polygon>
</svg>
</a>
)}


)}

{size === "lg" && <EditPost editPost={editPost} postId={postId} />}
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
89 changes: 65 additions & 24 deletions src/layouts/PostDetails.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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">;
Expand Down Expand Up @@ -42,25 +42,26 @@ 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}`,
author,
description,
pubDatetime,
modDatetime,
luma,
canonicalURL,
ogImage: ogUrl,
scrollSmooth: true,
};
/* ========== 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);
Expand Down Expand Up @@ -98,28 +99,68 @@ const nextPost =
postId={post.id}
/>

{
{
googlemeet && (
<p> <a href={mlink}>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 87.5 72">
<path fill="#00832d" d="M49.5 36l8.53 9.75 11.47 7.33 2-17.02-2-16.64-11.69 6.44z"/>
<path fill="#0066da" d="M0 51.5V66c0 3.315 2.685 6 6 6h14.5l3-10.96-3-9.54-9.95-3z"/>
<path fill="#e94235" d="M20.5 0L0 20.5l10.55 3 9.95-3 2.95-9.41z"/>
<path fill="#2684fc" d="M20.5 20.5H0v31h20.5z"/>
<path fill="#00ac47" d="M82.6 8.68L69.5 19.42v33.66l13.16 10.79c1.97 1.54 4.85.135 4.85-2.37V11c0-2.535-2.945-3.925-4.91-2.32zM49.5 36v15.5h-29V72h43c3.315 0 6-2.685 6-6V53.08z"/>
<path fill="#ffba00" d="M63.5 0h-43v20.5h29V36l20-16.57V6c0-3.315-2.685-6-6-6z"/>
</svg>
Google Meet </a>
</p>)
}
<p>
{" "}
<a href={mlink}>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 87.5 72"
>
<path
fill="#00832d"
d="M49.5 36l8.53 9.75 11.47 7.33 2-17.02-2-16.64-11.69 6.44z"
/>
<path
fill="#0066da"
d="M0 51.5V66c0 3.315 2.685 6 6 6h14.5l3-10.96-3-9.54-9.95-3z"
/>
<path
fill="#e94235"
d="M20.5 0L0 20.5l10.55 3 9.95-3 2.95-9.41z"
/>
<path fill="#2684fc" d="M20.5 20.5H0v31h20.5z" />
<path
fill="#00ac47"
d="M82.6 8.68L69.5 19.42v33.66l13.16 10.79c1.97 1.54 4.85.135 4.85-2.37V11c0-2.535-2.945-3.925-4.91-2.32zM49.5 36v15.5h-29V72h43c3.315 0 6-2.685 6-6V53.08z"
/>
<path
fill="#ffba00"
d="M63.5 0h-43v20.5h29V36l20-16.57V6c0-3.315-2.685-6-6-6z"
/>
</svg>
Google Meet{" "}
</a>
</p>
)
}

<article id="article" class="prose mx-auto mt-8 max-w-3xl">
{
youtube && (
<p> 儘量上字幕, 沒有太多後製, 麻煩大家進youtube 開字幕, 直接跳轉有興趣部分, 部分private影片, 由於講者或研討會有考量, 可以私訊 Shawn 加權限</p>
<div>
<iframe width="560" height="315" src={ylink} title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div>)
youtube && (
<>
<p>
{" "}
儘量上字幕, 沒有太多後製, 麻煩大家進youtube 開字幕,
直接跳轉有興趣部分, 部分private影片, 由於講者或研討會有考量,
可以私訊 Shawn 加權限
</p>
<div>
<iframe
width="560"
height="315"
src={ylink}
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
/>
</div>
</>
)
}

<Content />
Expand Down
Loading

0 comments on commit 51fa8be

Please sign in to comment.