feat: add shared truncated address component - #463
Conversation
Adds a shared StellarAddress.tsx component with middle truncation (first 6/last 4 chars), an explorer link to Stellar Expert, a custom dark tooltip showing the full address on hover with select-all support, a one-click copy button that shows a "Copied" badge for 1.5s, and an sr-only label for screen readers. Integrates it into ServiceCard.tsx, AgentCard.tsx, and agents/[address]/page.tsx (both the profile header and the owner field), removing duplicate local truncation/copy helpers and clipboard state along the way. Fixes two pre-existing issues surfaced during integration: a missing makeAgent helper in sort.test.ts and a missing registered_at field in RegistryPage.test.tsx's mocked services. Closes Stellar-Ecosystem#395
|
@Godfrey-Delight Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesStellar address display
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant StellarAddress
participant Stellar Explorer
participant Clipboard API
User->>StellarAddress: View Stellar address
StellarAddress->>Stellar Explorer: Open account URL
User->>StellarAddress: Click copy button
StellarAddress->>Clipboard API: Write full address
Clipboard API-->>StellarAddress: Resolve copy request
StellarAddress-->>User: Show Copied confirmation
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
frontend/app/agents/[address]/page.tsx (1)
366-366: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winImport
ReactNodeexplicitly.This module uses
React.ReactNodebut does not import theReactglobal; relying on a UMD global in a module makes the API surface fragile. Useimport type { ReactNode } from 'react'andvalue: ReactNode.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/app/agents/`[address]/page.tsx at line 366, Update the MetaItem type signature to use an explicitly imported ReactNode type: add a type-only ReactNode import from react and replace React.ReactNode in the value prop with ReactNode, without relying on the React global.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/components/StellarAddress.tsx`:
- Around line 20-21: Update the copied-state logic in StellarAddress to store
the timeout in a single ref, clear any existing timer before scheduling a new
one, and clear the timer during unmount cleanup. Add a regression test that
performs repeated copy actions and verifies the newer “Copied” state is not
cleared by the earlier timer.
- Around line 51-52: Update the tooltip div in StellarAddress to remove the
pointer-events-none class, allowing the address span’s existing select-all
behavior to work while preserving the other styling and hover behavior.
---
Nitpick comments:
In `@frontend/app/agents/`[address]/page.tsx:
- Line 366: Update the MetaItem type signature to use an explicitly imported
ReactNode type: add a type-only ReactNode import from react and replace
React.ReactNode in the value prop with ReactNode, without relying on the React
global.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e25be92b-d57b-4511-950f-88fa8462e0cc
⛔ Files ignored due to path filters (1)
frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (7)
frontend/__tests__/RegistryPage.test.tsxfrontend/__tests__/StellarAddress.test.tsxfrontend/app/agents/[address]/page.tsxfrontend/components/AgentCard.tsxfrontend/components/ServiceCard.tsxfrontend/components/StellarAddress.tsxfrontend/lib/sort.test.ts
|
Hi @Godfrey-Delight, This PR could not be merged because it has merge conflicts with the target branch. Please resolve the merge conflicts, push the updated changes, and the PR can be reviewed and merged. Thank you! |
Adds a shared StellarAddress.tsx component with middle truncation (first 6/last 4 chars), an explorer link to Stellar Expert, a custom dark tooltip showing the full address on hover with select-all support, a one-click copy button that shows a "Copied" badge for 1.5s, and an sr-only label for screen readers. Integrates it into ServiceCard.tsx, AgentCard.tsx, and agents/[address]/page.tsx (both the profile header and the owner field), removing duplicate local truncation/copy helpers and clipboard state along the way. Fixes two pre-existing issues surfaced during integration: a missing makeAgent helper in sort.test.ts and a missing registered_at field in RegistryPage.test.tsx's mocked services.
Closes #395
Summary by CodeRabbit
New Features
Tests