Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions client/agenda/AgendaMobileBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ const downloadIcsOptions = [

function jumpToDay (dayId) {
if (dayId === 'now') {
const lastEventId = agendaStore.findCurrentEventId()
if (lastEventId) {
document.getElementById(`agenda-rowid-${lastEventId}`)?.scrollIntoView(true)
const nowEventId = agendaStore.findNowEventId()
if (nowEventId) {
document.getElementById(`agenda-rowid-${nowEventId}`)?.scrollIntoView(true)
} else {
message.warning('There is no event happening right now.')
message.warning('There is no event happening right now or in the future.')
}
} else {
document.getElementById(dayId)?.scrollIntoView(true)
Expand Down
8 changes: 4 additions & 4 deletions client/agenda/AgendaQuickAccess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ function scrollToDay (daySlug, ev) {
}

function scrollToNow (ev) {
const lastEventId = agendaStore.findCurrentEventId()
const nowEventId = agendaStore.findNowEventId()

if (lastEventId) {
document.getElementById(`agenda-rowid-${lastEventId}`)?.scrollIntoView(true)
if (nowEventId) {
document.getElementById(`agenda-rowid-${nowEventId}`)?.scrollIntoView(true)
} else {
message.warning('There is no event happening right now.')
message.warning('There is no event happening right now or in the future.')
}
}

Expand Down
16 changes: 10 additions & 6 deletions client/agenda/AgendaScheduleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,10 @@ function renderLinkLabel (opt) {

function recalculateRedLine () {
state.currentMinute = DateTime.local().minute
const lastEventId = agendaStore.findCurrentEventId()
const currentEventId = agendaStore.findCurrentEventId()

if (lastEventId) {
state.redhandOffset = document.getElementById(`agenda-rowid-${lastEventId}`)?.offsetTop || 0
if (currentEventId) {
state.redhandOffset = document.getElementById(`agenda-rowid-${currentEventId}`)?.offsetTop || 0
} else {
state.redhandOffset = 0
}
Expand All @@ -614,9 +614,13 @@ function recalculateRedLine () {
return
}
unsubscribe() // we only need to scroll once, so unsubscribe from future updates
if(window.location.hash === "#now") {
const lastEventId = agendaStore.findCurrentEventId()
document.getElementById(`agenda-rowid-${lastEventId}`)?.scrollIntoView(true)
if (window.location.hash === "#now") {
const nowEventId = agendaStore.findNowEvent()
if (nowEventId) {
document.getElementById(`agenda-rowid-${nowEventId}`)?.scrollIntoView(true)
} else {
message.warning('There is no event happening right now or in the future.')
}
} else if(window.location.hash.startsWith(`#${daySlugPrefix}`)) {
document.getElementById(window.location.hash.substring(1))?.scrollIntoView(true)
}
Expand Down
22 changes: 22 additions & 0 deletions client/agenda/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,28 @@ export const useAgendaStore = defineStore('agenda', {

return lastEvent.id || null
},
findNowEventId () {
const currentEventId = this.findCurrentEventId()

if (currentEventId) {
return currentEventId
}

// if there isn't a current event then instead find the next event

const current = (this.nowDebugDiff ? DateTime.local().minus(this.nowDebugDiff) : DateTime.local()).setZone(this.timezone)

// -> Find next event after current time
let nextEventId = undefined
for(const sh of this.scheduleAdjusted) {
if (sh.adjustedStart > current) {
nextEventId = sh.id
break
}
}

return nextEventId || null
},
hideLoadingScreen () {
// -> Hide loading screen
const loadingRef = document.querySelector('#app-loading')
Expand Down
Loading