Skip to content

Refactor: Extract duplicated breadcrumbs, date formatting, and query options - #123

Merged
marcelo-m7 merged 4 commits into
masterfrom
copilot/refactor-duplicated-code-yet-again
Nov 1, 2025
Merged

marcelo-m7 merged 4 commits into
masterfrom
copilot/refactor-duplicated-code-yet-again

Conversation

Copilot AI commented Nov 1, 2025 •

Copy link
Copy Markdown
Contributor

Identified and consolidated duplicated patterns across pages: breadcrumb navigation (6 pages), date formatting (3 files), and React Query configuration (3 pages).

Changes

  • PageBreadcrumb component - Extracted breadcrumb JSX repeated across Projects, Blog, Solutions, Contact, and detail pages. Supports single and multi-level navigation with i18n.

  • createDateFormatter utility - Centralized Intl.DateTimeFormat instantiation with locale fallback, used in Blog listing, blog post detail, and comments.

  • LONG_STALE_QUERY_OPTIONS constant - Extracted common query config (staleTime: 10min, retry: 1, refetchOnWindowFocus: false) used in solutions/projects fetching.

Example

Before (repeated 6 times):

<Breadcrumb>
  <BreadcrumbList>
    <BreadcrumbItem>
      <BreadcrumbLink asChild>
        <Link to="/">{t('navigation.home')}</Link>
      </BreadcrumbLink>
    </BreadcrumbItem>
    <BreadcrumbSeparator />
    <BreadcrumbItem>
      <BreadcrumbPage>{t('navigation.blog')}</BreadcrumbPage>
    </BreadcrumbItem>
  </BreadcrumbList>
</Breadcrumb>

After:

<PageBreadcrumb segments={[{ label: t('navigation.blog') }]} />

Net: -54 lines (200 removed, 146 added as reusable code)

Original prompt

Find and refactor duplicated code


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 1, 2025 20:35
Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
@monynha-online

monynha-online Bot commented Nov 1, 2025 •

Copy link
Copy Markdown

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-11-01 20:39:56 CET

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: Extract duplicated breadcrumbs, date formatting, and query options Nov 1, 2025
Copilot AI requested a review from marcelo-m7 November 1, 2025 20:45
@marcelo-m7
marcelo-m7 marked this pull request as ready for review November 1, 2025 20:50
@marcelo-m7
marcelo-m7 merged commit b9913e4 into master Nov 1, 2025
1 check passed
@marcelo-m7
marcelo-m7 deleted the copilot/refactor-duplicated-code-yet-again branch November 1, 2025 20:50
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.

2 participants