|
24 | 24 | ) |
25 | 25 | //- ROW - DAY HEADING ----------------------- |
26 | 26 | template(v-if='item.displayType === `day`') |
27 | | - td(:id='`agenda-day-` + item.id', :colspan='pickerModeActive ? 6 : 5') {{item.date}} |
| 27 | + td(:id='item.slug', :colspan='pickerModeActive ? 6 : 5') {{item.date}} |
28 | 28 | //- ROW - SESSION HEADING ------------------- |
29 | 29 | template(v-else-if='item.displayType === `session-head`') |
30 | 30 | td.agenda-table-cell-check(v-if='pickerModeActive') |
@@ -200,7 +200,7 @@ import { |
200 | 200 |
|
201 | 201 | import AgendaDetailsModal from './AgendaDetailsModal.vue' |
202 | 202 |
|
203 | | -import { useAgendaStore } from './store' |
| 203 | +import { useAgendaStore, daySlugPrefix, daySlug } from './store' |
204 | 204 | import { useSiteStore } from '../shared/store' |
205 | 205 | import { getUrl } from '../shared/urls' |
206 | 206 |
|
@@ -248,6 +248,7 @@ const meetingEvents = computed(() => { |
248 | 248 | if (itemDate.toISODate() !== acc.lastDate) { |
249 | 249 | acc.result.push({ |
250 | 250 | id: item.id, |
| 251 | + slug: daySlug(item), |
251 | 252 | key: `day-${itemDate.toISODate()}`, |
252 | 253 | displayType: 'day', |
253 | 254 | date: itemDate.toLocaleString(DateTime.DATE_HUGE), |
@@ -575,6 +576,30 @@ function recalculateRedLine () { |
575 | 576 | } |
576 | 577 | } |
577 | 578 |
|
| 579 | +/** |
| 580 | + * On page load when browser location hash contains '#now' or '#agenda-day-*' then scroll accordingly |
| 581 | + */ |
| 582 | +;(function scrollToHashInit() { |
| 583 | + if (!window.location.hash) { |
| 584 | + return |
| 585 | + } |
| 586 | + if (!(window.location.hash === "#now" || window.location.hash.startsWith(`#${daySlugPrefix}`))) { |
| 587 | + return |
| 588 | + } |
| 589 | + const unsubscribe = agendaStore.$subscribe((_mutation, agendaStoreState) => { |
| 590 | + if (agendaStoreState.schedule.length === 0) { |
| 591 | + return |
| 592 | + } |
| 593 | + unsubscribe() // we only need to scroll once, so unsubscribe from future updates |
| 594 | + if(window.location.hash === "#now") { |
| 595 | + const lastEventId = agendaStore.findCurrentEventId() |
| 596 | + document.getElementById(`agenda-rowid-${lastEventId}`)?.scrollIntoView(true) |
| 597 | + } else if(window.location.hash.startsWith(`#${daySlugPrefix}`)) { |
| 598 | + document.getElementById(window.location.hash.substring(1))?.scrollIntoView(true) |
| 599 | + } |
| 600 | + }) |
| 601 | +})() |
| 602 | +
|
578 | 603 | // MOUNTED |
579 | 604 |
|
580 | 605 | onMounted(() => { |
|
0 commit comments