Skip to content

Commit 9b2893e

Browse files
authored
Merge pull request #206 from vim-jp/feature/2025/add_timetable
スケジュールを追加
2 parents 86134aa + f516f66 commit 9b2893e

File tree

6 files changed

+102
-27
lines changed

6 files changed

+102
-27
lines changed

2025/src/components/Schedule.astro

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
import Card from "../Card.astro";
3+
import { Clock, User } from "@lucide/astro";
4+
import { getScheduleCardStyle, formatTime } from "./index.ts";
5+
6+
type Props = {
7+
start_at: Date;
8+
end_at: Date;
9+
title: string;
10+
session_id?: string;
11+
speaker_name?: string;
12+
};
13+
14+
const { title, start_at, end_at, speaker_name } = Astro.props;
15+
const [cardClass, Icon] = getScheduleCardStyle(title);
16+
---
17+
18+
<Card class=`p-2 mb-5 ${cardClass}`>
19+
<div class="p-4">
20+
<div class="space-y-2">
21+
<div class="flex items-center text-sm">
22+
<Clock class="mr-2 h-4 w-4 flex-shrink-0 text-green-900" />
23+
<span class="font-bold text-gray-800"
24+
>{formatTime(start_at)} - {formatTime(end_at)}</span
25+
>
26+
{
27+
speaker_name && (
28+
<div class="ml-5 flex items-center">
29+
<User class="mr-2 h-4 w-4 text-gray-600" />
30+
<span class="text-gray-600">{speaker_name}</span>
31+
</div>
32+
)
33+
}
34+
</div><div class="flex items-center">
35+
<Icon class="mr-3 h-4 w-4 flex-shrink-0 text-gray-900" />
36+
<h3 class="min-w-0 flex-1 text-base leading-tight font-semibold">
37+
{title}
38+
</h3>
39+
</div>
40+
</div>
41+
</div>
42+
</Card>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
import { getCollection } from "astro:content";
3+
import Heading from "../Heading.astro";
4+
import TimeTable from "./TimeTable.astro";
5+
6+
const timetable = await getCollection("timetable");
7+
---
8+
9+
<section id="schedule" class="bg-white py-10 md:py-16">
10+
<div class="container mx-auto max-w-4xl px-4">
11+
<Heading>スケジュール</Heading>
12+
{
13+
timetable
14+
.shift()
15+
?.data.sort((a, b) => a.start_at.getTime() - b.start_at.getTime())
16+
.map((schedule) => <TimeTable {...schedule} />)
17+
}
18+
</div>
19+
</section>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { MicVocal, Zap, Coffee } from "@lucide/astro";
2+
3+
export const getScheduleCardStyle = (title: string) => {
4+
const isBreak = ["Short break", "Lunch break"].includes(title);
5+
if (isBreak) {
6+
return ["bg-gray-50 border-gray-200", Coffee];
7+
}
8+
const isLightningTalks = title === "Lightning talks";
9+
if (isLightningTalks) {
10+
return ["bg-yellow-50 border-yellow-200", Zap];
11+
}
12+
13+
const isOtherEvent = ["Opening", "Closing", "After party"].includes(title);
14+
if (isOtherEvent) {
15+
return ["bg-blue-50 border-blue-200", MicVocal];
16+
}
17+
18+
return ["bg-green-50", MicVocal];
19+
};
20+
21+
export const formatTime = (date: Date): string => {
22+
const hours = date.getHours().toString().padStart(2, "0");
23+
const minutes = date.getMinutes().toString().padStart(2, "0");
24+
return `${hours}:${minutes}`;
25+
};

2025/src/content/config.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { glob } from "astro/loaders";
2-
// src/content/config.ts
1+
import { file, glob } from "astro/loaders";
32
import { defineCollection, z } from "astro:content";
43

54
const sponsors = defineCollection({
@@ -15,6 +14,19 @@ const sponsors = defineCollection({
1514
}),
1615
});
1716

17+
const timetable = defineCollection({
18+
loader: file("./src/content/timetable.toml"),
19+
schema: z.array(
20+
z.object({
21+
title: z.string(),
22+
start_at: z.coerce.date(),
23+
end_at: z.coerce.date(),
24+
speaker_name: z.string().optional(),
25+
session_id: z.string().optional(),
26+
}),
27+
),
28+
});
29+
1830
const sessions = defineCollection({
1931
loader: glob({
2032
pattern: "*.toml",
@@ -35,4 +47,5 @@ const sessions = defineCollection({
3547
export const collections = {
3648
sponsors,
3749
sessions,
50+
timetable,
3851
};

2025/src/pages/[lang]/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import AboutVimConf from "../../components/AboutVimConf.astro";
33
import KeynoteSpeakers from "../../components/KeynoteSpeakers/index.astro";
4-
import Schedule from "../../components/Schedule.astro";
4+
import Schedule from "../../components/Schedule/index.astro";
55
import Sponsors from "../../components/Sponsors/index.astro";
66
import Staff from "../../components/Staff/index.astro";
77
import Top from "../../components/Top.astro";

0 commit comments

Comments
 (0)