Add copy-payload and collapse controls to event log rows
Description
src/app/events/page.tsx renders every event's payload in a fully expanded <pre>{JSON.stringify(e.payload, null, 2)}</pre> block with no way to copy a payload or collapse large ones, so a log of verbose payloads becomes a long scroll. This issue adds a per-row copy button and a collapse/expand affordance.
Requirements and context
- Repository scope: StableRoute-Org/Stableroute-frontend only.
- Add a "Copy JSON" control per row (reuse
src/components/Button.tsx) that writes the pretty-printed payload to the clipboard via navigator.clipboard.writeText, feature-detected with a graceful no-op fallback.
- Add a per-row collapse/expand toggle (using
aria-expanded and aria-controls) that hides the <pre> block; default to collapsed when the serialized payload exceeds a threshold (e.g. 400 chars).
- Keep the
type label, the role="alert" error region, row keying by e.id, and chronological order intact.
- Do not log payloads to the console.
Suggested execution
- Fork the repo and create a branch
git checkout -b enhancement/events-03-copy-collapse
- Implement changes
- Test and commit
Test and commit
- Run
npm run lint, npm test, and npm run build.
- Cover edge cases: small payload, large payload default-collapsed, clipboard available, and clipboard absent.
- Include the full
npm test output in the PR description.
Example commit message
feat: add copy-JSON and collapse controls to event log rows
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the StableRoute community on Discord for questions, reviews, and faster merges: https://discord.gg/37aCpusvx
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Add copy-payload and collapse controls to event log rows
Description
src/app/events/page.tsxrenders every event's payload in a fully expanded<pre>{JSON.stringify(e.payload, null, 2)}</pre>block with no way to copy a payload or collapse large ones, so a log of verbose payloads becomes a long scroll. This issue adds a per-row copy button and a collapse/expand affordance.Requirements and context
src/components/Button.tsx) that writes the pretty-printed payload to the clipboard vianavigator.clipboard.writeText, feature-detected with a graceful no-op fallback.aria-expandedandaria-controls) that hides the<pre>block; default to collapsed when the serialized payload exceeds a threshold (e.g. 400 chars).typelabel, therole="alert"error region, row keying bye.id, and chronological order intact.Suggested execution
git checkout -b enhancement/events-03-copy-collapsesrc/app/events/page.tsxusingsrc/components/Button.tsx.src/app/events/page.test.tsx— mock the clipboard and assert collapse/expand togglesaria-expanded.README.md.Test and commit
npm run lint,npm test, andnpm run build.npm testoutput in the PR description.Example commit message
feat: add copy-JSON and collapse controls to event log rowsGuidelines
Community & contribution rewards