Skip to content

Commit 343b79a

Browse files
committed
fix: adjust agenda grid column ordering
1 parent e044c6b commit 343b79a

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/components/agenda/Desktop.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ schedule.sessions.forEach(session => {
5151

5252
<style>
5353
.agenda-grid {
54-
grid-template-columns: [time] 4rem [R0] 1fr [R1] 1fr [R2] 1fr [RH] 1fr [end] auto [R4] 0;
54+
grid-template-columns: [time] 4rem [R0] 1fr [R1] 1fr [R2] 1fr [RH] 1fr [end] auto;
5555
}
5656
</style>
5757

src/components/agenda/Session.astro

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ const isZhTW = locale === 'zh-tw'
99
1010
const { session } = Astro.props
1111
12-
const columnOrder = {
13-
R0: 0,
14-
R1: 1,
15-
R2: 2,
16-
RH: 3,
17-
}
12+
const columnOrder = ['R0', 'R1', 'R2', 'RH', 'end']
13+
1814
const tags = session.tags.map(tagId => tagIdToDetail(tagId))
1915
const speakers = session.speakers.map(speakerId => speakerIdToDetail(speakerId))
2016
const type = typeToDetail(session.type)
@@ -27,9 +23,11 @@ const style = `grid-area: ${startRow} / ${startCol} / ${endRow} / ${endCol};`
2723
2824
function getColumnStartEnd(columns) {
2925
columns = columns.split(',')
30-
if (columns.length === 1) return [columns[0], columns[0]]
31-
columns.sort((a, b) => columnOrder[a] - columnOrder[b])
32-
return [columns[0], columns.at(-1)]
26+
if (columns.length !== 1) {
27+
columns.sort((a, b) => columnOrder.indexOf(a) - columnOrder.indexOf(b))
28+
}
29+
const last = columnOrder.indexOf(columns.at(-1)) + 1
30+
return [columns[0], columnOrder[last]]
3331
}
3432
3533
function speakerIdToDetail(speakerId) {

0 commit comments

Comments
 (0)