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.

Transcript: a file that could not be transcribed shows one centred state with Transcribe

Eric Brownroutcce5430f075f
diff --git a/app/src/renderer/src/components/Transcript.tsx b/app/src/renderer/src/components/Transcript.tsx
index 1881b722..8c9ac255 100644
--- a/app/src/renderer/src/components/Transcript.tsx
+++ b/app/src/renderer/src/components/Transcript.tsx
@@ -1,11 +1,12 @@
import { InlineError, ReadError } from './InlineError'
+import { TranscriptionNotice, type TranscriptNotice } from './Transcription'
import {transcriptReplacement} from '../../../shared/transcriptReplacement'
import { citationTargetIndex } from '../../../shared/citations'
import { SPEAKER_COLORS } from '../../../shared/speakerColors'
import { ScrollFade } from './ScrollFade'
import { Loading } from './Loading'
import { useLoadingState } from '../useLoadingState'
-import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode, type CSSProperties, type KeyboardEvent, type MouseEvent } from 'react'
+import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type KeyboardEvent, type MouseEvent } from 'react'
import { AudioLines, ArrowDown } from './Icons'
import type { Segment, TranscriptPartial } from '../../../shared/types'
import { t } from '../../../shared/i18n'
@@ -180,7 +181,7 @@ const Row = memo(function Row({ line: l, focused, name, playing, playable, focus
* while it records; after the meeting a line plays from that moment, and the player sits at the bottom. The header searches it.
*/
export function Transcript({ id, notice, processing=false, replacing=false, recording, inline = false, active = true, onClose, focus, toolbar }: {
- id: string; notice?:ReactNode; processing?:boolean; replacing?:boolean; recording: boolean; inline?: boolean; active?: boolean; toolbar?: HTMLElement | null; onClose?: () => void
+ id: string; notice?: TranscriptNotice; processing?:boolean; replacing?:boolean; recording: boolean; inline?: boolean; active?: boolean; toolbar?: HTMLElement | null; onClose?: () => void
/** a line to show and mark (an answer's source): ms into the meeting; seq: each time it is asked for */
focus?: { ms: number; match?: string; seq: number }
}) {
@@ -390,6 +391,8 @@ export function Transcript({ id, notice, processing=false, replacing=false, reco
setFinding(open)
if (open) { setShowAll(true); stick.current = false; ours.current?.stop(); ours.current = null }
}, [])
+ const empty = loaded && !failed && timeline.length === 0 && (!processing || !!notice)
+ const noticeContent = notice && <TranscriptionNotice notice={notice} centered={empty} hasLines={timeline.length > 0} />
const Surface = inline ? 'section' : 'aside'
return (
@@ -398,12 +401,17 @@ export function Transcript({ id, notice, processing=false, replacing=false, reco
<TranscriptFind key={id} lines={lines} list={list} active={active} playbackInset={playbackInset} beforeScroll={() => visibility.current?.programmatic()} onFinding={find} toolbar={toolbar} onClose={!inline ? onClose : undefined} />
<div className="transcript-scroll-wrap relative flex min-h-0 flex-1 flex-col">
<ScrollFade enabled={active && loaded}><ol id="transcript-lines" data-loaded={loaded} data-loading-phase={loadingPhase} data-testid="transcript" data-replacing={replacing&&processing} ref={list} onScroll={onScroll} onWheel={theirs} onTouchStart={theirs} onPointerDown={theirs} onKeyDownCapture={theirs} onKeyDown={onKeyDown} className="loading-content transcript-loading-content flex flex-1 flex-col gap-2 overflow-y-auto px-4 pb-4 pt-2 text-sm leading-[1.55]">
- {notice&&<li className="transcription-notice-slot">{notice}</li>}
- {processing&&!replacing&&timeline.length===0&&<li className="transcription-placeholder" aria-hidden="true"><p className="turn-head"><span className="loading-bar" style={{width:42}}/></p><p className="bubble bubble-them"><span className="loading-bar" style={{width:180}}/></p></li>}
+ {!empty && noticeContent && <li className="transcription-notice-slot">{noticeContent}</li>}
+ {processing&&!notice&&!replacing&&timeline.length===0&&<li className="transcription-placeholder" aria-hidden="true"><p className="turn-head"><span className="loading-bar" style={{width:42}}/></p><p className="bubble bubble-them"><span className="loading-bar" style={{width:180}}/></p></li>}
{failed && (timeline.length || processing || playable || notice ? <li><InlineError testId="transcript-read-error" retry={() => retry.current()} /></li>
: <li className="flex flex-1"><ReadError testId="transcript-read-error" retry={() => retry.current()} /></li>)}
{!failed && loadingPhase !== 'ready' && timeline.length===0 && <li className="loading-placeholder"><Loading layout="transcript" /></li>}
- {!failed && loaded && !processing && allLines.length === 0 && liveSaid.length === 0 && <li data-testid="transcript-empty" className="note-empty empty-state"><div className="empty-state-content"><div className="empty-tile"><AudioLines size={28} aria-hidden="true" /></div>{t('Nothing heard yet.')}</div></li>}
+ {empty && <li data-testid="transcript-empty" className="note-empty empty-state">
+ <div className="empty-state-content">
+ <div className="empty-tile"><AudioLines size={28} aria-hidden="true" /></div>
+ {noticeContent ?? t('Nothing heard yet.')}
+ </div>
+ </li>}
{drawn.earlier > 0 && <li className="flex justify-center"><button data-testid="transcript-earlier" onClick={() => { visibility.current?.programmatic(); stick.current = false; setShowAll(true) }} className="ghost-btn">{t('Show earlier lines')}</button></li>}
{drawn.runs.map(run => <Fragment key={run.k}>
{turns(run.lines).map((turn) => {
diff --git a/app/src/renderer/src/components/Transcription.tsx b/app/src/renderer/src/components/Transcription.tsx
index f4fb4cca..4dfbeb19 100644
--- a/app/src/renderer/src/components/Transcription.tsx
+++ b/app/src/renderer/src/components/Transcription.tsx
@@ -1,4 +1,5 @@
import { AudioLines, Loader } from './Icons'
+import { InlineError } from './InlineError'
import { t } from '../../../shared/i18n'
import { transcriptionLabel, type TranscriptionState } from '../../../shared/transcription'
import { Swap, SwapText } from './Swap'
@@ -10,13 +11,32 @@ export function TranscriptionControl({state,onStop}:{state:TranscriptionState;on
<SwapText text={state==='preparing'?t('Preparing audio…'):t('Transcribing…')}/>
</button>
}
-export function TranscriptionNotice({state,hasLines,onContinue,disabled}:{state?:TranscriptionState;hasLines:boolean;onContinue:()=>void;disabled?:boolean}) {
- if(state==='waiting-model'||state==='waiting-recording')return <p className="transcription-notice text-xs text-muted" role="status">{transcriptionLabel(state)}</p>
- if(state&& !['stopped','error'].includes(state))return null
- return <div className="summary-stopped transcription-notice" data-testid="transcription-notice">
- {state&&<p role="status">{transcriptionLabel(state)}</p>}
- <button className="summary-generate flex items-center gap-2.5 rounded-xl px-3 py-2 text-start text-sm whitespace-nowrap text-ink hover:bg-[var(--line)] focus-visible:bg-[var(--line)] disabled:opacity-50" data-testid="transcription-continue" disabled={disabled} onClick={onContinue}>
- <AudioLines size={15} className="text-muted" aria-hidden="true"/>{hasLines?t('Continue transcription'):t('Transcribe')}
- </button>
+
+export type TranscriptNotice =
+ | { kind: 'waiting'; state: 'waiting-model' | 'waiting-recording' }
+ | { kind: 'transcribe'; state?: 'stopped' | 'error'; run: () => void; disabled: boolean }
+ | { kind: 'upload'; run: () => void }
+
+export function transcriptionNotice(state: TranscriptionState | undefined, run: () => void, disabled: boolean): TranscriptNotice | undefined {
+ if (state === 'waiting-model' || state === 'waiting-recording') return { kind: 'waiting', state }
+ if (!state || state === 'stopped' || state === 'error') return { kind: 'transcribe', state, run, disabled }
+}
+
+export function TranscriptionNotice({ notice, centered, hasLines }: { notice: TranscriptNotice; centered: boolean; hasLines: boolean }) {
+ if (notice.kind === 'waiting') return <p role="status" className={centered ? undefined : 'transcription-notice text-xs text-muted'}>{transcriptionLabel(notice.state)}</p>
+
+ const upload = notice.kind === 'upload'
+ const message = upload ? t("Yogurt couldn't read this audio file.") : transcriptionLabel(notice.state)
+ const label = upload ? t('Upload a file') : hasLines ? t('Continue transcription') : t('Transcribe')
+ const button = <button type="button" data-testid={upload ? undefined : 'transcription-continue'} disabled={!upload && notice.disabled} onClick={notice.run}
+ className={centered || upload ? 'workspace-button' : 'summary-generate flex items-center gap-2.5 rounded-xl px-3 py-2 text-start text-sm whitespace-nowrap text-ink hover:bg-[var(--line)] focus-visible:bg-[var(--line)] disabled:opacity-50'}>
+ {!centered && !upload && <AudioLines size={15} className="text-muted" aria-hidden="true" />}{label}
+ </button>
+
+ if (upload && !centered) return <InlineError testId="upload-preparation-failed"><span>{message}</span>{button}</InlineError>
+ return <div data-testid={upload ? 'upload-preparation-failed' : 'transcription-notice'} data-state={upload ? 'failed' : undefined} role={upload ? 'alert' : undefined}
+ className={centered ? 'transcript-empty-notice' : 'summary-stopped transcription-notice'}>
+ {message && <p role={upload ? undefined : 'status'}>{message}</p>}
+ {button}
</div>
}
diff --git a/app/src/renderer/src/screens/Note.tsx b/app/src/renderer/src/screens/Note.tsx
index 234ebda9..801cab0a 100644
--- a/app/src/renderer/src/screens/Note.tsx
+++ b/app/src/renderer/src/screens/Note.tsx
@@ -1,5 +1,5 @@
import { InlineError, ReadError } from '../components/InlineError'
-import { TranscriptionControl, TranscriptionNotice } from '../components/Transcription'
+import { TranscriptionControl, transcriptionNotice } from '../components/Transcription'
import { transcriptionBusy } from '../../../shared/transcription'
import { citationTargetIndex } from '../../../shared/citations'
import { NoteReadingPane } from '../components/NoteReadingPane'
@@ -465,10 +465,10 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
{(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 notice={
hasAudio && (m.transcriptionPending || !hasTranscript) || m.transcriptionState === 'waiting-model' || m.transcriptionState === 'waiting-recording'
- ? <TranscriptionNotice state={m.transcriptionState} hasLines={hasTranscript} onContinue={() => void runTranscript()} disabled={recording || !!m.stopSavePending} />
+ ? transcriptionNotice(m.transcriptionState, () => void runTranscript(), recording || !!m.stopSavePending)
: !hasAudio && m.transcriptionState === 'error'
- ? <InlineError testId="upload-preparation-failed"><span>{t("Yogurt couldn't read this audio file.")}</span><button className="workspace-button" onClick={() => void openAudioUpload()}>{t('Upload a file')}</button></InlineError>
- : null
+ ? { kind: 'upload', run: () => void openAudioUpload() }
+ : undefined
} id={id} processing={transcribing} replacing={!!m.transcriptionAgain} recording={recording} active={primary === 'transcript'} inline toolbar={transcriptToolbar} focus={at?.ms != null ? { ...at, ms: at.ms } : undefined} />
</section>}
</div>
diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.css
index 6bacc92e..82b582cf 100644
--- a/app/src/renderer/src/styles.css
+++ b/app/src/renderer/src/styles.css
@@ -1021,7 +1021,16 @@ html:not(.widget) button:focus-visible, html:not(.widget) input:focus-visible {
.audio-upload-submit[aria-busy=true] .audio-upload-submit-label { opacity:0; }
.audio-upload-submit-icon { position:absolute;inset:0;display:flex;align-items:center;justify-content:center; }
.audio-upload-date-picker .audio-upload-month button:focus-visible { outline:none; }
-.transcription-notice-slot:empty { display:none; }
+#transcript-lines:has(> .empty-state) { padding-block:0;scrollbar-gutter:stable both-edges; }
+/* Equal space above and below while it fits. In a short pane, give the player clearance first. */
+#transcript-lines > .empty-state {
+ padding-block:0;
+ grid-template-rows:minmax(16px,1fr) auto minmax(max(16px,var(--playback-inset)),1fr);
+}
+/* The shared empty state sits 12px above centre. */
+#transcript-lines > .empty-state > .empty-state-content { grid-row:2;margin-block-end:24px;overflow-wrap:anywhere; }
+.transcript-empty-notice { display:grid;justify-items:center;gap:8px; }
+.transcript-empty-notice .workspace-button { max-width:100%;min-height:var(--button-height);height:auto;white-space:normal; }
/* Floating surfaces keep their solid theme fills until the display permits transparency. */
@supports (backdrop-filter:blur(1px)) and (background:color-mix(in srgb,white,transparent)) {
diff --git a/app/test/uploadPresentation.test.ts b/app/test/uploadPresentation.test.ts
index 0e13c7f4..88e1c188 100644
--- a/app/test/uploadPresentation.test.ts
+++ b/app/test/uploadPresentation.test.ts
@@ -3,7 +3,8 @@ import {afterEach,expect,it,vi} from 'vitest'
import {useState,type ReactElement,type ReactNode} from 'react'
import {Transcript} from '../src/renderer/src/components/Transcript'
import {Swap,SwapText} from '../src/renderer/src/components/Swap'
-import {TranscriptionControl} from '../src/renderer/src/components/Transcription'
+import {TranscriptionControl, TranscriptionNotice, transcriptionNotice, type TranscriptNotice} from '../src/renderer/src/components/Transcription'
+import {renderToStaticMarkup} from 'react-dom/server'
import {stepUploadClock,uploadClock} from '../src/shared/audioUpload'
vi.mock('react',async original=>({...await original<typeof import('react')>(),useState:vi.fn(),useRef:(current:unknown)=>({current}),useMemo:(fn:()=>unknown)=>fn(),useCallback:(fn:unknown)=>fn,useEffect:vi.fn(),useLayoutEffect:vi.fn()}))
@@ -16,12 +17,14 @@ function elements(node:ReactNode):ReactElement<any>[] {
const el=node as ReactElement<any>
return [el,...elements(el.props.children)]
}
-function transcript(processing:boolean,hasLines:boolean,replacing=false) {
+function transcriptElements(processing: boolean, hasLines: boolean, replacing = false, notice?: TranscriptNotice) {
const lines=hasLines?[{id:1,meetingId:'sample',track:'them',startMs:0,endMs:1000,text:'The draft is ready.'}]:[]
const states:unknown[]=[[],lines,false,true,{},false,false,['them']]
vi.mocked(useState).mockImplementation((initial?:unknown):[unknown,()=>void]=>[states.length?states.shift():typeof initial==='function'?initial():initial,()=>{}])
- return elements(Transcript({id:'sample',recording:false,processing,replacing})).map(e=>e.props.className)
+ return elements(Transcript({id:'sample',recording:false,processing,replacing,notice}))
}
+const transcript = (processing: boolean, hasLines: boolean, replacing = false) =>
+ transcriptElements(processing, hasLines, replacing).map(e => e.props.className)
it('shows the transcription placeholder only until the first text, and hides playback while working',()=>{
expect(transcript(true,false)).toContain('transcription-placeholder')
for(const replacing of [false,true]) {
@@ -31,6 +34,64 @@ it('shows the transcription placeholder only until the first text, and hides pla
}
expect(transcript(false,true)).toContain('transcript-player-dock')
})
+
+const rows = (notice: TranscriptNotice | undefined, hasLines = false, processing = false) =>
+ transcriptElements(processing, hasLines, false, notice).filter(e => e.type === 'li')
+
+it('puts a failed file and its working retry in one empty row', () => {
+ const run = vi.fn()
+ const list = rows(transcriptionNotice('error', run, false))
+ expect(list).toHaveLength(1)
+ expect(list[0].props['data-testid']).toBe('transcript-empty')
+ const html = renderToStaticMarkup(list[0])
+ expect(html).toContain('empty-tile')
+ expect(html).toContain('couldn&#x27;t transcribe this file.')
+ expect(html).toContain('>Transcribe</button>')
+ expect(html).not.toContain('Nothing heard yet.')
+ const view = elements(list[0]).find(e => e.type === TranscriptionNotice)!
+ const retry = elements(TranscriptionNotice(view.props)).find(e => e.type === 'button')!
+ expect(retry.props.className).toBe('workspace-button')
+ retry.props.onClick()
+ expect(run).toHaveBeenCalledOnce()
+})
+
+it('keeps the notice above retained lines and offers Continue transcription', () => {
+ const list = rows(transcriptionNotice('stopped', () => {}, true), true)
+ expect(list[0].props.className).toBe('transcription-notice-slot')
+ expect(list[1].props['data-testid']).toBe('transcript-turn')
+ const html = renderToStaticMarkup(list[0])
+ expect(html).toContain('Transcription stopped.')
+ expect(html).toContain('disabled=""')
+ expect(html).toContain('>Continue transcription</button>')
+ expect(html).not.toContain('empty-tile')
+})
+
+it('keeps the silent empty state even when a completed job has audio and no notice', () => {
+ const list = rows(transcriptionNotice('done', () => {}, false))
+ expect(list).toHaveLength(1)
+ expect(renderToStaticMarkup(list[0])).toContain('Nothing heard yet.')
+})
+
+it.each([['waiting-model', 'Waiting for the speech model'], ['waiting-recording', 'Waiting for recording to stop']] as const)(
+ 'centres %s alone while waiting for the first line', (state, message) => {
+ const list = rows(transcriptionNotice(state, () => {}, false), false, true)
+ expect(list).toHaveLength(1)
+ const html = renderToStaticMarkup(list[0])
+ expect(html).toContain(message)
+ expect(html).not.toMatch(/<button|Nothing heard yet|transcription-placeholder/)
+ },
+)
+
+it('keeps the upload recovery action and alert in both presentations', () => {
+ const notice: TranscriptNotice = { kind: 'upload', run: () => {} }
+ for (const hasLines of [false, true]) {
+ const first = rows(notice, hasLines)[0]
+ const html = renderToStaticMarkup(first)
+ expect(html).toContain('role="alert"')
+ expect(html).toContain('>Upload a file</button>')
+ expect(html.includes('empty-tile')).toBe(!hasLines)
+ }
+})
it('keeps the shared busy button box and label, without the extra inset edge',()=>{
const css=readFileSync(new URL('../src/renderer/src/styles.css',import.meta.url),'utf8')
const busy=css.match(/\.note-resume-action\[data-processing=true\] \{([^}]+)\}/)![1]