Refactor duplicated date formatting and breadcrumb navigation code - #120
Conversation
…adcrumb component Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
…configurable options Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,10 +1,11 @@ | |||
| import { useState, useMemo, useCallback } from 'react'; | |||
| import { useState, useMemo } from 'react'; | |||
There was a problem hiding this comment.
Restore useCallback import in Blog page
The top-level React import drops useCallback, but handlePageChange still calls useCallback later in this file. This will cause a compile/runtime failure (useCallback is not defined) when building the blog page. Re‑add useCallback to the import list so the pagination handler continues to work.
Useful? React with 👍 / 👎.
Identified and eliminated ~256 lines of duplicated code related to date formatting and breadcrumb navigation across multiple page components.
Changes
useLocalizedDateFormatterHookCreated a reusable hook consolidating date formatting logic previously duplicated across 5 files:
nullFallbackoptionBefore:
After:
Applied to: Projects.tsx, Blog.tsx, Dashboard.tsx, blog/[slug].tsx, CommentsSection.tsx
PageBreadcrumbComponentExtracted breadcrumb navigation structure duplicated across 4 pages:
Applied to: Blog.tsx, Contact.tsx, Projects.tsx, Solutions.tsx
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.