-
-
Notifications
You must be signed in to change notification settings - Fork 0
タイムテーブルを表示できるようにする #79
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
Draft
takusandayooo
wants to merge
16
commits into
main
Choose a base branch
from
add-time-table-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+493
−0
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ea3e8b6
add: time-tableのページを追加
takusandayooo 2ec6f74
タイムテーブル重複検知をカスタムテストに移行してCIに追加
yasulab 86e39e9
Merge pull request #80 from coderdojo-japan/refactor-time-table-valid…
yasulab d662724
refactor: タイムテーブルのロジックをJekyllプラグインに移行
yasulab 2d26d3e
refactor: タイムテーブルをイベント中心設計にして一貫性を強化
yasulab 95dd2f0
コメントの細かな用語を統一
yasulab a77d223
refactor: 変数名を意味的に明確化
yasulab 4c5e3c0
chore: 不要なActive Support依存を削除
yasulab 80e7720
Merge pull request #81 from coderdojo-japan/refactor-time-table-with-…
takusandayooo dc7d66c
色々調整してみた(ナビバーと相性が悪い...)
Fukusan64 3bf2ce7
fix: タイムテーブルの横スクロールのみ可能に変更
yasulab 5f624da
Merge pull request #83 from coderdojo-japan/fix-time-table-mobile-dis…
takusandayooo b71a202
time_table.yml のコンテンツを整理
kp54 847d7ea
fix: 日付情報を消去したのと, 縦方向のstickyを消去
takusandayooo 4214bbc
feat: イベントのリンク対応
takusandayooo ea321c8
fix: リンクがあるイベントがクリックできない問題を修正
takusandayooo 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 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,146 @@ | ||
slot_minutes: 10 | ||
|
||
rooms: | ||
- 大会議室 (セッション) | ||
- 展示 (コンテスト用) | ||
- 展示 | ||
- 中会議室 (WS1 電子工作) | ||
- 中会議室 (WS2 LTブース) | ||
- 中会議室 (WS3) | ||
- 中会議室 (WS4) | ||
|
||
room_styles: | ||
大会議室 (セッション): { color: "#c43b3b" } | ||
展示 (コンテスト用): { color: "#f5a201" } | ||
展示: { color: "#888888" } | ||
中会議室 (WS1 電子工作): { color: "#2e7d32" } | ||
中会議室 (WS2 LTブース): { color: "#1976d2" } | ||
中会議室 (WS3): { color: "#7b1fa2" } | ||
中会議室 (WS4): { color: "#ef6c00" } | ||
|
||
events: | ||
# 大会議室 (セッション) | ||
- room: "大会議室 (セッション)" | ||
start: "10:00" | ||
end: "10:10" | ||
title: "開会式" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "10:10" | ||
end: "10:20" | ||
title: "基調講演 (宮島さん)" | ||
link: "/sessions/keynote1/" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "11:00" | ||
end: "12:00" | ||
title: "コンテスト作品発表" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "12:00" | ||
end: "12:40" | ||
title: "ランチタイム" | ||
note: "適宜お昼をお取りください" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "12:40" | ||
end: "13:00" | ||
title: "みんなのセッション" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "13:40" | ||
end: "14:00" | ||
title: "九州チャンピオン座談会" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "14:20" | ||
end: "14:40" | ||
title: "スピーカーセッション とり子さん (20分)" | ||
|
||
- room: 大会議室 (セッション) | ||
start: "14:40" | ||
end: "14:50" | ||
title: "伸びるかも予備" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "14:50" | ||
end: "15:10" | ||
title: "スピーカーセッション 早良区Dojoチャンピオン (20分)" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "15:10" | ||
end: "15:20" | ||
title: "スポンサーセッション (2件)" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "15:20" | ||
end: "15:30" | ||
title: "招待講演 (小宮山さん)" | ||
link: "/sessions/keynote2/" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "16:00" | ||
end: "16:10" | ||
title: "コンテスト結果発表" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "16:10" | ||
end: "16:20" | ||
title: "スポンサーセッション (1件)" | ||
note: "該当なしの場合は CoderDojo Japan 活動報告" | ||
|
||
- room: "大会議室 (セッション)" | ||
start: "16:20" | ||
end: "16:30" | ||
title: "閉会式" | ||
|
||
# 展示 | ||
- room: "展示 (コンテスト用)" | ||
start: "10:00" | ||
end: "16:00" | ||
title: "ファイナリスト作品展示" | ||
note: "14:00 投票締切" | ||
|
||
- room: "展示" | ||
start: "10:00" | ||
end: "16:00" | ||
title: "展示" | ||
|
||
# WS1 電子工作 (随時受付) | ||
- room: "中会議室 (WS1 電子工作)" | ||
start: "11:00" | ||
end: "16:00" | ||
title: "電子工作ワークショップ (随時受付)" | ||
|
||
# WS2 LTブース | ||
- room: "中会議室 (WS2 LTブース)" | ||
start: "11:20" | ||
end: "12:00" | ||
title: "Dojo関係者等大人LT (要申込)" | ||
|
||
- room: "中会議室 (WS2 LTブース)" | ||
start: "13:00" | ||
end: "14:00" | ||
title: "DojoニンジャLT (要申込)" | ||
|
||
# WS3 | ||
- room: "中会議室 (WS3)" | ||
start: "11:00" | ||
end: "12:00" | ||
title: "ブレンダー (要申込)" | ||
|
||
- room: "中会議室 (WS3)" | ||
start: "13:00" | ||
end: "14:00" | ||
title: "PLAYRISE" | ||
|
||
# WS4 | ||
- room: "中会議室 (WS4)" | ||
start: "11:00" | ||
end: "12:00" | ||
title: "PowerPoint とプログラミング" | ||
|
||
- room: "中会議室 (WS4)" | ||
start: "14:10" | ||
end: "15:00" | ||
title: "PowerPoint とプログラミング" |
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,88 @@ | ||
--- | ||
layout: default | ||
permalink: /time-table/ | ||
title: タイムテーブル | ||
--- | ||
{% include navbar.html %} | ||
|
||
{% comment %} | ||
Jekyll プラグインで事前計算されたタイムテーブル表を使用 | ||
ロジックはプラグインで計算済み。Liquid は描画のみを担当 | ||
{% endcomment %} | ||
|
||
{% assign tte = site.data.time_table_events %} | ||
{% assign events = tte.events %} | ||
{% assign rooms = tte.rooms %} | ||
{% assign time_labels = tte.time_labels %} | ||
{% assign total_slots = tte.total_slots %} | ||
{% assign total_rooms = tte.total_rooms %} | ||
|
||
<section class="w-[calc(100dvw-40px)] max-w-7xl mx-auto mt-25 xl:mt-5"> | ||
<h2 class="text-4xl text-center mb-8"> | ||
Time table | ||
<span class="block mt-3 text-2xl">タイムテーブル</span> | ||
</h2> | ||
<div class="overflow-x-auto border-[1px] border-[#e6e6e9]" aria-label="タイムテーブル(横スクロール可)"> | ||
<table class="ttable" style="--room-count: {{ rooms | size }};"> | ||
<thead> | ||
<tr> | ||
<th scope="col" class="ttable__th ttable__th--start">時間</th> | ||
{% comment %} ルーム単位でヘッダーを描画 {% endcomment %} | ||
{% for room in rooms %} | ||
<th scope="col" | ||
class="ttable__th ttable__th--room" | ||
style="--room-color: {{ room.style.color | default: '#c43b3b' }};"> | ||
<span class="ttable__room-cap">{{ room.name }}</span> | ||
</th> | ||
{% endfor %} | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
{% comment %} スロット単位(行単位)でイベントを描画 {% endcomment %} | ||
{% for slot in (0..total_slots) %} | ||
<tr> | ||
<th scope="row" class="ttable__cell ttable__cell--start">{{ time_labels[slot] }}</th> | ||
|
||
{% comment %} 各イベントを描画 {% endcomment %} | ||
{% for room_index in (0..total_rooms) %} | ||
{% assign event = events[slot][room_index] %} | ||
{% assign room = rooms[room_index] %} | ||
|
||
{% if event == 'continued' %} | ||
{% comment %} イベント継続中 (rowspan で描画するため出力は不要) {% endcomment %} | ||
{% elsif event %} | ||
{% comment %} イベントを描画 {% endcomment %} | ||
{% assign accent = event.accent | default: room.style.color | default: '#c43b3b' %} | ||
{% assign link_url = event.url | default: event.link %} | ||
|
||
<td class="ttable__cell ttable__cell--event" | ||
rowspan="{{ event.duration }}" | ||
style="--span: {{ event.duration }};"> | ||
{% if link_url %} | ||
<a class="ttable__event" href="{{ link_url | relative_url }}" style="--accent: {{ accent }};"> | ||
{% else %} | ||
<div class="ttable__event" style="--accent: {{ accent }};"> | ||
{% endif %} | ||
<div class="ttable__event-time" >{{ event.start }}–{{ event.end }}</div> | ||
<div class="ttable__event-title">{{ event.title }}</div> | ||
{% if event.subtitle %}<div class="ttable__event-subtitle">{{ event.subtitle }}</div>{% endif %} | ||
{% if event.badge %}<span class="ttable__badge">{{ event.badge }}</span>{% endif %} | ||
{% if event.note %}<div class="ttable__event-note">{{ event.note }}</div>{% endif %} | ||
{% if link_url %} | ||
</a> | ||
{% else %} | ||
</div> | ||
{% endif %} | ||
</td> | ||
{% else %} | ||
{% comment %} イベント無し {% endcomment %} | ||
<td class="ttable__cell ttable__cell--empty" aria-label="空き時間"></td> | ||
{% endif %} | ||
{% endfor %} | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</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,100 @@ | ||
module Jekyll | ||
module TimeTableGenerator | ||
# タイムテーブル表を事前に計算してイベント表形式に変換 | ||
# これにより、Liquid テンプレートは単純な表示のみを担当 | ||
class Generator < Jekyll::Generator | ||
safe true | ||
priority :high | ||
|
||
# デフォルト設定値 | ||
DEFAULT_SLOT_MINUTES = 15 | ||
DEFAULT_DAY_START_HOUR = 10 # 10:00 | ||
DEFAULT_DAY_END_HOUR = 16 # 16:00 | ||
|
||
def generate(site) | ||
tt = site.data['time_table'] | ||
return unless tt | ||
|
||
# 設定値を取得 | ||
slot_minutes = tt.fetch('slot_minutes', DEFAULT_SLOT_MINUTES) | ||
day_start = tt.fetch('day_start_hour', DEFAULT_DAY_START_HOUR) | ||
day_end = tt.fetch('day_end_hour', DEFAULT_DAY_END_HOUR) | ||
rooms = tt.fetch('rooms', []) | ||
events = tt.fetch('events', []) | ||
room_styles = tt.fetch('room_styles', {}) | ||
|
||
# イベント情報を表形式で生成 | ||
time_table_events = create_event_table(events, rooms, room_styles, slot_minutes, day_start, day_end) | ||
|
||
# 生成したイベント表データを Liquid に提供 | ||
site.data['time_table_events'] = time_table_events | ||
end | ||
|
||
private | ||
|
||
def create_event_table(events, rooms, room_styles, slot_minutes, day_start, day_end) | ||
total_slots = ((day_end - day_start) * 60 / slot_minutes).to_i | ||
|
||
# 時間ラベルを生成 | ||
time_labels = (0...total_slots).map do |slot| | ||
minutes = day_start * 60 + slot * slot_minutes | ||
"#{minutes / 60}:%02d" % (minutes % 60) | ||
end | ||
|
||
# ルーム情報を生成(room.style でアクセス可能) | ||
rooms_data = rooms.map do |room_name| | ||
{ | ||
'name' => room_name, | ||
'style' => room_styles[room_name] || {} | ||
} | ||
end | ||
|
||
# イベント表を生成(2次元配列) | ||
table = Array.new(total_slots) { Array.new(rooms.size) } | ||
|
||
events.each do |event| | ||
place_event(event, table, rooms, slot_minutes, day_start, total_slots) | ||
end | ||
|
||
{ | ||
'events' => table, | ||
'rooms' => rooms_data, | ||
'time_labels' => time_labels, | ||
'total_slots' => total_slots - 1, # Liquidの (0..n) は inclusive なので -1 | ||
'total_rooms' => rooms.size - 1, # Liquidの (0..n) は inclusive なので -1 | ||
} | ||
end | ||
|
||
def place_event(event, table, rooms, slot_minutes, day_start, total_slots) | ||
room_index = rooms.index(event['room']) | ||
return unless room_index | ||
|
||
# 時間を分に変換して揃える | ||
event_start = time_to_minutes(event['start']) | ||
event_end = time_to_minutes(event['end']) | ||
|
||
# スロット計算(分に揃える) | ||
slot_start = [(event_start - day_start * 60) / slot_minutes, 0].max.to_i | ||
slot_end = [(event_end - day_start * 60) / slot_minutes, total_slots].min.to_i | ||
duration = slot_end - slot_start | ||
|
||
return if slot_start >= total_slots || duration <= 0 | ||
|
||
# イベントの長さ情報 (duration) を追加 | ||
table[slot_start][room_index] = event.merge('duration' => duration) | ||
|
||
# 継続スロットをマーク | ||
(slot_start + 1...slot_end).each do |slot| | ||
break if slot >= total_slots | ||
table[slot][room_index] = 'continued' | ||
end | ||
end | ||
|
||
def time_to_minutes(time_str) | ||
return 0 unless time_str | ||
hours, minutes = time_str.split(':').map(&:to_i) | ||
hours * 60 + minutes | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.
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.