Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.
TypeScript ai-meeting-assistantai-notetakerelectrongranola-alternativelinuxllama-cpplocal-ailocal-firstmacosmcpmeeting-minutesmeeting-notesoffline-firstopen-sourceprivacyspeech-to-texttranscriptionwhisperwhisper-cppwindows
fix ask page jumping and dropdown flicker
Eric Brownrout746ae721590d
diff --git a/app/e2e/askContext.spec.ts b/app/e2e/askContext.spec.tsindex dda8e745..c8905842 100644--- a/app/e2e/askContext.spec.ts+++ b/app/e2e/askContext.spec.ts@@ -167,3 +167,53 @@ test('Ask has soft thread edges, compact bubbles, and expands the same reading pawait expect(page.getByTestId('chat-latest')).toHaveCount(0)} finally { await app.close() }})++test('Ask anchors context growth and retains picker results between searches', async () => {+ const app = await electron.launch({ args: [join(import.meta.dirname, '../out/main/index.js')], env: {+ ...process.env, YOGURT_FAKE: '1', YOGURT_USER_DATA: mkdtempSync(join(tmpdir(), 'yogurt-ask-layout-')),+ } })+ try {+ const page = await app.firstWindow()+ await expect(page.getByTestId('home')).toBeVisible()+ for (const title of ['Project review', 'Team planning', 'Launch notes']) {+ const id = await app.evaluate(() => (globalThis as any).__fake__.bigMeeting(2)) as string+ await page.evaluate(({ id, title }) => window.yogurt.meetings.rename(id, title), { id, title })+ }+ const targets = await page.evaluate(() => window.yogurt.conversations.targets(''))+ await app.evaluate(({ ipcMain }, targets) => {+ ipcMain.removeHandler('conversations:targets')+ ipcMain.handle('conversations:targets', async (_event, query: string) => {+ await new Promise(resolve => setTimeout(resolve, 180))+ return targets.filter(target => target.title.toLowerCase().includes(query.toLowerCase()))+ })+ }, targets)+ await page.getByTestId('nav-chat').click()+ const input = page.getByTestId('chat-page-input'), title = page.locator('.ask-home-title'), composer = page.locator('.ask-composer')+ await expect(input).toBeEnabled()+ const top = await title.boundingBox(), composerTop = (await composer.boundingBox())!.y+ await input.fill('@')+ await expect(page.getByRole('option')).toHaveCount(3)+ await expect(page.getByRole('group', { name: 'Folders', exact: true })).toHaveCount(0)+ await page.locator('.ask-picker').evaluate(el => {+ el.dataset.emptyFrame = 'false'+ const observer = new MutationObserver(() => { if (!el.querySelector('[role=option]')) el.dataset.emptyFrame = 'true' })+ observer.observe(el, { childList: true, subtree: true })+ })+ await input.fill('@p'); await input.fill('@pr')+ await expect(page.getByRole('option')).toHaveCount(1)+ await expect(page.locator('.ask-picker')).toHaveAttribute('data-empty-frame', 'false')+ for (const [index, name] of ['Project review', 'Team planning', 'Launch notes'].entries()) {+ await input.fill(`@${name}`)+ await expect(page.getByRole('option')).toHaveCount(1)+ await expect(page.getByRole('option')).toContainText(name)+ await input.press('Enter')+ await expect(page.locator('.ask-context-row')).toHaveCount(index + 1)+ await expect(input).toHaveValue('')+ expect(await title.boundingBox()).toEqual(top)+ expect((await composer.boundingBox())!.y).toBe(composerTop)+ }+ await input.fill('@no-match')+ await expect(page.locator('.ask-picker')).toContainText('Nothing found')+ await expect(page.locator('.ask-picker h3')).toHaveCount(0)+ } finally { await app.close() }+})diff --git a/app/e2e/chatEntrance.spec.ts b/app/e2e/chatEntrance.spec.tsindex e7b92858..a79cb699 100644--- a/app/e2e/chatEntrance.spec.ts+++ b/app/e2e/chatEntrance.spec.ts@@ -5,7 +5,7 @@ import { join } from 'node:path'const before = process.env.YOGURT_UI_REVIEW === 'before'-test('Ask starters stay still and disappear while typing', async ({}, info) => {+test('Ask starters hide without moving the landing layout', async ({}, info) => {const app = await electron.launch({ args: [join(import.meta.dirname, '../out/main/index.js')], env: {...process.env, YOGURT_FAKE: '1', YOGURT_USER_DATA: mkdtempSync(join(tmpdir(), 'yogurt-chat-entrance-')),} })@@ -18,12 +18,24 @@ test('Ask starters stay still and disappear while typing', async ({}, info) => {const starters = page.getByTestId('chat-starter')await expect(starters).toHaveCount(3)if (!before) {- // The new top composer is static; suggestions yield to typing.+ const title = page.locator('.ask-home-title'), composer = page.getByTestId('chat-page-box')+ const titleBox = await title.boundingBox(), composerBox = await composer.boundingBox()expect(await starters.evaluateAll(els => els.every(el => el.getAnimations().length === 0))).toBe(true)await page.getByTestId('chat-page-input').fill('What did we decide?')- await expect(starters).toHaveCount(0)- await page.getByTestId('chat-page-input').fill('')await expect(starters).toHaveCount(3)+ await expect(starters.first()).toBeHidden()+ await expect(page.getByTestId('chat-starters')).toHaveAttribute('aria-hidden', 'true')+ expect(await title.boundingBox()).toEqual(titleBox)+ expect(await composer.boundingBox()).toEqual(composerBox)+ await page.getByTestId('chat-page-input').fill('')+ await expect(starters.first()).toBeVisible()+ expect(await title.boundingBox()).toEqual(titleBox)+ await page.getByRole('button', { name: 'Add a meeting or folder', exact: true }).click()+ await expect(starters.first()).toBeHidden()+ expect(await title.boundingBox()).toEqual(titleBox)+ expect(await composer.boundingBox()).toEqual(composerBox)+ await page.getByTestId('chat-page-input').fill('')+ await expect(starters.first()).toBeVisible()}await page.screenshot({ path: info.outputPath(`chat-${before ? 'before' : 'after'}-${colorScheme}.png`) })await page.getByTestId('nav-home').click()@@ -32,5 +44,12 @@ test('Ask starters stay still and disappear while typing', async ({}, info) => {await page.getByTestId('nav-chat').click()await expect(page.getByTestId('chat-starter')).toHaveCount(3)expect(await page.getByTestId('chat-starter').evaluateAll(els => els.every(el => el.getAnimations().length === 0 && getComputedStyle(el).opacity === '1' && getComputedStyle(el).transform === 'none'))).toBe(true)+ if (!before) {+ const title = page.locator('.ask-home-title'), titleBox = await title.boundingBox()+ await page.getByTestId('chat-page-input').fill('@')+ await expect(page.getByTestId('chat-starter').first()).toBeHidden()+ await expect(page.getByTestId('chat-starters')).toHaveCSS('transition-duration', '0s')+ expect(await title.boundingBox()).toEqual(titleBox)+ }} finally { await app.close() }})diff --git a/app/src/renderer/src/components/AskConversation.tsx b/app/src/renderer/src/components/AskConversation.tsxindex d4a58971..e8cdd300 100644--- a/app/src/renderer/src/components/AskConversation.tsx+++ b/app/src/renderer/src/components/AskConversation.tsx@@ -35,7 +35,8 @@ export function AskConversation({ id, initial, home = false, panel = false, recoconst [changing, setChanging] = useState(false)const [behind, setBehind] = useState(false)const [mention, setMention] = useState<{ start: number; end: number; query: string }>()- const [targets, setTargets] = useState<ContextTarget[]>([])+ const [targetResults, setTargetResults] = useState<{ query: string; items: ContextTarget[] }>()+ const targets = targetResults?.items ?? []const [selected, setSelected] = useState(0)const input = useRef<HTMLTextAreaElement>(null)const focusAfterRemove = useRef(false)@@ -67,9 +68,11 @@ export function AskConversation({ id, initial, home = false, panel = false, reco}, [id])useEffect(() => {let active = true- setTargets([]); setSelected(0)- if (mention) void window.yogurt.conversations.targets(mention.query).then(items => {- if (active) setTargets(items.filter(c => ![...(chat?.chips ?? []), ...(chat?.draftChips ?? [])].some(x => x.kind === c.kind && x.id === c.id)))+ if (!mention) { setTargetResults(undefined); setSelected(0); return }+ // Keep the last completed search visible until the replacement is ready.+ void window.yogurt.conversations.targets(mention.query).then(items => {+ if (!active) return+ setTargetResults({ query: mention.query, items: items.filter(c => ![...(chat?.chips ?? []), ...(chat?.draftChips ?? [])].some(x => x.kind === c.kind && x.id === c.id)) }); setSelected(0)}).catch(() => { if (active) setError(true) })return () => { active = false }}, [mention?.query, !!mention, chat?.chips, chat?.draftChips])@@ -153,8 +156,9 @@ export function AskConversation({ id, initial, home = false, panel = false, recoif (!chat || changing) returnvoid window.yogurt.conversations.current(attachContext(chat.chips, chat.draftChips), true).then(onSelect).catch(() => setError(true))}- const suggestions = !text && unsent && (landing || panel) && <div data-testid={panel ? 'chat-suggestions' : 'chat-starters'} className={`ask-starters${panel ? '' : ' ask-home-starters'}`}>- {starters(chat ? attachContext(chat.chips, chat.draftChips) : [], recording).map(q => <button type="button" key={q} title={q} data-testid={panel ? 'chat-suggestion' : 'chat-starter'} disabled={busy} onClick={() => send(q)}>{q}</button>)}+ const startersHidden = !panel && !!text+ const suggestions = unsent && (landing || panel) && (!panel || !text) && <div data-testid={panel ? 'chat-suggestions' : 'chat-starters'} aria-hidden={startersHidden || undefined} inert={startersHidden} className={`ask-starters${panel ? '' : ' ask-home-starters'}`}>+ {starters(chat ? attachContext(chat.chips, chat.draftChips) : [], recording).map(q => <button type="button" key={q} title={q} data-testid={panel ? 'chat-suggestion' : 'chat-starter'} disabled={busy || startersHidden} onClick={() => send(q)}>{q}</button>)}</div>return <div data-testid={landing ? "chat-empty" : undefined} aria-busy={last?.status === 'answering'} className={`ask-conversation${landing ? ' ask-landing' : ''}`}>{landing ? <h1 className="ask-home-title">{t('Ask about your meetings')}</h1> : <header className="ask-conversation-head">@@ -200,14 +204,15 @@ export function AskConversation({ id, initial, home = false, panel = false, reco</div></div>{mention && <div className="ask-picker" id={`${prefix}-contexts`} role="listbox" aria-label={t('Add context')}>- {(['meeting', 'folder'] as const).map(kind => <div key={kind} role="group" aria-label={kind === 'meeting' ? t('Meetings') : t('Folders')}>+ {(['meeting', 'folder'] as const).map(kind => targets.some(c => c.kind === kind) && <div key={kind} role="group" aria-label={kind === 'meeting' ? t('Meetings') : t('Folders')}><h3>{kind === 'meeting' ? t('Meetings') : t('Folders')}</h3>{targets.map((c, i) => c.kind === kind && <button type="button" role="option" aria-selected={selected === i} id={`${prefix}-context-${i}`} key={`${c.kind}:${c.id}`}onMouseDown={e => e.preventDefault()} onClick={() => insert(c)}>{kind === 'meeting' ? <FileText size={14} /> : <Folder size={14} />}<span>{chipTitle(c)}</span>{c.startedAt && <small>{dayLabel(c.startedAt)}</small>}</button>)}</div>)}- {!targets.length && <p>{t('Nothing found for “{query}”.', { query: mention.query })}</p>}+ {!targetResults && !error && <p role="status">{t('Loading…')}</p>}+ {targetResults && !targets.length && <p>{t('Nothing found for “{query}”.', { query: targetResults.query })}</p>}</div>}</form></LoadingContent></div>diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.cssindex b1ae94b9..bb5e5c12 100644--- a/app/src/renderer/src/workspace.css+++ b/app/src/renderer/src/workspace.css@@ -417,10 +417,11 @@ body:has(.chat-panel[open]) .app-toast-viewport { inset-inline-end:460px; }.ask-recent-button:hover,.ask-recent-button[aria-expanded=true],.ask-back:hover { background:var(--control);color:var(--ink); }.ask-recent-button:active,.ask-back:active { background:var(--control-pressed); }.ask-back { margin-inline-end:auto; }-.ask-page:has(.ask-landing) { padding-bottom:clamp(104px,24vh,240px); }+.ask-page:has(.ask-landing) { container-type:size;padding-bottom:clamp(104px,24vh,240px); }.ask-page:has(.ask-landing) .ask-back { display:none; }.ask-conversation { display:flex;flex-direction:column;min-height:0;min-width:0;flex:1; }-.ask-page>.ask-landing { width:100%;max-width:720px;flex:none;margin:auto; }+/* Anchor to the 194px empty composition; context and multiline drafts grow downward. */+.ask-page>.ask-landing { width:100%;max-width:720px;flex:none;margin:max(0px,calc((100cqh - 194px)/2)) auto 0; }.ask-home-title { margin:0 0 24px;text-align:center;font-size:20px;line-height:26px;font-weight:600;letter-spacing:-.55px; }.ask-page.ask-full-thread:not(:has(.ask-landing)) { overflow:hidden;padding-inline:0; }.ask-full-thread>.ask-conversation:not(.ask-landing) { --ask-reading-inset:max(32px,calc((100% - 720px)/2)); }@@ -484,7 +485,9 @@ body:has(.chat-panel[open]) .app-toast-viewport { inset-inline-end:460px; }.ask-context-row:hover>button,.ask-context-row:focus-within>button { opacity:1; }.ask-starters { display:flex;flex-direction:column;align-items:flex-end;gap:8px;min-width:0; }.ask-starters button { max-width:80%;border:0;border-radius:12px;padding:8px 12px;font-size:12px;line-height:20px;color:var(--muted);text-align:start;background:color-mix(in srgb,var(--control) 50%,transparent); }-.ask-home-starters { flex-direction:row;flex-wrap:wrap;justify-content:center;align-items:center;margin-top:12px; }+.ask-home-starters { opacity:1;visibility:visible;transition:opacity 140ms ease,visibility 0s;flex-direction:row;flex-wrap:wrap;justify-content:center;align-items:center;margin-top:12px; }+.ask-home-starters[aria-hidden=true] { opacity:0;visibility:hidden;pointer-events:none;transition:opacity 140ms ease,visibility 0s 140ms; }+@media (prefers-reduced-motion:reduce) { .ask-home-starters,.ask-home-starters[aria-hidden=true] { transition:none; } }.ask-home-starters button { height:28px;max-width:100%;padding:4px 10px;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }.ask-starters button:hover:not(:disabled) { background:var(--control);color:var(--ink); }.ask-starters button:active:not(:disabled) { background:var(--control-pressed); }diff --git a/app/test/askStarters.test.ts b/app/test/askStarters.test.tsnew file mode 100644index 00000000..d7fdc00f--- /dev/null+++ b/app/test/askStarters.test.ts@@ -0,0 +1,33 @@+import { afterEach, expect, it, vi } from 'vitest'+import { createElement } from 'react'+import { renderToStaticMarkup } from 'react-dom/server'+import { readFileSync } from 'node:fs'+import { AskConversation } from '../src/renderer/src/components/AskConversation'+import type { ConversationView } from '../src/shared/types'++afterEach(() => vi.unstubAllGlobals())+function render(draft: string, panel = false) {+ vi.stubGlobal('window', { matchMedia: () => ({ matches: false }) })+ const initial: ConversationView = { id: 'sample-chat', title: '', chips: [], draft, draftChips: [], firstChips: null, turns: [], waitsForMeeting: false, waitsForModel: false }+ return renderToStaticMarkup(createElement(AskConversation, { id: initial.id, initial, panel, home: !panel, onSelect() {}, onDeleted() {}, onSource() {} }))+}+it('keeps home starters in the layout but inaccessible while drafting, including mentions', () => {+ for (const draft of ['', 'W', '@']) {+ const html = render(draft), container = html.match(/<div data-testid="chat-starters"[^>]*>/)?.[0]+ expect(container).toBeTruthy()+ expect(html.match(/data-testid="chat-starter"/g)).toHaveLength(3)+ if (draft) {+ expect(container).toContain('aria-hidden="true"')+ expect(container).toContain('inert=""')+ expect(html.match(/data-testid="chat-starter" disabled=""/g)).toHaveLength(3)+ } else expect(container).not.toContain('aria-hidden')+ }+ const css = readFileSync(new URL('../src/renderer/src/workspace.css', import.meta.url), 'utf8')+ const hiddenRule = css.match(/\.ask-home-starters\[aria-hidden=true\] \{([^}]+)\}/)?.[1]+ expect(hiddenRule).toContain('visibility:hidden')+ expect(hiddenRule).not.toMatch(/display\s*:|height\s*:/)+})+it('preserves the note panel suggestion behavior', () => {+ expect(render('', true)).toContain('data-testid="chat-suggestions"')+ expect(render('@', true)).not.toContain('data-testid="chat-suggestions"')+})