Preview pane for non-module files in Module Inspector#4009
Merged
Conversation
Preview deployments |
fa12796 to
d9ee46e
Compare
Contributor
There was a problem hiding this comment.
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.
packages/host/app/components/operator-mode/code-submode/module-inspector.gts
Show resolved
Hide resolved
packages/host/app/components/operator-mode/code-submode/module-inspector.gts
Show resolved
Hide resolved
packages/host/app/components/operator-mode/code-submode/module-inspector.gts
Show resolved
Hide resolved
Contributor
backspace
approved these changes
Feb 18, 2026
habdelra
reviewed
Feb 18, 2026
packages/host/app/components/operator-mode/code-submode/module-inspector.gts
Show resolved
Hide resolved
522bfeb to
696a80c
Compare
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>
696a80c to
f293408
Compare
Contributor
Author
I'll capture this in a separate issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
FilePreviewPanelcomponent that renders a FileDef instance with a format toggle bar (isolated/embedded/fitted/atom)fileDefResourceinmodule-inspector.gtsthat loads the FileDef viastore.get(url, { type: 'file-meta' })when an incompatible file is selectedcode-submode-test.tsto 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
.pngfile in CodeMode → should see image preview with format toggle.jsonnon-card file → should see FileDef preview.gtsmodule → should see existing Schema/Playground/Spec (unchanged).json→ should see existing CardRendererPanel (unchanged)🤖 Generated with Claude Code