Skip to content

feat(v2): inline artifact previews in inspector detail#271

Merged
samxu01 merged 1 commit intomainfrom
feat/v2-artifact-previews
May 3, 2026
Merged

feat(v2): inline artifact previews in inspector detail#271
samxu01 merged 1 commit intomainfrom
feat/v2-artifact-previews

Conversation

@samxu01
Copy link
Copy Markdown
Contributor

@samxu01 samxu01 commented May 3, 2026

Adds an inline preview pane to the artifact detail sub-page so a member opening an artifact sees the content without leaving the inspector — the YC demo "the artifacts are in the room" beat.

Preview matrix

File uploads (signed-URL fetch, 200 KB cap on text reads):

Kind Preview
image ``
pdf `<iframe>` (browsers render PDF natively)
md ReactMarkdown render
txt monospace `
`
json JSON.stringify pretty-print (fall through to raw on parse fail)
csv naive table render of first 20 rows
office, archive, unknown no preview (Open button only)

URL artifacts (iframe where the vendor allows it):

Kind Embed
youtube `www.youtube.com/embed/` (handles youtu.be / watch / shorts)
loom `www.loom.com/embed/`
figma `www.figma.com/embed?url=`
notion / drive / docs / sheets / slides / github click-through only (vendor blocks iframe via X-Frame-Options)

Implementation notes

  • Helpers `useSignedFileUrl` and `useTextPreview` are local to V2PodInspector. No new shared utilities until a 3rd consumer appears (REVIEW.md §over-engineering).
  • Text fetch uses ReadableStream so a 50 MB log file aborts mid-read rather than buffering then truncating.
  • All inline styles use `var(--v2-*)` tokens; no hardcoded hex.

Out of scope (deferred)

  • Office doc preview (needs Office Online viewer or server-side LibreOffice — too heavy for demo path).
  • Notion embed (vendor blocks iframe by default).
  • Click file pill in chat → open inspector to artifact (would need V2PodChat → V2Layout handle wiring; new tab flow stays).

Test plan

  • Deploy dev: `gh workflow run deploy-dev.yml --ref main`
  • In Sam's YC Sprint pod, click the smoke-test.md artifact → markdown renders inline
  • Upload a .pdf in chat → click the artifact → PDF renders in iframe
  • Add a YouTube URL via "+ Add" → click the artifact → video plays in iframe
  • Add a Figma URL → embed renders
  • Add a Notion URL → no preview, click Open instead
  • Upload a .json → pretty-printed JSON visible
  • Upload a .csv → table renders, first 20 rows

🤖 Generated with Claude Code

Adds an inline preview pane to the artifact detail sub-page so a
member opening an artifact sees the content without leaving the
inspector — the YC demo "the artifacts are in the room" beat.

Files (signed-URL fetch, 200 KB cap on text reads):
- image  → <img> (existing signed-URL flow)
- pdf    → <iframe> (browsers render PDF natively)
- md     → ReactMarkdown render
- txt    → monospace <pre>
- json   → JSON.stringify pretty-print, fall through to raw on parse fail
- csv    → naive table render of first 20 rows
- office / archive / unknown → no preview (Open button only)

URL artifacts (iframe where the vendor allows it):
- youtube → www.youtube.com/embed/<id> (handles youtu.be / watch / shorts)
- loom    → www.loom.com/embed/<id>
- figma   → www.figma.com/embed?url=<original>

Notion / Drive / Docs / Sheets / Slides / GitHub stay click-through
because each vendor returns X-Frame-Options=DENY for unauth viewers.

Implementation:
- Helpers `useSignedFileUrl` and `useTextPreview` keep the fetch / cache
  logic local — no new shared utilities until a 3rd consumer appears.
- Text fetch uses ReadableStream so a 50 MB log file aborts mid-read
  rather than buffering then truncating.
- All inline styles use var(--v2-*) tokens; no hardcoded hex.

Out of scope (deferred):
- Office docs preview (needs Office Online viewer or server-side
  LibreOffice — too heavy for the demo path)
- Notion embed (vendor blocks iframe by default)
- Click pill in chat → open inspector to artifact (would need
  V2PodChat → V2Layout handle wiring; new tab flow stays for now)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@samxu01 samxu01 merged commit d52bd7b into main May 3, 2026
6 of 7 checks passed
@samxu01 samxu01 deleted the feat/v2-artifact-previews branch May 3, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant