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.

Summary: regenerating keeps the previous summary dimmed, then writes the new one in.

Eric Brownrout0d26a16cf007
diff --git a/app/e2e/note-layout.spec.ts b/app/e2e/note-layout.spec.ts
index 09780e44..53bd9e05 100644
--- a/app/e2e/note-layout.spec.ts
+++ b/app/e2e/note-layout.spec.ts
@@ -113,7 +113,7 @@ test('My notes and Summary tabs switch versions; summary actions regenerate', as
await expect(page.getByTestId('note-notes-tab')).toHaveAttribute('data-version', 'mine')
await page.getByTestId('note-view-menu').click()
await page.getByTestId('note-write-again').click()
- // written again from My notes: the enhanced notes are shown as they come
+ // The previous summary stays dimmed while reading, then the replacement writes in.
await expect(page.getByTestId('note-notes-tab')).toHaveAttribute('data-version', 'enhanced')
await expect(page.getByTestId('note-enhanced')).toHaveAttribute('data-status', 'writing', { timeout: 30_000 })
await expect(page.getByTestId('note-enhanced')).toHaveAttribute('data-status', 'done', { timeout: 30_000 })
diff --git a/app/e2e/note.spec.ts b/app/e2e/note.spec.ts
index d50cff46..4fb1b021 100644
--- a/app/e2e/note.spec.ts
+++ b/app/e2e/note.spec.ts
@@ -237,6 +237,10 @@ test('edits to the enhanced notes are saved; Write again asks first, then writes
await page.getByTestId('note-write-again-confirm').click()
await expect(page.getByTestId('note-enhanced')).toHaveAttribute('data-status', 'writing', { timeout: 30_000 })
await expect(page.getByTestId('note-summary-rim')).toHaveCount(0)
+ await expect(editor.locator('h2').first()).not.toHaveText('Launch plan (moved)')
+ await expect(editor).toHaveAttribute('aria-readonly', 'true')
+ await expect(page.locator('.summary-result')).toHaveCSS('opacity', '1')
+ await expect(page.locator('.summary-outline')).toHaveCount(0)
await expect(page.getByTestId('note-enhanced')).toHaveAttribute('data-status', 'done', { timeout: 30_000 })
await expect(editor.locator('h2').first()).toHaveText('Launch plan')
expect((await notesOf(page, id)).edited).toBe(false)
diff --git a/app/e2e/summaryRim.spec.ts b/app/e2e/summaryRim.spec.ts
index b6f11d18..7ef4dc22 100644
--- a/app/e2e/summaryRim.spec.ts
+++ b/app/e2e/summaryRim.spec.ts
@@ -60,7 +60,11 @@ for (const theme of ['light', 'dark'] as const) for (const width of [420, 860])
await push('done', text(22))
await expect(rim).toHaveCount(0)
await expect(latest).toBeHidden()
- expect(await pane.boundingBox()).toEqual(before)
+ const after = (await pane.boundingBox())!
+ expect(after.y).toBe(before!.y)
+ expect(after.width).toBe(before!.width)
+ // Saved summaries reserve the same status lane for the next regeneration.
+ expect(after.height).toBe(before!.height - 44)
expect(await pane.evaluate(el => el.scrollTop)).toBeCloseTo(scrollTop, 0)
await page.emulateMedia({ reducedMotion: 'no-preference' })
await expect(page.locator('.note-reading-frame')).toHaveAttribute('data-active', 'false')
diff --git a/app/src/renderer/src/components/NoteReadingPane.tsx b/app/src/renderer/src/components/NoteReadingPane.tsx
index 96ee0a1a..7ba78d38 100644
--- a/app/src/renderer/src/components/NoteReadingPane.tsx
+++ b/app/src/renderer/src/components/NoteReadingPane.tsx
@@ -1,11 +1,11 @@
-import { useEffect, useRef, useState, type ReactNode, type RefObject } from 'react'
+import { useEffect, useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from 'react'
import { ArrowDown } from 'lucide-react'
import { t } from '../../../shared/i18n'
import { useFollowLatest } from '../useFollowLatest'
import { ScrollFade } from './ScrollFade'
-export function NoteReadingPane({ active, summary, generating, writing, scroll, children }: {
- active: boolean; summary: boolean; generating: boolean; writing: boolean; scroll: RefObject<HTMLElement | null>; children: ReactNode
+export function NoteReadingPane({ active, summary, hasSummary, generating, writing, scroll, children }: {
+ active: boolean; summary: boolean; hasSummary: boolean; generating: boolean; writing: boolean; scroll: RefObject<HTMLElement | null>; children: ReactNode
}) {
const frame = useRef<HTMLDivElement>(null), content = useRef<HTMLDivElement>(null)
const [visible, setVisible] = useState(false)
@@ -19,7 +19,8 @@ export function NoteReadingPane({ active, summary, generating, writing, scroll,
return () => { observer.disconnect(); document.removeEventListener('visibilitychange', sync) }
}, [active, generating])
const follow = useFollowLatest(scroll, content, active && generating && visible)
- return <div ref={frame} className="note-reading-frame" hidden={!active} data-generating={generating} data-active={active && generating && visible}>
+ useLayoutEffect(() => { if (writing) follow.resume() }, [writing])
+ return <div ref={frame} className="note-reading-frame" hidden={!active} data-has-summary={summary && hasSummary} data-generating={generating} data-active={active && generating && visible}>
<div className="note-reading-clip">
<ScrollFade enabled={active}><section ref={scroll} id="note-notes-panel" role="tabpanel" aria-labelledby={summary ? 'note-summary-tab' : 'note-notes-tab'} className="note-content note-notes-pane">
<div ref={content} className="note-page-width note-notes-body">{children}</div>
diff --git a/app/src/renderer/src/components/SummaryWaiting.tsx b/app/src/renderer/src/components/SummaryWaiting.tsx
index 17038600..b57ff9da 100644
--- a/app/src/renderer/src/components/SummaryWaiting.tsx
+++ b/app/src/renderer/src/components/SummaryWaiting.tsx
@@ -1,16 +1,25 @@
+import { useLayoutEffect, useRef, useState } from 'react'
+import { createPortal } from 'react-dom'
import { t } from '../../../shared/i18n'
import type { NoteView } from '../../../shared/types'
-export function SummaryWaiting({ part }: { part?: NoteView['part'] }) {
- return <div data-testid="note-enhanced-waiting" className="summary-waiting" aria-live="polite">
- <div className="summary-outline" aria-hidden="true">
+export function SummaryWaiting({ part, outline = true, writing = false }: { part?: NoteView['part']; outline?: boolean; writing?: boolean }) {
+ const anchor = useRef<HTMLSpanElement>(null)
+ const [frame, setFrame] = useState<Element | null>(null)
+ useLayoutEffect(() => {
+ if (!outline) setFrame(anchor.current?.closest('.note-reading-frame') ?? null)
+ }, [outline])
+ const content = <div data-testid="note-enhanced-waiting" className="summary-waiting" aria-live="polite">
+ {outline && <div className="summary-outline" aria-hidden="true">
{[0, 1].map(block => <div key={block} className="summary-outline-block">
<div className="summary-outline-bar summary-outline-heading" />
{[0, 1].map(bullet => <div key={bullet} className="summary-outline-bullet">
<div className="summary-outline-bar" />
</div>)}
</div>)}
- </div>
- <span className="note-summary-status"><span className="summary-status-text">{part ? t('Reading a long meeting, part {part} of {of}…', { part: part.part, of: part.of }) : t('Reading the transcript…')}</span></span>
+ </div>}
+ <span className="note-summary-status"><span className="summary-status-text">{writing ? t('Generating notes…') : part ? t('Reading a long meeting, part {part} of {of}…', { part: part.part, of: part.of }) : t('Reading the transcript…')}</span></span>
</div>
+ // The scroller masks its descendants; the rewrite label belongs in the frame's reserved lane.
+ return outline ? content : <><span ref={anchor} hidden />{frame ? createPortal(content, frame) : content}</>
}
diff --git a/app/src/renderer/src/screens/Note.tsx b/app/src/renderer/src/screens/Note.tsx
index 62d262a8..a3ee3e64 100644
--- a/app/src/renderer/src/screens/Note.tsx
+++ b/app/src/renderer/src/screens/Note.tsx
@@ -25,6 +25,7 @@ import { ShareMenu } from '../components/ShareMenu'
import { NoteMenu } from '../components/NoteMenu'
import { DeleteNote } from '../components/DeleteNote'
import { moveToTrash } from '../components/TrashToast'
+import { useSummaryPresentation } from '../summaryPresentation'
import { useSmoothText } from '../useSmoothText'
import { NoteAutosave, registerAutosave } from '../noteAutosave'
import { People } from '../components/People'
@@ -85,6 +86,7 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
const [viewState, setView] = useState<'mine' | 'enhanced'>(() => readingViews.get(id)?.view ?? 'mine')
const [finishRequested, requestFinish] = useState(false)
const reducedMotion = useReducedMotion()
+ const summaryState = useSummaryPresentation(notes, reducedMotion)
const hasEnhanced = m?.id === id && m.state !== 'prepared' && m.state !== 'recording' && !!notes && notes.status !== 'idle'
// Reduced motion selects Summary in the very render that first exposes its tab.
const instantSummary = finishRequested && hasEnhanced && reducedMotion
@@ -388,12 +390,12 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
</header>
<div ref={setChatAnchor} className="note-reading-area">
<div ref={panels} className="note-panels">
- <NoteReadingPane active={primary === 'notes'} summary={shown === 'enhanced'} generating={shown === 'enhanced' && (notes.status === 'waiting' || notes.status === 'writing')} writing={shown === 'enhanced' && notes.status === 'writing' && !!notes.draft} scroll={readingScroll}>
+ <NoteReadingPane active={primary === 'notes'} summary={shown === 'enhanced'} hasSummary={notes.enhanced != null} generating={shown === 'enhanced' && ['waiting', 'streaming'].includes(summaryState)} writing={shown === 'enhanced' && summaryState === 'streaming'} scroll={readingScroll}>
{shown === 'mine' ? <Editor
focus={primary === 'notes' && at?.ms === null ? at : undefined} testId="note-mine" label={t('My notes')} className="min-h-[40vh]" markdown={notes.mine} placeholder={t('Write notes here. Yogurt fills in the rest after the meeting.')}
onChange={(md) => { typing.current = true; const next = { ...current.current!, mine: md }; current.current = next; setNotes(next); mineSave.change(md) }}
onBlur={() => { typing.current = false; mineSave.flush() }}
- /> : <Enhanced focus={primary === 'notes' && at?.ms === null ? at : undefined} notes={notes} disabled={starting} onChange={(md) => { setEditedHere(true); const next = { ...current.current!, enhanced: md }; current.current = next; setNotes(next); enhancedSave.change(md) }} onBlur={enhancedSave.flush} onRetry={writeAgain} />}
+ /> : <Enhanced key={id} presentation={summaryState} focus={primary === 'notes' && at?.ms === null ? at : undefined} notes={notes} disabled={starting} onChange={(md) => { setEditedHere(true); const next = { ...current.current!, enhanced: md }; current.current = next; setNotes(next); enhancedSave.change(md) }} onBlur={enhancedSave.flush} onRetry={writeAgain} />}
</NoteReadingPane>
{(primary === 'transcript' || transcriptVisited) && <section hidden={primary !== 'transcript'} id="note-transcript-panel" role="tabpanel" aria-labelledby="note-transcript-tab" className="note-content note-transcript-pane">
<Transcript id={id} recording={recording} active={primary === 'transcript'} inline toolbar={transcriptToolbar} focus={at?.ms != null ? { ...at, ms: at.ms } : undefined} />
@@ -487,12 +489,22 @@ function Title({ id, title, editing, onEdit }: { id: string; title: string; edit
}
/** The enhanced side: waiting, the draft as it is written, the saved notes (editable), or what went wrong */
-function Enhanced({ notes, disabled, onChange, onBlur, onRetry, focus }: { focus?: { match?: string; seq: number }; notes: NoteView; disabled?: boolean; onChange: (md: string) => void; onBlur: () => void; onRetry: () => void }) {
+function Enhanced({ notes, presentation, disabled, onChange, onBlur, onRetry, focus }: { presentation: ReturnType<typeof useSummaryPresentation>; focus?: { match?: string; seq: number }; notes: NoteView; disabled?: boolean; onChange: (md: string) => void; onBlur: () => void; onRetry: () => void }) {
const { status } = notes
- const writing = status === 'waiting' || status === 'writing'
- // the summary unrolls smoothly as it is written; the editor redraws at most every other frame
- const draft = useSmoothText(notes.draft ?? '', writing, { minCommitMs: 32 })
- if (status === 'failed' && notes.enhanced == null) {
+ const handoff = presentation === 'handoff'
+ const writing = presentation === 'waiting' || presentation === 'streaming' || handoff
+ const rewriting = presentation === 'rewriting'
+ const surface = useRef<HTMLDivElement>(null), height = useRef(0)
+ const previous = useRef(presentation)
+ useLayoutEffect(() => {
+ const pane = surface.current?.closest<HTMLElement>('.note-notes-pane')
+ if (status === 'failed' && previous.current === 'streaming' && pane) pane.scrollTop = 0
+ previous.current = presentation
+ }, [presentation, status])
+ useLayoutEffect(() => { if (!handoff) height.current = surface.current?.offsetHeight ?? 0 }, [handoff, rewriting, notes.enhanced])
+ // Warm the normal unroll and ink during the fade, so the first words are ready at the handoff.
+ const draft = useSmoothText(writing ? notes.draft : '', writing, { minCommitMs: 32 })
+ if (presentation === 'failed') {
return (
<InlineError testId="note-enhanced-failed">
<span>{t("Yogurt couldn't generate this summary.")}</span>
@@ -500,8 +512,8 @@ function Enhanced({ notes, disabled, onChange, onBlur, onRetry, focus }: { focus
</InlineError>
)
}
- if (status === 'empty') return <p data-testid="note-enhanced-empty" className="text-[15px] text-muted">{t('Nothing was said or written in this meeting.')}</p>
- if (writing && !notes.draft) {
+ if (presentation === 'empty') return <p data-testid="note-enhanced-empty" className="text-[15px] text-muted">{t('Nothing was said or written in this meeting.')}</p>
+ if (presentation === 'waiting') {
return (
<NotesModelWait downloading={(percent) => (
<p data-testid="note-enhanced-model-download" role="status" className="text-[15px] text-muted">{percent ? t('Yogurt is still downloading its AI model. Your notes will be ready in a few minutes. ({percent})', { percent }) : t('Yogurt is still downloading its AI model. Your notes will be ready in a few minutes.')}</p>
@@ -511,12 +523,20 @@ function Enhanced({ notes, disabled, onChange, onBlur, onRetry, focus }: { focus
)
}
return (
- <div data-testid="note-enhanced" data-status={status} className={writing ? 'streaming' : ''}>
+ <div data-testid="note-enhanced" data-status={status} className={presentation === 'streaming' ? 'streaming' : ''}>
{status === 'failed' && <InlineError testId="note-enhanced-rewrite-failed" className="mb-6">
<span>{t("Couldn't regenerate the summary. Your previous version is below.")}</span>
<button onClick={onRetry} className="inline-error-action">{t('Try again')}</button>
</InlineError>}
- <Editor focus={focus} testId="note-enhanced-editor" label={t('Summary')} className="enhanced" markdown={writing ? draft : notes.enhanced ?? ''} streaming={writing} editable={!writing && !disabled} onChange={onChange} onBlur={onBlur} />
+ {(rewriting || handoff) && <SummaryWaiting outline={false} writing={handoff} part={status === 'writing' ? notes.part : undefined} />}
+ <div ref={surface} className="summary-rewrite" data-rewriting={rewriting} data-handoff={handoff} style={handoff ? { minHeight: height.current } : undefined}>
+ <div className="summary-result">
+ <Editor focus={focus} testId="note-enhanced-editor" label={t('Summary')} className="enhanced" markdown={writing ? draft : notes.enhanced ?? ''} streaming={writing} editable={!writing && !rewriting && !disabled} onChange={onChange} onBlur={onBlur} />
+ </div>
+ {handoff && <div className="summary-previous" aria-hidden="true" inert>
+ <Editor testId="note-enhanced-previous" label={t('Summary')} className="enhanced" markdown={notes.enhanced ?? ''} editable={false} />
+ </div>}
+ </div>
{/* the caret dot and the Summarizing pill show progress; a visible label here would ride the end of the text up and down */}
{writing && <p className="sr-only" aria-live="polite">{t('Generating notes…')}</p>}
</div>
diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.css
index 5be72d12..d2afbd92 100644
--- a/app/src/renderer/src/styles.css
+++ b/app/src/renderer/src/styles.css
@@ -869,6 +869,18 @@ html:not(.widget) button:focus-visible, html:not(.widget) input:focus-visible {
@starting-style { .search-panel.dialog-motion { transform:none; } }
}
+/* The first chunk warms up out of view while the old reading surface fades. */
+.summary-rewrite { position:relative; }
+.summary-rewrite[data-rewriting=true]>.summary-result { opacity:.45;user-select:none;pointer-events:none; }
+.summary-previous { pointer-events:none;animation:summary-rewrite-out var(--dur-micro) var(--ease-out) reverse both; }
+.summary-rewrite[data-handoff=true]>.summary-result { position:absolute;inset:0;visibility:hidden;animation:summary-handoff-in 0s var(--dur-micro) forwards; }
+@keyframes summary-rewrite-out { from { opacity:0; } to { opacity:.45; } }
+@keyframes summary-handoff-in { to { visibility:visible; } }
+@media (prefers-reduced-motion: reduce) {
+ .summary-previous { display:none; }
+ .summary-rewrite[data-handoff=true]>.summary-result { position:static;visibility:visible;animation:none; }
+}
+
/* the summary's status line shimmers like Ask's thinking line */
.summary-status-text { background:linear-gradient(100deg,var(--muted) 35%,var(--ink) 50%,var(--muted) 65%) 0 0 / 250% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:step-shimmer 2.2s linear infinite; }
@media (prefers-reduced-motion: reduce) { .summary-status-text { animation:none;background:none;color:inherit; } }
diff --git a/app/src/renderer/src/summaryPresentation.ts b/app/src/renderer/src/summaryPresentation.ts
new file mode 100644
index 00000000..671492ef
--- /dev/null
+++ b/app/src/renderer/src/summaryPresentation.ts
@@ -0,0 +1,32 @@
+import { useEffect, useState } from 'react'
+import { motion } from './motion'
+import type { NoteView } from '../../shared/types'
+
+/** A saved result stays on screen until the replacement starts writing. */
+export function summaryPresentation(notes: Pick<NoteView, 'status' | 'enhanced' | 'draft'>) {
+ if (notes.status === 'waiting' || notes.status === 'writing') {
+ if (notes.enhanced != null && !/[\p{L}\p{N}]/u.test(notes.draft)) return 'rewriting'
+ return notes.draft ? 'streaming' : 'waiting'
+ }
+ if (notes.enhanced != null) return 'saved'
+ if (notes.status === 'failed') return 'failed'
+ if (notes.status === 'empty') return 'empty'
+ return 'saved'
+}
+
+/** Start the first-summary sequence only after the old reading surface has faded. */
+export function useSummaryPresentation(notes: NoteView | undefined, reduced: boolean) {
+ const presentation = notes ? summaryPresentation(notes) : 'saved'
+ const id = notes?.meetingId
+ const [last, setLast] = useState({ id, presentation, fading: false })
+ if (last.id !== id || last.presentation !== presentation) {
+ setLast({ id, presentation, fading: !reduced && last.id === id && last.presentation === 'rewriting' && presentation === 'streaming' })
+ }
+ useEffect(() => {
+ if (!last.fading) return
+ if (reduced) { setLast(s => ({ ...s, fading: false })); return }
+ const timer = setTimeout(() => setLast(s => ({ ...s, fading: false })), motion.micro)
+ return () => clearTimeout(timer)
+ }, [last.fading, reduced, id])
+ return last.fading && !reduced ? 'handoff' : presentation
+}
diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.css
index a250f294..fce7c3a7 100644
--- a/app/src/renderer/src/workspace.css
+++ b/app/src/renderer/src/workspace.css
@@ -635,6 +635,8 @@ body:has(.chat-panel[open]) .app-toast-viewport:dir(rtl) { --toast-x:440px; }
/* The scroll viewport meets the tab/footer borders; spacing belongs inside the scrolled content. */
.note-reading-frame { position:relative;min-width:0;min-height:0;flex:1;margin:0 calc(max(0px,(100% - 860px)/2) + clamp(20px,calc(10cqw - 42px),48px) - 14px);padding:0 2px;border-radius:12px; }
+/* Keep a status lane even at rest, so progress never covers or displaces the summary. */
+.note-reading-frame[data-has-summary=true] { padding-bottom:44px; }
.note-reading-frame[hidden] { display:none; }
.note-reading-clip { height:100%;overflow:hidden;border-radius:10px; }
.main-window .note-reading-clip>.note-notes-pane { height:100%;scrollbar-width:auto;scrollbar-gutter:stable; }
diff --git a/app/test/summaryHandoff.test.ts b/app/test/summaryHandoff.test.ts
new file mode 100644
index 00000000..e85f67f0
--- /dev/null
+++ b/app/test/summaryHandoff.test.ts
@@ -0,0 +1,80 @@
+import { useEffect, useState } from 'react'
+import { afterEach, expect, it, vi } from 'vitest'
+import { useSummaryPresentation } from '../src/renderer/src/summaryPresentation'
+import { motion } from '../src/renderer/src/motion'
+import type { NoteView } from '../src/shared/types'
+
+vi.mock('react', async original => ({ ...await original<typeof import('react')>(), useState: vi.fn(), useEffect: vi.fn() }))
+afterEach(() => { vi.useRealTimers(); vi.clearAllMocks() })
+const note = (patch: Partial<NoteView> = {}): NoteView => ({ meetingId: 'meeting', status: 'waiting', enhanced: 'Previous summary', draft: '', mine: '', edited: false, peopleChanged: false, ...patch })
+
+function harness() {
+ let state: unknown, dirty = false, dependencies: unknown[] | undefined, cleanup: (() => void) | void
+ return (notes: NoteView | undefined, reduced = false) => {
+ vi.mocked(useState).mockImplementation((initial?: unknown): [unknown, (next: unknown) => void] => {
+ state ??= typeof initial === 'function' ? initial() : initial
+ return [state, next => { state = typeof next === 'function' ? next(state) : next; dirty = true }]
+ })
+ let result: ReturnType<typeof useSummaryPresentation>
+ do { dirty = false; result = useSummaryPresentation(notes, reduced) } while (dirty)
+ const [effect, deps] = vi.mocked(useEffect).mock.lastCall!
+ if (!dependencies || deps!.some((dep, i) => dep !== dependencies![i])) {
+ cleanup?.(); dependencies = [...deps!]; cleanup = effect()
+ }
+ return result
+ }
+}
+
+it('fades on the first words once, without restarting for more chunks or animating completion', () => {
+ vi.useFakeTimers()
+ const render = harness()
+ expect(render(note())).toBe('rewriting')
+ expect(render(note({ status: 'writing', draft: '## ' }))).toBe('rewriting')
+ expect(render(note({ status: 'writing', draft: '## Release' }))).toBe('handoff')
+ vi.advanceTimersByTime(motion.micro / 2)
+ expect(render(note({ status: 'writing', draft: '## Release plan' }))).toBe('handoff')
+ vi.advanceTimersByTime(motion.micro / 2)
+ expect(render(note({ status: 'writing', draft: '## Release plan' }))).toBe('streaming')
+ expect(render(note({ status: 'done', enhanced: 'New summary' }))).toBe('saved')
+ expect(vi.getTimerCount()).toBe(0)
+})
+
+it.each(['failed', 'done'] as const)('restores the old result on %s before writing, during the fade, or after writing', status => {
+ vi.useFakeTimers()
+ for (const elapsed of [undefined, 0, motion.micro]) {
+ const render = harness()
+ render(note())
+ if (elapsed !== undefined) {
+ render(note({ status: 'writing', draft: 'New draft' }))
+ vi.advanceTimersByTime(elapsed)
+ }
+ expect(render(note({ status, draft: 'Abandoned partial' }))).toBe('saved')
+ vi.advanceTimersByTime(motion.micro)
+ expect(render(note({ status }))).toBe('saved')
+ expect(vi.getTimerCount()).toBe(0)
+ }
+})
+
+it('skips the handoff for first summaries, reopening an existing stream, and reduced motion', () => {
+ vi.useFakeTimers()
+ const first = harness()
+ expect(first(note({ enhanced: null }))).toBe('waiting')
+ expect(first(note({ enhanced: null, status: 'writing', draft: 'First words' }))).toBe('streaming')
+ expect(harness()(note({ status: 'writing', draft: 'Already writing' }))).toBe('streaming')
+ const reduced = harness()
+ reduced(note(), true)
+ expect(reduced(note({ status: 'writing', draft: 'New draft' }), true)).toBe('streaming')
+ expect(vi.getTimerCount()).toBe(0)
+})
+
+it('cancels the fade on navigation or a live reduced-motion change', () => {
+ vi.useFakeTimers()
+ const render = harness()
+ render(note()); render(note({ status: 'writing', draft: 'New draft' }))
+ expect(render(note({ meetingId: 'other', status: 'done' }))).toBe('saved')
+ expect(vi.getTimerCount()).toBe(0)
+ render(note()); render(note({ status: 'writing', draft: 'New draft' }))
+ expect(render(note({ status: 'writing', draft: 'New draft' }), true)).toBe('streaming')
+ expect(render(note({ status: 'writing', draft: 'New draft' }), false)).toBe('streaming')
+ expect(vi.getTimerCount()).toBe(0)
+})
diff --git a/app/test/summaryPresentation.test.ts b/app/test/summaryPresentation.test.ts
new file mode 100644
index 00000000..47e917cb
--- /dev/null
+++ b/app/test/summaryPresentation.test.ts
@@ -0,0 +1,28 @@
+import { expect, it } from 'vitest'
+import { summaryPresentation } from '../src/renderer/src/summaryPresentation'
+
+it('keeps first summaries waiting, then streaming, then editable', () => {
+ expect(summaryPresentation({ status: 'waiting', enhanced: null, draft: '' })).toBe('waiting')
+ expect(summaryPresentation({ status: 'writing', enhanced: null, draft: '' })).toBe('waiting')
+ expect(summaryPresentation({ status: 'writing', enhanced: null, draft: 'Partial' })).toBe('streaming')
+ expect(summaryPresentation({ status: 'done', enhanced: 'Complete', draft: '' })).toBe('saved')
+ expect(summaryPresentation({ status: 'empty', enhanced: null, draft: '' })).toBe('empty')
+ expect(summaryPresentation({ status: 'failed', enhanced: null, draft: '' })).toBe('failed')
+})
+
+it.each(['Previous summary', ''])('retains a saved summary through reading, then hands partial drafts to the normal stream (%j)', enhanced => {
+ for (const status of ['waiting', 'writing'] as const) {
+ for (const draft of ['', '## ', '\n ']) {
+ expect(summaryPresentation({ status, enhanced, draft })).toBe('rewriting')
+ }
+ }
+ expect(summaryPresentation({ status: 'writing', enhanced, draft: '## New heading' })).toBe('streaming')
+ expect(summaryPresentation({ status: 'writing', enhanced, draft: '会議' })).toBe('streaming')
+})
+
+it('restores the saved editor after failure or stopping, discards abandoned partial drafts', () => {
+ for (const status of ['failed', 'done', 'idle', 'empty'] as const) {
+ expect(summaryPresentation({ status, enhanced: 'Previous summary', draft: 'Abandoned draft' })).toBe('saved')
+ }
+ expect(summaryPresentation({ status: 'done', enhanced: 'New saved summary', draft: '' })).toBe('saved')
+})
diff --git a/app/test/summaryWaiting.test.ts b/app/test/summaryWaiting.test.ts
index 99305e8f..c047a82e 100644
--- a/app/test/summaryWaiting.test.ts
+++ b/app/test/summaryWaiting.test.ts
@@ -27,3 +27,14 @@ it('uses the actual long-meeting part and localizes both labels', () => {
expect(html).toContain('Lecture d’une longue réunion, partie 2 sur 4…')
expect(html).not.toContain('Lecture de la transcription…')
})
+
+it('shows the same working line without an outline during a rewrite', () => {
+ const reading = renderToStaticMarkup(createElement(SummaryWaiting, { outline: false, part: { part: 2, of: 4 } }))
+ expect(reading).toContain('Reading a long meeting, part 2 of 4…')
+ expect(reading).toContain('aria-live="polite"')
+ expect(reading).not.toContain('summary-outline')
+ const writing = renderToStaticMarkup(createElement(SummaryWaiting, { outline: false, writing: true }))
+ expect(writing).toContain('Generating notes…')
+ expect(writing).not.toContain('Reading the transcript')
+ expect(writing).not.toContain('summary-outline')
+})