Skip to content

phase3-2: multi-tab preview (re-opened after base branch deletion)#76

Merged
baochipham942-eng merged 4 commits intomainfrom
phase3-2-preview-tabs
Apr 23, 2026
Merged

phase3-2: multi-tab preview (re-opened after base branch deletion)#76
baochipham942-eng merged 4 commits intomainfrom
phase3-2-preview-tabs

Conversation

@baochipham942-eng
Copy link
Copy Markdown
Owner

Replaces #72 (auto-closed when its base branch `phase3-multi-preview` was deleted after #71 merged).

Content identical to #72 — Phase 3.2 multi-tab preview panel: tab-aware appStore model, PreviewTabs UI, LRU eviction at MAX=8, and extending in-app preview to md/csv/tsv/txt.

See #72 for original description. All commits preserved.

林晨 and others added 4 commits April 22, 2026 21:59
Introduces PreviewTab in appStore with per-tab content/savedContent/
mode/lastActivatedAt/isLoaded. Replaces previewFilePath with
previewTabs + activePreviewTabId. openPreview becomes a dedup-and-
activate action, so clicking the same artifact twice focuses the
existing tab instead of re-opening.

PreviewPanel now reads editor state from the active tab (content,
saved content, mode) and writes back via store actions
(updatePreviewTabContent, updatePreviewTabMode, markPreviewTabLoaded,
markPreviewTabSaved). Transient UI state (isLoading/isSaving/error/
isMaximized/isExporting) stays in the component.

No visible UI change yet: the tab bar arrives in the next commit. But
content state is now preserved across future tab switches because it
lives in the store rather than component-local useState.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds PreviewTabs.tsx rendering one row per open file above the panel
header. Clicking a tab activates it, X or middle-click closes it, and
the dirty indicator (amber dot) surfaces unsaved edits. closePreviewTab
in the store already picks the next most-recently-activated tab as
successor and hides the panel when the last tab closes.

With commit d043d2f's per-tab content state, tab switching now
preserves edit buffers — switching away from a markdown tab with
unsaved changes and coming back keeps the draft intact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Opening a 9th file now evicts the least-recently-activated tab.
lastActivatedAt switches from Date.now() to a monotonic counter so
rapid same-tick activations don't collide in MRU ordering.

Adds 7 unit tests covering dedup-by-path, LRU eviction, MRU successor
on close, panel hide on last-close, and the load/save content
lifecycle (markPreviewTabLoaded / markPreviewTabSaved).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
QuickFileActions and FileResultDisplay both gated the "Open preview"
button behind an isHtml-only check, so clicking a.md / c.ts / d.csv
fell through to the OS default app. PreviewPanel already renders
markdown and csv/tsv via dedicated panes (Phase 2), so the UI was the
bottleneck.

Introduces src/renderer/utils/previewable.ts as the single source of
truth for "what PreviewPanel can render cleanly" (md/mdx/markdown,
csv/tsv, html/htm, txt). ToolCallDisplay's two file-action surfaces
now use isPreviewable() instead of the narrow isHtml check.

ts/tsx/jsx/json/yaml are intentionally out of scope — they need the
CodeMirror editor from Phase 3.3 to be usefully rendered.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-agent Ready Ready Preview, Comment Apr 23, 2026 0:07am

@baochipham942-eng baochipham942-eng merged commit 60201cc into main Apr 23, 2026
3 checks passed
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