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.

Meetings: a deleted meeting's row folds away and Undo or Restore brings it back in place, in the list, folders and the Trash

Eric Brownrout228dc854bf02
diff --git a/app/e2e/trash.spec.ts b/app/e2e/trash.spec.ts
index fe7f8d2e..5804c3d9 100644
--- a/app/e2e/trash.spec.ts
+++ b/app/e2e/trash.spec.ts
@@ -30,6 +30,45 @@ const del = async (page: Page, title: string) => {
await expect(page.getByTestId('trash-toast')).toContainText('Moved to the Trash')
}
+for (const reducedMotion of ['no-preference', 'reduce'] as const) test(`a moving row keeps its click target (${reducedMotion})`, async () => {
+ const { app, page } = await launch()
+ try {
+ await page.emulateMedia({ reducedMotion })
+ await withMeetings(app, page)
+ await page.evaluate(() => {
+ const animate = Element.prototype.animate
+ Element.prototype.animate = function (frames, options) {
+ const animation = animate.call(this, frames, options)
+ if (this.matches('[data-row-id], .meeting-row-exit')) {
+ animation.pause()
+ animation.currentTime = Number(animation.effect!.getTiming().duration) / 2
+ }
+ return animation
+ }
+ })
+ await row(page, 'Budget review').hover()
+ await row(page, 'Budget review').getByTestId('past-note-more').click()
+ await page.getByTestId('past-note-trash').click()
+ await expect(page.getByTestId('past-note')).toHaveCount(3)
+ await expect(page.getByTestId('trash-undo')).toBeVisible()
+ const moving = page.locator('[data-row-id]').filter({ hasText: 'Weekly sync' })
+ if (reducedMotion === 'reduce') {
+ await expect(page.locator('.meeting-row-exit')).toHaveCount(0)
+ expect(await moving.evaluate(el => el.getAnimations().length)).toBe(0)
+ } else {
+ const copy = page.locator('.meeting-row-exit.native-meeting-row')
+ await expect(copy).toHaveCount(1)
+ await expect(copy).toHaveAttribute('inert', '')
+ await expect(copy).toHaveAttribute('aria-hidden', 'true')
+ await expect(copy.locator('[data-testid], [data-meeting-id], [id]')).toHaveCount(0)
+ expect(await moving.evaluate(el => el.getAnimations().length)).toBe(1)
+ }
+ const box = await moving.locator('.native-meeting-link').boundingBox()
+ await page.mouse.click(box!.x + 90, box!.y + box!.height / 2)
+ await expect(page.getByTestId('note-title')).toHaveText('Weekly sync')
+ } finally { await app.close() }
+})
+
test('meeting rows swap metadata for More without shifting content and share pointer and keyboard actions', async () => {
const { app, page } = await launch()
try {
diff --git a/app/src/renderer/src/components/DeleteNote.tsx b/app/src/renderer/src/components/DeleteNote.tsx
index 8fb4e9ab..da7174c4 100644
--- a/app/src/renderer/src/components/DeleteNote.tsx
+++ b/app/src/renderer/src/components/DeleteNote.tsx
@@ -1,3 +1,4 @@
+import { changeMeetingRows } from '../meetingRowMotion'
import { useState } from 'react'
import { t } from '../../../shared/i18n'
import { osWords } from '../keys'
@@ -14,7 +15,7 @@ export function DeleteNote({ id, title, onDone }: { id: string; title: string; o
const cancel = () => onDone(false)
const yes = async () => {
setBusy(true); setFailed(null)
- const r = await window.yogurt.meetings.delete(id).catch(() => 'failed' as const)
+ const r = await changeMeetingRows('delete', [id], () => window.yogurt.meetings.delete(id), result => result === 'deleted' || result === 'missing' ? [id] : []).catch(() => 'failed' as const)
setBusy(false)
if (r === 'deleted' || r === 'missing') onDone(true)
else setFailed(r)
diff --git a/app/src/renderer/src/components/MeetingRow.tsx b/app/src/renderer/src/components/MeetingRow.tsx
index 4b52cc7a..3d3ba214 100644
--- a/app/src/renderer/src/components/MeetingRow.tsx
+++ b/app/src/renderer/src/components/MeetingRow.tsx
@@ -57,7 +57,7 @@ export function MeetingRow({ id, recording, children, selected, targets, members
else if (e.key === 'Home' || e.key === 'End') { e.preventDefault(); items[e.key === 'Home' ? 0 : items.length - 1]?.focus() }
else if (e.key === 'Tab') close()
}
- return <li ref={row} className="native-meeting-row row-swap" data-menu-open={!!open} data-selected={selected}
+ return <li ref={row} data-row-id={id} className="native-meeting-row row-swap" data-menu-open={!!open} data-selected={selected}
onClickCapture={e => { if (row.current?.contains(e.target as Node) && (e.target as HTMLElement).closest('.native-meeting-link')) onClick(e) }}
onContextMenu={(e) => { if (!row.current?.contains(e.target as Node)) return; e.preventDefault(); show({ x: e.clientX, y: e.clientY }) }}
onKeyDown={(e) => {
diff --git a/app/src/renderer/src/components/TrashToast.tsx b/app/src/renderer/src/components/TrashToast.tsx
index 1c383d72..3808fd99 100644
--- a/app/src/renderer/src/components/TrashToast.tsx
+++ b/app/src/renderer/src/components/TrashToast.tsx
@@ -5,6 +5,7 @@ import { t } from '../../../shared/i18n'
import type { SetupState, UpdateStatus } from '../../../shared/types'
import { motion, useReducedMotion } from '../motion'
import { notesReadyNotice } from '../notesSetup'
+import { changeMeetingRows } from '../meetingRowMotion'
import { trashMeetings, restoreMeetings } from '../trashMeetings'
let toastHost: HTMLDivElement | undefined
@@ -39,7 +40,7 @@ export async function moveToTrash(id: string, from?: string): Promise<boolean> {
}
export async function moveMeetingsToTrash(ids: string[], from?: string, bulk = true): Promise<string[]> {
- const result = await trashMeetings(ids, id => window.yogurt.meetings.trash(id))
+ const result = await changeMeetingRows('trash', ids, () => trashMeetings(ids, id => window.yogurt.meetings.trash(id)), result => result.done)
const error = result.error === 'recording' ? t('Stop the recording first, then try again.')
: result.error === 'save-pending' ? t('Open this note and finish saving before deleting it.')
: result.error ? t("Yogurt couldn't move this note to the Trash. Try again.") : undefined
@@ -117,7 +118,7 @@ export function TrashToast({ go }: { go: (route: string) => void }) {
if (restoring) return
restoring = true
try {
- remaining = await restoreMeetings(remaining, id => window.yogurt.meetings.restore(id))
+ remaining = await changeMeetingRows('restore', remaining, () => restoreMeetings(remaining, id => window.yogurt.meetings.restore(id)), failed => remaining.filter(id => !failed.includes(id)))
if (remaining.length) { toasts.update(id, { title: t("Yogurt couldn't make that change. Try again."), timeout: 0 }); return }
toasts.close(id)
if (s.from) go(s.from)
diff --git a/app/src/renderer/src/meetingRowMotion.ts b/app/src/renderer/src/meetingRowMotion.ts
new file mode 100644
index 00000000..d294e843
--- /dev/null
+++ b/app/src/renderer/src/meetingRowMotion.ts
@@ -0,0 +1,126 @@
+import { useCallback, useLayoutEffect, useRef, type RefObject } from 'react'
+import type { MeetingCard } from '../../shared/types'
+import { motion, useReducedMotion } from './motion'
+
+type Change = { kind: 'trash' | 'restore' | 'delete'; ids: string[] }
+const listeners = new Set<(change: Change) => void>()
+const changing = new Set<Promise<unknown>>()
+let revision = 0
+
+/** Mark only explicit mutations; ordinary reloads, paging and folder changes stay still. */
+export async function changeMeetingRows<T>(kind: Change['kind'], ids: string[], change: () => Promise<T>, changed: (result: T) => string[] = () => ids): Promise<T> {
+ revision++
+ const result = Promise.resolve().then(change)
+ changing.add(result)
+ try {
+ const value = await result
+ const done = changed(value)
+ if (done.length) for (const listen of listeners) listen({ kind, ids: done })
+ return value
+ } finally { changing.delete(result) }
+}
+
+/** A bulk action gets one list update, including any rows that failed to change. */
+export async function readMeetingRows<T>(read: () => Promise<T>): Promise<T> {
+ for (;;) {
+ while (changing.size) await Promise.allSettled([...changing])
+ const before = revision, result = await read()
+ if (before === revision) return result
+ }
+}
+
+type Row = { top: number }
+type Snapshot = { scrollTop: number; rows: Map<string, Row>; removed: { element: HTMLElement; shift: number }[]; entering: Set<string> }
+const rowKey = (el: HTMLElement) => el.dataset.rowId ?? `heading:${el.dataset.rowHeading}`
+const rowsIn = (root: HTMLElement) => Array.from(root.querySelectorAll<HTMLElement>('[data-row-id], [data-row-heading]'))
+
+export function captureMeetingRows(root: HTMLElement, next: MeetingCard[], pending: Map<string, boolean>): Snapshot | undefined {
+ const elements = rowsIn(root), current = new Set(elements.map(rowKey)), incoming = new Set(next.map(c => c.id))
+ const removed = new Set<string>(), entering = new Set<string>()
+ for (const [id, present] of pending) {
+ if (present && !current.has(id) && incoming.has(id)) entering.add(id)
+ if (!present && current.has(id) && !incoming.has(id)) removed.add(id)
+ }
+ pending.clear()
+ if (!removed.size && !entering.size) return
+ const headings = new Set(next.map(c => new Date(c.startedAt).toDateString()))
+ const box = root.getBoundingClientRect(), rows = new Map<string, Row>(), copies: Snapshot['removed'] = []
+ let shift = 0
+ for (const el of elements) {
+ const rect = el.getBoundingClientRect()
+ rows.set(rowKey(el), { top: rect.top })
+ if (!removed.has(el.dataset.rowId!) && (!el.dataset.rowHeading || headings.has(el.dataset.rowHeading))) continue
+ const copy = el.cloneNode(true) as HTMLElement
+ // Exit copies are decoration, never a second focus target, drag source or test locator.
+ for (const node of [copy, ...copy.querySelectorAll<HTMLElement>('*')]) {
+ for (const attr of ['id', 'data-testid', 'data-meeting-id', 'data-row-id', 'data-row-heading']) node.removeAttribute(attr)
+ node.removeAttribute('draggable')
+ }
+ copy.inert = true
+ copy.setAttribute('aria-hidden', 'true')
+ copy.classList.add('meeting-row-exit')
+ if (el.dataset.rowHeading) copy.classList.add('meeting-day-exit')
+ Object.assign(copy.style, { position: 'absolute', margin: '0', pointerEvents: 'none', top: `${rect.top - box.top + root.scrollTop}px`, left: `${rect.left - box.left + root.scrollLeft}px`, width: `${rect.width}px`, height: `${rect.height}px` })
+ copies.push({ element: copy, shift })
+ shift -= rect.height
+ }
+ return { scrollTop: root.scrollTop, rows, removed: copies, entering }
+}
+
+export function playMeetingRows(root: HTMLElement, snapshot: Snapshot): () => void {
+ const animations: Animation[] = []
+ const duration = snapshot.entering.size ? motion.base : motion.micro
+ const animate = (el: HTMLElement, frames: Keyframe[]) => {
+ const animation = el.animate(frames, { duration, easing: motion.ease })
+ animations.push(animation)
+ return animation
+ }
+ for (const el of rowsIn(root)) {
+ const old = snapshot.rows.get(rowKey(el)), rect = el.getBoundingClientRect()
+ if (old) {
+ const y = old.top - rect.top
+ if (y) animate(el, [{ transform: `translateY(${y}px)` }, { transform: 'translateY(0)' }])
+ } else if (snapshot.entering.has(el.dataset.rowId!) || (el.dataset.rowHeading && snapshot.entering.size)) {
+ animate(el, [{ opacity: 0, clipPath: 'inset(0 0 100% 0)' }, { opacity: 1, clipPath: 'inset(0)' }])
+ }
+ }
+ for (const { element: copy, shift } of snapshot.removed) {
+ copy.style.top = `${parseFloat(copy.style.top) + root.scrollTop - snapshot.scrollTop}px`
+ root.append(copy)
+ const animation = animate(copy, [{ opacity: 1, clipPath: 'inset(0)', transform: 'translateY(0)' }, { opacity: 0, clipPath: 'inset(0 0 100% 0)', transform: `translateY(${shift}px)` }])
+ animation.onfinish = () => copy.remove()
+ }
+ return () => { for (const animation of animations) animation.cancel(); for (const { element } of snapshot.removed) element.remove() }
+}
+
+/** Capture before React removes rows; move the live controls so hit targets follow their visible positions. */
+export function useMeetingRowMotion(root: RefObject<HTMLElement | null>, scope: string) {
+ const reduced = useReducedMotion(), pending = useRef(new Map<string, boolean>())
+ const snapshot = useRef<Snapshot | undefined>(undefined), stop = useRef<(() => void) | undefined>(undefined)
+ useLayoutEffect(() => {
+ const listen = ({ kind, ids }: Change) => {
+ const present = scope === 'trash' ? kind === 'trash' : kind === 'restore'
+ for (const id of ids) pending.current.set(id, present)
+ }
+ listeners.add(listen)
+ return () => { listeners.delete(listen); pending.current.clear(); snapshot.current = undefined; stop.current?.() }
+ }, [scope])
+ useLayoutEffect(() => {
+ if (reduced) { stop.current?.(); snapshot.current = undefined; pending.current.clear() }
+ if (snapshot.current && root.current) {
+ stop.current = playMeetingRows(root.current, snapshot.current)
+ snapshot.current = undefined
+ }
+ })
+ return useCallback((cards: MeetingCard[]) => {
+ const captured = !reduced && root.current ? captureMeetingRows(root.current, cards, pending.current) : undefined
+ // Measure an interrupted transition before cancelling it, so the next one starts where it was visible.
+ if (!captured && !reduced && root.current) {
+ const current = rowsIn(root.current).filter(el => el.dataset.rowId).map(el => el.dataset.rowId)
+ if (current.length === cards.length && current.every((id, i) => id === cards[i].id)) return
+ }
+ stop.current?.(); stop.current = undefined
+ snapshot.current = captured
+ pending.current.clear()
+ }, [reduced, root])
+}
diff --git a/app/src/renderer/src/screens/Home.tsx b/app/src/renderer/src/screens/Home.tsx
index 9f85677e..205841f4 100644
--- a/app/src/renderer/src/screens/Home.tsx
+++ b/app/src/renderer/src/screens/Home.tsx
@@ -10,6 +10,7 @@ import { t } from '../../../shared/i18n'
import { dayLabel, timeOf, useDay } from '../dates'
import { useLanguage } from '../i18n'
import { moveMeetingsToTrash, toasts } from '../components/TrashToast'
+import { readMeetingRows, useMeetingRowMotion } from '../meetingRowMotion'
import { MeetingRow } from '../components/MeetingRow'
import { FolderChip } from '../components/FolderPicker'
import { Agenda } from '../components/Agenda'
@@ -62,6 +63,7 @@ export function usePastNotes(folder?: string) {
const [sentinel, setSentinel] = useState<HTMLDivElement | null>(null)
const memoryKey = folder ? `folder/${folder}` : 'meetings'
const scroll = useScrollMemory<HTMLDivElement>(memoryKey, !!cards)
+ const animateRows = useMeetingRowMotion(scroll, memoryKey)
const attachRoot = useCallback((el: HTMLDivElement | null) => { scroll.current = el; setRoot(el) }, [scroll])
const shown = useRef(loadedCounts.get(memoryKey) ?? 0)
const loading = useRef(false)
@@ -70,11 +72,12 @@ export function usePastNotes(folder?: string) {
const reload = useCallback(() => {
const mine = ++seq.current
// however far down the person scrolled, in steps (one call to main is capped)
- void loadUpTo((o) => window.yogurt.meetings.cards({ ...o, ...(folder ? { folder } : {}) }), shown.current, PAGE).then(({ cards: list, more }) => {
+ void readMeetingRows(() => loadUpTo((o) => window.yogurt.meetings.cards({ ...o, ...(folder ? { folder } : {}) }), shown.current, PAGE)).then(({ cards: list, more }) => {
if (mine !== seq.current) return
+ animateRows(list)
shown.current = list.length; loadedCounts.set(memoryKey, list.length); setCards(list); setMore(more)
})
- }, [folder])
+ }, [folder, animateRows])
useEffect(() => {
reload()
let timer: ReturnType<typeof setTimeout> | undefined
@@ -162,7 +165,7 @@ export function PastNotes({ cards, day, more, sentinel, onOpen, openFolder, show
else if (e.key === 'Escape') { e.preventDefault(); select({ type: 'clear' }) }
}}>
{days.map((group) => <div className="native-meeting-day" key={group.key}>
- <h2 data-testid={loading ? undefined : "past-day"}>{loading ? <span className="loading-bar" style={{ width: 48 }} /> : group.label}</h2>
+ <h2 data-row-heading={loading ? undefined : group.key} data-testid={loading ? undefined : "past-day"}>{loading ? <span className="loading-bar" style={{ width: 48 }} /> : group.label}</h2>
<ul>{group.cards.map((meeting) => loading ? <li className="native-meeting-row" key={meeting.id}><PastCard c={meeting} onOpen={onOpen} me="" showFolders={showFolders} loading /></li> : <MeetingRow key={meeting.id} id={meeting.id} recording={meeting.state === 'recording'} selected={selected.includes(meeting.id)} targets={meetingTargets(selected, meeting.id)} memberships={memberships} busy={busy}
onSelect={() => select({ type: 'select', id: meeting.id, visible })} onTrash={ids => void trash(ids)}
onClick={e => {
diff --git a/app/src/renderer/src/screens/Trash.tsx b/app/src/renderer/src/screens/Trash.tsx
index 8afcbbf8..68e43fc8 100644
--- a/app/src/renderer/src/screens/Trash.tsx
+++ b/app/src/renderer/src/screens/Trash.tsx
@@ -1,6 +1,7 @@
+import { changeMeetingRows, readMeetingRows, useMeetingRowMotion } from '../meetingRowMotion'
import { LoadingContent } from '../components/LoadingContent'
import { MeetingListLoading } from './Home'
-import { useCallback, useEffect, useLayoutEffect, useState } from 'react'
+import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import { RotateCcw, Trash2 } from 'lucide-react'
import type { MeetingCard } from '../../../shared/types'
@@ -22,14 +23,23 @@ export function Trash({ open }: { open: (id: string) => void }) {
const me = useMyName()
const [cards, setCards] = useState<MeetingCard[]>()
const scroll = useScrollMemory<HTMLDivElement>('trash', !!cards)
+ const animateRows = useMeetingRowMotion(scroll, 'trash')
const [deleting, setDeleting] = useState<MeetingCard>()
const [emptying, setEmptying] = useState(false)
const [actions, setActions] = useState<HTMLElement | null>(null)
useLayoutEffect(() => { setActions(document.getElementById('workspace-actions')) }, [])
- const reload = useCallback(() => { void window.yogurt.meetings.trashed().then(setCards) }, [])
+ const sequence = useRef(0)
+ const reload = useCallback(() => {
+ const mine = ++sequence.current
+ void readMeetingRows(() => window.yogurt.meetings.trashed()).then(cards => {
+ if (mine !== sequence.current) return
+ animateRows(cards); setCards(cards)
+ })
+ }, [animateRows])
useEffect(() => {
reload()
- return window.yogurt.meetings.onChange(reload)
+ const off = window.yogurt.meetings.onChange(reload)
+ return () => { off(); sequence.current++ }
}, [reload])
return <div data-testid="trash-page" className="native-folder">
{actions && !!cards?.length && createPortal(<button data-testid="trash-empty" className="workspace-button no-drag" onClick={() => setEmptying(true)}>{t('Empty Trash')}</button>, actions)}
@@ -40,9 +50,9 @@ export function Trash({ open }: { open: (id: string) => void }) {
<div className="empty-tile"><Trash2 size={28} strokeWidth={1.5} aria-hidden="true" /></div><h2>{t('The Trash is empty')}</h2>
<p>{t('Deleted meetings stay here for a while, so you can bring them back.')}</p>
</div></section> : <ul aria-label={t('Deleted meetings')}>
- {cards?.map((c) => <li key={c.id} data-testid="trash-row" className="native-meeting-row trash-row row-swap" tabIndex={0} title={dayLabel(c.startedAt)}>
+ {cards?.map((c) => <li key={c.id} data-row-id={c.id} data-testid="trash-row" className="native-meeting-row trash-row row-swap" tabIndex={0} title={dayLabel(c.startedAt)}>
<PastCard c={c} onOpen={open} me={me} fixed />
- <div className="trash-actions row-swap-actions"><button data-testid="trash-restore" title={t('Restore')} className="workspace-icon" onClick={() => void window.yogurt.meetings.restore(c.id)} aria-label={t('Restore')}>
+ <div className="trash-actions row-swap-actions"><button data-testid="trash-restore" title={t('Restore')} className="workspace-icon" onClick={() => void changeMeetingRows('restore', [c.id], () => window.yogurt.meetings.restore(c.id))} aria-label={t('Restore')}>
<RotateCcw size={14} aria-hidden="true" />
</button>
<button data-testid="trash-delete" className="workspace-icon meeting-delete" onClick={() => setDeleting(c)} aria-label={t('Delete now')} title={t('Delete now')}>
@@ -52,23 +62,23 @@ export function Trash({ open }: { open: (id: string) => void }) {
</ul>}</LoadingContent>
</div>
{deleting && <DeleteNote id={deleting.id} title={deleting.title} onDone={() => setDeleting(undefined)} />}
- {emptying && cards && <EmptyTrash count={cards.length} onDone={() => setEmptying(false)} />}
+ {emptying && cards && <EmptyTrash ids={cards.map(c => c.id)} onDone={() => setEmptying(false)} />}
</div>
}
/** Empty Trash asks first, Cancel focused; a meeting that couldn't go stays in the Trash and says so */
-function EmptyTrash({ count, onDone }: { count: number; onDone: () => void }) {
+function EmptyTrash({ ids, onDone }: { ids: string[]; onDone: () => void }) {
const [busy, setBusy] = useState(false)
const [failed, setFailed] = useState(false)
const yes = async () => {
setBusy(true); setFailed(false)
- const r = await window.yogurt.meetings.emptyTrash().catch(() => ({ deleted: 0, failed: 1 }))
+ const r = await changeMeetingRows('delete', ids, () => window.yogurt.meetings.emptyTrash(), result => result.deleted ? ids : []).catch(() => ({ deleted: 0, failed: 1 }))
setBusy(false)
if (r.failed) setFailed(true)
else onDone()
}
return <Modal testId="trash-empty-confirm" role="alertdialog" title={t('Empty the Trash?')}
- description={osWords({ mac: t('{count} meetings, with their notes, transcripts and recordings, are removed from this Mac for good.', { count }), other: t('{count} meetings, with their notes, transcripts and recordings, are removed from this computer for good.', { count }) })} onCancel={onDone} busy={busy}>
+ description={osWords({ mac: t('{count} meetings, with their notes, transcripts and recordings, are removed from this Mac for good.', { count: ids.length }), other: t('{count} meetings, with their notes, transcripts and recordings, are removed from this computer for good.', { count: ids.length }) })} onCancel={onDone} busy={busy}>
{failed && <p className="modal-error" role="alert">{t("Yogurt couldn't delete everything in the Trash.")}</p>}
<div className="modal-actions">
<button data-testid="trash-empty-yes" onClick={() => void yes()} disabled={busy} className="modal-button danger">{t('Empty Trash')}</button>
diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.css
index ea6c2eb6..b55e1683 100644
--- a/app/src/renderer/src/workspace.css
+++ b/app/src/renderer/src/workspace.css
@@ -137,10 +137,10 @@
.workspace-toolbar[data-note=true]:has(.notes-download-status) { padding-inline-end:62px; }
.workspace:dir(rtl) .workspace-toolbar:has(.notes-download-status) { padding-inline-end:132px; }
.workspace:dir(rtl) .workspace-toolbar[data-note=true]:has(.notes-download-status) { padding-inline-end:185px; }
-.native-library { padding:29px 26px 30px;min-width:0;overflow:auto; }
+.native-library { position:relative;padding:29px 26px 30px;min-width:0;overflow:auto; }
.native-library>h1 { font-size:20px;line-height:26px;font-weight:600;letter-spacing:-.55px;margin-bottom:9px; }
.native-meeting-day { margin-top:25px; }
-.native-meeting-day>h2 { font-size:10px;line-height:14px;font-weight:500;color:var(--muted);margin-bottom:9px; }
+.native-meeting-day>h2,.meeting-day-exit { font-size:10px;line-height:14px;font-weight:500;color:var(--muted);margin-bottom:9px; }
.native-meeting-row { position:relative;display:grid;grid-template-columns:minmax(0,1fr) max-content;align-items:center;column-gap:12px;margin-inline:-8px;padding-inline-end:8px;border-radius:7px;overflow:hidden; }
.native-meeting-row:hover:not(:focus-visible):not(:has(:focus-visible)) { background:var(--row-hover); }
.native-meeting-card { grid-area:1 / 1 / 2 / 3;display:grid;grid-template-columns:subgrid;align-items:center;min-width:0;border-radius:inherit; }
diff --git a/app/test/motion.test.ts b/app/test/motion.test.ts
index db3aa105..29a02e5f 100644
--- a/app/test/motion.test.ts
+++ b/app/test/motion.test.ts
@@ -2,11 +2,12 @@ import { readFileSync } from 'node:fs'
import { afterEach, expect, it, vi } from 'vitest'
import { useLayoutEffect, useRef, useState } from 'react'
import { cubicBezier } from 'motion'
+import { captureMeetingRows, playMeetingRows, changeMeetingRows, readMeetingRows, useMeetingRowMotion } from '../src/renderer/src/meetingRowMotion'
import { motion, usePopoverPresence } from '../src/renderer/src/motion'
import { useLoadingState } from '../src/renderer/src/useLoadingState'
vi.mock('react', async original => ({
- ...await original<typeof import('react')>(), useState: vi.fn(), useLayoutEffect: vi.fn(), useEffect: vi.fn(), useRef: vi.fn(),
+ ...await original<typeof import('react')>(), useCallback: (callback: unknown) => callback, useState: vi.fn(), useLayoutEffect: vi.fn(), useEffect: vi.fn(), useRef: vi.fn(),
}))
afterEach(() => { vi.useRealTimers(); vi.clearAllMocks() })
@@ -139,3 +140,137 @@ it('moves the sidebar and page together with the original timing and child layou
const styles = readFileSync(new URL('../src/renderer/src/styles.css', import.meta.url), 'utf8')
for (const animation of ['icon-lift', 'icon-write', 'icon-turn']) expect(css + styles).not.toContain(animation)
})
+
+// DOM geometry is supplied here; the browser owns interpolation and hit testing.
+function rowScene(ids: string[]) {
+ const elements = new Map<string, ReturnType<typeof element>>()
+ function element(id: string, top: number) {
+ const attributes = [{ name: 'id' }, { name: 'data-testid' }, { name: 'data-row-id' }]
+ const animation = { cancel: vi.fn(), onfinish: undefined as (() => void) | undefined }
+ const el = { dataset: { rowId: id }, top, attributes, inert: false, style: {},
+ classList: { add: vi.fn() }, setAttribute: vi.fn(), removeAttribute: vi.fn(), remove: vi.fn(),
+ querySelectorAll: () => [], getBoundingClientRect: () => ({ top: el.top, left: 20, width: 400, height: 57 }),
+ animate: vi.fn((_frames: Keyframe[], _options: KeyframeAnimationOptions) => animation), cloneNode: (): unknown => element(id, el.top), animation }
+ return el
+ }
+ for (const [i, id] of ids.entries()) elements.set(id, element(id, i * 57))
+ const root = { scrollTop: 0, scrollLeft: 0, querySelectorAll: () => [...elements.values()],
+ getBoundingClientRect: () => ({ top: 0, left: 0 }), append: vi.fn() }
+ return { root: root as unknown as HTMLElement, elements, append: root.append }
+}
+const cardsFor = (...ids: string[]) => ids.map(id => ({ id, startedAt: 0 })) as import('../src/shared/types').MeetingCard[]
+
+it('animates only marked removals and restores, leaving first load, paging and filtering still', () => {
+ const scene = rowScene(['a', 'b'])
+ for (const next of [cardsFor('a', 'b', 'c'), cardsFor('b'), cardsFor()]) {
+ expect(captureMeetingRows(scene.root, next, new Map())).toBeUndefined()
+ }
+ expect(captureMeetingRows(rowScene([]).root, cardsFor('a'), new Map())).toBeUndefined()
+ const pending = new Map([['a', false]])
+ expect(captureMeetingRows(scene.root, cardsFor('a', 'b'), pending)).toBeUndefined()
+ expect(pending.size).toBe(0)
+})
+
+it('collapses a bulk removal together, leaves failed rows live and strips all copied identities', () => {
+ const scene = rowScene(['a', 'b', 'c', 'd'])
+ const snapshot = captureMeetingRows(scene.root, cardsFor('c', 'd'), new Map([['a', false], ['b', false], ['c', false]]))!
+ expect(snapshot.removed).toHaveLength(2)
+ for (const { element: copy } of snapshot.removed) {
+ expect(copy.inert).toBe(true)
+ expect(copy.style.pointerEvents).toBe('none')
+ expect(copy.setAttribute).toHaveBeenCalledWith('aria-hidden', 'true')
+ for (const attr of ['id', 'data-testid', 'data-row-id', 'draggable']) expect(copy.removeAttribute).toHaveBeenCalledWith(attr)
+ }
+ scene.elements.delete('a'); scene.elements.delete('b')
+ scene.elements.get('c')!.top = 0; scene.elements.get('d')!.top = 57
+ const stop = playMeetingRows(scene.root, snapshot)
+ expect(scene.elements.get('c')!.animate).toHaveBeenCalledWith([{ transform: 'translateY(114px)' }, { transform: 'translateY(0)' }], { duration: motion.micro, easing: motion.ease })
+ expect(scene.elements.get('d')!.animate).toHaveBeenCalledTimes(1)
+ expect(scene.append).toHaveBeenCalledTimes(2)
+ expect(snapshot.removed[1].shift).toBe(-57)
+ stop()
+ expect(scene.elements.get('c')!.animation.cancel).toHaveBeenCalledOnce()
+ for (const { element: copy } of snapshot.removed) expect(copy.remove).toHaveBeenCalledOnce()
+})
+
+it('reveals restored rows in their sorted position with the base timing and no text scaling', () => {
+ const scene = rowScene(['a', 'c'])
+ const snapshot = captureMeetingRows(scene.root, cardsFor('a', 'b', 'c'), new Map([['b', true]]))!
+ const restored = rowScene(['b']).elements.get('b')!
+ restored.top = 57; scene.elements.set('b', restored); scene.elements.get('c')!.top = 114
+ playMeetingRows(scene.root, snapshot)
+ expect(restored.animate).toHaveBeenCalledWith([{ opacity: 0, clipPath: 'inset(0 0 100% 0)' }, { opacity: 1, clipPath: 'inset(0)' }], { duration: motion.base, easing: motion.ease })
+ expect(scene.elements.get('c')!.animate.mock.calls[0][0]).toEqual([{ transform: 'translateY(-57px)' }, { transform: 'translateY(0)' }])
+ expect(scene.elements.get('a')!.animate).not.toHaveBeenCalled()
+})
+
+it('captures the visible position before interrupting a row movement', () => {
+ const scene = rowScene(['a', 'b', 'c'])
+ scene.elements.get('c')!.top = 87
+ const snapshot = captureMeetingRows(scene.root, cardsFor('a', 'c'), new Map([['b', false]]))!
+ scene.elements.delete('b'); scene.elements.get('c')!.top = 57
+ playMeetingRows(scene.root, snapshot)
+ expect(scene.elements.get('c')!.animate.mock.calls[0][0]).toEqual([{ transform: 'translateY(30px)' }, { transform: 'translateY(0)' }])
+})
+
+it('waits for a complete bulk mutation without swallowing its error or delaying its result for motion', async () => {
+ let finish!: () => void
+ const result = changeMeetingRows('trash', ['a', 'b'], () => new Promise<string>(resolve => { finish = () => resolve('done') }))
+ const ready = vi.fn()
+ const waiting = readMeetingRows(async () => undefined).then(ready)
+ await Promise.resolve()
+ expect(ready).not.toHaveBeenCalled()
+ finish()
+ expect(await result).toBe('done')
+ await waiting
+ expect(ready).toHaveBeenCalledOnce()
+ await expect(changeMeetingRows('restore', ['a'], async () => { throw new Error('failed') })).rejects.toThrow('failed')
+ await readMeetingRows(async () => undefined)
+})
+
+it.each(['meetings', 'folder/planning', 'trash'])('routes mutation intent to %s and clears it on scope changes', async scope => {
+ const pending = { current: new Map<string, boolean>() }, snapshot = { current: undefined }, stop = { current: vi.fn() }
+ vi.mocked(useState).mockReturnValueOnce([false, vi.fn()])
+ vi.mocked(useRef).mockReturnValueOnce(pending).mockReturnValueOnce(snapshot).mockReturnValueOnce(stop)
+ vi.mocked(useLayoutEffect).mockClear()
+ useMeetingRowMotion({ current: null }, scope)
+ const cleanup = vi.mocked(useLayoutEffect).mock.calls[0][0]()
+ await changeMeetingRows('trash', ['a', 'b'], async () => {})
+ expect([...pending.current]).toEqual([['a', scope === 'trash'], ['b', scope === 'trash']])
+ await changeMeetingRows('restore', ['a'], async () => {})
+ expect(pending.current.get('a')).toBe(scope !== 'trash')
+ await changeMeetingRows('trash', ['failed'], async () => 'failed', () => [])
+ expect(pending.current.has('failed')).toBe(false)
+ await expect(changeMeetingRows('restore', ['rejected'], async () => { throw new Error('failed') })).rejects.toThrow('failed')
+ expect(pending.current.has('rejected')).toBe(false)
+ await changeMeetingRows('delete', ['b'], async () => {})
+ expect(pending.current.get('b')).toBe(false)
+ if (typeof cleanup === 'function') cleanup()
+ expect(pending.current.size).toBe(0)
+ expect(stop.current).toHaveBeenCalledOnce()
+})
+
+it('reduced motion cancels active rows immediately and performs no measurement or animation', () => {
+ const scene = rowScene(['a', 'b']), measure = vi.spyOn(scene.root, 'querySelectorAll')
+ const pending = { current: new Map([['a', false]]) }, snapshot = { current: undefined }, stop = { current: vi.fn() }
+ vi.mocked(useState).mockReturnValueOnce([true, vi.fn()])
+ vi.mocked(useRef).mockReturnValueOnce(pending).mockReturnValueOnce(snapshot).mockReturnValueOnce(stop)
+ vi.mocked(useLayoutEffect).mockClear()
+ const prepare = useMeetingRowMotion({ current: scene.root }, 'meetings')
+ vi.mocked(useLayoutEffect).mock.calls[1][0]()
+ expect(stop.current).toHaveBeenCalledOnce()
+ expect(pending.current.size).toBe(0)
+ prepare(cardsFor('b'))
+ expect(measure).not.toHaveBeenCalled()
+ expect(scene.elements.get('b')!.animate).not.toHaveBeenCalled()
+})
+
+it('retries a read begun before a mutation so partial bulk results cannot reach the list', async () => {
+ let finishRead!: () => void
+ const read = vi.fn().mockImplementationOnce(() => new Promise(resolve => { finishRead = () => resolve(['partial']) })).mockResolvedValue(['complete'])
+ const result = readMeetingRows(read)
+ await changeMeetingRows('trash', ['a', 'b'], async () => {})
+ finishRead()
+ expect(await result).toEqual(['complete'])
+ expect(read).toHaveBeenCalledTimes(2)
+})