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
- Fork the repo and create a branch
git checkout -b feature/api-usage-response-viewer
- 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
- 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
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
Description
This is a UI/UX issue.
ApiUsage.tsxcurrently 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
src/ApiUsage.tsx— the test-call response areaPretty / Rawsegmented control above the vieweraria-expandedSuggested Execution
src/components/JsonViewer.tsx— new component with collapse/expand statesrc/ApiUsage.tsx— replace the raw<pre>with<JsonViewer value={response} />src/index.css— add.json-key,.json-string,.json-number,.json-boolcolor tokens for both themesnpm testExample commit message
Acceptance Criteria
aria-expandedGuidelines