Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Notes: a long meeting name shortens so Resume and Copy stay on the first line

Eric Brownroutb61eb284e211
diff --git a/app/src/renderer/src/components/NoteDate.tsx b/app/src/renderer/src/components/NoteDate.tsx
index f995874a..27136870 100644
--- a/app/src/renderer/src/components/NoteDate.tsx
+++ b/app/src/renderer/src/components/NoteDate.tsx
@@ -12,6 +12,37 @@ import { useNotePopover } from '../useNotePopover'
import { useLoadingState } from '../useLoadingState'
import { nearestEvents, shiftCalendarDay } from '../../../shared/calendarPicker'
+/** Give the linked name the space left after the other chips and actions choose their widths. */
+function fitNoteEventName(name: HTMLSpanElement | null) {
+ const button = name?.closest('button')
+ const chips = button?.closest('.note-metadata')
+ const row = chips?.closest('.note-meta-row')
+ const actions = row?.querySelector('.note-header-actions')
+ if (!name || !button || !row || !chips || !actions) return
+ const context = document.createElement('canvas').getContext('2d')!
+ const width = (el: Element) => el.getBoundingClientRect().width
+ const gap = (el: Element) => parseFloat(getComputedStyle(el).columnGap)
+ const fit = () => {
+ context.font = getComputedStyle(name).font
+ const minimum = context.measureText('0').width * 8
+ let onChipsLine = width(row) - (width(button) - width(name))
+ const chipGap = gap(chips)
+ for (const chip of chips.children) {
+ if (chip === button.parentElement) continue
+ observer.observe(chip)
+ if (chip.getClientRects().length) onChipsLine -= width(chip) + chipGap
+ }
+ const besideActions = onChipsLine - width(actions) - gap(row)
+ // When actions need their own line, give their space back to the name.
+ const budget = besideActions >= minimum ? besideActions : Math.max(minimum, onChipsLine)
+ name.style.maxInlineSize = `${budget}px`
+ }
+ const observer = new ResizeObserver(fit)
+ for (const el of [row, chips, actions, ...button.children]) observer.observe(el)
+ fit()
+ return () => observer.disconnect()
+}
+
export function NoteDate({ m }: { m: Meeting }) {
const [open, setOpen] = useState<false | 'pointer' | 'keyboard'>(false)
const presence = usePopoverPresence(open)
@@ -28,7 +59,7 @@ export function NoteDate({ m }: { m: Meeting }) {
<CalendarDays size={14} strokeWidth={1.75} aria-hidden="true" /><span>{date}</span>
{eventTitle && <>
<span aria-hidden="true" className={color ? 'note-date-chip-dot' : undefined} style={{ backgroundColor: color }}>{color ? null : ' · '}</span>
- <span className="note-date-chip-name" dir="auto">{eventTitle}</span>
+ <span ref={fitNoteEventName} className="note-date-chip-name" dir="auto">{eventTitle}</span>
</>}
</button>
{presence.value && <DateCard key={m.id} m={m} details={details} event={event} eventTitle={eventTitle} color={color} refreshLinked={refresh} chip={chip} motionProps={presence.props} onClose={close} />}
diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.css
index 15dae1c6..9efe431c 100644
--- a/app/src/renderer/src/styles.css
+++ b/app/src/renderer/src/styles.css
@@ -544,7 +544,7 @@ input::selection, textarea::selection, .note-prose ::selection { background: var
.note-header { flex:none;padding-top:84px; }
.note-metadata { display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0; }
.note-meta-row { display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-top:16px; }
-.note-header-actions { display:flex;align-items:center;flex-wrap:wrap;gap:12px; }
+.note-header-actions { display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:12px;margin-inline-start:auto; }
.note-recorder-controls { display:flex;align-items:center;gap:8px; }
.note-elapsed { font-size:11px;font-variant-numeric:tabular-nums;color:var(--muted);white-space:nowrap; }
.note-primary-tabs { position:relative;display:flex;gap:24px;margin-top:22px;border-bottom:1px solid var(--line); }
@@ -779,7 +779,7 @@ html:not(.widget) button:focus-visible, html:not(.widget) input:focus-visible {
/* Calendar linking lives in the date popover; attendee editing stays in People. */
.note-date-anchor { min-width:0;max-width:min(100%, 17rem); }
.note-date-chip { max-width:100%;white-space:nowrap; }
-.note-date-chip>svg { flex:none; }
+.note-date-chip>:not(.note-date-chip-name) { flex:none; }
.note-date-chip-dot { width:6px;height:6px;border-radius:50%;flex:none; }
.note-date-chip-name { min-width:0;overflow:hidden;text-overflow:ellipsis; }
.note-date-card { --note-date-ms:var(--dur-base);--note-date-ease:var(--ease-out); }
diff --git a/app/test/noteHeaderFit.test.ts b/app/test/noteHeaderFit.test.ts
new file mode 100644
index 00000000..0303cbb9
--- /dev/null
+++ b/app/test/noteHeaderFit.test.ts
@@ -0,0 +1,74 @@
+import { readFileSync } from 'node:fs'
+import { afterEach, expect, it, vi } from 'vitest'
+import { Children, isValidElement, type ReactNode } from 'react'
+import type { Meeting } from '../src/shared/types'
+import { NoteDate } from '../src/renderer/src/components/NoteDate'
+
+vi.mock('react', async original => ({
+ ...await original<typeof import('react')>(),
+ useState: (value: unknown) => [value, vi.fn()], useRef: () => ({ current: null }), useCallback: (fn: unknown) => fn,
+}))
+vi.mock('../src/renderer/src/motion', () => ({ usePopoverPresence: () => ({}) }))
+vi.mock('../src/renderer/src/useNoteCalendar', () => ({ useNoteCalendar: () => ({}) }))
+afterEach(() => vi.unstubAllGlobals())
+
+type ChipChild = { className?: string; children?: ReactNode; ref?: (el: HTMLElement) => (() => void) | undefined }
+function findName(node: ReactNode): ChipChild | undefined {
+ if (!isValidElement<ChipChild>(node)) return
+ if (node.props.className === 'note-date-chip-name') return node.props
+ return Children.toArray(node.props.children).map(findName).find(Boolean)
+}
+
+it('ellipsizes the linked name to fit Resume and Copy at 764px and returns their space on wrap', () => {
+ // Border boxes from the 2× screenshot. The full name occupies 132px of the 227.5px date chip.
+ const box = (width: number) => ({ getBoundingClientRect: () => ({ width }), getClientRects: () => [1] })
+ const anchor = box(227.5), people = box(151.5), folder = box(119)
+ const actions = box(248), row = { ...box(764), querySelector: () => actions }
+ const chips = { children: [anchor, people, folder], closest: () => row }
+ const button = { ...box(227.5), parentElement: anchor, closest: () => chips, children: [] }
+ const name = { ...box(132), closest: () => button, style: { maxInlineSize: '' } }
+ let resize!: () => void
+ const disconnect = vi.fn()
+ vi.stubGlobal('ResizeObserver', class {
+ constructor(callback: () => void) { resize = callback }
+ observe() {}
+ disconnect = disconnect
+ })
+ vi.stubGlobal('getComputedStyle', (el: unknown) => ({ columnGap: el === row ? '12px' : '8px', font: '13px system-ui' }))
+ vi.stubGlobal('document', { createElement: () => ({ getContext: () => ({ measureText: () => ({ width: 8 }) }) }) })
+
+ const eventTitle = 'BOWLS AND DOMION'
+ const date = NoteDate({ m: { startedAt: Date.now(), eventId: 'linked', eventTitle } as Meeting })
+ const renderedName = findName(date)
+ expect(renderedName).toBeDefined()
+ const cleanup = renderedName?.ref?.(name as unknown as HTMLElement)
+ const used = () => Math.min(132, parseFloat(name.style.maxInlineSize) || 132)
+ const rowWidth = () => 514 - (132 - used()) + 12 + 248
+ expect(rowWidth()).toBe(764) // previously 774px
+ expect(used()).toBe(122)
+
+ row.getBoundingClientRect = () => ({ width: 450 })
+ resize()
+ expect(used()).toBe(68)
+ row.getBoundingClientRect = () => ({ width: 400 })
+ resize()
+ expect(used()).toBe(64) // retain eight characters before other chips wrap
+ // With the recording controls and two chips, the same rule uses the new widths.
+ row.getBoundingClientRect = () => ({ width: 530 })
+ chips.children = [anchor, folder]
+ actions.getBoundingClientRect = () => ({ width: 214 })
+ resize()
+ expect(used()).toBe(81.5)
+ chips.children = [anchor]
+ resize()
+ expect(used()).toBe(132)
+ cleanup?.()
+ expect(disconnect).toHaveBeenCalledOnce()
+})
+
+it('anchors wrapped actions to the inline end in both writing directions', () => {
+ const css = readFileSync(new URL('../src/renderer/src/styles.css', import.meta.url), 'utf8')
+ const actions = css.match(/\.note-header-actions \{([^}]+)\}/)?.[1]
+ expect(actions).toContain('margin-inline-start:auto')
+ expect(actions).toContain('justify-content:flex-end')
+})