diff --git a/2025/src/components/Schedule.astro b/2025/src/components/Schedule.astro deleted file mode 100644 index 0f278f80..00000000 --- a/2025/src/components/Schedule.astro +++ /dev/null @@ -1,24 +0,0 @@ ---- -import Card from "./Card.astro"; -import Heading from "./Heading.astro"; -import { CalendarClock } from "@lucide/astro"; ---- - - - - スケジュール - - - - タイムテーブルは近日公開 - - - カンファレンスの詳細なスケジュールは近日公開されます - - - - diff --git a/2025/src/components/Schedule/TimeTable.astro b/2025/src/components/Schedule/TimeTable.astro new file mode 100644 index 00000000..ebcb3d4d --- /dev/null +++ b/2025/src/components/Schedule/TimeTable.astro @@ -0,0 +1,42 @@ +--- +import Card from "../Card.astro"; +import { Clock, User } from "@lucide/astro"; +import { getScheduleCardStyle, formatTime } from "./index.ts"; + +type Props = { + start_at: Date; + end_at: Date; + title: string; + session_id?: string; + speaker_name?: string; +}; + +const { title, start_at, end_at, speaker_name } = Astro.props; +const [cardClass, Icon] = getScheduleCardStyle(title); +--- + + + + + + + {formatTime(start_at)} - {formatTime(end_at)} + { + speaker_name && ( + + + {speaker_name} + + ) + } + + + + {title} + + + + + diff --git a/2025/src/components/Schedule/index.astro b/2025/src/components/Schedule/index.astro new file mode 100644 index 00000000..493abfe7 --- /dev/null +++ b/2025/src/components/Schedule/index.astro @@ -0,0 +1,19 @@ +--- +import { getCollection } from "astro:content"; +import Heading from "../Heading.astro"; +import TimeTable from "./TimeTable.astro"; + +const timetable = await getCollection("timetable"); +--- + + + + スケジュール + { + timetable + .shift() + ?.data.sort((a, b) => a.start_at.getTime() - b.start_at.getTime()) + .map((schedule) => ) + } + + diff --git a/2025/src/components/Schedule/index.ts b/2025/src/components/Schedule/index.ts new file mode 100644 index 00000000..4ed052db --- /dev/null +++ b/2025/src/components/Schedule/index.ts @@ -0,0 +1,25 @@ +import { MicVocal, Zap, Coffee } from "@lucide/astro"; + +export const getScheduleCardStyle = (title: string) => { + const isBreak = ["Short break", "Lunch break"].includes(title); + if (isBreak) { + return ["bg-gray-50 border-gray-200", Coffee]; + } + const isLightningTalks = title === "Lightning talks"; + if (isLightningTalks) { + return ["bg-yellow-50 border-yellow-200", Zap]; + } + + const isOtherEvent = ["Opening", "Closing", "After party"].includes(title); + if (isOtherEvent) { + return ["bg-blue-50 border-blue-200", MicVocal]; + } + + return ["bg-green-50", MicVocal]; +}; + +export const formatTime = (date: Date): string => { + const hours = date.getHours().toString().padStart(2, "0"); + const minutes = date.getMinutes().toString().padStart(2, "0"); + return `${hours}:${minutes}`; +}; diff --git a/2025/src/content/config.ts b/2025/src/content/config.ts index dfb24827..b4824bd8 100644 --- a/2025/src/content/config.ts +++ b/2025/src/content/config.ts @@ -1,5 +1,4 @@ -import { glob } from "astro/loaders"; -// src/content/config.ts +import { file, glob } from "astro/loaders"; import { defineCollection, z } from "astro:content"; const sponsors = defineCollection({ @@ -15,6 +14,19 @@ const sponsors = defineCollection({ }), }); +const timetable = defineCollection({ + loader: file("./src/content/timetable.toml"), + schema: z.array( + z.object({ + title: z.string(), + start_at: z.coerce.date(), + end_at: z.coerce.date(), + speaker_name: z.string().optional(), + session_id: z.string().optional(), + }), + ), +}); + const sessions = defineCollection({ loader: glob({ pattern: "*.toml", @@ -35,4 +47,5 @@ const sessions = defineCollection({ export const collections = { sponsors, sessions, + timetable, }; diff --git a/2025/src/pages/[lang]/index.astro b/2025/src/pages/[lang]/index.astro index d3e0a3ef..7bc14aec 100644 --- a/2025/src/pages/[lang]/index.astro +++ b/2025/src/pages/[lang]/index.astro @@ -1,7 +1,7 @@ --- import AboutVimConf from "../../components/AboutVimConf.astro"; import KeynoteSpeakers from "../../components/KeynoteSpeakers/index.astro"; -import Schedule from "../../components/Schedule.astro"; +import Schedule from "../../components/Schedule/index.astro"; import Sponsors from "../../components/Sponsors/index.astro"; import Staff from "../../components/Staff/index.astro"; import Top from "../../components/Top.astro";
- カンファレンスの詳細なスケジュールは近日公開されます -