Skip to content

Commit b09f6ef

Browse files
authored
feat: add jump to now/day on mobile agenda (ietf-tools#6654)
1 parent 3d44825 commit b09f6ef

3 files changed

Lines changed: 68 additions & 18 deletions

File tree

client/agenda/AgendaMobileBar.vue

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
<template lang="pug">
22
.agenda-mobile-bar(v-if='siteStore.viewport < 990')
3+
n-dropdown(
4+
:options='jumpToDayOptions'
5+
size='huge'
6+
:show-arrow='true'
7+
trigger='click'
8+
@select='jumpToDay'
9+
)
10+
button
11+
i.bi.bi-arrow-down-circle
312
button(@click='agendaStore.$patch({ filterShown: true })')
4-
i.bi.bi-filter-square-fill.me-2
5-
span Filters
13+
i.bi.bi-funnel
614
n-badge.ms-2(:value='agendaStore.selectedCatSubs.length', processing)
715
button(@click='agendaStore.$patch({ calendarShown: true })')
8-
i.bi.bi-calendar3.me-2
9-
span Cal
16+
i.bi.bi-calendar3
1017
n-dropdown(
1118
:options='downloadIcsOptions'
1219
size='huge'
@@ -15,14 +22,13 @@
1522
@select='downloadIcs'
1623
)
1724
button
18-
i.bi.bi-calendar-check.me-2
19-
span .ics
25+
i.bi.bi-download
2026
button(@click='agendaStore.$patch({ settingsShown: !agendaStore.settingsShown })')
2127
i.bi.bi-gear
2228
</template>
2329

2430
<script setup>
25-
import { h } from 'vue'
31+
import { computed, h } from 'vue'
2632
2733
import {
2834
NBadge,
@@ -43,13 +49,34 @@ const message = useMessage()
4349
const agendaStore = useAgendaStore()
4450
const siteStore = useSiteStore()
4551
52+
// Meeting Days
53+
54+
const jumpToDayOptions = computed(() => {
55+
const days = []
56+
if (agendaStore.isMeetingLive) {
57+
days.push({
58+
label: 'Jump to Now',
59+
key: 'now',
60+
icon: () => h('i', { class: 'bi bi-arrow-down-right-square text-red' })
61+
})
62+
}
63+
for (const day of agendaStore.meetingDays) {
64+
days.push({
65+
label: `Jump to ${day.label}`,
66+
key: day.slug,
67+
icon: () => h('i', { class: 'bi bi-arrow-down-right-square' })
68+
})
69+
}
70+
return days
71+
})
72+
4673
// Download Ics Options
4774
4875
const downloadIcsOptions = [
4976
{
5077
label: 'Subscribe... (webcal)',
5178
key: 'subscribe',
52-
icon: () => h('i', { class: 'bi bi-calendar-week text-blue' })
79+
icon: () => h('i', { class: 'bi bi-calendar-week' })
5380
},
5481
{
5582
label: 'Download... (.ics)',
@@ -60,6 +87,20 @@ const downloadIcsOptions = [
6087
6188
// METHODS
6289
90+
function jumpToDay (dayId) {
91+
if (dayId === 'now') {
92+
const lastEventId = agendaStore.findCurrentEventId()
93+
94+
if (lastEventId) {
95+
document.getElementById(`agenda-rowid-${lastEventId}`)?.scrollIntoView(true)
96+
} else {
97+
message.warning('There is no event happening right now.')
98+
}
99+
} else {
100+
document.getElementById(`agenda-day-${dayId}`)?.scrollIntoView(true)
101+
}
102+
}
103+
63104
function downloadIcs (key) {
64105
message.loading('Generating calendar file... Download will begin shortly.')
65106
let icsUrl = ''
@@ -102,6 +143,8 @@ function downloadIcs (key) {
102143
color: #FFF;
103144
padding: 0 15px;
104145
transition: all .4s ease;
146+
text-align: center;
147+
flex: 1 1;
105148
106149
& + button {
107150
margin-left: 1px;

client/agenda/AgendaScheduleList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ const meetingEvents = computed(() => {
362362
if (item.links.calendar) {
363363
links.push({
364364
id: `lnk-${item.id}-calendar`,
365-
label: isMobile.value ? `Calendar (.ics) entry for this session` : `Calendar (.ics) entry for ${item.acronym} session on ${item.adjustedStart.toFormat('fff')}`,
365+
label: 'Calendar (.ics) entry for this session',
366366
icon: 'calendar-check',
367367
href: item.links.calendar,
368368
color: 'pink'

playwright/tests/meeting/agenda.spec.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,27 +1427,34 @@ test.describe('past - small screens', () => {
14271427

14281428
// has a bottom mobile bar
14291429
await expect(page.locator('.agenda-mobile-bar')).toBeVisible()
1430-
await expect(barBtnLocator).toHaveCount(4)
1431-
await expect(barBtnLocator.first()).toContainText('Filters')
1432-
await expect(barBtnLocator.nth(1)).toContainText('Cal')
1433-
await expect(barBtnLocator.nth(2)).toContainText('.ics')
1434-
await expect(barBtnLocator.last().locator('> *')).toHaveCount(1)
1435-
await expect(barBtnLocator.last().locator('> *')).toHaveClass(/bi/)
1430+
await expect(barBtnLocator).toHaveCount(5)
14361431

1437-
// can open the filters overlay
1432+
// can open the jump to day dropdown
14381433
await barBtnLocator.first().click()
1434+
const jumpDayDdnLocator = page.locator('.n-dropdown-menu > .n-dropdown-option')
1435+
await expect(jumpDayDdnLocator).toHaveCount(7)
1436+
for (let idx = 0; idx < 7; idx++) {
1437+
const localDateTime = DateTime.fromISO(meetingData.meeting.startDate, { zone: meetingData.meeting.timezone })
1438+
.setLocale(BROWSER_LOCALE)
1439+
.plus({ days: idx })
1440+
.toFormat('ccc LLL d')
1441+
await expect(jumpDayDdnLocator.nth(idx)).toContainText(`Jump to ${localDateTime}`)
1442+
}
1443+
1444+
// can open the filters overlay
1445+
await barBtnLocator.nth(1).click()
14391446
await expect(page.locator('.agenda-personalize')).toBeVisible()
14401447
await page.locator('.agenda-personalize .agenda-personalize-actions > button').nth(1).click()
14411448
await expect(page.locator('.agenda-personalize')).toBeHidden()
14421449

14431450
// can open the calendar view
1444-
await barBtnLocator.nth(1).click()
1451+
await barBtnLocator.nth(2).click()
14451452
await expect(page.locator('.agenda-calendar')).toBeVisible()
14461453
await page.locator('.agenda-calendar .agenda-calendar-actions > button').nth(1).click()
14471454
await expect(page.locator('.agenda-calendar')).toBeHidden()
14481455

14491456
// can open the ics dropdown
1450-
await barBtnLocator.nth(2).click()
1457+
await barBtnLocator.nth(3).click()
14511458
const calDdnLocator = page.locator('.n-dropdown-menu > .n-dropdown-option')
14521459
await expect(calDdnLocator).toHaveCount(2)
14531460
await expect(calDdnLocator.first()).toContainText('Subscribe')

0 commit comments

Comments
 (0)