Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.
TypeScript ai-meeting-assistantai-notetakerelectrongranola-alternativelinuxllama-cpplocal-ailocal-firstmacosmcpmeeting-minutesmeeting-notesoffline-firstopen-sourceprivacyspeech-to-texttranscriptionwhisperwhisper-cppwindows
Meetings: going to a date from search scrolls the meeting list to the nearest day; a future date returns the list to today at the top
Eric Brownrout09818d7da07a
diff --git a/app/e2e/home.spec.ts b/app/e2e/home.spec.tsindex 61e26547..cce2b1e4 100644--- a/app/e2e/home.spec.ts+++ b/app/e2e/home.spec.ts@@ -465,6 +465,91 @@ test('calendar access turned off: the one button opens the Mac settings', async} finally { await app.close() }})+for (const theme of ['light', 'dark'] as const) {+ test(`Go to date lands on the nearest meeting day and returns to the top for a future date in ${theme}`, async ({}, testInfo) => {+ const { app, page, userData } = await launch()+ const db = new DatabaseSync(join(userData, 'yogurt.db'), { timeout: 5000 })+ try {+ await fake(app, 'manyMeetings', { n: 100, clean: true })+ const rows = db.prepare('SELECT id FROM meetings ORDER BY started_at DESC').all()+ const date = (offset: number) => new Date(2024, 10, 11 + offset, 12)+ const stamp = db.prepare('UPDATE meetings SET started_at = ?, ended_at = ? WHERE id = ?')+ const today = new Date(2026, 10, 24, 12)+ await page.clock.setFixedTime(today)+ // Nov 12 is a tie. Skipping Nov 9 makes Nov 11 the closest day to Nov 10 on the second page.+ rows.forEach(({ id }, i) => {+ const at = theme === 'light' && i < 3 ? today.getTime() - i * 60_000 : date(i === 61 ? -4 : 2 * (60 - i)).getTime()+ stamp.run(at, at + 30 * 60_000, id)+ })+ await page.evaluate(theme => window.yogurt.settings.setTheme(theme), theme)+ await page.reload()+ await page.emulateMedia({ colorScheme: theme, reducedMotion: theme === 'dark' ? 'reduce' : 'no-preference' })+ await expect(page.getByTestId('past-note').first()).toBeVisible()+ expect(await page.getByTestId('past-note').count()).toBeLessThan(61)+ await page.getByRole('button', { name: 'Hide Agenda' }).click()+ if (theme === 'dark') await openFromCorner(page, 'nav-trash')++ const jump = async (query: string) => {+ await page.keyboard.press('Meta+k')+ await page.getByTestId('search-input').fill(query)+ await expect(page.getByTestId('command-agenda-date')).toHaveAttribute('aria-selected', 'true')+ await page.keyboard.press('Enter')+ await expect(page.getByTestId('search')).toHaveCount(0)+ }+ const library = page.locator('.native-home .native-library')+ const trace = await page.evaluateHandle(() => ({+ landing: new Promise<{ from: number; viewport: number }>(resolve => {+ document.addEventListener('focusin', function onFocus(event) {+ const heading = event.target+ if (!(heading instanceof HTMLElement) || !heading.dataset.rowHeading) return+ document.removeEventListener('focusin', onFocus)+ const pane = heading.closest<HTMLElement>('.native-library')!+ resolve({ from: pane.scrollTop, viewport: pane.clientHeight })+ })+ }),+ }))+ await jump('November 12, 2024')+ const heading = page.locator(`[data-row-heading="${date(0).toDateString()}"]`)+ await expect(heading).toBeFocused()+ await expect.poll(() => heading.evaluate(el => {+ const pane = el.closest<HTMLElement>('.native-library')!+ return Math.abs(el.getBoundingClientRect().top - pane.getBoundingClientRect().top - parseFloat(getComputedStyle(pane).paddingTop))+ })).toBeLessThan(1)+ const { from, viewport } = await trace.evaluate(t => t.landing)+ const to = await library.evaluate(el => el.scrollTop)+ expect(to).toBeGreaterThan(viewport * 2)+ if (theme === 'light') expect(Math.abs(to - from - viewport)).toBeLessThanOrEqual(1)+ else expect(from).toBe(0)+ await expect(heading).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')+ await expect(heading).toHaveCSS('outline-style', 'none')+ await expect(library.getByText(/^No meetings on /)).toHaveCount(0)+ const agenda = page.getByRole('complementary', { name: 'Agenda' })+ await expect(agenda.getByRole('button', { name: 'Tuesday, November 12', exact: true })).toHaveAttribute('aria-pressed', 'true')+ await page.getByTestId('home').screenshot({ path: testInfo.outputPath(`meeting-date-jump-${theme}.png`) })++ await jump('November 10, 2024')+ await expect(heading).toBeFocused()+ await expect(agenda.getByRole('button', { name: 'Sunday, November 10', exact: true })).toHaveAttribute('aria-pressed', 'true')+ await jump('November 11, 2023')+ const oldest = date(2 * (61 - rows.length)).toDateString()+ await expect(library.locator(`[data-row-heading="${oldest}"]`)).toBeFocused()+ await expect.poll(() => library.evaluate(el => Math.abs(el.scrollHeight - el.clientHeight - el.scrollTop))).toBeLessThan(1)+ await expect(library.getByText(/^No meetings on /)).toHaveCount(0)++ await jump('December 12')+ await expect(agenda.getByRole('button', { name: 'Saturday, December 12', exact: true })).toHaveAttribute('aria-pressed', 'true')+ await expect.poll(() => library.evaluate(el => el.scrollTop)).toBe(0)+ await expect(library.getByRole('heading', { name: 'Your meetings', exact: true })).toBeFocused()++ await library.focus()+ await jump('December 13')+ await expect(agenda.getByRole('button', { name: 'Sunday, December 13', exact: true })).toHaveAttribute('aria-pressed', 'true')+ await expect(library).toBeFocused()+ expect(await library.evaluate(el => el.scrollTop)).toBe(0)+ } finally { db.close(); await app.close() }+ })+}+test('500 past meetings: the list opens fast, grouped by day, and loads more as you scroll', async () => {const { app, page } = await launch()try {diff --git a/app/src/renderer/src/App.tsx b/app/src/renderer/src/App.tsxindex bae232d6..ea03f11b 100644--- a/app/src/renderer/src/App.tsx+++ b/app/src/renderer/src/App.tsx@@ -202,7 +202,7 @@ export function App() {onResumeRequested={resumeRequested ? () => { setResumeRequested(false); rememberRoute(route) } : undefined}folderSuggestion={suggestedFolder ? { folder: suggestedFolder, dismiss: () => dismissFolderSuggestion(noteId) } : undefined} />: chatId !== undefined ? <ChatPage id={chatId} go={go} openSource={openSource} />- : trash ? <Trash open={open} /> : folderScreen || <Home open={open} openSearch={openSearch} openFolder={(id) => go(`/folder/${id}`)} agendaJump={agendaJump} />+ : trash ? <Trash open={open} /> : folderScreen || <Home open={open} openSearch={openSearch} openFolder={(id) => go(`/folder/${id}`)} agendaJump={agendaJump} searching={searching} />const mac = window.yogurt.platform === 'darwin'const startupError = !setup && setupFailedconst launching = mac && !startupError && (!booted || holding)diff --git a/app/src/renderer/src/components/Search.tsx b/app/src/renderer/src/components/Search.tsxindex d082ae45..6b46b851 100644--- a/app/src/renderer/src/components/Search.tsx+++ b/app/src/renderer/src/components/Search.tsx@@ -48,7 +48,7 @@ export function Search({ folder, folders, onOpen, onNavigate, onSettingsChange,const selectedPeople = uniqueSearchPeople(personQuery.matches.map(m => m.person))const peopleKey = selectedPeople.map(searchPersonKey).join('|')const parsed = parseSearchQuery(personQuery.text, searchOptions)- const request = { q, scope, peopleKey, people: selectedPeople, date: parsed.date, suggestions: personQuery.suggestions.slice(0, 5) }+ const request = { q, scope, peopleKey, people: selectedPeople, date: parsed.date, jumpAt: parsed.jumpAt, suggestions: personQuery.suggestions.slice(0, 5) }const [results, setResults] = useState<typeof request & { list: SearchResult[] }>()const [active, setActive] = useState<number | null>(null)const [prefs, setPrefs] = useState<Awaited<ReturnType<typeof window.yogurt.settings.get>>>()@@ -123,7 +123,7 @@ export function Search({ folder, folders, onOpen, onNavigate, onSettingsChange,].filter((c) => !c.id.startsWith('theme-') || !!prefs)const defaultSelection = useRef<string | undefined>(undefined)const rank = (search: typeof request, list: SearchResult[]) => {- const date = window.yogurt.capabilities.calendar && searchDateCommand(search.date, search.q)+ const date = searchDateCommand(search.jumpAt, search.q)const commands = date ? [{ ...date, Icon: CalendarDays, run: () => onNavigate('', date.at) }, ...allCommands] : allCommandsreturn searchPalette(commands, list, search.q, search.q, search.suggestions, defaultSelection.current, !!search.date || search.people.length > 0)}diff --git a/app/src/renderer/src/meetingDateJump.ts b/app/src/renderer/src/meetingDateJump.tsnew file mode 100644index 00000000..ed658789--- /dev/null+++ b/app/src/renderer/src/meetingDateJump.ts@@ -0,0 +1,71 @@+import { useLayoutEffect, useRef } from 'react'+import { daysAgo } from '../../shared/dates'+import { glide, scrollBehavior } from './motion'++type Card = { startedAt: number }+type Destination = { kind: 'top' | 'page' | 'empty' } | { kind: 'day' | 'bottom'; key: string }++export function resolveMeetingDate(at: number, cards: Card[], more: boolean, now = Date.now()): Destination {+ const start = new Date(at).setHours(0, 0, 0, 0)+ if (start > now) return { kind: 'top' }+ const end = new Date(at).setHours(24, 0, 0, 0)+ // Newest first. Page until we have the requested day, both neighbors, or the end of history.+ const i = cards.findIndex(card => card.startedAt < end)+ if (i < 0) {+ if (more) return { kind: 'page' }+ const oldest = cards.at(-1)+ return oldest ? { kind: 'bottom', key: new Date(oldest.startedAt).toDateString() } : { kind: 'empty' }+ }+ let closest = cards[i]+ const later = cards[i - 1]+ if (closest.startedAt < start && later && daysAgo(at, later.startedAt) < daysAgo(closest.startedAt, at)) {+ closest = later+ }+ return { kind: 'day', key: new Date(closest.startedAt).toDateString() }+}++export function landOnHeading(root: HTMLElement, heading: HTMLElement, top: number) {+ const distance = top - root.scrollTop+ if (Math.abs(distance) > root.clientHeight && scrollBehavior() === 'smooth') {+ root.scrollTop = top - Math.sign(distance) * root.clientHeight+ }+ heading.tabIndex = -1+ heading.focus({ preventScroll: true })+ const listeners = new AbortController()+ const stop = glide(root, top, () => listeners.abort(), 300)+ const interrupt = () => { listeners.abort(); stop() }+ for (const event of ['wheel', 'touchstart', 'pointerdown', 'keydown']) {+ root.addEventListener(event, interrupt, { passive: true, signal: listeners.signal })+ }+ return interrupt+}++export function useMeetingDateJump(request: { at: number } | undefined, past: {+ cards?: Card[]; root: HTMLElement | null; more: boolean; failed?: string; next: () => void+}, ready: boolean) {+ const { cards, root, more, failed, next } = past+ const handled = useRef<typeof request>(undefined)+ const cleanup = useRef<(() => void) | undefined>(undefined)+ const target = request && cards && resolveMeetingDate(request.at, cards, more)+ const key = target && 'key' in target ? target.key : undefined+ const kind = target?.kind+ // Paging and live refreshes can rerender Home during the glide. A new command replaces it.+ useLayoutEffect(() => () => { cleanup.current?.(); handled.current = undefined }, [request])+ useLayoutEffect(() => {+ if (!request || handled.current === request || !ready || !root || !kind || kind === 'empty' || (failed && kind !== 'top')) return+ if (kind === 'page') { next(); return }+ if (kind === 'top' && root.scrollTop === 0) { handled.current = request; return }+ const heading = root.querySelector<HTMLElement>(kind === 'top' ? 'h1' : `[data-row-heading="${key}"]`)+ if (!heading) return+ const max = root.scrollHeight - root.clientHeight+ let top = 0+ if (kind === 'bottom') top = max+ if (kind === 'day') {+ top = root.scrollTop + heading.getBoundingClientRect().top - root.getBoundingClientRect().top - parseFloat(getComputedStyle(root).paddingTop)+ // Load enough rows below the heading to align it with the top of the pane.+ if (more && top > max) { next(); return }+ }+ handled.current = request+ cleanup.current = landOnHeading(root, heading, Math.max(0, Math.min(max, top)))+ }, [request, ready, root, failed, kind, key, more, next])+}diff --git a/app/src/renderer/src/screens/Home.tsx b/app/src/renderer/src/screens/Home.tsxindex 259e9bb9..c78fb10b 100644--- a/app/src/renderer/src/screens/Home.tsx+++ b/app/src/renderer/src/screens/Home.tsx@@ -9,6 +9,7 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, uimport type { MeetingCard } from '../../../shared/types'import { useScrollMemory } from '../useScrollMemory'import { loadUpTo } from '../paging'+import { useMeetingDateJump } from '../meetingDateJump'import { t } from '../../../shared/i18n'import { dayLabel, timeOf, useDay } from '../dates'import { useLanguage } from '../i18n'@@ -27,7 +28,7 @@ const PAGE = 40const loadedCounts = new Map<string, number>()/** The workspace, backed by the existing meeting and calendar bridge. */-export function Home({ open, openSearch, openFolder, agendaJump }: { open: (id: string) => void; openSearch: () => void; openFolder?: (id: string) => void; agendaJump?: { at: number } }) {+export function Home({ open, openSearch, openFolder, agendaJump, searching }: { open: (id: string) => void; openSearch: () => void; openFolder?: (id: string) => void; agendaJump?: { at: number }; searching?: boolean }) {const past = usePastNotes()const day = useDay()const recording = past.cards?.find((c) => c.state === 'recording')@@ -42,6 +43,8 @@ export function Home({ open, openSearch, openFolder, agendaJump }: { open: (id:const [emptyActions, setEmptyActions] = useState<HTMLDivElement | null>(null)const calendar = window.yogurt.capabilities.calendarconst [agendaOpen, setAgendaOpen] = useState(readAgendaOpen)+ const [listReady, setListReady] = useState(false)+ useMeetingDateJump(agendaJump, past, listReady && !searching)const [agendaMotion, setAgendaMotion] = useState(false)const [toolbar, setToolbar] = useState<HTMLElement | null>(null)const toggle = useRef<HTMLButtonElement>(null)@@ -78,7 +81,15 @@ export function Home({ open, openSearch, openFolder, agendaJump }: { open: (id:</button></div>{past.failed && !!past.cards?.length && <InlineError testId="meetings-read-error" retry={past.retry} />}- <LoadingContent pending={!past.cards && !past.failed} testId="meetings-loading" skeleton={<MeetingListLoading />} className="library-load">{!past.cards?.length ? <LibraryEmpty testId="past-empty" icon={<FileText size={28} aria-hidden="true" />} title={t('Your notes will show up here')} description={t('Your summary appears after you stop recording.')} retry={past.failed ? past.retry : undefined}><div ref={setEmptyActions} /></LibraryEmpty> : <PastNotes cards={past.cards ?? []} day={day} more={past.more} sentinel={past.setSentinel} onOpen={open} openFolder={openFolder} />}</LoadingContent>+ <LoadingContent pending={!past.cards && !past.failed} onReady={() => setListReady(true)}+ testId="meetings-loading" skeleton={<MeetingListLoading />} className="library-load">+ {past.cards?.length ? <PastNotes cards={past.cards} day={day} more={past.more} sentinel={past.setSentinel}+ onOpen={open} openFolder={openFolder} /> :+ <LibraryEmpty testId="past-empty" icon={<FileText size={28} aria-hidden="true" />} title={t('Your notes will show up here')}+ description={t('Your summary appears after you stop recording.')} retry={past.failed ? past.retry : undefined}>+ <div ref={setEmptyActions} />+ </LibraryEmpty>}+ </LoadingContent></div>{calendar && <div ref={panel} id="home-agenda" className="home-agenda-panel" inert={!agendaOpen}>{(agendaOpen || agendaMotion) && <Agenda revision={calendarRevision} recording={recording} onStart={start} onOpen={open} jumpTo={agendaJump} />}@@ -121,13 +132,15 @@ export function usePastNotes(folder?: string) {const reload = useCallback(() => {const mine = ++seq.current+ loading.current = true// however far down the person scrolled, in steps (one call to main is capped)void readMeetingRows(() => loadUpTo((o) => window.yogurt.meetings.cards({ ...o, ...(folder ? { folder } : {}) }), shown.current, PAGE)).then(({ cards: list, more }) => {if (mine !== seq.current) return+ loading.current = falsesetFailed(undefined)animateRows(list)shown.current = list.length; loadedCounts.set(memoryKey, list.length); setCards(list); setMore(more)- }).catch(() => { if (mine === seq.current) setFailed('list') })+ }).catch(() => { if (mine === seq.current) { loading.current = false; setFailed('list') } })}, [folder, animateRows])useEffect(() => {reload()@@ -146,6 +159,7 @@ export function usePastNotes(folder?: string) {const mine = seq.currentvoid window.yogurt.meetings.cards({ limit: PAGE, before: { at: last.startedAt, id: last.id }, ...(folder ? { folder } : {}) }).then((page) => {if (mine !== seq.current) return+ loading.current = falsesetFailed(undefined)setCards((cur) => {const have = new Set(cur?.map((c) => c.id))@@ -154,7 +168,7 @@ export function usePastNotes(folder?: string) {return all})setMore(page.length === PAGE)- }).catch(() => { if (mine === seq.current) setFailed('page') }).finally(() => { loading.current = false })+ }).catch(() => { if (mine === seq.current) { loading.current = false; setFailed('page') } })}, [cards, folder])useEffect(() => {@@ -164,7 +178,7 @@ export function usePastNotes(folder?: string) {return () => io.disconnect()}, [sentinel, root, more, next])- return { cards, more, failed, retry: failed === 'page' ? next : reload, setRoot: attachRoot, setSentinel }+ return { cards, root, more, next, failed, retry: failed === 'page' ? next : reload, setRoot: attachRoot, setSentinel }}/** Delete on a row moves the meeting to the Trash at once (Undo in the note at the bottom) */diff --git a/app/src/renderer/src/searchFilters.ts b/app/src/renderer/src/searchFilters.tsindex 792f3c4f..634d0fa3 100644--- a/app/src/renderer/src/searchFilters.ts+++ b/app/src/renderer/src/searchFilters.ts@@ -3,13 +3,11 @@ import type { Person } from '../../shared/types'import type { SearchPersonMatch } from '../../shared/searchPeople'import type { SearchDate } from '../../shared/searchQuery'-export function searchDateCommand(date: SearchDate | undefined, query: string) {- if (!date) return undefined- const start = new Date(date.start)- if (new Date(start.getFullYear(), start.getMonth(), start.getDate() + 1).getTime() !== date.end) return undefined+export function searchDateCommand(at: number | undefined, query: string) {+ if (at === undefined) return undefinedreturn { id: 'agenda-date', query, group: t('Go to'), label: t('Go to {date}', {- date: new Intl.DateTimeFormat(language(), { month: 'short', day: 'numeric', year: 'numeric' }).format(start),- }), at: date.start }+ date: new Intl.DateTimeFormat(language(), { month: 'short', day: 'numeric', year: 'numeric' }).format(at),+ }), at }}export function searchDateLabel(date: SearchDate, locale = language()) {diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.cssindex 2e53a1e6..b6c73e8d 100644--- a/app/src/renderer/src/workspace.css+++ b/app/src/renderer/src/workspace.css@@ -164,6 +164,7 @@.native-library>h1 { font-size:20px;line-height:26px;font-weight:600;letter-spacing:-.55px;margin-bottom:9px; }.native-meeting-day { margin-top:25px; }.native-meeting-day>h2,.meeting-day-exit { font-size:11px;line-height:14px;font-weight:550;color:var(--written);margin-bottom:9px; }+.native-home :is(h1, [data-row-heading])[tabindex="-1"]:focus { outline:none; }.native-meeting-row { position:relative;display:grid;grid-template-columns:minmax(0,1fr) max-content;align-items:center;column-gap:12px;margin-inline:-8px;padding-inline-end:8px;border-radius:7px;overflow:hidden; }.native-meeting-row:hover:not([data-focus-ring]):not(:has([data-focus-ring])) { background:var(--row-hover); }.native-meeting-card { grid-area:1 / 1 / 2 / 3;display:grid;grid-template-columns:subgrid;align-items:center;min-width:0;border-radius:inherit; }diff --git a/app/src/shared/searchQuery.ts b/app/src/shared/searchQuery.tsindex a31ce399..31f07533 100644--- a/app/src/shared/searchQuery.ts+++ b/app/src/shared/searchQuery.ts@@ -25,13 +25,15 @@ const parsers: Record<string, Chrono> = { en, de, fr, ja, pt, nl, ru, es, uk, it/** Calendar boundaries use local dates, including days that are not 24 hours long. */export function parseSearchQuery(query: string, { now = new Date(), locale = new Intl.DateTimeFormat().resolvedOptions().locale, language = locale }: SearchOptions = {}) {+ let jumpAt: number | undefinedlet date: SearchDate | undefinedlet dateSpan: { start: number; end: number } | undefinedlet text = queryconst day = (offset = 0) => new Date(now.getFullYear(), now.getMonth(), now.getDate() + offset)- const consume = (span: { start: number; end: number }, start: Date, end: Date) => {+ const consume = (span: { start: number; end: number }, start: Date, end: Date, calendarStart = start.getTime()) => {if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime()) || end <= start) returndate = { start: start.getTime(), end: end.getTime() }+ if (new Date(start.getFullYear(), start.getMonth(), start.getDate() + 1).getTime() === date.end) jumpAt = calendarStartdateSpan = spantext = (query.slice(0, span.start) + ' ' + query.slice(span.end)).replace(/\s+/g, ' ').trim()}@@ -84,6 +86,8 @@ export function parseSearchQuery(query: string, { now = new Date(), locale = newconst numeric = [...result.text.matchAll(/\b(\d{1,2})\/(\d{1,2})(?:\/\d{4})?\b/g)]if (numeric.some(m => Number(m[dayFirst ? 2 : 1]) > 12)) continue}+ // Go to uses the parsed calendar day. Meeting history searches the most recent occurrence.+ const calendarStart = start.getTime()if (result.start.isCertain('month') && !result.start.isCertain('year') && !result.end?.isCertain('year') && start > day()) {const month = start.getMonth(), lastMonth = last.getMonth()start.setFullYear(start.getFullYear() - 1); last.setFullYear(last.getFullYear() - 1)@@ -95,11 +99,11 @@ export function parseSearchQuery(query: string, { now = new Date(), locale = new}const end = monthOnly ? new Date(start.getFullYear(), start.getMonth() + 1, 1): new Date(last.getFullYear(), last.getMonth(), last.getDate() + 1)- consume(span, start, end)+ consume(span, start, end, calendarStart)if (date) break}}- return { text, words: searchWords(text), date, ...(dateSpan ? { dateSpan } : {}) }+ return { text, words: searchWords(text), date, jumpAt, ...(dateSpan ? { dateSpan } : {}) }}/** A single insertion, deletion or substitution; short words stay exact. */diff --git a/app/test/home.test.ts b/app/test/home.test.tsindex 3329bb47..e3bc157e 100644--- a/app/test/home.test.ts+++ b/app/test/home.test.ts@@ -5,6 +5,7 @@ import { readAgendaOpen, saveAgendaOpen } from '../src/renderer/src/agenda'import { Home } from '../src/renderer/src/screens/Home'import { pickNext } from '../src/shared/comingUp'import { loadUpTo } from '../src/renderer/src/paging'+import { landOnHeading, resolveMeetingDate } from '../src/renderer/src/meetingDateJump'import type { CalEvent } from '../src/shared/types'vi.mock('../src/renderer/src/components/LoadingContent', () => ({ LoadingContent: () => null }))@@ -50,6 +51,58 @@ describe('loadUpTo', () => {})})+describe('Go to a meeting day', () => {+ afterEach(() => vi.unstubAllGlobals())+ const at = (day: number, hour = 0) => new Date(2026, 10, day, hour).getTime()+ const cards = (days: number[]) => days.map(d => ({ startedAt: at(d, 23) }))+ const jump = (day: number, days: number[], more: boolean) => resolveMeetingDate(at(day), cards(days), more, at(15, 12))+ const key = (day: number) => new Date(at(day)).toDateString()+ it('lands on the exact local day, including today and meetings late in the day', () => {+ for (const day of [15, 11]) expect(jump(day, [15, 12, 11, 11, 8], true)).toEqual({ kind: 'day', key: key(day) })+ })+ it('chooses the closest calendar day in either direction, preferring the earlier day on a tie', () => {+ expect(jump(11, [14, 12, 6, 4], true)).toEqual({ kind: 'day', key: key(12) })+ expect(jump(11, [14, 10, 6], true)).toEqual({ kind: 'day', key: key(10) })+ expect(jump(11, [12, 10], true)).toEqual({ kind: 'day', key: key(10) })+ expect(jump(15, [11, 8], true)).toEqual({ kind: 'day', key: key(11) })+ const aroundMidnight = [{ startedAt: at(2) }, { startedAt: at(0) }]+ expect(resolveMeetingDate(at(1, 23), aroundMidnight, false, at(15))).toEqual({ kind: 'day', key: key(0) })+ })+ it('pages until the closest day is known and lands at the bottom for dates before the library', () => {+ expect(jump(4, [14, 10], true)).toEqual({ kind: 'page' })+ expect(jump(4, [14, 10, 7, 5], true)).toEqual({ kind: 'page' })+ expect(jump(4, [14, 10, 7, 5, 4], true)).toEqual({ kind: 'day', key: key(4) })+ expect(jump(4, [14, 10, 7, 5, 1], false)).toEqual({ kind: 'day', key: key(5) })+ expect(jump(3, [14, 10, 7, 5, 4], false)).toEqual({ kind: 'bottom', key: key(4) })+ expect(jump(3, [], false)).toEqual({ kind: 'empty' })+ })+ it('sends a future date directly to the top regardless of the loaded meetings', () => {+ for (const days of [[15, 12], [12], []]) expect(jump(16, days, true)).toEqual({ kind: 'top' })+ })+ it.each([false, true])('limits travel to one viewport going back to the top without highlighting (reduced %s)', reduced => {+ vi.stubGlobal('window', { matchMedia: () => ({ matches: reduced }) })+ vi.stubGlobal('performance', { now: () => 0 })+ let frame: FrameRequestCallback | undefined+ vi.stubGlobal('requestAnimationFrame', (fn: FrameRequestCallback) => { frame = fn; return 1 })+ vi.stubGlobal('cancelAnimationFrame', vi.fn())+ const root = Object.assign(new EventTarget(), { scrollTop: 3200, clientHeight: 500 })+ const heading = { focus: vi.fn(), animate: vi.fn() }+ const cleanup = landOnHeading(root as HTMLElement, heading as unknown as HTMLElement, 0)+ expect(heading.focus).toHaveBeenCalledWith({ preventScroll: true })+ if (reduced) expect(frame).toBeUndefined()+ else {+ expect(root.scrollTop).toBe(500)+ frame!(150)+ expect(root.scrollTop).toBeGreaterThan(0)+ expect(root.scrollTop).toBeLessThan(250)+ frame!(300)+ }+ expect(root.scrollTop).toBe(0)+ expect(heading.animate).not.toHaveBeenCalled()+ cleanup()+ })+})+describe('Home Agenda', () => {afterEach(() => vi.unstubAllGlobals())it('starts shown and restores the chosen layout when Home remounts', () => {diff --git a/app/test/motionInteractions.test.ts b/app/test/motionInteractions.test.tsindex 2956a26d..925841ec 100644--- a/app/test/motionInteractions.test.ts+++ b/app/test/motionInteractions.test.ts@@ -4,6 +4,7 @@ import { App } from '../src/renderer/src/App'import { afterEach, expect, it, vi } from 'vitest'import { useEffect, useLayoutEffect, useRef, useState, type ReactElement, type ReactNode } from 'react'import { useDialogFocus } from '../src/renderer/src/useDialogFocus'+import { useMeetingDateJump } from '../src/renderer/src/meetingDateJump'import { Search } from '../src/renderer/src/components/Search'import { Ask } from '../src/renderer/src/components/Chat'import { AskContext, scopeLabel } from '../src/renderer/src/components/AskContext'@@ -516,26 +517,50 @@ it.each([false, true])('opens a pending command-search question as a draft whenexpect(draft).toHaveBeenCalledExactlyOnceWith('draft-id', 'What did we decide?')})-it.each([true, false])('offers and runs the date command only with an agenda (calendar: %s)', async calendar => {+it.each([+ [true, 'December 12', new Date(2026, 11, 12), 2025],+ [false, 'December 12', new Date(2026, 11, 12), 2025],+ [false, 'November 11, 2025', new Date(2025, 10, 11), 2025],+] as const)('opens the requested day with or without Agenda (calendar %s, query %s)', async (calendar, query, target, filterYear) => {vi.useFakeTimers()+ vi.setSystemTime(new Date(2026, 10, 14, 12))vi.stubGlobal('document', { activeElement: null })vi.stubGlobal('HTMLButtonElement', class {})vi.stubGlobal('window', { yogurt: { capabilities: { calendar }, search: { query: vi.fn().mockResolvedValue([]) } } })const onNavigate = vi.fn()const render = renderer(() => Search({ onOpen() {}, onNavigate, onSettingsChange() {}, onShortcuts() {}, onClose() {}, sidebarCollapsed: false, onToggleSidebar() {} }))- find(render(), 'search-input').props.onChange({ target: { value: 'November 11, 2028' } })+ find(render(), 'search-input').props.onChange({ target: { value: query } })render()vi.mocked(useEffect).mock.calls.find(([, deps]) => deps?.length === 6)![0]()await vi.runAllTimersAsync()const tree = render()- expect(find(tree, 'search-date').props.children[1].props.title).toContain('2028')- if (!calendar) { expect(() => find(tree, 'command-agenda-date')).toThrow('Missing'); return }+ expect(find(tree, 'search-date').props.children[1].props.title).toContain(String(filterYear))const row = find(tree, 'command-agenda-date')expect(row.props['aria-selected']).toBe(true)expect(row.props.children[0].type).toBe(CalendarDays)- expect(row.props.children[1].props.children[0]).toBe('Go to Nov 11, 2028')+ expect(row.props.children[1].props.children[0]).toBe('Go to ' + target.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }))find(tree, 'search').props.onKeyDown({ key: 'Enter', nativeEvent: {}, preventDefault() {} })- expect(onNavigate).toHaveBeenCalledExactlyOnceWith('', new Date(2028, 10, 11).getTime())+ expect(onNavigate).toHaveBeenCalledExactlyOnceWith('', target.getTime())+})++it.each([0, 3200])('returns a scrolled list to zero and leaves focus alone if already there (scrollTop %s)', scrollTop => {+ vi.useFakeTimers()+ vi.setSystemTime(new Date(2026, 10, 24, 12))+ vi.stubGlobal('window', { matchMedia: () => ({ matches: true }) })+ const heading = { focus: vi.fn() }+ const root = Object.assign(new EventTarget(), { scrollTop, clientHeight: 500, scrollHeight: 3700, querySelector: vi.fn(() => heading) })+ const next = vi.fn()+ renderer(() => {+ useMeetingDateJump({ at: new Date(2026, 11, 12).getTime() }, {+ cards: [{ startedAt: new Date(2026, 10, 20).getTime() }], root: root as unknown as HTMLElement, more: true, failed: 'page', next,+ }, true)+ return null+ })()+ for (const [effect] of vi.mocked(useLayoutEffect).mock.calls) effect()+ expect(root.scrollTop).toBe(0)+ expect(next).not.toHaveBeenCalled()+ if (scrollTop) expect(root.querySelector).toHaveBeenCalledWith('h1')+ expect(heading.focus).toHaveBeenCalledTimes(scrollTop ? 1 : 0)})it('jumps a mounted agenda to the day and week, closes details, and keeps arrows and repeated jumps working', async () => {diff --git a/app/test/searchFilters.test.ts b/app/test/searchFilters.test.tsindex 9d72858c..26cdb8ad 100644--- a/app/test/searchFilters.test.ts+++ b/app/test/searchFilters.test.ts@@ -13,26 +13,31 @@ describe('agenda date command', () => {const options = { now: new Date(2026, 10, 14, 12), locale: 'en-US', language: 'en' }it.each(['November 11th, 2028', '11/11/2028', '2028-11-11', 'today', 'tomorrow', 'planning on November 11, 2028'])('offers a single-day jump for %s and keeps meeting results', query => {const parsed = parseSearchQuery(query, options)- const command = searchDateCommand(parsed.date, query)!+ const command = searchDateCommand(parsed.jumpAt, query)!expect(command).toMatchObject({ id: 'agenda-date', group: 'Go to', at: parsed.date!.start })const meeting = { meetingId: 'example', confident: true }const palette = searchPalette([...commands, command], [meeting], query, query, [], undefined, true)expect(palette.rows.map(row => row.kind)).toEqual(['meeting', 'command'])expect(palette.rows[palette.active]).toEqual({ kind: 'command', command })})+ it.each(['December 12', 'December twelfth', '12/12'])('opens the upcoming date for %s while meeting results use the past occurrence', query => {+ const { date, jumpAt } = parseSearchQuery(query, { ...options, now: new Date(2026, 10, 24, 12) })+ expect(date?.start).toBe(new Date(2025, 11, 12).getTime())+ expect(searchDateCommand(jumpAt, query)).toMatchObject({ label: 'Go to Dec 12, 2026', at: new Date(2026, 11, 12).getTime() })+ })it.each(['', 'planning', 'November', 'in November', 'last week', 'past 7 days', 'November 11 to November 13, 2028', '02/30/2028'])('omits the jump for %s', query => {- expect(searchDateCommand(parseSearchQuery(query, options).date, query)).toBeUndefined()+ expect(searchDateCommand(parseSearchQuery(query, options).jumpAt, query)).toBeUndefined()})it('formats the label in the app language, including the year', () => {- const date = parseSearchQuery('November 11, 2028', options).date- expect(searchDateCommand(date, 'November 11, 2028')?.label).toBe('Go to Nov 11, 2028')+ const at = parseSearchQuery('November 11, 2028', options).jumpAt+ expect(searchDateCommand(at, 'November 11, 2028')?.label).toBe('Go to Nov 11, 2028')setLanguage('fr')- expect(searchDateCommand(date, '11/11/2028')).toMatchObject({ group: 'Aller à', label: 'Aller au 11 nov. 2028' })+ expect(searchDateCommand(at, '11/11/2028')).toMatchObject({ group: 'Aller à', label: 'Aller au 11 nov. 2028' })})it('matches localized and relative input even when it differs from the label', () => {setLanguage('de')const query = '11. November 2028'- const command = searchDateCommand(parseSearchQuery(query, { ...options, language: 'de' }).date, query)!+ const command = searchDateCommand(parseSearchQuery(query, { ...options, language: 'de' }).jumpAt, query)!expect(command.label).toBe('Zum 11. Nov. 2028 springen')const palette = searchPalette([command], [], query, query, [], undefined, true)expect(palette.rows[palette.active]).toEqual({ kind: 'command', command })@@ -43,9 +48,9 @@ describe('agenda date command', () => {try {process.env.TZ = 'America/Los_Angeles'for (const query of ['March 8, 2026', 'November 1, 2026']) {- const date = parseSearchQuery(query, options).date!- expect(date.end - date.start).not.toBe(24 * 60 * 60 * 1000)- expect(searchDateCommand(date, query)?.at).toBe(date.start)+ const { date, jumpAt } = parseSearchQuery(query, options)+ expect(date!.end - date!.start).not.toBe(24 * 60 * 60 * 1000)+ expect(searchDateCommand(jumpAt, query)?.at).toBe(date!.start)}} finally {if (saved === undefined) delete process.env.TZ