Skip to content

refactor: extract duplicated company formatting to shared utility - #60

Merged
mitoperni merged 2 commits into
mainfrom
fix/extract-visible-companies
Feb 9, 2026
Merged

refactor: extract duplicated company formatting to shared utility#60
mitoperni merged 2 commits into
mainfrom
fix/extract-visible-companies

Conversation

@mitoperni

@mitoperni mitoperni commented Feb 9, 2026

Copy link
Copy Markdown
Owner

Description

Move duplicated company truncation logic from NetworkCard and StationsHeader into a reusable formatCompanies() function in utils.ts.

Type of Change

  • New feature
  • Bug fix
  • Refactoring
  • Documentation
  • Styling

Changes Made

  • src/lib/utils.ts: Add formatCompanies() utility that returns { text, remainingCount }
  • src/components/networks/network-card.tsx: Replace inline company logic with formatCompanies()
  • src/components/stations/stations-header.tsx: Replace inline company logic with formatCompanies()
  • src/lib/tests/utils.test.ts: Add 5 test cases for the new utility

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No TypeScript errors
  • Tests added/updated
  • All CI checks pass

Related Issues

N/A


Open with Devin

Move duplicated company truncation logic from NetworkCard and
StationsHeader into a reusable formatCompanies() function in utils.ts.
Add unit tests for edge cases.
@vercel

vercel Bot commented Feb 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cyclemap Ready Ready Preview, Comment Feb 9, 2026 10:14pm

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@mitoperni mitoperni self-assigned this Feb 9, 2026
@mitoperni
mitoperni merged commit c475011 into main Feb 9, 2026
6 checks passed
@mitoperni
mitoperni deleted the fix/extract-visible-companies branch February 10, 2026 08:09
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.

1 participant