Skip to content

Refactor/use locale context in detail#301

Merged
zigzagdev merged 4 commits intochore/create-language-contextfrom
refactor/use-locale-context-in-detail
Apr 30, 2026
Merged

Refactor/use locale context in detail#301
zigzagdev merged 4 commits intochore/create-language-contextfrom
refactor/use-locale-context-in-detail

Conversation

@zigzagdev
Copy link
Copy Markdown
Owner

@zigzagdev zigzagdev commented Apr 29, 2026

Summary

  • Drop URL-derived locale plumbing in WorldHeritageDetailContainer and the locale/toggleLocale props on HeritageDetailLayout, HeritageHero, and
    HeritageOverViewSection; each component now reads locale from useLocale().
  • Inline the LocaleContextType alias on the createContext call so LocaleProvider.tsx carries no named type declaration.
  • Fix the LocaleProvider import path (../../domain/criteria.ts) that broke after the move under src/shared/locale/.

Test plan

  • `npx tsc --noEmit` passes
  • `npm run dev` boots without the prior Vite "Failed to resolve import "../../../domain/criteria.ts"" error
  • Detail page renders, locale toggle button still flips between EN/JA and updates the `?lang=` query
  • `world-heritage-detail-container` Jest tests still pass

zigzagdev and others added 3 commits April 29, 2026 17:28
feat: add LocaleProvider with URL synced locale state
Drop the named LocaleContextType alias and pass the shape directly to
createContext, keeping the .tsx file free of named type declarations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the URL-derived locale plumbing in WorldHeritageDetailContainer
and the locale/toggleLocale props on HeritageDetailLayout, HeritageHero,
and HeritageOverViewSection. Each component now reads locale from
useLocale(), so the container only forwards item and the detail tree
no longer prop-drills locale state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zigzagdev zigzagdev self-assigned this Apr 29, 2026
@zigzagdev zigzagdev linked an issue Apr 29, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Owner Author

@zigzagdev zigzagdev left a comment

Choose a reason for hiding this comment

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

LGTM

The earlier consumer migration removed the locale prop from
HeritageOverViewSection but left the call site still passing it,
breaking the CI typecheck.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zigzagdev zigzagdev merged commit 486232b into chore/create-language-context Apr 30, 2026
1 check passed
@zigzagdev zigzagdev deleted the refactor/use-locale-context-in-detail branch April 30, 2026 00:00
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.

Refactor: Introduce LanguageContext to eliminate prop drilling

1 participant