5
5
---
6
6
{% include navbar.html %}
7
7
8
- {% assign tt = site.data.time_table %}
9
- {% assign slot = tt.slot_minutes | default: 15 %}
10
- {% assign rooms = tt.rooms %}
11
- {% assign room_count = rooms | size %}
8
+ {% comment %}
9
+ Jekyll プラグインで事前計算されたタイムテーブル表を使用
10
+ ロジックはプラグインで計算済み。Liquid は描画のみを担当
11
+ {% endcomment %}
12
12
13
- {% assign day_start_min = 600 %}
14
- {% assign day_end_min = 960 %}
15
- {% assign total_minutes = day_end_min | minus: day_start_min %}
16
- {% assign slots_count = total_minutes | divided_by: slot %}
17
- {% assign last_row = slots_count | minus: 1 %}
13
+ {% assign tte = site.data.time_table_events %}
14
+ {% assign events = tte.events %}
15
+ {% assign rooms = tte.rooms %}
16
+ {% assign time_labels = tte.time_labels %}
17
+ {% assign total_slots = tte.total_slots %}
18
+ {% assign total_rooms = tte.total_rooms %}
18
19
19
20
< section class ="max-w-[1200px] mx-auto px-4 sm:px-8 mt-30 xl:mt-15 ">
20
21
< h2 class ="text-4xl text-center mb-8 ">
@@ -23,94 +24,55 @@ <h2 class="text-4xl text-center mb-8">
23
24
</ h2 >
24
25
25
26
< div class ="ttable-wrap " aria-label ="タイムテーブル(横スクロール可) ">
26
- < table class ="ttable " style ="--room-count: {{ room_count }}; ">
27
+ < table class ="ttable " style ="--room-count: {{ rooms | size }}; ">
27
28
< caption >
28
- {{ tt.date | default: site.date_event }} のタイムテーブル
29
+ {{ site.date_event }} のタイムテーブル
29
30
</ caption >
30
31
31
32
< thead >
32
33
< tr >
33
34
< th scope ="col " class ="ttable__th ttable__th--start "> 時間</ th >
34
- {% for r in rooms %}
35
- {% assign rstyle = tt.room_styles[r] %}
35
+ {% comment %} ルーム単位でヘッダーを描画 {% endcomment %}
36
+ {% for room in rooms %}
36
37
< th scope ="col "
37
38
class ="ttable__th ttable__th--room "
38
- style ="--room-color: {{ rstyle .color | default: '#c43b3b' }}; ">
39
- < span class ="ttable__room-cap "> {{ r }}</ span >
39
+ style ="--room-color: {{ room.style .color | default: '#c43b3b' }}; ">
40
+ < span class ="ttable__room-cap "> {{ room.name }}</ span >
40
41
</ th >
41
42
{% endfor %}
42
43
</ tr >
43
44
</ thead >
44
45
45
46
< tbody >
46
- {% for i in (0..last_row) %}
47
- {% assign row_min = i | times: slot | plus: day_start_min %}
48
- {% assign h = row_min | divided_by: 60 %}
49
- {% assign mf = row_min | modulo: 60 | plus: 0 | prepend: '0' | slice: -2, 2 %}
50
-
47
+ {% comment %} スロット単位(行単位)でイベントを描画 {% endcomment %}
48
+ {% for slot in (0..total_slots) %}
51
49
< tr >
52
- <!-- 左1列(sticky) -->
53
- < th scope ="row " class ="ttable__cell ttable__cell--start "> {{ h }}:{{ mf }}</ th >
54
-
55
- {% for r in rooms %}
56
- {% assign rstyle = tt.room_styles[r] %}
57
- {% assign events_in_room = tt.events | where: 'room', r | sort: 'start' %}
58
-
59
- {% assign active_event = nil %}
60
- {% assign active_event_start_index = nil %}
61
-
62
- {% for ev in events_in_room %}
63
- {% assign s_h = ev.start | split: ':' | first | plus: 0 %}
64
- {% assign s_m = ev.start | split: ':' | last | plus: 0 %}
65
- {% assign e_h = ev.end | split: ':' | first | plus: 0 %}
66
- {% assign e_m = ev.end | split: ':' | last | plus: 0 %}
67
- {% assign s_min = s_h | times: 60 | plus: s_m %}
68
- {% assign e_min = e_h | times: 60 | plus: e_m %}
69
-
70
- {% assign s_clamped = s_min %}
71
- {% if s_clamped < day _start_min %}{% assign s_clamped = day_start_min %}{% endif %}
72
- {% assign e_clamped = e_min %}
73
- {% if e_clamped > day_end_min %}{% assign e_clamped = day_end_min %}{% endif %}
74
-
75
- {% assign span_minutes = e_clamped | minus: s_clamped %}
76
- {% if span_minutes > 0 %}
77
- {% assign numerator = span_minutes | plus: slot | minus: 1 %}
78
- {% assign span_slots = numerator | divided_by: slot %}
79
- {% assign s_index = s_clamped | minus: day_start_min | divided_by: slot %}
80
- {% assign e_index = s_index | plus: span_slots %}
81
- {% if i > = s_index and i < e _index %}
82
- {% assign active_event = ev %}
83
- {% assign active_event_start_index = s_index %}
84
- {% endif %}
85
- {% endif %}
86
- {% endfor %}
87
-
88
- {% if active_event and i == active_event_start_index %}
89
- {%- assign s_h = active_event.start | split: ':' | first | plus: 0 -%}
90
- {%- assign s_m = active_event.start | split: ':' | last | plus: 0 -%}
91
- {%- assign e_h = active_event.end | split: ':' | first | plus: 0 -%}
92
- {%- assign e_m = active_event.end | split: ':' | last | plus: 0 -%}
93
- {%- assign s_min = s_h | times: 60 | plus: s_m -%}
94
- {%- assign e_min = e_h | times: 60 | plus: e_m -%}
95
- {%- if s_min < day _start_min -%}{%- assign s_min = day_start_min -%}{%- endif -%}
96
- {%- if e_min > day_end_min -%}{%- assign e_min = day_end_min -%}{%- endif -%}
97
- {%- assign span_minutes = e_min | minus: s_min -%}
98
- {%- assign numerator = span_minutes | plus: slot | minus: 1 -%}
99
- {%- assign span_slots = numerator | divided_by: slot -%}
100
- {%- assign accent = active_event.accent | default: rstyle.color -%}
101
- < td class ="ttable__cell ttable__cell--event " rowspan ="{{ span_slots }} " style ="--span: {{ span_slots }}; ">
102
- < div class ="ttable__event " style ="--accent: {{ accent | default: '#c43b3b' }}; ">
103
- < div class ="ttable__event-time "> {{ active_event.start }}–{{ active_event.end }}</ div >
104
- < div class ="ttable__event-title "> {{ active_event.title }}</ div >
105
- {% if active_event.subtitle %}
106
- < div class ="ttable__event-subtitle "> {{ active_event.subtitle }}</ div >
107
- {% endif %}
108
- {% if active_event.badge %}
109
- < span class ="ttable__badge "> {{ active_event.badge }}</ span >
110
- {% endif %}
50
+ < th scope ="row " class ="ttable__cell ttable__cell--start "> {{ time_labels[slot] }}</ th >
51
+
52
+ {% comment %} 各イベントを描画 {% endcomment %}
53
+ {% for room_index in (0..total_rooms) %}
54
+ {% assign event = events[slot][room_index] %}
55
+ {% assign room = rooms[room_index] %}
56
+
57
+ {% if event == 'continued' %}
58
+ {% comment %} イベント継続中 (rowspan で描画するため出力は不要) {% endcomment %}
59
+ {% elsif event %}
60
+ {% comment %} イベントを描画 {% endcomment %}
61
+ {% assign accent = event.accent | default: room.style.color | default: '#c43b3b' %}
62
+
63
+ < td class ="ttable__cell ttable__cell--event "
64
+ rowspan ="{{ event.duration }} "
65
+ style ="--span: {{ event.duration }}; ">
66
+ < div class ="ttable__event " style ="--accent: {{ accent }}; ">
67
+ < div class ="ttable__event-time " > {{ event.start }}–{{ event.end }}</ div >
68
+ < div class ="ttable__event-title "> {{ event.title }}</ div >
69
+ {% if event.subtitle %}< div class ="ttable__event-subtitle "> {{ event.subtitle }}</ div > {% endif %}
70
+ {% if event.badge %}< span class ="ttable__badge "> {{ event.badge }}</ span > {% endif %}
71
+ {% if event.note %}< div class ="ttable__event-note "> {{ event.note }}</ div > {% endif %}
111
72
</ div >
112
73
</ td >
113
- {% elsif active_event == nil %}
74
+ {% else %}
75
+ {% comment %} イベント無し {% endcomment %}
114
76
< td class ="ttable__cell ttable__cell--empty " aria-label ="空き時間 "> </ td >
115
77
{% endif %}
116
78
{% endfor %}
0 commit comments