-
Notifications
You must be signed in to change notification settings - Fork 37
スケジュールを追加 #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
スケジュールを追加 #206
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
77cb8f2
feat: timetableのスキーマを追加
staticWagomU 51eaeb4
feat: TimeTableコンポーネントを作成
staticWagomU 377e6ee
feat(Schedule): TimeTableコンポーネントを使う
staticWagomU 40a0572
style: apply format
staticWagomU e9f38b4
chore: index.tsに変更
staticWagomU 758aa32
feat(Schedule): 開始日時でソート
staticWagomU 1aab41f
fix(Schedule): optionalなため、`| undefined`を削除
staticWagomU 73e18db
fix(Schedule): 不要なpropsを削除
staticWagomU 088395b
Merge branch 'main' into feature/2025/add_timetable
staticWagomU f516f66
Merge branch 'main' into feature/2025/add_timetable
staticWagomU File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
--- | ||
|
||
<Card class=`p-2 mb-5 ${cardClass}`> | ||
<div class="p-4"> | ||
<div class="space-y-2"> | ||
<div class="flex items-center text-sm"> | ||
<Clock class="mr-2 h-4 w-4 flex-shrink-0 text-green-900" /> | ||
<span class="font-bold text-gray-800" | ||
>{formatTime(start_at)} - {formatTime(end_at)}</span | ||
> | ||
{ | ||
speaker_name && ( | ||
<div class="ml-5 flex items-center"> | ||
<User class="mr-2 h-4 w-4 text-gray-600" /> | ||
<span class="text-gray-600">{speaker_name}</span> | ||
</div> | ||
) | ||
} | ||
</div><div class="flex items-center"> | ||
<Icon class="mr-3 h-4 w-4 flex-shrink-0 text-gray-900" /> | ||
<h3 class="min-w-0 flex-1 text-base leading-tight font-semibold"> | ||
{title} | ||
</h3> | ||
</div> | ||
</div> | ||
</div> | ||
</Card> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
import { getCollection } from "astro:content"; | ||
import Heading from "../Heading.astro"; | ||
import TimeTable from "./TimeTable.astro"; | ||
|
||
const timetable = await getCollection("timetable"); | ||
--- | ||
|
||
<section id="schedule" class="bg-white py-10 md:py-16"> | ||
<div class="container mx-auto max-w-4xl px-4"> | ||
<Heading>スケジュール</Heading> | ||
{ | ||
timetable | ||
.shift() | ||
?.data.sort((a, b) => a.start_at.getTime() - b.start_at.getTime()) | ||
.map((schedule) => <TimeTable {...schedule} />) | ||
} | ||
</div> | ||
</section> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}`; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.