Refactor duplicated date formatting, normalization, and breadcrumb code - #122
Merged
Merged
Conversation
- Create reusable date formatting utilities in lib/i18n.ts - Create data normalization utilities in lib/utils.ts - Update Blog.tsx, Projects.tsx, Dashboard.tsx, blog/[slug].tsx, and CommentsSection.tsx to use new date formatting utilities - Update Contact.tsx and About.tsx to use new normalization utilities - Reduce code duplication across 7 files Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
- Add PageBreadcrumb component to reduce breadcrumb duplication - Update Contact.tsx, Blog.tsx, Solutions.tsx, Projects.tsx to use PageBreadcrumb - Update blog/[slug].tsx and solutions/[slug].tsx to use PageBreadcrumb with intermediate items - Remove ~150 lines of duplicated breadcrumb code across 6 pages Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
- Remove unused index parameter from map callback in PageBreadcrumb component Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor duplicated code for improved maintainability
Refactor duplicated date formatting, normalization, and breadcrumb code
Nov 1, 2025
marcelo-m7
marked this pull request as ready for review
November 1, 2025 20:21
|
The preview deployment is ready. 🟢 Open Preview | Open Build Logs Last updated at: 2025-11-01 20:41:50 CET |
marcelo-m7
approved these changes
Nov 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Identified and extracted three patterns of code duplication across the codebase: date formatting logic, data normalization functions, and breadcrumb components.
Changes
Date Formatting (
lib/i18n.ts)createDateFormatter()andformatDate()utilities with locale fallback handlingData Normalization (
lib/utils.ts)normalizeToStringArray()andnormalizeToTypedArray<T>()for parsing JSON/arrays from SupabaseBreadcrumb Component (
components/PageBreadcrumb.tsx)Impact
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.