Skip to content

Preview pane for non-module files in Module Inspector#4009

Merged
lukemelia merged 1 commit intomainfrom
cs-10196-file-preview-panel
Feb 18, 2026
Merged

Preview pane for non-module files in Module Inspector#4009
lukemelia merged 1 commit intomainfrom
cs-10196-file-preview-panel

Conversation

@lukemelia
Copy link
Contributor

@lukemelia lukemelia commented Feb 17, 2026

Summary

  • Added FilePreviewPanel component that renders a FileDef instance with a format toggle bar (isolated/embedded/fitted/atom)
  • Added a reactive fileDefResource in module-inspector.gts that loads the FileDef via store.get(url, { type: 'file-meta' }) when an incompatible file is selected
  • Updated the template decision chain to show the preview (with loading state) instead of the "No tools available" message
  • Updated tests in code-submode-test.ts to assert [data-test-file-preview-panel] instead of [data-test-file-incompatibility-message]
Screen.Recording.2026-02-17.at.5.49.35.PM.mov

Test plan

  • Open a .png file in CodeMode → should see image preview with format toggle
  • Open a .json non-card file → should see FileDef preview
  • Open a .gts module → should see existing Schema/Playground/Spec (unchanged)
  • Open a card instance .json → should see existing CardRendererPanel (unchanged)
  • Toggle between formats (isolated/embedded/fitted/atom) → should re-render
  • Verify existing code-submode tests pass

🤖 Generated with Claude Code

@github-actions
Copy link

Preview deployments

@github-actions
Copy link

github-actions bot commented Feb 17, 2026

Host Test Results

    1 files  ±0      1 suites  ±0   1h 40m 5s ⏱️ -4s
1 849 tests ±0  1 836 ✅ ±0  13 💤 ±0  0 ❌ ±0 
1 864 runs  ±0  1 851 ✅ ±0  13 💤 ±0  0 ❌ ±0 

Results for commit f293408. ± Comparison against base commit 38d8042.

♻️ This comment has been updated with latest results.

@lukemelia lukemelia force-pushed the cs-10196-file-preview-panel branch 2 times, most recently from fa12796 to d9ee46e Compare February 17, 2026 19:12
@lukemelia lukemelia changed the title CS-10196: Preview pane for non-module files in Module Inspector Preview pane for non-module files in Module Inspector Feb 17, 2026
@lukemelia lukemelia marked this pull request as ready for review February 17, 2026 20:26
@lukemelia lukemelia requested review from a team, backspace and Copilot February 17, 2026 20:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a preview capability for non-module files in the Module Inspector. Instead of showing a "No tools available" message for incompatible files (like images, non-card JSON files, or text files), the system now loads and renders these files as FileDef instances with a format toggle bar.

Changes:

  • Added FilePreviewPanel component to render FileDef instances with format selection (isolated/embedded/fitted/atom)
  • Implemented fileDefResource in module-inspector to reactively load FileDef via store.get with file-meta type
  • Replaced file incompatibility message with preview panel and loading states in the template decision chain

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

File Description
packages/host/app/components/operator-mode/code-submode/file-preview-panel.gts New component that renders a FileDef with CardRenderer and FormatChooser, providing preview functionality for non-module files
packages/host/app/components/operator-mode/code-submode/module-inspector.gts Added fileDefResource to load FileDef instances, added template conditions to show preview panel or loading state instead of incompatibility message
packages/host/tests/acceptance/code-submode-test.ts Updated test assertions to check for file-preview-panel element instead of file-incompatibility-message

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@backspace
Copy link
Contributor

The test plan suggests opening a non-card JSON file but this one won’t render, what’s expected?

e8c0a21ef0e0f5101a0d9e590435203ca7bf96af 2026-02-18 08-16-03

Copy link
Contributor

@backspace backspace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this in the preview deployment, success

Image

Since we control the rendering (right?) why not add a bit of padding beneath the filename? It looks weird right up against the bottom edge

@lukemelia lukemelia force-pushed the cs-10196-file-preview-panel branch 2 times, most recently from 522bfeb to 696a80c Compare February 18, 2026 16:59
When a non-module file (e.g., .png, .css, .json non-card) is selected in
CodeMode, the Module Inspector now renders a FilePreviewPanel showing the
file's FileDef instance with a format toggle (isolated/embedded/fitted/atom)
instead of the "No tools available" message.

Make it a template-only component

Unify CardRendererPanel and FilePreviewPanel into PreviewPanel

Merge the separate FilePreviewPanel into a single PreviewPanel component
that handles both card instances and file defs. The component now accepts
BaseDef instead of CardDef, guards card-specific features (edit, menu items,
open in interact mode) behind isCardInstance checks, and filters out the
edit format for non-card files.

Enrich existing code-submode tests to verify that file previews (FileDef)
don't show edit format or edit button, while card previews do.

- Change fileDefResource and fileDefInstance from BaseDef to FileDef for
  better type safety since store.get with 'file-meta' returns FileDef.
- Add fileDefError getter and show a meaningful error message in the
  incompatibility fallback when the file preview fails to load.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lukemelia lukemelia force-pushed the cs-10196-file-preview-panel branch from 696a80c to f293408 Compare February 18, 2026 17:03
@lukemelia
Copy link
Contributor Author

The test plan suggests opening a non-card JSON file but this one won’t render, what’s expected?

I'll capture this in a separate issue

@lukemelia lukemelia merged commit e2c80a4 into main Feb 18, 2026
106 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.

3 participants

Comments