Use vue-json-pretty for collapsible JSON views - #86
Merged
Conversation
Replace the raw <pre>JSON.stringify()</pre> dumps in AdminView and EmailSignalCard's signal-object modal with a shared JsonView component built on vue-json-pretty. Attributes named in collapsedKeys (defaults to ["body"]) collapse automatically via pathCollapsible for objects/arrays and a custom renderNodeValue truncation for long strings, instead of hand-rolling tree collapse state.
Preview deployedURL: https://email.rhosys.cloud/pr/claude-json-rendering-collapsible-47i5ib/ |
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
<pre>{{ JSON.stringify(..., null, 2) }}</pre>dumps (Thread/Signal inAdminView, and the signal-object modal inEmailSignalCard) with a new sharedsrc/components/ui/JsonView.vuewrapper aroundvue-json-pretty, a maintained Vue 3 JSON tree component — instead of hand-rolling collapse/expand state.JsonViewexposes acollapsedKeysprop (defaults to['body']) so any attribute by name starts collapsed: objects/arrays collapse via vue-json-pretty'spathCollapsiblehook, and long string values (like emailbody) truncate behind a "click to expand" toggle via a customrenderNodeValuerenderer.--ctp-*CSS variables) so it's visually consistent with the rest of the UI.EmailSignalCard's signal-object modal now stores the parsedSignalobject (for the tree view) and derives the stringified JSON via a computed for the existing "Copy" button.Test plan
npx vue-tsc --noEmitnpx eslinton changed files (0 warnings)npx vitest run— full suite (509 tests) passesnpm run build— production build succeeds,JsonViewcode-splits into its own chunkGenerated by Claude Code