Link previews in a bubble-tail popover, plus a thumbnail layer for attachments #271

Open
opened 2026-10-14 12:41:09 +00:00 by kayg · 2 comments
Owner

kayg, 2026-10-14: when a link points at something inside Calternal (a note or any attachment), show a preview in the same bubble-tail popover as the link editor (#255). It's one component, and it places itself above, below or beside the link wherever the screen has room. "That's super important for great UX."

Preview content by kind:

  • Note: title and the first few lines, using the same renderer as the editor (#245 point 12).
  • Image: a thumbnail.
  • Video: a poster frame and the length.
  • PDF: the first page and the page count.
  • Text, code or CSV: the first lines, highlighted.
  • Audio: the waveform.
  • Web link: the preview card (#165).

When it shows (Claude's proposal, to confirm with kayg):

  • Desktop: hover the pill for about 400 ms, or focus it with the keyboard and press Space. It leaves when the pointer does, unless you move into it.
  • Phone: a long press shows the preview at the top of the popover, with the Name / Link / Show in place fields below it. One popover, two halves.

Server: a thumbnail layer. Generate and cache small previews:

  • image thumbnails in several sizes, including HEIC;
  • a video poster frame through ffmpeg in a sandbox;
  • a PDF's first page;
  • a text excerpt.

Requirements:

  • content-addressed and cached on disk;
  • generated in the background, never blocking typing;
  • zero idle CPU (#44);
  • size and time limits, with no decoding of untrusted files in-process if it can be avoided;
  • served same-origin under the CSP.

This also feeds the attachment cards (#172) and the gallery.

Perf: a preview opens in under 100 ms from cache; thumbnails are made within seconds of an upload.

kayg, 2026-10-14: when a link points at something inside Calternal (a note or any attachment), show a **preview** in the same bubble-tail popover as the link editor (#255). It's one component, and it places itself above, below or beside the link wherever the screen has room. "That's super important for great UX." **Preview content by kind:** - **Note:** title and the first few lines, using the same renderer as the editor (#245 point 12). - **Image:** a thumbnail. - **Video:** a poster frame and the length. - **PDF:** the first page and the page count. - **Text, code or CSV:** the first lines, highlighted. - **Audio:** the waveform. - **Web link:** the preview card (#165). **When it shows (Claude's proposal, to confirm with kayg):** - **Desktop:** hover the pill for about 400 ms, or focus it with the keyboard and press Space. It leaves when the pointer does, unless you move into it. - **Phone:** a long press shows the preview at the top of the popover, with the Name / Link / Show in place fields below it. One popover, two halves. **Server: a thumbnail layer.** Generate and cache small previews: - image thumbnails in several sizes, including HEIC; - a video poster frame through ffmpeg in a sandbox; - a PDF's first page; - a text excerpt. Requirements: - content-addressed and cached on disk; - generated in the background, never blocking typing; - zero idle CPU (#44); - size and time limits, with no decoding of untrusted files in-process if it can be avoided; - served same-origin under the CSP. This also feeds the attachment cards (#172) and the gallery. **Perf:** a preview opens in under 100 ms from cache; thumbnails are made within seconds of an upload.
Author
Owner

Scope (kayg): keep this to the minimum needed for previews:

  • thumbnails, a video poster frame, a PDF's first page and text excerpts;
  • built behind the hard performance gate: benchmark, then optimise.

Smarter features are separate later issues: #273 (OCR and auto-tagging) and #274 (photo recognition). We stay lean, and we never repeat v0.

**Scope (kayg):** keep this to the **minimum needed for previews**: - thumbnails, a video poster frame, a PDF's first page and text excerpts; - built behind the hard performance gate: benchmark, then optimise. Smarter features are separate later issues: #273 (OCR and auto-tagging) and #274 (photo recognition). We stay lean, and we never repeat v0.
Author
Owner

Decided by kayg (2026-10-14):

When a preview shows:

  • Desktop: after about 400 ms of hover, or on keyboard focus plus Space.
  • Phone: a long press shows the preview on top, with the Name / Link / Show in place fields below.

Benchmark (points 1–4 accepted), measured on the perf VM:

  1. Test files:
    • 1,000 photos (JPEG/HEIC/PNG, some 40 MP);
    • 200 PDFs (1 to 500 pages, some scanned);
    • 100 videos;
    • 200 text/code/CSV files;
    • the 100k-note home.
  2. Measures:
    • time to make each preview, p50/p99, by kind;
    • time to open from the cache, p50/p99;
    • memory and CPU per file;
    • cache size on disk;
    • idle CPU after the queue drains (must be zero);
    • save latency while 100 photos upload (ties in with #298).
  3. Pass marks:
    • cached open under 100 ms p99;
    • a photo thumbnail within 2 s;
    • a PDF first page within 3 s;
    • no save regression during uploads;
    • under 256 MB per file being made.
  4. Wired into perf/budgets.json, so a regression fails CI.

kayg's addition, the real test: "spam scrolling on pages and having the full page load with all of its contents as we blaze through multiple notes."

  • Blaze test: a browser test on the perf VM against the 100k home with attachment-heavy notes (galleries, PDFs, videos, link cards, note cards).
    • It flicks through 50 notes (j/k, or list taps at about 100 ms each).
    • Then it fling-scrolls each long note top to bottom and back.
  • Measured:
    • for each note, the time until everything on screen is fully drawn (every thumbnail, card and preview in place, no placeholders left), p50/p99;
    • dropped frames and long tasks during the scroll;
    • layout shift when content arrives (must be zero; space reserved from the known sizes);
    • that obsolete requests for notes already left are cancelled, so they never block the current one;
    • that the cache is hit when going back;
    • that memory stays flat after 50 notes, with no growth from images that weren't released.
  • Pass:
    • a note fully drawn within 300 ms of arriving when cached, and within 1 s cold;
    • no frame over 50 ms while scrolling;
    • layout shift 0;
    • memory flat within 10% over the run.
**Decided by kayg (2026-10-14):** **When a preview shows:** - **Desktop:** after about 400 ms of hover, or on keyboard focus plus Space. - **Phone:** a long press shows the preview on top, with the Name / Link / Show in place fields below. **Benchmark (points 1–4 accepted), measured on the perf VM:** 1. **Test files:** - 1,000 photos (JPEG/HEIC/PNG, some 40 MP); - 200 PDFs (1 to 500 pages, some scanned); - 100 videos; - 200 text/code/CSV files; - the 100k-note home. 2. **Measures:** - time to make each preview, p50/p99, by kind; - time to open from the cache, p50/p99; - memory and CPU per file; - cache size on disk; - idle CPU after the queue drains (must be zero); - save latency while 100 photos upload (ties in with #298). 3. **Pass marks:** - cached open under 100 ms p99; - a photo thumbnail within 2 s; - a PDF first page within 3 s; - no save regression during uploads; - under 256 MB per file being made. 4. **Wired into perf/budgets.json**, so a regression fails CI. **kayg's addition, the real test:** "spam scrolling on pages and having the full page load with all of its contents as we blaze through multiple notes." - **Blaze test:** a browser test on the perf VM against the 100k home with attachment-heavy notes (galleries, PDFs, videos, link cards, note cards). - It flicks through 50 notes (j/k, or list taps at about 100 ms each). - Then it fling-scrolls each long note top to bottom and back. - **Measured:** - for each note, the time until everything on screen is fully drawn (every thumbnail, card and preview in place, no placeholders left), p50/p99; - dropped frames and long tasks during the scroll; - layout shift when content arrives (must be zero; space reserved from the known sizes); - that obsolete requests for notes already left are cancelled, so they never block the current one; - that the cache is hit when going back; - that memory stays flat after 50 notes, with no growth from images that weren't released. - **Pass:** - a note fully drawn within 300 ms of arriving when cached, and within 1 s cold; - no frame over 50 ms while scrolling; - layout shift 0; - memory flat within 10% over the run.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#271
No description provided.