Skip to content

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.

Notes: the date popover shows a linked event as the event, complete on open, with Join only around meeting time; an unlinked note lists that day's events to link; people are grouped by company

Eric Brownrout42042b30c5b2
diff --git a/app/e2e/home.spec.ts b/app/e2e/home.spec.ts
index 3d4accc8..1b038317 100644
--- a/app/e2e/home.spec.ts
+++ b/app/e2e/home.spec.ts
@@ -542,6 +542,10 @@ test('agenda detail cards support keyboard entry, dismissal and return focus wit
await expect(details.getByTestId('event-open')).toBeFocused()
await page.keyboard.press('Tab')
await expect(details.getByRole('link', { name: 'Join meeting' })).toBeFocused()
+ await page.clock.setFixedTime(at.getTime() + 30 * 60_000)
+ await page.evaluate(() => window.dispatchEvent(new Event('focus')))
+ await expect(details.getByRole('link', { name: 'Join meeting' })).toHaveCount(0)
+ await expect(details.getByTestId('event-open')).toBeVisible()
// The card is nonmodal: a click in the rest of the page dismisses it and still works.
await page.getByTestId('nav-chat').click()
await expect(page.getByTestId('chat-page')).toBeVisible()
diff --git a/app/e2e/note-layout.spec.ts b/app/e2e/note-layout.spec.ts
index 3cb85d92..ddcc3445 100644
--- a/app/e2e/note-layout.spec.ts
+++ b/app/e2e/note-layout.spec.ts
@@ -138,14 +138,15 @@ test('people added and removed by hand are saved, and the notes are written agai
await expect(card.getByTestId('people-private')).toHaveText('Nothing is sent. This is only for your notes.')
await expect(card.getByTestId('people-add')).toHaveAttribute('placeholder', 'Name or email')
expect(await card.getByTestId('people-list').evaluate((list) => !!(list.compareDocumentPosition(document.querySelector('[data-testid="people-add"]')!) & Node.DOCUMENT_POSITION_FOLLOWING))).toBe(true)
- await expect(card.locator('.person-initials')).toHaveCount(0)
+ await expect(card.locator('.person-initials')).toHaveCount(1)
+ await expect(card.getByRole('heading', { name: 'Other people' })).toBeVisible()
await expect(card.getByTestId('people-row')).toHaveCount(1)
await expect(card.getByTestId('people-row').first()).toContainText('(me)')
await card.getByTestId('people-add').fill('Maya Chen [email protected]')
await page.keyboard.press('Enter')
await expect(card.getByTestId('people-row')).toHaveCount(2)
await expect(card.getByTestId('people-count')).toHaveCount(0)
- await expect(card.getByTestId('people-row').nth(1).getByTestId('people-name')).toHaveText('Maya Chen')
+ await expect(card.getByTestId('people-name')).toHaveText('Maya Chen')
await expect(card.getByTestId('people-email')).toHaveText('[email protected]')
await page.mouse.move(0, 0)
await expect(card.getByTestId('people-remove')).toHaveCSS('opacity', '0')
@@ -154,9 +155,11 @@ test('people added and removed by hand are saved, and the notes are written agai
await expect(page.getByTestId('note-attendees-summary')).toHaveText('Maya')
expect((await page.evaluate((id) => window.yogurt.meetings.get(id), id))?.attendees).toEqual([{ name: 'Maya Chen', email: '[email protected]' }])
await expect(editor).toContainText('With Maya Chen.', { timeout: 30_000 })
- await card.getByTestId('people-row').nth(1).hover()
- await card.getByTestId('people-remove').click()
+ const attendee = card.getByTestId('people-row').filter({ has: page.getByTestId('people-name') })
+ await attendee.hover()
+ await attendee.getByTestId('people-remove').click()
await expect(card.getByTestId('people-row')).toHaveCount(1)
+ await expect.poll(async () => (await page.evaluate(id => window.yogurt.meetings.get(id), id))?.attendees).toEqual([])
await expect(editor).not.toContainText('With Maya Chen.', { timeout: 30_000 })
await expect(page.getByTestId('note-people-changed')).toHaveCount(0)
} finally { await app.close() }
@@ -185,7 +188,7 @@ test('linking an event updates the date chip, people chip and Summary separately
try {
const id = await finished(app, page)
await page.getByTestId('note-date').click()
- await page.getByTestId('note-date-events-toggle').click()
+ await expect(page.getByTestId('note-date-events-toggle')).toHaveCount(0)
await page.getByTestId('note-date-event').filter({ hasText: 'Team standup' }).click()
await expect(page.getByTestId('note-title')).toHaveText('Team standup')
await expect(page.getByTestId('note-attendees-summary')).toHaveText('Ann, Bo')
diff --git a/app/e2e/noteDateStates.spec.ts b/app/e2e/noteDateStates.spec.ts
index 937074ba..f247ab54 100644
--- a/app/e2e/noteDateStates.spec.ts
+++ b/app/e2e/noteDateStates.spec.ts
@@ -22,32 +22,33 @@ for (const theme of ['light', 'dark'] as const) for (const status of ['notDeterm
await page.getByTestId('note-date').click()
const card = page.getByTestId('note-date-card')
await expect(card.getByRole('button', { name: 'Close', exact: true })).toHaveCount(0)
- await expect(card).toContainText('25 min')
+ if (status !== 'granted') await expect(card).toContainText('25 min')
if (status !== 'granted') await expect(card.getByTestId('note-date-previous')).toHaveCount(0)
await expect(card.getByTestId('note-date-heading')).toBeVisible()
- const label = status === 'error' ? 'Try again' : status === 'denied' ? 'Open System Settings' : status === 'notDetermined' ? 'Connect calendar' : 'Link event'
- const action = card.getByRole('button', { name: label, exact: true })
- await expect(action).toHaveClass('workspace-button agenda-open-note')
- await expect(action).toHaveCSS('height', '28px')
- // the label fits its button: a collapsed button once let it spill over "Calendar access is off"
- expect(await action.evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true)
- if (status === 'denied') {
- await action.click()
- await expect.poll(() => app.evaluate(() => (globalThis as any).__fake__.main().settingsOpened)).toBe(1)
- await expect(card).toContainText('Calendar access is off')
- await app.evaluate(() => (globalThis as any).__fake__.calendarStatus('granted'))
- await page.evaluate(() => window.dispatchEvent(new Event('focus')))
- } else if (status === 'error') {
- await expect(card).toContainText("Yogurt couldn't read your calendar")
- await app.evaluate(() => (globalThis as any).__fake__.calendarStatus('granted'))
- await action.click()
- } else if (status === 'notDetermined') {
- await expect(card).toContainText('Calendar access is off')
- await action.click()
+ if (status !== 'granted') {
+ const label = status === 'error' ? 'Try again' : status === 'denied' ? 'Open System Settings' : 'Connect calendar'
+ const action = card.getByRole('button', { name: label, exact: true })
+ await expect(action).toHaveClass('workspace-button agenda-open-note')
+ await expect(action).toHaveCSS('height', '28px')
+ // the label fits its button: a collapsed button once let it spill over "Calendar access is off"
+ expect(await action.evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true)
+ if (status === 'denied') {
+ await action.click()
+ await expect.poll(() => app.evaluate(() => (globalThis as any).__fake__.main().settingsOpened)).toBe(1)
+ await expect(card).toContainText('Calendar access is off')
+ await app.evaluate(() => (globalThis as any).__fake__.calendarStatus('granted'))
+ await page.evaluate(() => window.dispatchEvent(new Event('focus')))
+ } else if (status === 'error') {
+ await expect(card).toContainText("Yogurt couldn't read your calendar")
+ await app.evaluate(() => (globalThis as any).__fake__.calendarStatus('granted'))
+ await action.click()
+ } else if (status === 'notDetermined') {
+ await expect(card).toContainText('Calendar access is off')
+ await action.click()
+ }
}
await expect(card.getByTestId('note-date-events-none')).toHaveText('No events')
- await card.getByTestId('note-date-events-toggle').press('Enter')
- await expect(card.getByTestId('note-date-previous')).toBeFocused()
+ await expect(card.getByTestId('note-date-events-toggle')).toHaveCount(0)
const header = card.locator('.agenda-inspector-heading')
const meetingDay = await header.getByTestId('note-date-heading').textContent()
await expect(header.getByTestId('note-date-previous')).toBeVisible()
diff --git a/app/e2e/peopleCalendar.spec.ts b/app/e2e/peopleCalendar.spec.ts
index 9ffdc294..bcf33a82 100644
--- a/app/e2e/peopleCalendar.spec.ts
+++ b/app/e2e/peopleCalendar.spec.ts
@@ -12,6 +12,7 @@ for (const theme of ['light', 'dark'] as const) test(`split metadata popovers st
await expect(page.getByTestId('home')).toBeVisible()
await app.evaluate(() => (globalThis as unknown as { __fake__: { manyMeetings(o: unknown): void } }).__fake__.manyMeetings({ n: 1, clean: true }))
const [meeting] = await page.evaluate(() => window.yogurt.meetings.cards({ limit: 1 }))
+ await page.clock.setFixedTime(meeting.startedAt)
const events = [{ id: 'linked-event', title: 'Planning with Jamie', start: new Date(meeting.startedAt).toISOString(), end: new Date(meeting.startedAt + 1_800_000).toISOString(),
attendees: [{ name: 'Jamie Quill', email: '[email protected]' }], url: 'https://meet.google.com/fak-eeve-ntx', calendarId: 'work', calendar: 'Work', calendarSource: '[email protected]' }]
const next = new Date(meeting.startedAt); next.setDate(next.getDate() + 1)
@@ -23,7 +24,8 @@ for (const theme of ['light', 'dark'] as const) test(`split metadata popovers st
await page.getByTestId('past-note').click()
await page.getByTestId('note-date').click()
const date = page.getByTestId('note-date-card')
- await expect(date).toContainText('25 min')
+ await expect(date.getByTestId('note-date-event')).toHaveCount(1)
+ await expect(date.getByTestId('note-date-events-toggle')).toHaveCount(0)
await expect(date.getByTestId('people-list')).toHaveCount(0)
await expect(date.getByRole('link')).toHaveCount(0)
await page.keyboard.press('Escape')
@@ -33,7 +35,13 @@ for (const theme of ['light', 'dark'] as const) test(`split metadata popovers st
await expect(page.getByTestId('people-card')).not.toContainText('Who was there')
await page.keyboard.press('Escape')
await page.getByTestId('note-date').click()
- await page.getByTestId('note-date-events-toggle').press('Enter')
+ await expect(date.getByTestId('note-date-event').first()).toBeVisible()
+ await expect(date.getByTestId('note-date-heading')).toBeFocused()
+ await page.keyboard.press('Tab')
+ await expect(date.getByTestId('note-date-previous')).toBeFocused()
+ await page.keyboard.press('Tab')
+ await expect(date.getByTestId('note-date-next')).toBeFocused()
+ await page.keyboard.press('Tab')
await expect(page.getByTestId('note-date-event').first()).toBeFocused()
await expect(page.getByTestId('note-date-event').first()).toContainText('Jamie')
// Access lost between listing and selection must be a retryable error.
@@ -45,7 +53,7 @@ for (const theme of ['light', 'dark'] as const) test(`split metadata popovers st
await page.getByTestId('note-date-event').filter({ hasText: 'Planning with Jamie' }).press('Enter')
await expect(date).toContainText('Planning with Jamie')
await expect(date).toContainText('Work')
- await expect(date).toContainText('[email protected]')
+ await expect(date).not.toContainText('[email protected]')
await expect(date.getByRole('button', { name: 'Open note', exact: true })).toHaveCount(0)
await expect(date.getByRole('link', { name: 'Join meeting' })).toHaveAttribute('href', events[0].url)
await expect(date.getByRole('link', { name: 'Join meeting' })).toHaveClass('workspace-button agenda-open-note')
@@ -57,20 +65,25 @@ for (const theme of ['light', 'dark'] as const) test(`split metadata popovers st
await expect(date.getByTestId('note-date-event')).toHaveCount(0)
await expect(date).not.toContainText('Switch to')
await expect(date.getByTestId('note-date-unlink')).toContainText('Keep the title, attendees and notes.')
- const linkedDay = await date.getByTestId('note-date-heading').textContent()
- await page.getByTestId('note-date-next').click()
- await expect(date.getByTestId('note-date-heading')).not.toHaveText(linkedDay!)
- await page.getByTestId('note-date-events-toggle').click()
- await expect(date.getByTestId('note-date-heading')).toHaveText(linkedDay!)
+ await expect(date.getByTestId('note-date-heading')).toHaveCount(0)
+ await expect(date.getByTestId('note-date-next')).toHaveCount(0)
+ await page.keyboard.press('Escape')
+ await expect(date.getByTestId('note-date-events-toggle')).toBeFocused()
+ await expect(date.getByTestId('note-date-unlink')).not.toBeVisible()
+ await page.keyboard.press('Escape')
+ await expect(date).toHaveCount(0)
+ await expect(page.getByTestId('note-date')).toBeFocused()
+ await page.getByTestId('note-date').press('Enter')
await page.getByTestId('note-date-events-toggle').press('Enter')
await expect(date.getByTestId('note-date-unlink')).toBeFocused()
await date.getByTestId('note-date-unlink').press('Enter')
- await expect(date.getByTestId('note-date-events-toggle')).toHaveText('Link event')
- await expect(date.getByTestId('note-date-event')).toHaveCount(0)
- await page.getByTestId('note-date-events-toggle').press('Enter')
+ await expect(date.getByTestId('note-date-events-toggle')).toHaveCount(0)
+ await expect(date.getByTestId('note-date-event')).toHaveCount(1)
await page.getByTestId('note-date-next').click()
await page.getByTestId('note-date-event').filter({ hasText: 'Next day review' }).click()
await expect(page.getByTestId('note-title')).toHaveText('Next day review')
+ await expect(date.getByRole('link', { name: 'Join meeting' })).toHaveCount(0)
+ await expect(date.locator('.note-date-actions')).toHaveCount(0)
await page.keyboard.press('Escape')
await page.reload()
await page.getByTestId('note-date').click()
@@ -81,22 +94,25 @@ for (const theme of ['light', 'dark'] as const) test(`split metadata popovers st
await expect(date.getByRole('button', { name: 'Open System Settings' })).toBeVisible()
await expect(date).toContainText('Next day review')
await expect(date).toContainText('Work')
- await expect(date).toContainText('[email protected]')
+ await expect(date).not.toContainText('[email protected]')
await app.evaluate(() => (globalThis as any).__fake__.calendarStatus('granted'))
await page.evaluate(() => window.dispatchEvent(new Event('focus')))
- await expect(date.getByTestId('note-date-next')).toBeVisible()
+ await expect(date.getByRole('button', { name: 'Open System Settings' })).toHaveCount(0)
+ await expect(date.getByTestId('note-date-next')).toHaveCount(0)
await page.getByTestId('note-date-events-toggle').click()
- await page.getByTestId('note-date-previous').click()
await expect(date.getByTestId('note-date-event')).toHaveCount(0)
await page.getByTestId('note-date-unlink').click()
- await expect(page.getByTestId('note-date-events-toggle')).toHaveText('Link event')
- await expect(page.getByTestId('note-date-events-toggle')).toHaveClass('workspace-button agenda-open-note')
+ await expect(date.getByTestId('note-date-events-toggle')).toHaveCount(0)
+ await expect(date.getByTestId('note-date-event')).toHaveCount(1)
await expect(page.getByTestId('note-title')).toHaveText('Next day review')
expect((await page.evaluate(id => window.yogurt.meetings.get(id), meeting.id))?.startedAt).toBe(meeting.startedAt)
await page.getByTestId('note-attendees').click()
await expect(date).toHaveCount(0)
const people = page.getByTestId('people-card')
await expect(people.getByTestId('people-email')).toHaveText('[email protected]')
+ await expect(people.getByRole('heading', { name: 'Example', exact: true })).toBeVisible()
+ await expect(people.getByRole('heading', { name: 'Other people', exact: true })).toBeVisible()
+ await expect(people.locator('.person-initials')).toHaveCount(2)
await expect(people).not.toContainText('Planning with Jamie')
// a mouse-opened card shows no row actions until hovered or reached by keyboard
await expect(people.getByTestId('people-edit')).toHaveCSS('opacity', '0')
diff --git a/app/src/renderer/src/components/Agenda.tsx b/app/src/renderer/src/components/Agenda.tsx
index bbc89c76..df70339f 100644
--- a/app/src/renderer/src/components/Agenda.tsx
+++ b/app/src/renderer/src/components/Agenda.tsx
@@ -10,6 +10,7 @@ import { agendaNoteAction } from '../../../shared/agendaNote'
import { pickNext } from '../../../shared/comingUp'
import { daysAgo, timeOf, useDay } from '../dates'
import { eventPhase, shiftDay, stepAgendaDay, weekDates } from '../agenda'
+import { useJoinWindow } from '../useJoinWindow'
import { useAgendaCard } from '../useAgendaCard'
import { motion, scrollBehavior, usePopoverPresence } from '../motion'
import { peopleSummary, personName, useMyName } from './People'
@@ -222,7 +223,8 @@ function EventDetails({ motionProps, event, recording, onOpen, onStart, now, onC
document.addEventListener('keydown', escape, true)
return () => { document.removeEventListener('pointerdown', outside); document.removeEventListener('keydown', escape, true) }
}, [onClose, opener, motionProps.inert])
- const url = event.url?.trim()
+ const joinable = useJoinWindow(event.start, event.end)
+ const url = joinable ? event.url?.trim() : undefined
return <dialog {...motionProps} ref={panel} id="agenda-event-details" data-testid="event-details-content" className="agenda-inspector menu-entry" aria-labelledby="agenda-detail-title" onCancel={e => { e.preventDefault(); onClose() }}>
<i className="agenda-inspector-arrow" aria-hidden="true" />
<div className="agenda-inspector-content">
diff --git a/app/src/renderer/src/components/NoteDate.tsx b/app/src/renderer/src/components/NoteDate.tsx
index 698e6868..fd0d9682 100644
--- a/app/src/renderer/src/components/NoteDate.tsx
+++ b/app/src/renderer/src/components/NoteDate.tsx
@@ -1,10 +1,13 @@
import { usePopoverPresence } from '../motion'
import { Component, createRef, useCallback, useEffect, useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from 'react'
import { ScrollFade } from './ScrollFade'
-import { CalendarDays, ChevronDown, ChevronLeft, ChevronRight, Clock, ExternalLink, Link2, Link2Off } from 'lucide-react'
+import { CalendarDays, ChevronDown, ChevronLeft, ChevronRight, Clock, ExternalLink, Link2Off } from 'lucide-react'
import type { CalEvent, CalendarStatus, Meeting } from '../../../shared/types'
import { language, t } from '../../../shared/i18n'
import { noteDateLabel, timeOf } from '../dates'
+import { eventTimeRange } from '../../../shared/dates'
+import { useJoinWindow } from '../useJoinWindow'
+import { useNoteCalendar, type NoteCalendar } from '../useNoteCalendar'
import { useNotePopover } from '../useNotePopover'
import { useLoadingState } from '../useLoadingState'
import { nearestEvents, shiftCalendarDay } from '../../../shared/calendarPicker'
@@ -14,17 +17,18 @@ export function NoteDate({ m }: { m: Meeting }) {
const [open, setOpen] = useState<false | 'pointer' | 'keyboard'>(false)
const presence = usePopoverPresence(open)
const chip = useRef<HTMLButtonElement>(null)
+ const { details, refresh } = useNoteCalendar(m)
const close = useCallback(() => { setOpen(false); chip.current?.focus({ preventScroll: true }) }, [])
return <div className="relative">
<button ref={chip} data-testid="note-date" aria-haspopup="dialog" aria-expanded={!!open} onClick={e => setOpen(o => o ? false : e.detail > 0 ? 'pointer' : 'keyboard')}
className="note-chip flex items-center gap-1.5 rounded-md border border-line px-2.5 text-[13px] text-muted">
<CalendarDays size={14} strokeWidth={1.75} aria-hidden="true" />{noteDateLabel(m.startedAt)}
</button>
- {presence.value && <DateCard key={m.id} m={m} chip={chip} motionProps={presence.props} onClose={close} />}
+ {presence.value && <DateCard key={m.id} m={m} details={details} refreshLinked={refresh} chip={chip} motionProps={presence.props} onClose={close} />}
</div>
}
-function DateCard({ m, chip, motionProps, onClose }: { m: Meeting; chip: RefObject<HTMLButtonElement | null>; motionProps: ReturnType<typeof usePopoverPresence>['props']; onClose: (restore?: boolean) => void }) {
+function DateCard({ m, details, refreshLinked, chip, motionProps, onClose }: { m: Meeting; details?: NoteCalendar; refreshLinked: () => void; chip: RefObject<HTMLButtonElement | null>; motionProps: ReturnType<typeof usePopoverPresence>['props']; onClose: (restore?: boolean) => void }) {
const card = useRef<HTMLDivElement>(null)
// no calendar on this computer (Windows, Linux): the date and length only, as for a note with no event
const calendar = window.yogurt.capabilities.calendar
@@ -32,26 +36,33 @@ function DateCard({ m, chip, motionProps, onClose }: { m: Meeting; chip: RefObje
const [revision, setRevision] = useState(0)
const [picking, setPicking] = useState(false)
const [day, setDay] = useState(m.eventStartedAt ?? m.startedAt)
- const [result, setResult] = useState<Awaited<ReturnType<typeof window.yogurt.calendar.day>>>()
+ const [dayResult, setResult] = useState<Awaited<ReturnType<typeof window.yogurt.calendar.day>> | undefined>(details?.result)
+ const result = linked ? details?.result : dayResult
+ const reserveCalendar = useRef(linked && !details)
const [linking, setLinking] = useState(false)
const heading = useRef<HTMLHeadingElement>(null)
const [compactDate, setCompactDate] = useState(false)
- const loadingPhase = useLoadingState(calendar && !result)
+ const loadingPhase = useLoadingState(calendar && !linked && !result)
const pickerKeyboard = useRef(false)
const previous = useRef<HTMLButtonElement>(null)
const toggle = useRef<HTMLButtonElement>(null)
const recovery = useRef<HTMLButtonElement>(null)
useNotePopover(card, chip, onClose, !motionProps.inert)
const days = useRef(new Map<string, Awaited<ReturnType<typeof window.yogurt.calendar.day>>>())
+ if (details) {
+ if (details.result.status !== 'granted') days.current.clear()
+ days.current.set(new Date(m.eventStartedAt ?? m.startedAt).toDateString(), details.result)
+ }
const [selection, setSelection] = useState(m.eventId)
// Keep the card mounted, but never commit the previous link's picker or day.
if (selection !== m.eventId) {
const nextDay = m.eventStartedAt ?? m.startedAt
+ reserveCalendar.current = linked && !details
setSelection(m.eventId); setPicking(false); setDay(nextDay)
setResult(days.current.get(new Date(nextDay).toDateString()))
}
useEffect(() => {
- if (!calendar) return
+ if (!calendar || linked) return
let active = true
void window.yogurt.calendar.day(day).catch(() => ({ status: 'error' as const, events: [] })).then(value => {
if (!active) return
@@ -60,7 +71,7 @@ function DateCard({ m, chip, motionProps, onClose }: { m: Meeting; chip: RefObje
setResult(value)
})
return () => { active = false }
- }, [calendar, day, revision])
+ }, [calendar, linked, day, revision])
const browse = (nextDay: number) => {
setResult(days.current.get(new Date(nextDay).toDateString()))
setDay(nextDay)
@@ -72,24 +83,26 @@ function DateCard({ m, chip, motionProps, onClose }: { m: Meeting; chip: RefObje
const eventResult = new Date(day).toDateString() === eventDay ? result : days.current.get(eventDay)
const event = linked ? eventResult?.events.find(e => e.id === m.eventId || e.aliases?.includes(m.eventId!)) ?? (eventResult ? null : undefined) : null
useEffect(() => {
- if (!calendar) return
+ if (!calendar || linked) return
const refresh = () => setRevision(n => n + 1)
const off = window.yogurt.calendar.onChange(refresh)
window.addEventListener('focus', refresh)
return () => { off(); window.removeEventListener('focus', refresh) }
- }, [calendar])
- const connect = () => void window.yogurt.calendar.connect().then(() => setRevision(n => n + 1), () => setResult({ status: 'error', events: [] }))
+ }, [calendar, linked])
+ const refresh = () => linked ? refreshLinked() : setRevision(n => n + 1)
+ const connect = () => void window.yogurt.calendar.connect().then(refresh, () => linked ? refreshLinked() : setResult({ status: 'error', events: [] }))
const available = result?.status === 'granted'
- const browsing = picking && (!result || available)
+ const browsing = calendar && !linked && (!result || available)
useEffect(() => {
if (picking && pickerKeyboard.current && !linked && result && !available) recovery.current?.focus({ preventScroll: true })
}, [picking, linked, result, available])
- const otherDay = new Date(day).toDateString() !== new Date(m.eventStartedAt ?? m.startedAt).toDateString()
const at = event?.start ?? (linked ? m.eventStartedAt : null) ?? m.startedAt
const eventEnd = event?.end ?? (linked ? m.eventEndedAt : null)
const eventCalendar = event?.calendar ?? (linked && m.eventCalendarName ? { name: m.eventCalendarName, source: m.eventCalendarSource } : null)
const minutes = Math.max(0, Math.round((m.durationMs ?? (m.endedAt ? m.endedAt - m.startedAt : m.state === 'recording' ? Date.now() - m.startedAt : 0)) / 60_000))
- const url = event?.url?.trim()
+ const joinable = useJoinWindow(at, eventEnd)
+ const url = joinable ? event?.url?.trim() : undefined
+ const color = event?.calendar?.id ? details?.colors[event.calendar.id] : undefined
const date = new Date(browsing ? day : at)
const dateOptions: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric', ...(date.getFullYear() === new Date().getFullYear() ? {} : { year: 'numeric' }) }
const fullDate = date.toLocaleDateString(language(), { ...dateOptions, weekday: 'long' })
@@ -106,56 +119,60 @@ function DateCard({ m, chip, motionProps, onClose }: { m: Meeting; chip: RefObje
const observer = new ResizeObserver(measure)
observer.observe(el)
return () => observer.disconnect()
- }, [fullDate])
+ }, [fullDate, linked])
const loading = loadingPhase !== 'skeleton' ? null : <div className="loading-content" data-loading-phase={loadingPhase} aria-busy="true">
<div className="loading-placeholder"><span role="status" className="sr-only">{t('Looking at your calendar…')}</span>
<div className="loading-mask" aria-hidden="true"><span className="loading-bar" style={{ width: '65%' }} /></div>
</div>
</div>
- return <div ref={card} data-testid="note-date-card" {...motionProps} data-anchor="start" data-picking={picking} role="dialog" aria-label={t('Date')}
+ const recoveryAction = result && !available ? <div className="note-date-access flex flex-wrap items-center gap-x-3 gap-y-2">
+ <p role="status" className="text-xs text-muted">{result.status === 'error' ? t("Yogurt couldn't read your calendar") : t('Calendar access is off')}</p>
+ <div className="ms-auto flex shrink-0"><button ref={recovery} className="workspace-button agenda-open-note" onClick={result.status === 'error' ? refresh : connect}>{result.status === 'error' ? t('Try again') : result.status === 'denied' ? t('Open System Settings') : t('Connect calendar')}</button></div>
+ </div> : null
+ return <div ref={card} data-testid="note-date-card" {...motionProps} data-anchor="start" data-picking={browsing || picking} role="dialog" aria-label={t('Date')}
className="people-card menu-entry note-date-card absolute start-0 top-full z-30 mt-2 w-[min(340px,calc(100vw-48px))] rounded-lg border border-line bg-float text-ink shadow-[var(--shadow)]"
- onKeyDown={e => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); onClose() } }}>
- <NoteDateBody view={`${m.eventId ?? 'unlinked'}/${!linked && picking ? 'picker' : 'details'}/${result?.status ?? (loadingPhase === 'skeleton' ? 'skeleton' : 'waiting')}`}>
- <div className="agenda-inspector-heading">
+ onKeyDown={e => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); if (linked && picking) { setPicking(false); toggle.current?.focus({ preventScroll: true }) } else onClose() } }}>
+ <NoteDateBody view={`${m.eventId ?? 'unlinked'}/${browsing ? 'picker' : 'details'}/${linked ? 'linked' : result?.status ?? (loadingPhase === 'skeleton' ? 'skeleton' : 'waiting')}`}>
+ {!linked && <div className="agenda-inspector-heading">
<h3 ref={heading} data-testid="note-date-heading" tabIndex={-1} aria-live="polite" aria-label={fullDate} title={fullDate}>{compactDate ? shortDate : fullDate}</h3>
<div className="flex shrink-0 items-center gap-1">
- {(available || browsing) && <>
+ {(available || (picking && browsing)) && <>
<button type="button" ref={previous} className="workspace-icon" data-testid="note-date-previous" aria-label={t('Previous day')} disabled={linking} onClick={e => { pickerKeyboard.current = e.detail === 0; setPicking(true); browse(shiftCalendarDay(day, -1)) }}><ChevronLeft size={15} aria-hidden="true" /></button>
<button type="button" className="workspace-icon" data-testid="note-date-next" aria-label={t('Next day')} disabled={linking} onClick={e => { pickerKeyboard.current = e.detail === 0; setPicking(true); browse(shiftCalendarDay(day, 1)) }}><ChevronRight size={15} aria-hidden="true" /></button>
</>}
</div>
- </div>
+ </div>}
{linked && <div className="note-date-linked">
- <button ref={toggle} data-testid="note-date-events-toggle" className="note-date-event-toggle text-sm font-medium" aria-expanded={picking} disabled={linking} onClick={e => { pickerKeyboard.current = e.detail === 0; if (otherDay) { browse(m.eventStartedAt ?? m.startedAt); setPicking(false) } else setPicking(v => !v) }}><span>{event?.title || m.eventTitle || m.title}</span><ChevronDown size={15} aria-hidden="true" /></button>
+ <button type="button" ref={toggle} data-testid="note-date-events-toggle" className="note-date-event-toggle" aria-expanded={picking} disabled={linking} onClick={e => { pickerKeyboard.current = e.detail === 0; setPicking(v => !v) }}>
+ <span className="note-date-color note-date-reveal" data-ready={!!color} aria-hidden="true" style={{ backgroundColor: color }} />
+ <span className="note-date-identity"><strong title={event?.title || m.eventTitle || m.title}>{event?.title || m.eventTitle || m.title}</strong>
+ <span className="note-date-time">{eventEnd != null ? eventTimeRange(at, eventEnd) : `${timeOf(at)} · ${t('{count} min', { count: minutes })}`}</span>
+ {(eventCalendar?.name || reserveCalendar.current) && <span className="note-date-calendar note-date-reveal" data-ready={!!eventCalendar?.name} title={eventCalendar?.name}>{eventCalendar?.name}</span>}
+ </span>
+ <ChevronDown size={15} aria-hidden="true" />
+ </button>
<div className="accordion note-date-motion note-date-picker-motion" data-open={picking} aria-hidden={!picking} inert={!picking}>
- <div><div className="note-date-picker-space"><EventPicker keyboard={pickerKeyboard.current} open={picking} m={m} day={day} result={result} loading={loading} previous={toggle} linking={linking} onLinking={setLinking} onLinked={() => requestAnimationFrame(() => toggle.current?.focus({ preventScroll: true }))} /></div></div>
+ <div><div className="note-date-picker-space"><EventPicker keyboard={pickerKeyboard.current} open={picking} m={m} day={day} result={result} loading={loading} previous={toggle} linking={linking} onLinking={setLinking} onLinked={() => requestAnimationFrame(() => (toggle.current ?? heading.current)?.focus({ preventScroll: true }))} /></div></div>
</div>
</div>}
- {(!browsing || linked) && <div className="accordion note-date-motion note-date-details-motion" data-open={true}><div><div className="note-date-details"><div className="agenda-inspector-line"><Clock size={15} aria-hidden="true" /><div>
+ {!linked && !browsing && <div className="accordion note-date-motion note-date-details-motion" data-open={true}><div><div className="note-date-details"><div className="agenda-inspector-line"><Clock size={15} aria-hidden="true" /><div>
<p>{timeOf(at)}{eventEnd != null ? ` – ${timeOf(eventEnd)}` : ` · ${t('{count} min', { count: minutes })}`}</p>
</div></div>
- {linked && available && event === null && <p role="status" className="text-xs text-muted">{t('Calendar event unavailable')}
- <button className="ms-2 underline" onClick={() => setRevision(n => n + 1)}>{t('Try again')}</button>
- </p>}
- {(eventCalendar || url) && <div className="agenda-inspector-footer">
- {eventCalendar && <div className="agenda-inspector-line"><CalendarDays size={15} aria-hidden="true" /><p>{eventCalendar.name}<span className="agenda-inspector-muted">{eventCalendar.source}</span></p></div>}
- {url && <div className="agenda-inspector-actions">
- <a className="workspace-button agenda-open-note" title={t('Join meeting')} href={url} target="_blank" rel="noreferrer"><span>{t('Join meeting')}</span><ExternalLink size={12} aria-hidden="true" /></a>
- </div>}
- </div>}
</div></div></div>}
- {calendar && result?.status !== 'unsupported' && !browsing && <>
- {!result ? loading
- : !available ? <div className="flex flex-wrap items-center gap-x-3 gap-y-2">
- <p role="status" className="text-xs text-muted">{result.status === 'error' ? t("Yogurt couldn't read your calendar") : t('Calendar access is off')}</p>
- <div className="ms-auto flex shrink-0"><button ref={recovery} className="workspace-button agenda-open-note" onClick={result.status === 'error' ? () => setRevision(n => n + 1) : connect}>{result.status === 'error' ? t('Try again') : result.status === 'denied' ? t('Open System Settings') : t('Connect calendar')}</button></div>
- </div>
- : !linked && <div className="note-date-empty-row">
- {!result.events.length && <p role="status" className="text-xs text-muted" data-testid="note-date-events-none" title={t('No events')}>{t('No events')}</p>}
- <div className="ms-auto flex shrink-0"><button ref={toggle} data-testid="note-date-events-toggle" className="workspace-button agenda-open-note" title={t('Link to a calendar event')} aria-expanded={browsing} onClick={e => { pickerKeyboard.current = e.detail === 0; setPicking(true) }}><Link2 size={13} aria-hidden="true" /><span>{t('Link event')}</span></button></div>
+ {linked && ((joinable && !result) || url || (result && (!available || event === null))) && <div className="note-date-actions" aria-busy={!result}>
+ <div className="note-date-reveal" data-ready={!!result}>
+ {available && event === null && <div className="note-date-access flex items-center gap-3 text-xs text-muted">
+ <p role="status">{t('Calendar event unavailable')}</p>
+ <button className="ms-auto shrink-0 underline" onClick={refresh}>{t('Try again')}</button>
</div>}
- </>}
- {picking && !linked && <EventPicker keyboard={pickerKeyboard.current} m={m} day={day} result={result} loading={loading} previous={previous} linking={linking} onLinking={setLinking} onLinked={() => requestAnimationFrame(() => toggle.current?.focus({ preventScroll: true }))} />}
+ {url && <div className="agenda-inspector-actions">
+ <a className="workspace-button agenda-open-note" title={t('Join meeting')} href={url} target="_blank" rel="noreferrer"><span>{t('Join meeting')}</span><ExternalLink size={12} aria-hidden="true" /></a>
+ </div>}
+ {result?.status !== 'unsupported' && recoveryAction}
+ </div>
+ </div>}
+ {calendar && !linked && result?.status !== 'unsupported' && !browsing && recoveryAction}
+ {browsing && <EventPicker keyboard={pickerKeyboard.current} m={m} day={day} result={result} loading={loading} previous={previous} linking={linking} onLinking={setLinking} onLinked={() => requestAnimationFrame(() => (toggle.current ?? heading.current)?.focus({ preventScroll: true }))} />}
</NoteDateBody>
</div>
}
diff --git a/app/src/renderer/src/components/People.tsx b/app/src/renderer/src/components/People.tsx
index 954bb6d3..732a8c15 100644
--- a/app/src/renderer/src/components/People.tsx
+++ b/app/src/renderer/src/components/People.tsx
@@ -1,6 +1,6 @@
import { attendeeSuggestions, searchPersonKey } from '../../../shared/searchPeople'
import { usePopoverPresence } from '../motion'
-import { attendeePrivacy, emailName } from '../../../shared/people'
+import { attendeePrivacy, emailName, groupPeople, initials } from '../../../shared/people'
import { toasts } from './TrashToast'
import { useCallback, useEffect, useId, useRef, useState, type KeyboardEvent, type RefObject } from 'react'
import { useNotePopover } from '../useNotePopover'
@@ -108,18 +108,22 @@ function Card({ m, me, motionProps, chip, onClose }: { m: Meeting; me: string; m
const key = (e: KeyboardEvent) => {
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); onClose() }
}
- // the person themself first, marked; an invite that lists them too shows them once
+ // Keep original attendee indices when grouping; an invite lists the person themself once.
const others = m.attendees.map((p, i) => ({ p, i })).filter(({ p }) => !same(p.name, me))
+ const groups = groupPeople<{ p: Person; i: number; mine?: boolean }>([{ p: { name: me || t('Me'), email: m.attendees.find(p => same(p.name, me))?.email ?? null }, i: -1, mine: true }, ...others])
+
return (
<div ref={card} data-testid="people-card" {...motionProps} data-anchor="start" role="dialog" aria-label={t('People')} onKeyDown={key}
className="people-card menu-entry absolute start-0 top-full z-30 mt-2 w-[min(340px,calc(100vw-48px))] rounded-lg border border-line bg-float text-ink shadow-[var(--shadow)]">
- <ul data-testid="people-list" className="people-list max-h-64 overflow-y-auto p-1.5">
- <Row name={me || t('Me')} email={m.attendees.find(p => same(p.name, me))?.email} mine />
- {others.map(({ p, i }) => (
- <Row key={p.email || i} name={personName(p.name)} email={p.email} onRename={name => window.yogurt.meetings.renameAttendee(m.id, i, name, p)} onRemove={() => void save(m.attendees.filter((_, j) => j !== i))} />
- ))}
- </ul>
+ <div data-testid="people-list" className="people-list grouped-people overflow-y-auto p-1.5">
+ {groups.map(group => <section key={group.domain} aria-label={group.label || t('Other people')}>
+ <h4 className="company-heading" title={group.domain || undefined}>{group.label || t('Other people')}</h4>
+ <ul>{group.people.map(({ p, i, mine }) => <Row key={p.email || i} name={personName(p.name)} email={p.email} mine={mine}
+ onRename={mine ? undefined : name => window.yogurt.meetings.renameAttendee(m.id, i, name, p)}
+ onRemove={mine ? undefined : () => void save(m.attendees.filter((_, j) => j !== i))} />)}</ul>
+ </section>)}
+ </div>
<div className={`border-t border-line ${adding ? 'p-3' : ''}`}>
<button data-testid="people-add-open" onClick={() => { setAdding(true); input.current?.focus() }} className={`flex w-full items-center gap-2 text-start text-[13px] text-muted ${adding ? 'mb-2' : 'h-11 px-4 hover:bg-card'}`}><Plus size={14} aria-hidden="true" />{t('Add an attendee')}</button>
{adding && <div className="people-add-field flex h-9 items-center rounded-md border border-line bg-card px-2.5">
@@ -171,12 +175,13 @@ function Row({ name, email, mine, onRemove, onRename }: { name: string; email?:
}
return (
<li data-testid="people-row" data-me={mine ? '' : undefined} className={`person-row flex ${email ? 'min-h-[52px]' : 'min-h-10'} items-center gap-2 rounded-md px-2.5 py-1.5`}>
+ <span className="person-initials" aria-hidden="true">{initials(name)}</span>
<div className="min-w-0 flex-1 text-[13px]" title={email ?? undefined}>
{editing ? <input data-testid="people-rename" autoFocus value={draft} disabled={saving} maxLength={200} aria-label={t('Rename')} onChange={e => setDraft(e.target.value)}
onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); void save() } if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); stopEditing() } }} className="w-full rounded border border-line bg-card px-1 py-0.5" />
: onRename ? <button ref={nameButton} data-testid="people-name" title={t('Rename')} className="block max-w-full truncate text-start" onClick={() => { setDraft(name); setEditing(true) }}>{name}</button>
- : <span>{name}{mine && <span className="text-muted"> {t('(me)')}</span>}</span>}
- {email && <span data-testid="people-email" className="block break-words text-xs leading-[17px] text-muted">{email}</span>}
+ : <span className="block truncate">{name}{mine && <span className="text-muted"> {t('(me)')}</span>}</span>}
+ {email && <span data-testid="people-email" className="block truncate text-xs leading-[17px] text-muted">{email}</span>}
</div>
{onRename && !editing && <button data-testid="people-edit" aria-label={t('Rename')} title={t('Rename')} onClick={() => { setDraft(name); setEditing(true) }} className="person-remove grid size-6 shrink-0 place-items-center rounded text-muted hover:bg-[var(--line)] hover:text-ink"><Pencil size={14} strokeWidth={1.75} aria-hidden="true" /></button>}
{onRemove && (
diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.css
index e0ef80c9..686299a2 100644
--- a/app/src/renderer/src/styles.css
+++ b/app/src/renderer/src/styles.css
@@ -759,6 +759,12 @@ html:not(.widget) button:focus-visible, html:not(.widget) input:focus-visible {
.people-card { display:flex;flex-direction:column;max-height:var(--people-available-height,calc(100dvh - 200px));overflow-y:auto;overscroll-behavior:contain; }
.people-card > * { flex-shrink:0; }
.people-card .people-list { flex-shrink:1;min-height:40px;overscroll-behavior:contain; }
+.grouped-people { max-height:386px; }
+.grouped-people section+section { margin-top:6px; }
+.company-heading { font-size:11px;line-height:16px;font-weight:500;color:var(--muted);padding:8px 10px 3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
+.grouped-people .person-row { gap:9px; }
+.person-initials { display:grid;place-items:center;width:28px;height:28px;flex:none;border-radius:50%;background:var(--control);font-size:10px;font-weight:500;color:var(--muted); }
+
/* Name ink comes from the same folder token in both transcript surfaces. */
:is(.line-who,.widget-preview-speaker)[data-folder-color] { color:var(--folder-ink); }
@@ -771,26 +777,45 @@ html:not(.widget) button:focus-visible, html:not(.widget) input:focus-visible {
@media (prefers-reduced-motion:reduce) { .note-date-card { --note-date-ms:0ms; } }
.note-date-card .agenda-inspector-heading h3 { flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.note-date-linked { display:flex;flex-direction:column; }
-.note-date-picker-space { padding-top:8px; }
-.note-date-motion,.note-date-motion[data-open=true] { transition:grid-template-rows var(--note-date-ms) var(--note-date-ease),margin-top var(--note-date-ms) var(--note-date-ease); }
+.note-date-picker-space { padding-top:0; }
+.note-date-linked .note-date-picker-motion { margin-inline:-8px; }
+.note-date-linked .note-date-picker-motion[data-open=true] { margin-top:12px; }
+/* the open Unlink row sits as close to the bottom edge as the event row sits to the top (both pull their hover box into the padding) */
+.note-date-linked:last-child .note-date-picker-motion[data-open=true] { margin-bottom:-8px; }
+.note-date-motion,.note-date-motion[data-open=true] { transition:grid-template-rows var(--note-date-ms) var(--note-date-ease),margin-top var(--note-date-ms) var(--note-date-ease),margin-bottom var(--note-date-ms) var(--note-date-ease); }
.note-date-motion>* { transition:opacity var(--note-date-ms) var(--note-date-ease),visibility 0s var(--note-date-ms); }
.note-date-motion[data-open=true]>* { transition:opacity var(--note-date-ms) var(--note-date-ease),visibility 0s; }
/* Cancel the parent's row gap as the compact switcher replaces the details. */
.note-date-details-motion[data-open=false] { margin-top:-16px; }
-.note-date-linked .note-date-picker { border:1px solid var(--line);border-radius:6px;padding:4px;background:var(--card); }
+.note-date-linked .note-date-link { gap:6px; }
.note-date-details { display:flex;flex-direction:column;gap:16px; }
-.note-date-empty-row { display:flex;align-items:center;justify-content:space-between;gap:8px;white-space:nowrap; }
-.note-date-empty-row>p { min-width:0;overflow:hidden;text-overflow:ellipsis; }
.note-date-event-toggle[aria-expanded=true]>svg { transform:rotate(180deg); }
-.note-date-event-toggle { display:flex;align-items:center;gap:8px;width:100%;text-align:start;border-radius:4px; }
-.note-date-event-toggle>span { white-space:nowrap;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis; }
-/* centred under the day arrow above it: that 28px button hangs 4px past the edge, so its 15px icon sits 2.5px further in */
-.note-date-event-toggle>svg { flex:none;margin-inline-end:2.5px;color:var(--muted);transition:transform var(--note-date-ms) var(--note-date-ease); }
+.note-date-event-toggle { display:flex;align-items:flex-start;gap:10px;width:calc(100% + 16px);margin:-8px;padding:8px;border-radius:6px;text-align:start; }
+.note-date-color { width:10px;height:10px;border-radius:3px;flex:none;margin-top:5px; }
+/* Keep late linked-event data in its reserved space instead of resizing the card. */
+.note-date-actions { min-height:28px; }
+.note-date-actions .note-date-access { flex-wrap:nowrap; }
+.note-date-actions p { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
+.note-date-reveal { opacity:1;transition:opacity var(--dur-micro) var(--ease-out); }
+.note-date-reveal[data-ready=false] { opacity:0; }
+@media (prefers-reduced-motion:reduce) { .note-date-reveal { transition:none; } }
+
+.note-date-identity { min-width:0;flex:1; }
+.note-date-identity>strong,.note-date-time,.note-date-calendar { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
+.note-date-identity>strong { font-size:14px;font-weight:600;line-height:21px; }
+.note-date-time { font-size:12px;line-height:18px;color:var(--written);margin-top:3px; }
+.note-date-calendar { min-height:16px;font-size:11px;line-height:16px;color:var(--muted);margin-top:3px; }
+.note-date-event-toggle>svg { flex:none;margin-top:3px;color:var(--muted);transition:transform var(--note-date-ms) var(--note-date-ease); }
+.note-date-linked :is(.note-date-event-toggle,.note-date-link):hover:not(:disabled) { background:var(--row-hover); }
+.note-date-linked :is(.note-date-event-toggle,.note-date-link):active:not(:disabled) { background:var(--control-pressed); }
+.note-date-linked :is(.note-date-event-toggle,.note-date-link):focus-visible { outline:2px solid var(--focus);outline-offset:-2px; }
@media (prefers-reduced-motion:reduce) { .note-date-motion,.note-date-motion[data-open=true],.note-date-motion>*,.note-date-motion[data-open=true]>*,.note-date-event-toggle>svg { transition:none; } }
.note-date-link { display:flex;align-items:center;gap:8px;width:100%;padding:8px;border-radius:6px;text-align:start;font-size:12px;color:var(--muted); }
.note-date-link:hover,.note-date-event:hover { background:var(--card);color:var(--ink); }
.note-date-card .note-date-picker button:focus-visible { outline-offset:-2px; }
-.note-date-link small { display:block;margin-top:3px;font-size:11px; }
+.note-date-link>span { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
+.note-date-link>svg { flex:none; }
+.note-date-link small { display:block;margin-top:3px;font-size:11px;overflow:hidden;text-overflow:ellipsis; }
.note-date-events { max-height:240px;overflow-y:auto;overscroll-behavior:contain; }
.note-date-events>p { padding:12px 8px;font-size:12px;color:var(--muted); }
.note-date-event { display:flex;align-items:center;gap:8px;width:100%;padding:8px;border-radius:6px;text-align:start; }
diff --git a/app/src/renderer/src/useJoinWindow.ts b/app/src/renderer/src/useJoinWindow.ts
new file mode 100644
index 00000000..ff2e3f20
--- /dev/null
+++ b/app/src/renderer/src/useJoinWindow.ts
@@ -0,0 +1,21 @@
+import { useEffect, useState } from 'react'
+import { canJoinEvent, JOIN_EARLY_MS } from '../../shared/comingUp'
+
+/** Recheck at the two join boundaries and when waking, without polling an open card. */
+export function useJoinWindow(start: number, end: number | null | undefined): boolean {
+ const [now, setNow] = useState(Date.now)
+ useEffect(() => {
+ let timer: ReturnType<typeof setTimeout> | undefined
+ const update = () => {
+ clearTimeout(timer)
+ const at = Date.now()
+ setNow(at)
+ const next = at < start - JOIN_EARLY_MS ? start - JOIN_EARLY_MS : end != null && at < end ? end : undefined
+ if (next !== undefined) timer = setTimeout(update, Math.min(next - at, 2_147_483_647))
+ }
+ update()
+ window.addEventListener('focus', update)
+ return () => { clearTimeout(timer); window.removeEventListener('focus', update) }
+ }, [start, end])
+ return canJoinEvent(start, end, now)
+}
diff --git a/app/src/renderer/src/useNoteCalendar.ts b/app/src/renderer/src/useNoteCalendar.ts
new file mode 100644
index 00000000..6f97cd38
--- /dev/null
+++ b/app/src/renderer/src/useNoteCalendar.ts
@@ -0,0 +1,46 @@
+import { useCallback, useEffect, useState } from 'react'
+import type { Meeting, YogurtApi } from '../../shared/types'
+
+type CalendarList = Awaited<ReturnType<YogurtApi['calendar']['list']>>
+export type NoteCalendar = { key: string; result: Awaited<ReturnType<YogurtApi['calendar']['day']>>; colors: Record<string, string> }
+let calendars: Promise<CalendarList> | undefined
+let watching = false
+
+function calendarList() {
+ if (!watching) {
+ watching = true
+ const invalidate = () => { calendars = undefined }
+ window.yogurt.calendar.onChange(invalidate)
+ window.addEventListener('focus', invalidate)
+ }
+ if (!calendars) {
+ const read = window.yogurt.calendar.list()
+ calendars = read
+ void read.then(value => { if (value.status !== 'granted' && calendars === read) calendars = undefined }, () => { if (calendars === read) calendars = undefined })
+ }
+ return calendars
+}
+
+/** Read the linked event while the note is visible, before its date popover opens. */
+export function useNoteCalendar(m: Meeting) {
+ const [details, setDetails] = useState<NoteCalendar>()
+ const [revision, setRevision] = useState(0)
+ const refresh = useCallback(() => setRevision(n => n + 1), [])
+ const at = m.eventStartedAt ?? m.startedAt
+ const key = `${m.id}/${m.eventId}/${at}`
+ const enabled = window.yogurt.capabilities.calendar && !!m.eventId
+ useEffect(() => {
+ if (!enabled) return
+ let active = true
+ void Promise.all([
+ window.yogurt.calendar.day(at).catch(() => ({ status: 'error' as const, events: [] })),
+ calendarList().catch(() => null),
+ ]).then(([result, list]) => {
+ if (active) setDetails({ key, result, colors: Object.fromEntries((list?.calendars ?? []).filter(c => /^#[0-9a-f]{6}$/i.test(c.color ?? '')).map(c => [c.id, c.color!])) })
+ })
+ const off = window.yogurt.calendar.onChange(refresh)
+ window.addEventListener('focus', refresh)
+ return () => { active = false; off(); window.removeEventListener('focus', refresh) }
+ }, [enabled, key, at, revision, refresh])
+ return { details: enabled && details?.key === key ? details : undefined, refresh }
+}
diff --git a/app/src/shared/comingUp.ts b/app/src/shared/comingUp.ts
index 89cc30cf..3426e903 100644
--- a/app/src/shared/comingUp.ts
+++ b/app/src/shared/comingUp.ts
@@ -12,3 +12,7 @@ export function pickNext(events: CalEvent[], now: number): string | undefined {
const on = events.filter((e) => e.start <= now && e.end > now).sort((a, b) => b.start - a.start)
return on[0]?.id
}
+
+export const JOIN_EARLY_MS = 10 * MIN
+export const canJoinEvent = (start: number, end: number | null | undefined, now: number): boolean =>
+ end != null && now >= start - JOIN_EARLY_MS && now < end
diff --git a/app/src/shared/dates.ts b/app/src/shared/dates.ts
index 18c1a500..8bfc6cbd 100644
--- a/app/src/shared/dates.ts
+++ b/app/src/shared/dates.ts
@@ -27,3 +27,14 @@ export function noteDateLabel(ms: number): string {
/** 10:30 AM, 10:30, as the interface's language writes it */
export const timeOf = (ms: number) => new Date(ms).toLocaleTimeString(language(), { hour: 'numeric', minute: '2-digit' })
+/** Let the locale place a shared day period before or after the range. */
+export function eventTimeRange(start: number, end: number | null | undefined, locale = language()): string {
+ const format = new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit' })
+ if (end == null) return format.format(start)
+ const period = (at: number) => format.formatToParts(at).find(part => part.type === 'dayPeriod')?.value
+ const sharedPeriod = period(start)
+ if (end >= start && sharedPeriod && sharedPeriod === period(end) && new Date(start).toDateString() === new Date(end).toDateString()) {
+ return format.formatRange(start, end)
+ }
+ return `${format.format(start)} – ${format.format(end)}`
+}
diff --git a/app/src/shared/locales/ar.json b/app/src/shared/locales/ar.json
index 5d9dcd2a..58a5733f 100644
--- a/app/src/shared/locales/ar.json
+++ b/app/src/shared/locales/ar.json
@@ -1,5 +1,5 @@
{
- "Link event": "ربط حدث",
+ "Other people": "أشخاص آخرون",
"No events": "لا أحداث",
"Go to {date}": "انتقل إلى {date}",
"Resume notes · {title}": "متابعة تدوين الملاحظات · {title}",
@@ -16,7 +16,6 @@
"Open": "فتح",
"Next day": "اليوم التالي",
"Previous day": "اليوم السابق",
- "Link to a calendar event": "ربط بحدث في التقويم",
"Yogurt couldn't update the calendar link. Try again.": "تعذّر على Yogurt تحديث رابط التقويم. حاول مرة أخرى.",
"Keep the title, attendees and notes.": "الاحتفاظ بالعنوان والحضور والملاحظات.",
"Unlink calendar event": "إلغاء ربط حدث التقويم",
diff --git a/app/src/shared/locales/bn.json b/app/src/shared/locales/bn.json
index 4bdc7ef5..f314529f 100644
--- a/app/src/shared/locales/bn.json
+++ b/app/src/shared/locales/bn.json
@@ -1,5 +1,5 @@
{
- "Link event": "ইভেন্ট লিঙ্ক করুন",
+ "Other people": "অন্যান্য ব্যক্তি",
"No events": "কোনো ইভেন্ট নেই",
"Go to {date}": "{date} তারিখে যান",
"Resume notes · {title}": "নোট নেওয়া চালিয়ে যান · {title}",
@@ -16,7 +16,6 @@
"Open": "খুলুন",
"Next day": "পরের দিন",
"Previous day": "আগের দিন",
- "Link to a calendar event": "ক্যালেন্ডারের ইভেন্টে লিঙ্ক করুন",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt ক্যালেন্ডারের লিংক আপডেট করতে পারেনি। আবার চেষ্টা করুন।",
"Keep the title, attendees and notes.": "শিরোনাম, অংশগ্রহণকারী ও নোট রাখুন।",
"Unlink calendar event": "ক্যালেন্ডার ইভেন্টের সংযোগ সরান",
diff --git a/app/src/shared/locales/cs.json b/app/src/shared/locales/cs.json
index e4a1c4a8..fd581043 100644
--- a/app/src/shared/locales/cs.json
+++ b/app/src/shared/locales/cs.json
@@ -1,5 +1,5 @@
{
- "Link event": "Propojit událost",
+ "Other people": "Ostatní lidé",
"No events": "Žádné události",
"Go to {date}": "Přejít na {date}",
"Resume notes · {title}": "Pokračovat v poznámkách · {title}",
@@ -16,7 +16,6 @@
"Open": "Otevřít",
"Next day": "Další den",
"Previous day": "Předchozí den",
- "Link to a calendar event": "Propojit s událostí v kalendáři",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt nemohl aktualizovat propojení s kalendářem. Zkuste to znovu.",
"Keep the title, attendees and notes.": "Zachovat název, účastníky a poznámky.",
"Unlink calendar event": "Odpojit událost z kalendáře",
diff --git a/app/src/shared/locales/da.json b/app/src/shared/locales/da.json
index 8d7bc7f0..45ae3d2d 100644
--- a/app/src/shared/locales/da.json
+++ b/app/src/shared/locales/da.json
@@ -1,5 +1,5 @@
{
- "Link event": "Tilknyt begivenhed",
+ "Other people": "Andre personer",
"No events": "Ingen begivenheder",
"Go to {date}": "Gå til {date}",
"Resume notes · {title}": "Fortsæt noter · {title}",
@@ -16,7 +16,6 @@
"Open": "Åbn",
"Next day": "Næste dag",
"Previous day": "Forrige dag",
- "Link to a calendar event": "Tilknyt en kalenderbegivenhed",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt kunne ikke opdatere koblingen til kalenderen. Prøv igen.",
"Keep the title, attendees and notes.": "Behold titel, deltagere og noter.",
"Unlink calendar event": "Fjern kobling til kalenderbegivenhed",
diff --git a/app/src/shared/locales/de.json b/app/src/shared/locales/de.json
index e00696e3..5f9efae1 100644
--- a/app/src/shared/locales/de.json
+++ b/app/src/shared/locales/de.json
@@ -1,5 +1,5 @@
{
- "Link event": "Termin verknüpfen",
+ "Other people": "Weitere Personen",
"No events": "Keine Termine",
"Go to {date}": "Zum {date} springen",
"Resume notes · {title}": "Notizen fortsetzen · {title}",
@@ -16,7 +16,6 @@
"Open": "Öffnen",
"Next day": "Nächster Tag",
"Previous day": "Vorheriger Tag",
- "Link to a calendar event": "Mit einem Kalendertermin verknüpfen",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt konnte die Kalenderverknüpfung nicht aktualisieren. Versuch es noch einmal.",
"Keep the title, attendees and notes.": "Titel, Teilnehmende und Notizen behalten.",
"Unlink calendar event": "Kalendertermin trennen",
diff --git a/app/src/shared/locales/el.json b/app/src/shared/locales/el.json
index 64edb854..6e842bae 100644
--- a/app/src/shared/locales/el.json
+++ b/app/src/shared/locales/el.json
@@ -1,5 +1,5 @@
{
- "Link event": "Σύνδεση συμβάντος",
+ "Other people": "Άλλα άτομα",
"No events": "Κανένα συμβάν",
"Go to {date}": "Μετάβαση στις {date}",
"Resume notes · {title}": "Συνέχιση σημειώσεων · {title}",
@@ -16,7 +16,6 @@
"Open": "Άνοιγμα",
"Next day": "Επόμενη ημέρα",
"Previous day": "Προηγούμενη ημέρα",
- "Link to a calendar event": "Σύνδεση με συμβάν ημερολογίου",
"Yogurt couldn't update the calendar link. Try again.": "Το Yogurt δεν μπόρεσε να ενημερώσει τη σύνδεση με το ημερολόγιο. Δοκιμάστε ξανά.",
"Keep the title, attendees and notes.": "Διατήρηση τίτλου, συμμετεχόντων και σημειώσεων.",
"Unlink calendar event": "Αποσύνδεση συμβάντος ημερολογίου",
diff --git a/app/src/shared/locales/en.json b/app/src/shared/locales/en.json
index f97c3736..81482a3e 100644
--- a/app/src/shared/locales/en.json
+++ b/app/src/shared/locales/en.json
@@ -1,6 +1,6 @@
{
+ "Other people": "Other people",
"Reading the transcript…": "Reading the transcript…",
- "Link event": "Link event",
"No events": "No events",
"Go to {date}": "Go to {date}",
"Previous day": "Previous day",
diff --git a/app/src/shared/locales/es.json b/app/src/shared/locales/es.json
index 24465906..0b8cbe8a 100644
--- a/app/src/shared/locales/es.json
+++ b/app/src/shared/locales/es.json
@@ -1,5 +1,5 @@
{
- "Link event": "Vincular evento",
+ "Other people": "Otras personas",
"No events": "No hay eventos",
"Go to {date}": "Ir al {date}",
"Resume notes · {title}": "Continuar tomando notas · {title}",
@@ -16,7 +16,6 @@
"Open": "Abrir",
"Next day": "Día siguiente",
"Previous day": "Día anterior",
- "Link to a calendar event": "Vincular a un evento del calendario",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt no pudo actualizar el vínculo con el calendario. Inténtalo de nuevo.",
"Keep the title, attendees and notes.": "Conservar el título, los asistentes y las notas.",
"Unlink calendar event": "Desvincular evento del calendario",
diff --git a/app/src/shared/locales/fi.json b/app/src/shared/locales/fi.json
index 5ffc31b1..5effcd16 100644
--- a/app/src/shared/locales/fi.json
+++ b/app/src/shared/locales/fi.json
@@ -1,5 +1,5 @@
{
- "Link event": "Liitä tapahtuma",
+ "Other people": "Muut henkilöt",
"No events": "Ei tapahtumia",
"Go to {date}": "Siirry päivään {date}",
"Resume notes · {title}": "Jatka muistiinpanoja · {title}",
@@ -16,7 +16,6 @@
"Open": "Avaa",
"Next day": "Seuraava päivä",
"Previous day": "Edellinen päivä",
- "Link to a calendar event": "Liitä kalenteritapahtumaan",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt ei voinut päivittää kalenterilinkkiä. Yritä uudelleen.",
"Keep the title, attendees and notes.": "Säilytä otsikko, osallistujat ja muistiinpanot.",
"Unlink calendar event": "Irrota kalenteritapahtuma",
diff --git a/app/src/shared/locales/fil.json b/app/src/shared/locales/fil.json
index 7b97570a..d1e785ac 100644
--- a/app/src/shared/locales/fil.json
+++ b/app/src/shared/locales/fil.json
@@ -1,5 +1,5 @@
{
- "Link event": "I-link ang event",
+ "Other people": "Iba pang tao",
"No events": "Walang event",
"Go to {date}": "Pumunta sa {date}",
"Resume notes · {title}": "Ipagpatuloy ang mga tala · {title}",
@@ -16,7 +16,6 @@
"Open": "Buksan",
"Next day": "Susunod na araw",
"Previous day": "Nakaraang araw",
- "Link to a calendar event": "I-link sa isang kaganapan sa kalendaryo",
"Yogurt couldn't update the calendar link. Try again.": "Hindi ma-update ng Yogurt ang link sa calendar. Subukan ulit.",
"Keep the title, attendees and notes.": "Panatilihin ang pamagat, mga kalahok at mga note.",
"Unlink calendar event": "Alisin ang link sa event ng calendar",
diff --git a/app/src/shared/locales/fr.json b/app/src/shared/locales/fr.json
index ef409e12..1f8df5d2 100644
--- a/app/src/shared/locales/fr.json
+++ b/app/src/shared/locales/fr.json
@@ -1,5 +1,5 @@
{
- "Link event": "Lier un événement",
+ "Other people": "Autres personnes",
"No events": "Aucun événement",
"Go to {date}": "Aller au {date}",
"Resume notes · {title}": "Reprendre les notes · {title}",
@@ -16,7 +16,6 @@
"Open": "Ouvrir",
"Next day": "Jour suivant",
"Previous day": "Jour précédent",
- "Link to a calendar event": "Lier à un événement du calendrier",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt n’a pas pu mettre à jour le lien avec le calendrier. Réessayez.",
"Keep the title, attendees and notes.": "Garder le titre, les participants et les notes.",
"Unlink calendar event": "Dissocier l’événement du calendrier",
diff --git a/app/src/shared/locales/he.json b/app/src/shared/locales/he.json
index 2696e284..7f0fa609 100644
--- a/app/src/shared/locales/he.json
+++ b/app/src/shared/locales/he.json
@@ -1,5 +1,5 @@
{
- "Link event": "קישור אירוע",
+ "Other people": "אנשים אחרים",
"No events": "אין אירועים",
"Go to {date}": "מעבר אל {date}",
"Resume notes · {title}": "המשך כתיבת הערות · {title}",
@@ -16,7 +16,6 @@
"Open": "פתיחה",
"Next day": "היום הבא",
"Previous day": "היום הקודם",
- "Link to a calendar event": "קישור לאירוע ביומן",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt לא הצליח לעדכן את הקישור ליומן. כדאי לנסות שוב.",
"Keep the title, attendees and notes.": "לשמור את הכותרת, המשתתפים וההערות.",
"Unlink calendar event": "ניתוק אירוע היומן",
diff --git a/app/src/shared/locales/hi.json b/app/src/shared/locales/hi.json
index 40ad8440..7f576ea3 100644
--- a/app/src/shared/locales/hi.json
+++ b/app/src/shared/locales/hi.json
@@ -1,5 +1,5 @@
{
- "Link event": "इवेंट लिंक करें",
+ "Other people": "अन्य लोग",
"No events": "कोई इवेंट नहीं",
"Go to {date}": "{date} पर जाएँ",
"Resume notes · {title}": "नोट्स लेना जारी रखें · {title}",
@@ -16,7 +16,6 @@
"Open": "खोलें",
"Next day": "अगला दिन",
"Previous day": "पिछला दिन",
- "Link to a calendar event": "कैलेंडर इवेंट से लिंक करें",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt कैलेंडर लिंक अपडेट नहीं कर सका। फिर से कोशिश करें।",
"Keep the title, attendees and notes.": "टाइटल, भाग लेने वाले और नोट्स रखें।",
"Unlink calendar event": "कैलेंडर इवेंट से अलग करें",
diff --git a/app/src/shared/locales/hu.json b/app/src/shared/locales/hu.json
index bee032e7..6476c4ca 100644
--- a/app/src/shared/locales/hu.json
+++ b/app/src/shared/locales/hu.json
@@ -1,5 +1,5 @@
{
- "Link event": "Esemény csatolása",
+ "Other people": "Más résztvevők",
"No events": "Nincs esemény",
"Go to {date}": "Ugrás erre a napra: {date}",
"Resume notes · {title}": "Jegyzetelés folytatása · {title}",
@@ -16,7 +16,6 @@
"Open": "Megnyitás",
"Next day": "Következő nap",
"Previous day": "Előző nap",
- "Link to a calendar event": "Kapcsolás naptáreseményhez",
"Yogurt couldn't update the calendar link. Try again.": "A Yogurt nem tudta frissíteni a naptárkapcsolatot. Próbáld újra.",
"Keep the title, attendees and notes.": "A cím, a résztvevők és a jegyzetek megtartása.",
"Unlink calendar event": "Naptáresemény leválasztása",
diff --git a/app/src/shared/locales/id.json b/app/src/shared/locales/id.json
index 667ba015..96907432 100644
--- a/app/src/shared/locales/id.json
+++ b/app/src/shared/locales/id.json
@@ -1,5 +1,5 @@
{
- "Link event": "Tautkan acara",
+ "Other people": "Orang lain",
"No events": "Tidak ada acara",
"Go to {date}": "Buka tanggal {date}",
"Resume notes · {title}": "Lanjutkan catatan · {title}",
@@ -16,7 +16,6 @@
"Open": "Buka",
"Next day": "Hari berikutnya",
"Previous day": "Hari sebelumnya",
- "Link to a calendar event": "Tautkan ke acara kalender",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt tidak bisa memperbarui tautan kalender. Coba lagi.",
"Keep the title, attendees and notes.": "Pertahankan judul, peserta, dan catatan.",
"Unlink calendar event": "Lepaskan tautan acara kalender",
diff --git a/app/src/shared/locales/it.json b/app/src/shared/locales/it.json
index 5863d882..c09d7d9f 100644
--- a/app/src/shared/locales/it.json
+++ b/app/src/shared/locales/it.json
@@ -1,5 +1,5 @@
{
- "Link event": "Collega evento",
+ "Other people": "Altre persone",
"No events": "Nessun evento",
"Go to {date}": "Vai al {date}",
"Resume notes · {title}": "Riprendi gli appunti · {title}",
@@ -16,7 +16,6 @@
"Open": "Apri",
"Next day": "Giorno successivo",
"Previous day": "Giorno precedente",
- "Link to a calendar event": "Collega a un evento del calendario",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt non è riuscito ad aggiornare il collegamento al calendario. Riprova.",
"Keep the title, attendees and notes.": "Mantieni titolo, partecipanti e note.",
"Unlink calendar event": "Scollega evento del calendario",
diff --git a/app/src/shared/locales/ja.json b/app/src/shared/locales/ja.json
index ac78a53f..2770b0aa 100644
--- a/app/src/shared/locales/ja.json
+++ b/app/src/shared/locales/ja.json
@@ -1,5 +1,5 @@
{
- "Link event": "予定にリンク",
+ "Other people": "その他の参加者",
"No events": "予定はありません",
"Go to {date}": "{date}に移動",
"Resume notes · {title}": "メモを再開 · {title}",
@@ -16,7 +16,6 @@
"Open": "開く",
"Next day": "次の日",
"Previous day": "前の日",
- "Link to a calendar event": "カレンダーの予定にリンク",
"Yogurt couldn't update the calendar link. Try again.": "Yogurtはカレンダーとのリンクを更新できませんでした。もう一度お試しください。",
"Keep the title, attendees and notes.": "タイトル、参加者、メモは残します。",
"Unlink calendar event": "カレンダーの予定とのリンクを解除",
diff --git a/app/src/shared/locales/ko.json b/app/src/shared/locales/ko.json
index b396332e..efdc7db4 100644
--- a/app/src/shared/locales/ko.json
+++ b/app/src/shared/locales/ko.json
@@ -1,5 +1,5 @@
{
- "Link event": "일정 연결",
+ "Other people": "기타 참석자",
"No events": "일정 없음",
"Go to {date}": "{date}로 이동",
"Resume notes · {title}": "메모 재개 · {title}",
@@ -16,7 +16,6 @@
"Open": "열기",
"Next day": "다음 날",
"Previous day": "이전 날",
- "Link to a calendar event": "캘린더 일정에 연결",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt가 캘린더 연결을 업데이트하지 못했어요. 다시 시도하세요.",
"Keep the title, attendees and notes.": "제목, 참석자, 노트를 유지해요.",
"Unlink calendar event": "캘린더 일정 연결 해제",
diff --git a/app/src/shared/locales/ms.json b/app/src/shared/locales/ms.json
index 88f3a2b6..d85808c8 100644
--- a/app/src/shared/locales/ms.json
+++ b/app/src/shared/locales/ms.json
@@ -1,5 +1,5 @@
{
- "Link event": "Pautkan acara",
+ "Other people": "Orang lain",
"No events": "Tiada acara",
"Go to {date}": "Pergi ke {date}",
"Resume notes · {title}": "Sambung catatan · {title}",
@@ -16,7 +16,6 @@
"Open": "Buka",
"Next day": "Hari seterusnya",
"Previous day": "Hari sebelumnya",
- "Link to a calendar event": "Pautkan ke acara kalendar",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt tidak dapat mengemas kini pautan kalendar. Cuba lagi.",
"Keep the title, attendees and notes.": "Kekalkan tajuk, peserta dan nota.",
"Unlink calendar event": "Nyahpaut acara kalendar",
diff --git a/app/src/shared/locales/nb.json b/app/src/shared/locales/nb.json
index bfb278ba..450e534b 100644
--- a/app/src/shared/locales/nb.json
+++ b/app/src/shared/locales/nb.json
@@ -1,5 +1,5 @@
{
- "Link event": "Koble til hendelse",
+ "Other people": "Andre personer",
"No events": "Ingen hendelser",
"Go to {date}": "Gå til {date}",
"Resume notes · {title}": "Fortsett notater · {title}",
@@ -16,7 +16,6 @@
"Open": "Åpne",
"Next day": "Neste dag",
"Previous day": "Forrige dag",
- "Link to a calendar event": "Koble til en kalenderhendelse",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt kunne ikke oppdatere koblingen til kalenderen. Prøv igjen.",
"Keep the title, attendees and notes.": "Behold tittel, deltakere og notater.",
"Unlink calendar event": "Koble fra kalenderhendelse",
diff --git a/app/src/shared/locales/nl.json b/app/src/shared/locales/nl.json
index 6720a216..cc30381d 100644
--- a/app/src/shared/locales/nl.json
+++ b/app/src/shared/locales/nl.json
@@ -1,5 +1,5 @@
{
- "Link event": "Afspraak koppelen",
+ "Other people": "Andere personen",
"No events": "Geen afspraken",
"Go to {date}": "Ga naar {date}",
"Resume notes · {title}": "Notities hervatten · {title}",
@@ -16,7 +16,6 @@
"Open": "Openen",
"Next day": "Volgende dag",
"Previous day": "Vorige dag",
- "Link to a calendar event": "Koppelen aan een agenda-afspraak",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt kon de koppeling met de agenda niet bijwerken. Probeer het opnieuw.",
"Keep the title, attendees and notes.": "Titel, deelnemers en notities behouden.",
"Unlink calendar event": "Agenda-item ontkoppelen",
diff --git a/app/src/shared/locales/pl.json b/app/src/shared/locales/pl.json
index 12c4634a..364ca5c3 100644
--- a/app/src/shared/locales/pl.json
+++ b/app/src/shared/locales/pl.json
@@ -1,5 +1,5 @@
{
- "Link event": "Połącz wydarzenie",
+ "Other people": "Inne osoby",
"No events": "Brak wydarzeń",
"Go to {date}": "Przejdź do {date}",
"Resume notes · {title}": "Wznów notowanie · {title}",
@@ -16,7 +16,6 @@
"Open": "Otwórz",
"Next day": "Następny dzień",
"Previous day": "Poprzedni dzień",
- "Link to a calendar event": "Połącz z wydarzeniem w kalendarzu",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt nie mógł zaktualizować połączenia z kalendarzem. Spróbuj ponownie.",
"Keep the title, attendees and notes.": "Zachowaj tytuł, uczestników i notatki.",
"Unlink calendar event": "Odłącz wydarzenie z kalendarza",
diff --git a/app/src/shared/locales/pt-BR.json b/app/src/shared/locales/pt-BR.json
index 966bf660..42e101af 100644
--- a/app/src/shared/locales/pt-BR.json
+++ b/app/src/shared/locales/pt-BR.json
@@ -1,5 +1,5 @@
{
- "Link event": "Vincular evento",
+ "Other people": "Outras pessoas",
"No events": "Nenhum evento",
"Go to {date}": "Ir para {date}",
"Resume notes · {title}": "Retomar anotações · {title}",
@@ -16,7 +16,6 @@
"Open": "Abrir",
"Next day": "Próximo dia",
"Previous day": "Dia anterior",
- "Link to a calendar event": "Vincular a um evento do calendário",
"Yogurt couldn't update the calendar link. Try again.": "O Yogurt não conseguiu atualizar o vínculo com o calendário. Tente de novo.",
"Keep the title, attendees and notes.": "Manter o título, os participantes e as notas.",
"Unlink calendar event": "Desvincular evento do calendário",
diff --git a/app/src/shared/locales/ro.json b/app/src/shared/locales/ro.json
index 8c31e371..bae62003 100644
--- a/app/src/shared/locales/ro.json
+++ b/app/src/shared/locales/ro.json
@@ -1,5 +1,5 @@
{
- "Link event": "Leagă eveniment",
+ "Other people": "Alte persoane",
"No events": "Niciun eveniment",
"Go to {date}": "Mergi la {date}",
"Resume notes · {title}": "Reia notițele · {title}",
@@ -16,7 +16,6 @@
"Open": "Deschide",
"Next day": "Ziua următoare",
"Previous day": "Ziua precedentă",
- "Link to a calendar event": "Leagă de un eveniment din calendar",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt nu a putut actualiza legătura cu calendarul. Încercați din nou.",
"Keep the title, attendees and notes.": "Păstrați titlul, participanții și notițele.",
"Unlink calendar event": "Dezlegați evenimentul din calendar",
diff --git a/app/src/shared/locales/ru.json b/app/src/shared/locales/ru.json
index 26ab28bb..cb91157d 100644
--- a/app/src/shared/locales/ru.json
+++ b/app/src/shared/locales/ru.json
@@ -1,5 +1,5 @@
{
- "Link event": "Связать событие",
+ "Other people": "Другие участники",
"No events": "Нет событий",
"Go to {date}": "Перейти к {date}",
"Resume notes · {title}": "Продолжить заметки · {title}",
@@ -16,7 +16,6 @@
"Open": "Открыть",
"Next day": "Следующий день",
"Previous day": "Предыдущий день",
- "Link to a calendar event": "Связать с событием календаря",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt не смог обновить связь с календарём. Попробуйте снова.",
"Keep the title, attendees and notes.": "Оставить название, участников и заметки.",
"Unlink calendar event": "Отвязать событие календаря",
diff --git a/app/src/shared/locales/sv.json b/app/src/shared/locales/sv.json
index 4e1762dd..ab3ebe21 100644
--- a/app/src/shared/locales/sv.json
+++ b/app/src/shared/locales/sv.json
@@ -1,5 +1,5 @@
{
- "Link event": "Länka händelse",
+ "Other people": "Andra personer",
"No events": "Inga händelser",
"Go to {date}": "Gå till {date}",
"Resume notes · {title}": "Fortsätt anteckna · {title}",
@@ -16,7 +16,6 @@
"Open": "Öppna",
"Next day": "Nästa dag",
"Previous day": "Föregående dag",
- "Link to a calendar event": "Länka till en kalenderhändelse",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt kunde inte uppdatera kopplingen till kalendern. Försök igen.",
"Keep the title, attendees and notes.": "Behåll titel, deltagare och anteckningar.",
"Unlink calendar event": "Koppla bort kalenderhändelse",
diff --git a/app/src/shared/locales/th.json b/app/src/shared/locales/th.json
index 3aaf5822..5bbdb34f 100644
--- a/app/src/shared/locales/th.json
+++ b/app/src/shared/locales/th.json
@@ -1,5 +1,5 @@
{
- "Link event": "เชื่อมโยงกิจกรรม",
+ "Other people": "บุคคลอื่น",
"No events": "ไม่มีกิจกรรม",
"Go to {date}": "ไปที่ {date}",
"Resume notes · {title}": "จดบันทึกต่อ · {title}",
@@ -16,7 +16,6 @@
"Open": "เปิด",
"Next day": "วันถัดไป",
"Previous day": "วันก่อนหน้า",
- "Link to a calendar event": "เชื่อมโยงกับกิจกรรมในปฏิทิน",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt อัปเดตลิงก์ปฏิทินไม่ได้ ลองอีกครั้ง",
"Keep the title, attendees and notes.": "เก็บชื่อ ผู้เข้าร่วม และโน้ตไว้",
"Unlink calendar event": "ยกเลิกการลิงก์กิจกรรมในปฏิทิน",
diff --git a/app/src/shared/locales/tr.json b/app/src/shared/locales/tr.json
index 55cf7830..b4a0825e 100644
--- a/app/src/shared/locales/tr.json
+++ b/app/src/shared/locales/tr.json
@@ -1,5 +1,5 @@
{
- "Link event": "Etkinlik bağla",
+ "Other people": "Diğer kişiler",
"No events": "Etkinlik yok",
"Go to {date}": "Şu tarihe git: {date}",
"Resume notes · {title}": "Not almaya devam et · {title}",
@@ -16,7 +16,6 @@
"Open": "Aç",
"Next day": "Sonraki gün",
"Previous day": "Önceki gün",
- "Link to a calendar event": "Bir takvim etkinliğine bağla",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt takvim bağlantısını güncelleyemedi. Yeniden deneyin.",
"Keep the title, attendees and notes.": "Başlığı, katılımcıları ve notları koru.",
"Unlink calendar event": "Takvim etkinliği bağlantısını kaldır",
diff --git a/app/src/shared/locales/uk.json b/app/src/shared/locales/uk.json
index 5bbbd404..91344e53 100644
--- a/app/src/shared/locales/uk.json
+++ b/app/src/shared/locales/uk.json
@@ -1,5 +1,5 @@
{
- "Link event": "Пов’язати подію",
+ "Other people": "Інші учасники",
"No events": "Немає подій",
"Go to {date}": "Перейти до {date}",
"Resume notes · {title}": "Продовжити нотатки · {title}",
@@ -16,7 +16,6 @@
"Open": "Відкрити",
"Next day": "Наступний день",
"Previous day": "Попередній день",
- "Link to a calendar event": "Пов’язати з подією календаря",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt не зміг оновити зв’язок із календарем. Спробуйте ще раз.",
"Keep the title, attendees and notes.": "Залишити назву, учасників і нотатки.",
"Unlink calendar event": "Відв’язати подію календаря",
diff --git a/app/src/shared/locales/vi.json b/app/src/shared/locales/vi.json
index 23143159..697dddc7 100644
--- a/app/src/shared/locales/vi.json
+++ b/app/src/shared/locales/vi.json
@@ -1,5 +1,5 @@
{
- "Link event": "Liên kết sự kiện",
+ "Other people": "Những người khác",
"No events": "Không có sự kiện",
"Go to {date}": "Đi đến {date}",
"Resume notes · {title}": "Tiếp tục ghi chú · {title}",
@@ -16,7 +16,6 @@
"Open": "Mở",
"Next day": "Ngày tiếp theo",
"Previous day": "Ngày trước",
- "Link to a calendar event": "Liên kết với sự kiện lịch",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt không cập nhật được liên kết lịch. Hãy thử lại.",
"Keep the title, attendees and notes.": "Giữ tiêu đề, người tham dự và ghi chú.",
"Unlink calendar event": "Bỏ liên kết sự kiện lịch",
diff --git a/app/src/shared/locales/zh-CN.json b/app/src/shared/locales/zh-CN.json
index 0bb668c2..3912bd1b 100644
--- a/app/src/shared/locales/zh-CN.json
+++ b/app/src/shared/locales/zh-CN.json
@@ -1,5 +1,5 @@
{
- "Link event": "关联活动",
+ "Other people": "其他人",
"No events": "没有活动",
"Go to {date}": "转到{date}",
"Resume notes · {title}": "继续记笔记 · {title}",
@@ -16,7 +16,6 @@
"Open": "打开",
"Next day": "后一天",
"Previous day": "前一天",
- "Link to a calendar event": "关联到日历活动",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt 无法更新日历链接。请重试。",
"Keep the title, attendees and notes.": "保留标题、参会人和笔记。",
"Unlink calendar event": "取消关联日历事件",
diff --git a/app/src/shared/locales/zh-TW.json b/app/src/shared/locales/zh-TW.json
index 0ee8b610..0a982bae 100644
--- a/app/src/shared/locales/zh-TW.json
+++ b/app/src/shared/locales/zh-TW.json
@@ -1,5 +1,5 @@
{
- "Link event": "連結活動",
+ "Other people": "其他人",
"No events": "沒有活動",
"Go to {date}": "前往{date}",
"Resume notes · {title}": "繼續記筆記 · {title}",
@@ -16,7 +16,6 @@
"Open": "開啟",
"Next day": "後一天",
"Previous day": "前一天",
- "Link to a calendar event": "連結至行事曆活動",
"Yogurt couldn't update the calendar link. Try again.": "Yogurt 無法更新行事曆連結。請再試一次。",
"Keep the title, attendees and notes.": "保留標題、與會者和筆記。",
"Unlink calendar event": "取消連結行事曆活動",
diff --git a/app/src/shared/people.ts b/app/src/shared/people.ts
index 88502a80..055cb01b 100644
--- a/app/src/shared/people.ts
+++ b/app/src/shared/people.ts
@@ -14,3 +14,22 @@ export function resolvedPersonName(email: string, display: string | null, seen:
names.sort((a, b) => b.trim().split(/\s+/).length - a.trim().split(/\s+/).length || b.length - a.length)
return names[0] || fallback
}
+
+// shortcut: company labels use domain text, use verified organization metadata when available.
+export function groupPeople<Row extends { p: Person }>(rows: Row[]) {
+ const groups = new Map<string, { domain: string; label: string; people: Row[] }>()
+ const personal = new Set(['gmail.com', 'outlook.com', 'hotmail.com', 'icloud.com', 'yahoo.com', 'proton.me', 'protonmail.com', 'mail.example'])
+ for (const row of rows) {
+ const email = row.p.email?.trim().toLowerCase() ?? ''
+ const match = /^[^\s@]+@([^\s@]+\.[^\s@]+)$/.exec(email)
+ const domain = match && !personal.has(match[1]) ? match[1] : ''
+ const label = domain ? domain.split('.')[0].replace(/[-_]+/g, ' ').replace(/\b\w/g, c => c.toUpperCase()) : ''
+ if (!groups.has(domain)) groups.set(domain, { domain, label, people: [] })
+ groups.get(domain)!.people.push(row)
+ }
+ return [...groups.values()].sort((a, b) => !a.domain ? 1 : !b.domain ? -1 : a.label.localeCompare(b.label))
+}
+
+export function initials(name: string): string {
+ return name.trim().split(/\s+/).filter(Boolean).filter((_, i, a) => i === 0 || i === a.length - 1).map(s => Array.from(s)[0]).join('').toLocaleUpperCase()
+}
diff --git a/app/test/agendaJoin.test.ts b/app/test/agendaJoin.test.ts
new file mode 100644
index 00000000..bbbc7559
--- /dev/null
+++ b/app/test/agendaJoin.test.ts
@@ -0,0 +1,27 @@
+import { afterEach, expect, it, vi } from 'vitest'
+import { createElement } from 'react'
+import { renderToStaticMarkup } from 'react-dom/server'
+import { Agenda } from '../src/renderer/src/components/Agenda'
+
+const fixture = vi.hoisted(() => ({ index: 0, day: {} as any, event: {} as any }))
+vi.mock('react', async original => {
+ const react = await original<typeof import('react')>()
+ return { ...react, useState: (initial: any) => react.useState(fixture.index++ === 2 ? fixture.day : initial) }
+})
+vi.mock('../src/renderer/src/dates', async original => ({ ...await original<typeof import('../src/renderer/src/dates')>(), useDay: () => new Date().toDateString() }))
+vi.mock('../src/renderer/src/components/People', async original => ({ ...await original<typeof import('../src/renderer/src/components/People')>(), useMyName: () => '' }))
+vi.mock('../src/renderer/src/motion', async original => ({ ...await original<typeof import('../src/renderer/src/motion')>(), usePopoverPresence: () => ({ value: fixture.event, props: {} }) }))
+afterEach(() => { vi.unstubAllGlobals(); vi.useRealTimers() })
+it.each([[-600_001, false], [-600_000, true], [0, true], [1_800_000, false]])('uses the same Join window in the agenda at offset %s', (offset, visible) => {
+ vi.useFakeTimers()
+ const start = +new Date(2026, 10, 16, 12)
+ vi.setSystemTime(start + Number(offset))
+ vi.stubGlobal('window', { matchMedia: () => ({ matches: true }) })
+ fixture.index = 0
+ fixture.event = { id: 'event', title: 'Review', start, end: start + 1_800_000, attendees: [], url: 'https://call.example/meeting' }
+ fixture.day = { at: start, status: 'granted', events: [fixture.event] }
+ const html = renderToStaticMarkup(createElement(Agenda, { revision: 0, onStart: async () => {}, onOpen() {} }))
+ expect(html).toContain('event-details-content')
+ expect(html.includes('Join meeting')).toBe(visible)
+ expect(html.includes('href="https://call.example/meeting"')).toBe(visible)
+})
diff --git a/app/test/eventTimeRange.test.ts b/app/test/eventTimeRange.test.ts
new file mode 100644
index 00000000..3e450f01
--- /dev/null
+++ b/app/test/eventTimeRange.test.ts
@@ -0,0 +1,31 @@
+import { expect, it } from 'vitest'
+import { eventTimeRange } from '../src/shared/dates'
+import { LOCALES } from '../src/shared/i18n'
+
+const at = (hour: number, minute = 0, day = 16) => +new Date(2026, 10, day, hour, minute)
+const spaces = (text: string) => text.replace(/\s/g, ' ')
+it('shares AM or PM for same-day ranges', () => {
+ expect(spaces(eventTimeRange(at(10), at(10, 30), 'en-US'))).toBe('10:00 – 10:30 AM')
+ expect(spaces(eventTimeRange(at(13), at(13, 30), 'en-US'))).toBe('1:00 – 1:30 PM')
+})
+it('keeps both periods across noon, midnight, different days or reversed times', () => {
+ expect(eventTimeRange(at(11), at(13), 'en-US')).toBe('11:00 AM – 1:00 PM')
+ expect(eventTimeRange(at(23), at(1, 0, 17), 'en-US')).toBe('11:00 PM – 1:00 AM')
+ expect(eventTimeRange(at(10), at(10, 30, 17), 'en-US')).toBe('10:00 AM – 10:30 AM')
+ expect(eventTimeRange(at(10, 30), at(10), 'en-US')).toBe('10:30 AM – 10:00 AM')
+})
+it('keeps 24-hour locale formatting and handles missing or equal end times', () => {
+ expect(eventTimeRange(at(10), at(10, 30), 'en-GB')).toBe('10:00 – 10:30')
+ expect(eventTimeRange(at(10), null, 'en-US')).toBe('10:00 AM')
+ expect(eventTimeRange(at(10), undefined, 'en-US')).toBe('10:00 AM')
+ expect(eventTimeRange(at(10), at(10), 'en-US')).toBe('10:00 AM')
+})
+it('uses native placement and numerals in all supported locales, including leading periods', () => {
+ for (const { id } of LOCALES) {
+ const format = new Intl.DateTimeFormat(id, { hour: 'numeric', minute: '2-digit' })
+ const hasPeriod = format.formatToParts(at(10)).some(p => p.type === 'dayPeriod')
+ expect(eventTimeRange(at(10), at(10, 30), id)).toBe(hasPeriod ? format.formatRange(at(10), at(10, 30)) : `${format.format(at(10))} – ${format.format(at(10, 30))}`)
+ }
+ const leading = new Intl.DateTimeFormat('ko', { hour: 'numeric', minute: '2-digit' }).formatToParts(at(10)).find(p => p.type === 'dayPeriod')!.value
+ expect(eventTimeRange(at(10), at(10, 30), 'ko').startsWith(leading)).toBe(true)
+})
diff --git a/app/test/i18n-tables.test.ts b/app/test/i18n-tables.test.ts
index 3b4a5893..68bd9d9b 100644
--- a/app/test/i18n-tables.test.ts
+++ b/app/test/i18n-tables.test.ts
@@ -287,3 +287,12 @@ it('translates the summary language setting in every locale', () => {
}
}
})
+
+it('translates the ungrouped people heading in every locale', () => {
+ expect(keys).toContain('Other people')
+ for (const { id } of LOCALES) {
+ expect(load(id)['Other people']).toBeTypeOf('string')
+ expect(load(id)['Other people']).not.toBe('')
+ if (id !== 'en') expect(load(id)['Other people']).not.toBe('Other people')
+ }
+})
diff --git a/app/test/joinWindow.test.ts b/app/test/joinWindow.test.ts
new file mode 100644
index 00000000..3029e872
--- /dev/null
+++ b/app/test/joinWindow.test.ts
@@ -0,0 +1,20 @@
+import { expect, it } from 'vitest'
+import { canJoinEvent } from '../src/shared/comingUp'
+
+const start = 2_000_000, end = start + 30 * 60_000
+it('hides Join before the ten-minute window', () => {
+ expect(canJoinEvent(start, end, start - 600_001)).toBe(false)
+ expect(canJoinEvent(start, end, start - 86_400_000)).toBe(false)
+})
+it('shows Join from exactly ten minutes before the start until just before the end', () => {
+ for (const now of [start - 600_000, start - 1, start, end - 1]) expect(canJoinEvent(start, end, now)).toBe(true)
+})
+it('hides Join at the end and afterward, including old meetings', () => {
+ expect(canJoinEvent(start, end, end)).toBe(false)
+ expect(canJoinEvent(start, end, end + 1)).toBe(false)
+ expect(canJoinEvent(start, end, end + 7 * 86_400_000)).toBe(false)
+})
+it('does not infer an active window when the event end is missing', () => {
+ expect(canJoinEvent(start, null, start)).toBe(false)
+ expect(canJoinEvent(start, undefined, start)).toBe(false)
+})
diff --git a/app/test/noteCalendar.test.ts b/app/test/noteCalendar.test.ts
new file mode 100644
index 00000000..26c520b0
--- /dev/null
+++ b/app/test/noteCalendar.test.ts
@@ -0,0 +1,117 @@
+import { afterEach, beforeEach, expect, it, vi } from 'vitest'
+import type { Meeting } from '../src/shared/types'
+
+const h = vi.hoisted(() => ({ current: null as any }))
+vi.mock('react', async original => ({ ...await original<typeof import('react')>(),
+ useState: (initial: any) => {
+ const ctx = h.current, index = ctx.index++
+ if (!(index in ctx.values)) ctx.values[index] = typeof initial === 'function' ? initial() : initial
+ return [ctx.values[index], (next: any) => { ctx.values[index] = typeof next === 'function' ? next(ctx.values[index]) : next }]
+ },
+ useCallback: (callback: any) => { const ctx = h.current, index = ctx.index++; return ctx.values[index] ??= callback },
+ useEffect: (run: () => unknown, deps: unknown[]) => { const ctx = h.current; ctx.pending.push({ index: ctx.index++, run, deps }) },
+}))
+const cleanups = new Set<() => void>()
+function renderer(hook: typeof import('../src/renderer/src/useNoteCalendar').useNoteCalendar) {
+ const ctx = { index: 0, values: [] as any[], pending: [] as any[], effects: new Map<number, any>() }
+ const unmount = () => { for (const effect of ctx.effects.values()) effect.cleanup?.(); ctx.effects.clear() }
+ cleanups.add(unmount)
+ return { unmount, render: (m: Meeting) => {
+ h.current = ctx; ctx.index = 0; ctx.pending = []
+ const result = hook(m)
+ for (const effect of ctx.pending) {
+ const old = ctx.effects.get(effect.index)
+ if (!old || effect.deps.some((value: unknown, i: number) => !Object.is(value, old.deps[i]))) {
+ old?.cleanup?.()
+ ctx.effects.set(effect.index, { deps: effect.deps, cleanup: effect.run() })
+ }
+ }
+ return result
+ } }
+}
+const at = +new Date(2026, 10, 16, 10)
+const meeting = { id: 'note', eventId: 'event', startedAt: at } as Meeting
+const event = { id: 'event', title: 'Review', start: at, end: at + 1_800_000, attendees: [], url: 'https://call.example/meeting', calendar: { id: 'work', name: 'Work' } }
+const dayValue = { status: 'granted', events: [event] }
+const listValue = { status: 'granted', calendars: [{ id: 'work', color: '#438879' }, { id: 'invalid', color: 'invalid' }] }
+const flush = async () => { for (let i = 0; i < 8; i++) await Promise.resolve() }
+function deferred() { let resolve!: (value: any) => void; const promise = new Promise<any>(done => { resolve = done }); return { promise, resolve } }
+function setup(day = vi.fn().mockResolvedValue(dayValue), list = vi.fn().mockResolvedValue(listValue)) {
+ const changes = new Set<() => void>(), focus = new Set<() => void>()
+ vi.stubGlobal('window', { yogurt: { capabilities: { calendar: true }, calendar: { day, list, onChange: (fn: () => void) => { changes.add(fn); return () => changes.delete(fn) } } }, addEventListener: (_event: string, fn: () => void) => focus.add(fn), removeEventListener: (_event: string, fn: () => void) => focus.delete(fn) })
+ return { day, list, change: () => [...changes].forEach(fn => fn()), focus: () => [...focus].forEach(fn => fn()) }
+}
+beforeEach(() => vi.resetModules())
+afterEach(() => { cleanups.forEach(fn => fn()); cleanups.clear(); vi.unstubAllGlobals() })
+it('prefetches a complete linked event and color together before the popover is opened', async () => {
+ const day = deferred(), list = deferred()
+ const api = setup(vi.fn(() => day.promise), vi.fn(() => list.promise))
+ const { useNoteCalendar } = await import('../src/renderer/src/useNoteCalendar')
+ const note = renderer(useNoteCalendar)
+ expect(note.render(meeting).details).toBeUndefined()
+ expect(api.day).toHaveBeenCalledWith(at)
+ expect(api.list).toHaveBeenCalledOnce()
+ day.resolve(dayValue); await flush()
+ expect(note.render(meeting).details).toBeUndefined()
+ list.resolve(listValue); await flush()
+ expect(note.render(meeting).details).toMatchObject({ result: dayValue, colors: { work: '#438879' } })
+ expect(note.render(meeting).details!.colors).not.toHaveProperty('invalid')
+ expect(api.day).toHaveBeenCalledOnce()
+})
+it('shares pending and completed calendar lists across notes and invalidates on calendar changes and focus', async () => {
+ const api = setup()
+ const { useNoteCalendar } = await import('../src/renderer/src/useNoteCalendar')
+ const first = renderer(useNoteCalendar), second = renderer(useNoteCalendar)
+ first.render(meeting); second.render({ ...meeting, id: 'other' }); await flush()
+ expect(api.list).toHaveBeenCalledOnce()
+ first.unmount(); second.unmount()
+ const next = renderer(useNoteCalendar)
+ next.render(meeting); await flush()
+ expect(api.list).toHaveBeenCalledOnce()
+ api.change(); next.render(meeting); await flush()
+ expect(api.list).toHaveBeenCalledTimes(2)
+ api.focus(); next.render(meeting); await flush()
+ expect(api.list).toHaveBeenCalledTimes(3)
+})
+it('ignores old note reads and makes no requests for unlinked notes or unsupported computers', async () => {
+ const old = deferred()
+ const api = setup(vi.fn().mockReturnValueOnce(old.promise).mockResolvedValue(dayValue))
+ const { useNoteCalendar } = await import('../src/renderer/src/useNoteCalendar')
+ const note = renderer(useNoteCalendar)
+ note.render({ ...meeting, eventId: null })
+ expect(api.day).not.toHaveBeenCalled(); expect(api.list).not.toHaveBeenCalled()
+ note.render(meeting)
+ const next = { ...meeting, id: 'next', eventId: 'next-event' }
+ note.render(next); await flush()
+ const current = note.render(next).details
+ old.resolve({ status: 'denied', events: [] }); await flush()
+ expect(note.render(next).details).toBe(current)
+ expect(note.render(meeting).details).toBeUndefined()
+ window.yogurt.capabilities.calendar = false
+ const calls = api.day.mock.calls.length
+ expect(note.render(next).details).toBeUndefined()
+ expect(api.day).toHaveBeenCalledTimes(calls)
+})
+it('keeps call details when the calendar list fails, and retries failures without caching them', async () => {
+ const api = setup(vi.fn().mockResolvedValue(dayValue), vi.fn().mockRejectedValueOnce(new Error('Unavailable')).mockResolvedValue(listValue))
+ const { useNoteCalendar } = await import('../src/renderer/src/useNoteCalendar')
+ const note = renderer(useNoteCalendar)
+ note.render(meeting); await flush()
+ expect(note.render(meeting).details).toMatchObject({ result: dayValue, colors: {} })
+ note.render(meeting).refresh(); note.render(meeting); await flush()
+ expect(note.render(meeting).details!.colors.work).toBe('#438879')
+ expect(api.list).toHaveBeenCalledTimes(2)
+})
+it('reports event-read failures and retains settled details while refreshing', async () => {
+ const next = deferred()
+ const api = setup(vi.fn().mockResolvedValueOnce(dayValue).mockReturnValueOnce(next.promise).mockRejectedValue(new Error('Unavailable')))
+ const { useNoteCalendar } = await import('../src/renderer/src/useNoteCalendar')
+ const note = renderer(useNoteCalendar)
+ note.render(meeting); await flush()
+ const ready = note.render(meeting)
+ ready.refresh()
+ expect(note.render(meeting).details).toBe(ready.details)
+ next.resolve(dayValue); await flush()
+ api.focus(); note.render(meeting); await flush()
+ expect(note.render(meeting).details!.result).toEqual({ status: 'error', events: [] })
+})
diff --git a/app/test/noteDateCard.test.ts b/app/test/noteDateCard.test.ts
index cd71b8ef..6425d10d 100644
--- a/app/test/noteDateCard.test.ts
+++ b/app/test/noteDateCard.test.ts
@@ -1,13 +1,14 @@
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
-import { timeOf } from '../src/renderer/src/dates'
+import { eventTimeRange } from '../src/shared/dates'
import { NoteDate } from '../src/renderer/src/components/NoteDate'
import type { CalEvent, CalendarStatus, Meeting } from '../src/shared/types'
import { LOCALES, setLanguage, t } from '../src/shared/i18n'
// SSR supplies settled hook states; interactions and async reads are covered by the CI spec.
-const state = vi.hoisted(() => ({ values: [] as unknown[], index: 0, keyboard: false, focusEffect: undefined as undefined | { run: () => void; previous: { current: unknown } } }))
+const state = vi.hoisted(() => ({ values: [] as unknown[], index: 0, keyboard: false, details: undefined as any, focusEffect: undefined as undefined | { run: () => void; previous: { current: unknown } } }))
+vi.mock('../src/renderer/src/useNoteCalendar', () => ({ useNoteCalendar: () => ({ details: state.details, refresh: vi.fn() }) }))
vi.mock('react', async importOriginal => {
const react = await importOriginal<typeof import('react')>()
return { ...react,
@@ -24,10 +25,12 @@ beforeEach(() => { vi.useFakeTimers(); vi.setSystemTime(new Date(2026, 10, 13))
afterEach(() => { vi.useRealTimers(); vi.unstubAllGlobals(); setLanguage('en') })
const at = +new Date(2026, 10, 10, 12, 24)
const meeting = { id: 'note', title: 'Planning', startedAt: at, durationMs: 420_000, eventId: null, attendees: [], state: 'done' } as unknown as Meeting
-function render(status?: CalendarStatus, { picking = false, linked = false, calendar = true, day = at, linking = false, loading = false, compact = false, keyboard = false, snapshot = {} as Partial<Meeting>, event = null as CalEvent | null, events = [] as CalEvent[] } = {}) {
+function render(status?: CalendarStatus, { picking = false, linked = false, calendar = true, day = at, linking = false, loading = false, compact = false, keyboard = false, snapshot = {} as Partial<Meeting>, event = null as CalEvent | null, events = [] as CalEvent[], colors = {} as Record<string, string> } = {}) {
vi.stubGlobal('window', { yogurt: { capabilities: { calendar } }, matchMedia: () => ({ matches: false }) })
state.index = 0; state.keyboard = keyboard; state.focusEffect = undefined
- state.values = ['keyboard', { value: 'keyboard', pointer: false }, 0, picking, day, status ? { status, events: event ? [event, ...events.filter(e => e.id !== event.id)] : events } : undefined, linking, compact, false, loading ? 'skeleton' : 'waiting', linked ? 'event' : null]
+ const result = status ? { status, events: event ? [event, ...events.filter(e => e.id !== event.id)] : events } : undefined
+ state.details = linked && result ? { result, colors } : undefined
+ state.values = ['keyboard', { value: 'keyboard', pointer: false }, 0, picking, day, status ? { status, events: event ? [event, ...events.filter(e => e.id !== event.id)] : events } : undefined, linking, compact, false, loading ? 'skeleton' : 'waiting', linked ? 'event' : null, Date.now()]
return renderToStaticMarkup(createElement(NoteDate, { m: { ...meeting, ...snapshot, eventId: linked ? 'event' : null } }))
}
@@ -48,11 +51,13 @@ it.each([
expect(html).not.toContain('class="underline"')
}
})
-it('keeps empty-day navigation in the same header before and during browsing', () => {
+it('shows empty-day choices and navigation immediately', () => {
const html = render('granted')
- expect(html).toContain('7 min')
+ expect(html).not.toContain('7 min')
expect(html).toContain('No events')
- expect(html).toContain('Link to a calendar event')
+ expect(html).not.toContain('Link to a calendar event')
+ expect(html).not.toContain('note-date-events-toggle')
+ expect(html).toContain('data-testid="note-date-events"')
expect(html).not.toContain('note-date-days')
expect(html).toContain('note-date-next')
const picker = render('granted', { picking: true })
@@ -62,7 +67,7 @@ it('keeps empty-day navigation in the same header before and during browsing', (
})
it('keeps the unlinked picker ordered and separate from unlinking', () => {
const events = [20, 1].map(n => ({ id: String(n), title: `Event ${n}`, start: at + n * 60_000, end: at + (n + 30) * 60_000, attendees: [], url: null }))
- const html = render('granted', { picking: true, events })
+ const html = render('granted', { events })
expect(html).toContain('data-event-id="1"')
expect(html.indexOf('data-event-id="1"')).toBeLessThan(html.indexOf('data-event-id="20"'))
expect(html).not.toContain('note-date-unlink')
@@ -84,7 +89,7 @@ it('uses existing short translations for every recovery and empty state in all 3
expect(LOCALES).toHaveLength(32)
for (const { id } of LOCALES) {
setLanguage(id)
- for (const key of ['Calendar access is off', "Yogurt couldn't read your calendar", 'Connect calendar', 'Open System Settings', 'Try again', 'No events', 'Link event', 'Previous day', 'Next day']) {
+ for (const key of ['Calendar access is off', "Yogurt couldn't read your calendar", 'Connect calendar', 'Open System Settings', 'Try again', 'No events', 'Previous day', 'Next day']) {
expect(t(key)).toBeTruthy()
expect(t(key)).not.toMatch(/[::—\n]/)
if (id !== 'en') expect(t(key)).not.toBe(key)
@@ -94,23 +99,23 @@ it('uses existing short translations for every recovery and empty state in all 3
it('shows the selected date once with day buttons and no close button', () => {
const day = +new Date(2026, 10, 11, 12, 24)
- for (const linked of [false, true]) {
- const html = render('granted', { picking: true, linked, day })
- const header = html.match(/<div class="agenda-inspector-heading">[\s\S]*?<\/h3>[\s\S]*?<\/div><\/div>/)?.[0] ?? ''
- expect(header).toContain('Wednesday, Nov 11')
- expect(header).toContain('aria-live="polite"')
- expect(header).toContain('note-date-previous')
- expect(header.indexOf('note-date-previous')).toBeLessThan(header.indexOf('note-date-next'))
- expect(html).not.toContain('note-date-close')
- expect(html).not.toContain('aria-label="Close"')
- expect(html.match(/>Wednesday, Nov 11<\/h3>/g)).toHaveLength(1)
- expect(html).not.toContain('Tuesday, Nov 10')
- expect(html).not.toContain('note-date-days')
- }
+ const html = render('granted', { picking: true, day })
+ const header = html.match(/<div class="agenda-inspector-heading">[\s\S]*?<\/h3>[\s\S]*?<\/div><\/div>/)?.[0] ?? ''
+ expect(header).toContain('Wednesday, Nov 11')
+ expect(header).toContain('aria-live="polite"')
+ expect(header).toContain('note-date-previous')
+ expect(header.indexOf('note-date-previous')).toBeLessThan(header.indexOf('note-date-next'))
+ expect(html).not.toContain('note-date-close')
+ expect(html).not.toContain('aria-label="Close"')
+ expect(html.match(/>Wednesday, Nov 11<\/h3>/g)).toHaveLength(1)
+ expect(html).not.toContain('Tuesday, Nov 10')
+ expect(html).not.toContain('note-date-days')
})
-it('keeps the meeting date as the linked detail heading and locks navigation while linking', () => {
+it('keeps the date on the chip when linked and locks unlinked navigation while linking', () => {
const html = render('granted', { linked: true })
- expect(html.match(/>Tuesday, Nov 10<\/h3>/g)).toHaveLength(1)
+ expect(html).not.toContain('note-date-heading')
+ expect(html).not.toContain('note-date-next')
+ expect(html).not.toContain('note-date-previous')
expect(html).toContain('note-date-events-toggle')
const busy = render('granted', { picking: true, linking: true })
for (const direction of ['previous', 'next']) expect(busy).toMatch(new RegExp(`data-testid="note-date-${direction}"[^>]*disabled=""`))
@@ -120,11 +125,12 @@ it('places the linked actions directly under the title before details and access
const event = { id: 'event', title: 'Planning', start: at, end: at + 1_800_000, attendees: [], url: null }
for (const status of ['granted', 'denied'] as const) {
const html = render(status, { linked: true, picking: true, events: [event, { ...event, id: 'alias', aliases: ['event'] }], event: status === 'granted' ? event : null })
- expect(html.match(/Planning/g)).toHaveLength(1)
+ expect(html.match(/>Planning<\/strong>/g)).toHaveLength(1)
expect(html).not.toContain('data-event-id="event"')
expect(html).not.toContain('data-event-id="alias"')
expect(html.indexOf('note-date-events-toggle')).toBeLessThan(html.indexOf('note-date-unlink'))
- expect(html.indexOf('note-date-unlink')).toBeLessThan(html.indexOf('note-date-details'))
+ expect(html).not.toContain('note-date-details')
+ expect(html.indexOf('note-date-time')).toBeLessThan(html.indexOf('note-date-unlink'))
if (status === 'denied') expect(html.indexOf('note-date-unlink')).toBeLessThan(html.indexOf('Open System Settings'))
}
})
@@ -161,21 +167,20 @@ it('shows only Unlink and its description for linked notes, regardless of calend
}
}
const unlinked = render('granted', { events: [event] })
- expect(unlinked).toContain('Link event')
- expect(unlinked).not.toContain('data-testid="note-date-events"')
+ expect(unlinked).not.toContain('Link event')
+ expect(unlinked).toContain('data-testid="note-date-events"')
+ expect(unlinked).toContain('Design review')
const choosing = render('granted', { picking: true, events: [event] })
expect(choosing).toContain('Design review')
expect(choosing).not.toContain('note-date-unlink')
})
-it('keeps A details visible while the attached picker stays mounted and becomes inert when closed', () => {
+it('keeps the event block visible while the attached picker stays mounted and becomes inert when closed', () => {
for (const picking of [false, true]) {
const html = render('granted', { linked: true, picking })
const picker = html.match(/class="accordion note-date-motion note-date-picker-motion"[^>]*>/)?.[0]
- const details = html.match(/class="accordion note-date-motion note-date-details-motion"[^>]*>/)?.[0]
expect(picker).toContain(`data-open="${picking}"`)
- expect(details).toContain('data-open="true"')
- expect(details).not.toContain('inert=')
- expect(details).not.toContain('aria-hidden="true"')
+ expect(html).toContain('class="note-date-identity"')
+ expect(html).not.toContain('note-date-details-motion')
expect(picker).toContain(`aria-hidden="${!picking}"`)
if (picking) expect(picker).not.toContain('inert=')
else expect(picker).toContain('inert=""')
@@ -191,9 +196,9 @@ it('keeps the linked title, time range and calendar when access is off, using th
const html = render(status, { linked: true, snapshot, event: status === 'granted' ? event : null })
expect(html).toContain('Calendar title')
expect(html).not.toContain('My renamed note')
- expect(html).toContain(`${timeOf(event.start)} – ${timeOf(event.end)}`)
+ expect(html).toContain(eventTimeRange(event.start, event.end))
expect(html).toContain('Work')
- expect(html).toContain('Team calendar')
+ expect(html).not.toContain('Team calendar')
expect(html).not.toContain('7 min')
if (status === 'denied') {
expect(html).toContain('Calendar access is off')
@@ -216,3 +221,46 @@ it.each([false, true])('only moves picker focus for keyboard activation, keyboar
expect(focus).toHaveBeenCalledTimes(keyboard && picking ? 1 : 0)
}
})
+
+it('joins calendar color by id without a grey fallback and keeps the active call link', () => {
+ vi.setSystemTime(at)
+ const event = { id: 'event', title: 'Planning', start: at, end: at + 1_800_000, attendees: [], url: 'https://call.example/meeting', calendar: { id: 'work', name: 'Work', source: 'Account' } }
+ const html = render('granted', { linked: true, event, colors: { work: '#438879', other: '#112233' } })
+ expect(html).toContain('background-color:#438879')
+ expect(html).toContain('href="https://call.example/meeting"')
+ expect(html).toContain('Join meeting')
+ expect(html).toContain('class="note-date-actions" aria-busy="false"')
+ expect(html).not.toContain('loading-placeholder')
+ expect(html).not.toContain('Open calendar')
+ const missing = render('granted', { linked: true, event, colors: { other: '#112233' } })
+ expect(missing).toContain('class="note-date-color note-date-reveal" data-ready="false"')
+ expect(missing).not.toContain('background-color:var(--muted)')
+})
+
+it('reserves linked loading space immediately without a skeleton or a grey mark', () => {
+ vi.setSystemTime(at)
+ const snapshot = { eventStartedAt: at, eventEndedAt: at + 1_800_000 }
+ const waiting = render(undefined, { linked: true, snapshot })
+ const slow = render(undefined, { linked: true, loading: true, snapshot })
+ for (const html of [waiting, slow]) {
+ expect(html).toContain('class="note-date-actions" aria-busy="true"')
+ expect(html).toContain('class="note-date-calendar note-date-reveal" data-ready="false"')
+ expect(html).toContain('class="note-date-color note-date-reveal" data-ready="false"')
+ expect(html).not.toContain('background-color:var(--muted)')
+ expect(html).not.toContain('loading-placeholder')
+ expect(html).not.toContain('loading-bar')
+ expect(html).not.toContain('href=')
+ }
+})
+
+it.each([[-600_001, false], [-600_000, true], [0, true], [1_799_999, true], [1_800_000, false], [7 * 86_400_000, false]])('only shows the Join row during the event window at offset %s', (offset, visible) => {
+ vi.setSystemTime(at + Number(offset))
+ const event = { id: 'event', title: 'Planning', start: at, end: at + 1_800_000, attendees: [], url: 'https://call.example/meeting' }
+ const html = render('granted', { linked: true, event })
+ expect(html.includes('Join meeting')).toBe(visible)
+ expect(html.includes('class="note-date-actions"')).toBe(visible)
+ if (!visible) {
+ const pending = render(undefined, { linked: true, snapshot: { eventStartedAt: at, eventEndedAt: event.end } })
+ expect(pending).not.toContain('class="note-date-actions"')
+ }
+})
diff --git a/app/test/noteDateRead.test.ts b/app/test/noteDateRead.test.ts
index 4b6108ad..6e07ba3a 100644
--- a/app/test/noteDateRead.test.ts
+++ b/app/test/noteDateRead.test.ts
@@ -3,7 +3,8 @@ import { NoteDate } from '../src/renderer/src/components/NoteDate'
import type { Meeting } from '../src/shared/types'
// Exercise this component's hooks and effects without mounting a browser or its child components.
-const h = vi.hoisted(() => ({ values: [] as any[], index: 0, dirty: false, pending: [] as any[], effects: new Map<number, any>() }))
+const h = vi.hoisted(() => ({ values: [] as any[], index: 0, dirty: false, pending: [] as any[], effects: new Map<number, any>(), details: undefined as any }))
+vi.mock('../src/renderer/src/useNoteCalendar', () => ({ useNoteCalendar: () => ({ details: h.details, refresh: vi.fn() }) }))
vi.mock('react', async original => {
const react = await original<typeof import('react')>()
const effect = (run: () => unknown, deps?: unknown[]) => {
@@ -37,8 +38,10 @@ const byId = (tree: any, id: string) => find(tree, node => node.props?.['data-te
const picker = (tree: any) => find(tree, node => node.type?.name === 'EventPicker')
function setup(day: ReturnType<typeof vi.fn>, onClose = vi.fn()) {
vi.useFakeTimers()
+ vi.setSystemTime(at)
vi.stubGlobal('requestAnimationFrame', vi.fn())
vi.stubGlobal('window', { yogurt: { capabilities: { calendar: true }, calendar: { day, onChange: () => () => {} } }, matchMedia: () => ({ matches: false, addEventListener() {}, removeEventListener() {} }), addEventListener() {}, removeEventListener() {} })
+ h.details = undefined
h.values = ['pointer']; h.index = 0
const first = NoteDate({ m: linked }) as any
const cardElement = first.props.children[1]
@@ -47,7 +50,7 @@ function setup(day: ReturnType<typeof vi.fn>, onClose = vi.fn()) {
h.values = []; h.effects.clear()
return (m: Meeting) => {
let tree: any
- do { h.dirty = false; h.index = 0; h.pending = []; tree = cardElement.type({ ...cardElement.props, m, chip: { current: null }, onClose }) } while (h.dirty)
+ do { h.dirty = false; h.index = 0; h.pending = []; tree = cardElement.type({ ...cardElement.props, m, details: m.eventId ? h.details : undefined, chip: { current: null }, onClose }) } while (h.dirty)
for (const effect of h.pending) {
const old = h.effects.get(effect.index)
if (!old || !effect.deps || effect.deps.some((dep: unknown, i: number) => !Object.is(dep, old.deps?.[i]))) {
@@ -59,21 +62,18 @@ function setup(day: ReturnType<typeof vi.fn>, onClose = vi.fn()) {
}
}
afterEach(() => { for (const effect of h.effects.values()) effect.cleanup?.(); h.effects.clear(); vi.useRealTimers(); vi.unstubAllGlobals() })
-it('keeps the card and cached results through unlink, Link event and selecting the event again', async () => {
+it('keeps the card and cached results through unlink and selecting the event again without an extra step', async () => {
const value = { status: 'granted', events: [event] }
const day = vi.fn().mockResolvedValue(value)
const render = setup(day)
- render(linked)
- await Promise.resolve(); await Promise.resolve()
+ h.details = { result: value, colors: {} }
let tree = render(linked)
byId(tree, 'note-date-events-toggle').props.onClick({ detail: 1 })
tree = render(linked)
picker(tree).props.onLinked()
expect(byId(render(linked), 'note-date-events-toggle').props['aria-expanded']).toBe(true)
tree = render(unlinked)
- expect(byId(tree, 'note-date-events-toggle').props['aria-expanded']).toBe(false)
- byId(tree, 'note-date-events-toggle').props.onClick({ detail: 1 })
- tree = render(unlinked)
+ expect(byId(tree, 'note-date-events-toggle')).toBeUndefined()
expect(picker(tree).props.result).toBe(value)
picker(tree).props.onLinked()
expect(picker(render(unlinked))).toBeDefined()
@@ -86,19 +86,19 @@ it('keeps the card and cached results through unlink, Link event and selecting t
it.each([50, 99])('never inserts a loading placeholder for a %s ms read', async delay => {
const day = vi.fn(() => new Promise(resolve => setTimeout(() => resolve({ status: 'granted', events: [event] }), delay)))
const render = setup(day)
- expect(find(render(unlinked), node => node.props?.className === 'loading-content')).toBeUndefined()
+ expect(picker(render(unlinked)).props.loading).toBeNull()
await vi.advanceTimersByTimeAsync(delay)
- expect(find(render(unlinked), node => node.props?.className === 'loading-content')).toBeUndefined()
+ expect(picker(render(unlinked)).props.loading).toBeNull()
await vi.advanceTimersByTimeAsync(200)
- expect(find(render(unlinked), node => node.props?.className === 'loading-content')).toBeUndefined()
+ expect(picker(render(unlinked)).props.loading).toBeNull()
})
it('shows the delayed skeleton for a read that remains pending', async () => {
const render = setup(vi.fn(() => new Promise(() => {})))
render(unlinked)
await vi.advanceTimersByTimeAsync(99)
- expect(find(render(unlinked), node => node.props?.className === 'loading-content')).toBeUndefined()
+ expect(picker(render(unlinked)).props.loading).toBeNull()
await vi.advanceTimersByTimeAsync(1)
- expect(find(render(unlinked), node => node.props?.className === 'loading-content')?.props['data-loading-phase']).toBe('skeleton')
+ expect(picker(render(unlinked)).props.loading?.props['data-loading-phase']).toBe('skeleton')
})
it('does not expose the previous ready phase as a loading flash when navigating to an uncached day', async () => {
const day = vi.fn().mockResolvedValueOnce({ status: 'granted', events: [event] }).mockImplementation(() => new Promise(() => {}))
@@ -132,3 +132,91 @@ it('dismisses on Escape and restores the date chip for outside dismissal', () =>
expect(h.values[0]).toBe(false)
expect(focus).toHaveBeenCalledWith({ preventScroll: true })
})
+
+it('toggles the linked actions and collapses them on Escape before dismissing the popover', () => {
+ const close = vi.fn()
+ const render = setup(vi.fn(() => new Promise(() => {})), close)
+ let tree = render(linked)
+ const focus = vi.fn()
+ byId(tree, 'note-date-events-toggle').props.ref.current = { focus }
+ byId(tree, 'note-date-events-toggle').props.onClick({ detail: 0 })
+ tree = render(linked)
+ expect(picker(tree).props.open).toBe(true)
+ expect(picker(tree).props.keyboard).toBe(true)
+ const escape = { key: 'Escape', preventDefault: vi.fn(), stopPropagation: vi.fn() }
+ tree.props.onKeyDown(escape)
+ tree = render(linked)
+ expect(picker(tree).props.open).toBe(false)
+ expect(focus).toHaveBeenCalledWith({ preventScroll: true })
+ expect(close).not.toHaveBeenCalled()
+ byId(tree, 'note-date-events-toggle').props.onClick({ detail: 1 })
+ tree = render(linked)
+ byId(tree, 'note-date-events-toggle').props.onClick({ detail: 1 })
+ tree = render(linked)
+ expect(picker(tree).props.open).toBe(false)
+ tree.props.onKeyDown(escape)
+ expect(close).toHaveBeenCalledOnce()
+})
+
+it('fades late details into reserved space without changing the body view or refetching', () => {
+ const day = vi.fn()
+ const render = setup(day)
+ const pending = render(linked)
+ const body = (tree: any) => find(tree, node => node.type?.name === 'NoteDateBody')
+ expect(find(pending, node => node.props?.className === 'note-date-actions')).toBeDefined()
+ expect(find(pending, node => node.props?.className === 'note-date-color note-date-reveal').props['data-ready']).toBe(false)
+ h.details = { result: { status: 'granted', events: [{ ...event, url: 'https://call.example/meeting', calendar: { id: 'work', name: 'Work' } }] }, colors: { work: '#438879' } }
+ const ready = render(linked)
+ expect(body(ready).props.view).toBe(body(pending).props.view)
+ expect(find(ready, node => node.props?.className === 'note-date-actions')).toBeDefined()
+ expect(find(ready, node => node.props?.className === 'note-date-color note-date-reveal').props).toMatchObject({ 'data-ready': true, style: { backgroundColor: '#438879' } })
+ expect(find(ready, node => node.type === 'a').props.href).toBe('https://call.example/meeting')
+ expect(day).not.toHaveBeenCalled()
+})
+it('removes the action row when a slow event has no call link, keeping the calendar line stable', () => {
+ const render = setup(vi.fn())
+ render(linked)
+ h.details = { result: { status: 'granted', events: [event] }, colors: {} }
+ const tree = render(linked)
+ expect(find(tree, node => node.props?.className === 'note-date-actions')).toBeUndefined()
+ expect(find(tree, node => node.props?.className === 'note-date-calendar note-date-reveal')).toBeDefined()
+ expect(find(tree, node => node.type === 'a')).toBeUndefined()
+})
+
+it('updates the open date card at both join boundaries without reserving a hidden row', async () => {
+ const render = setup(vi.fn())
+ vi.setSystemTime(at - 600_001)
+ h.details = { result: { status: 'granted', events: [{ ...event, url: 'https://call.example/meeting' }] }, colors: {} }
+ const action = () => find(render(linked), node => node.props?.className === 'note-date-actions')
+ expect(action()).toBeUndefined()
+ await vi.advanceTimersByTimeAsync(1)
+ expect(action()).toBeDefined()
+ await vi.advanceTimersByTimeAsync(event.end - (at - 600_000))
+ expect(action()).toBeUndefined()
+})
+
+it('opens choices on the note day, browses another day and keeps empty days navigable', async () => {
+ const nextDay = at + 86_400_000
+ const other = { ...event, id: 'other', title: 'Review', start: nextDay, end: nextDay + 1_800_000 }
+ const day = vi.fn(async (date: number) => ({ status: 'granted', events: date === at ? [event] : date === nextDay ? [other] : [] }))
+ const render = setup(day)
+ render(unlinked)
+ await Promise.resolve(); await Promise.resolve()
+ let tree = render(unlinked)
+ expect(byId(tree, 'note-date-events-toggle')).toBeUndefined()
+ expect(picker(tree).props.result.events).toEqual([event])
+ byId(tree, 'note-date-next').props.onClick({ detail: 1 })
+ render(unlinked)
+ await Promise.resolve(); await Promise.resolve()
+ tree = render(unlinked)
+ expect(picker(tree).props.day).toBe(nextDay)
+ expect(picker(tree).props.result.events).toEqual([other])
+ expect(byId(tree, 'note-date-heading').props['aria-label']).toContain('Nov 11')
+ byId(tree, 'note-date-next').props.onClick({ detail: 1 })
+ render(unlinked)
+ await Promise.resolve(); await Promise.resolve()
+ tree = render(unlinked)
+ expect(picker(tree).props.result.events).toEqual([])
+ expect(byId(tree, 'note-date-previous')).toBeDefined()
+ expect(byId(tree, 'note-date-next')).toBeDefined()
+})
diff --git a/app/test/peopleCard.test.ts b/app/test/peopleCard.test.ts
new file mode 100644
index 00000000..cb31d8c6
--- /dev/null
+++ b/app/test/peopleCard.test.ts
@@ -0,0 +1,58 @@
+import { afterEach, expect, it, vi } from 'vitest'
+import { People } from '../src/renderer/src/components/People'
+import type { Meeting } from '../src/shared/types'
+
+// Exercise grouped row callbacks with original indices without a browser.
+const hooks = vi.hoisted(() => ({ values: [] as any[], index: 0 }))
+vi.mock('react', async original => ({ ...await original<typeof import('react')>(),
+ useState: (initial: any) => {
+ const index = hooks.index++
+ if (!(index in hooks.values)) hooks.values[index] = typeof initial === 'function' ? initial() : initial
+ return [hooks.values[index], (next: any) => { hooks.values[index] = typeof next === 'function' ? next(hooks.values[index]) : next }]
+ },
+ useRef: () => ({ current: null }), useId: () => 'people', useCallback: (fn: unknown) => fn, useEffect: () => {},
+}))
+vi.mock('../src/renderer/src/motion', () => ({ usePopoverPresence: () => ({ value: 'keyboard', props: {} }) }))
+vi.mock('../src/renderer/src/useNotePopover', () => ({ useNotePopover: () => {} }))
+function nodes(tree: any): any[] {
+ if (!tree || typeof tree !== 'object') return []
+ return [tree, ...[tree.props?.children].flat(Infinity).flatMap(nodes)]
+}
+const attendees = [{ name: 'Attendee One', email: '[email protected]' }, { name: 'Attendee Two', email: '[email protected]' }, { name: 'Self', email: '[email protected]' }]
+const meeting = { id: 'note', attendees, startedAt: 1 } as Meeting
+function setup() {
+ const renameAttendee = vi.fn().mockResolvedValue(true), setAttendees = vi.fn().mockResolvedValue(undefined)
+ vi.stubGlobal('window', { yogurt: { meetings: { renameAttendee, setAttendees } } })
+ hooks.values = [false, 'Self']; hooks.index = 0
+ const root = People({ m: meeting }) as any
+ const element = root.props.children[1]
+ hooks.values = []; hooks.index = 0
+ const close = vi.fn()
+ const render = () => { hooks.index = 0; return element.type({ ...element.props, onClose: close }) }
+ return { render, renameAttendee, setAttendees, close }
+}
+afterEach(() => vi.unstubAllGlobals())
+it('renames and removes the original attendee after company sorting, keeping self uneditable', async () => {
+ const { render, renameAttendee, setAttendees } = setup()
+ const rows = nodes(render()).filter(n => n.type?.name === 'Row')
+ expect(rows.map(r => r.props.name)).toEqual(['Attendee Two', 'Self', 'Attendee One'])
+ expect(rows[1].props.mine).toBe(true)
+ expect(rows[1].props.onRemove).toBeUndefined()
+ expect(rows[1].props.onRename).toBeUndefined()
+ await rows[0].props.onRename('Updated attendee')
+ expect(renameAttendee).toHaveBeenCalledWith('note', 1, 'Updated attendee', attendees[1])
+ rows[0].props.onRemove()
+ expect(setAttendees).toHaveBeenCalledWith('note', [attendees[0], attendees[2]])
+})
+it('retains keyboard entry for adding attendees and Escape dismissal', async () => {
+ const { render, setAttendees, close } = setup()
+ const byId = (id: string) => nodes(render()).find(n => n.props?.['data-testid'] === id)
+ byId('people-add-open').props.onClick()
+ byId('people-add').props.onChange({ target: { value: 'Additional attendee [email protected]' } })
+ byId('people-add').props.onKeyDown({ key: 'Enter', nativeEvent: { isComposing: false }, preventDefault: vi.fn() })
+ await Promise.resolve(); await Promise.resolve()
+ expect(setAttendees).toHaveBeenCalledWith('note', [...attendees, { name: 'Additional attendee', email: '[email protected]' }])
+ expect(byId('people-add').props.value).toBe('')
+ render().props.onKeyDown({ key: 'Escape', preventDefault: vi.fn(), stopPropagation: vi.fn() })
+ expect(close).toHaveBeenCalledOnce()
+})
diff --git a/app/test/peopleGroups.test.ts b/app/test/peopleGroups.test.ts
new file mode 100644
index 00000000..b3492afa
--- /dev/null
+++ b/app/test/peopleGroups.test.ts
@@ -0,0 +1,30 @@
+import { expect, it } from 'vitest'
+import { groupPeople, initials } from '../src/shared/people'
+
+const row = (email: string | null, i: number) => ({ p: { name: `Attendee ${i}`, email }, i })
+it('groups case-insensitive domains, sorts company labels and preserves original rows and indices', () => {
+ const rows = [row('[email protected]', 0), row(' [email protected] ', 1), row('[email protected]', 2), row('[email protected]', 3)]
+ const groups = groupPeople(rows)
+ expect(groups.map(g => g.label)).toEqual(['North Line', 'North Line', 'Zeta'])
+ expect(groups.map(g => g.domain)).toEqual(['north-line.example', 'north-line.test', 'zeta.example'])
+ expect(groups[0].people).toEqual([rows[1], rows[2]])
+ expect(groups[0].people[0]).toBe(rows[1])
+})
+it('keeps personal, missing and invalid email addresses in the last group', () => {
+ const emails = ['gmail.com', 'outlook.com', 'hotmail.com', 'icloud.com', 'yahoo.com', 'proton.me', 'protonmail.com', 'mail.example'].map(domain => `attendee@${domain}`)
+ const rows = [...emails, null, '', 'invalid', 'one@@example.com', 'one@example', 'one@two words.example'].map(row)
+ const groups = groupPeople([...rows, row('[email protected]', 99)])
+ expect(groups.map(g => g.domain)).toEqual(['work.example', ''])
+ expect(groups[1].people).toEqual(rows)
+ expect(groups[1].label).toBe('')
+ expect(groupPeople([])).toEqual([])
+})
+it('keeps self markers and derives initials from the first and last words', () => {
+ const mine = { ...row('[email protected]', -1), mine: true }
+ expect(groupPeople([mine])[0].people[0]).toBe(mine)
+ expect(initials(' Attendee Middle One ')).toBe('AO')
+ expect(initials('Attendee')).toBe('A')
+ expect(initials('')).toBe('')
+ expect(initials('参会 者')).toBe('参者')
+ expect(initials('𐐨 Test')).toBe('𐐀T')
+})