Skip to content

Add a request/response viewer with pretty-print + raw toggle to ApiUsage test-call panel #149

Description

@greatest0fallt1me

Description

This is a UI/UX issue. ApiUsage.tsx currently shows a "Make Test Call" response as a flat stringified blob. Replace it with a proper request/response viewer that renders JSON in a syntax-highlighted, collapsible tree with a "Pretty / Raw" toggle, so developers can inspect deeply nested fields quickly.

Requirements and Context

  • Reference: src/ApiUsage.tsx — the test-call response area
  • Provide a Pretty / Raw segmented control above the viewer
  • Collapsible nodes must be operable with Enter/Space and expose aria-expanded
  • Long string values should truncate with a "Show more" affordance, not break layout
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b feature/api-usage-response-viewer
  2. Implement changes
    • src/components/JsonViewer.tsx — new component with collapse/expand state
    • src/ApiUsage.tsx — replace the raw <pre> with <JsonViewer value={response} />
    • src/index.css — add .json-key, .json-string, .json-number, .json-bool color tokens for both themes
  3. Test and commit
    • Test with a 5-level-deep mock response
    • Verify Tab order through collapsed/expanded nodes
    • npm test

Example commit message

feat: add JSON request/response viewer to ApiUsage

Acceptance Criteria

  • Pretty/Raw toggle switches between tree view and plain text
  • Each node is keyboard-collapsible and announces aria-expanded
  • Syntax colors meet AA contrast in light and dark themes
  • No horizontal page scroll on deeply nested responses

Guidelines

  • Prefer CSS-driven syntax colors over inline styles
  • Do not pull in a heavy JSON-viewer dependency; a tiny in-house tree is enough
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programaccessibilityWCAG 2.1 AA accessibilitydesignVisual/design-system workenhancementNew feature or improvementui/uxUI/UX design, usability, and visual polish

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions