Skip to content

[#116] Extract truncateAddress to shared utility#118

Merged
realproject7 merged 1 commit intomainfrom
task/116-extract-truncate-address
Mar 15, 2026
Merged

[#116] Extract truncateAddress to shared utility#118
realproject7 merged 1 commit intomainfrom
task/116-extract-truncate-address

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Extracted truncateAddress() from 4 files (ConnectWallet.tsx, StoryCard.tsx, RatingWidget.tsx, story/[storylineId]/page.tsx) into lib/utils.ts
  • All 4 components now import from the shared location
  • No logic changes — function body is identical

Fixes #116

Test plan

  • npm run lint passes
  • npm run typecheck passes
  • Wallet address displays correctly in header (ConnectWallet)
  • Writer address displays correctly on story cards
  • Writer address displays correctly on story detail page
  • Rater addresses display correctly in RatingWidget

🤖 Generated with Claude Code

Move duplicated truncateAddress() from ConnectWallet, StoryCard,
RatingWidget, and story page into lib/utils.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The PR cleanly extracts truncateAddress into a shared utility and updates all current call sites without changing behavior. The change is minimal, matches issue #116, and CI passed.

Findings

  • None.

Decision

Approve because the refactor is focused, follows existing patterns, and satisfies the acceptance criteria with passing checks.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T2b Review: APPROVE

Clean mechanical extraction — function body is identical across all 4 originals, import paths match existing conventions (verified against sibling imports like ../../lib/rpc and ../../../../lib/price), all duplicate definitions removed, TypeScript types preserved. No logic changes. +7/-16, minimal diff.

One non-blocking note: lib/utils.ts is generic — if more utilities land here, consider more specific module names. Fine for now with a single function.

@realproject7 realproject7 merged commit aa2db3c into main Mar 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] truncateAddress utility duplicated in 3 components

2 participants