-
Notifications
You must be signed in to change notification settings - Fork 0
45 reafcator code #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
peterlipt
commented
Dec 25, 2025
- Unified FileCard: Replaced disparate file displays with a standardized, reusable component across all pages.
- I18n Cleanup: Removed redundant locale props and standardized usage of the useTranslate hook.
…gle reusable `PageHeader`
… and file type icon logic into `FileIcon` component.
…tor `LanguageProvider`, and update reminder translations with a new `EmptyState` component.
…troduce a generic `PageHeader` component
…ok and add new translation keys to dictionaries.
…ionary keys, and add corresponding translations.
…integrate i18n for dynamic translation.
…nowledge base pages, and remove redundant locale props from reminder and decision components.
…e new `FileCard` component
…a fetching functions
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the codebase to unify file display components and standardize internationalization (i18n) handling. The changes introduce a reusable FileCard component, implement a custom useTranslate hook for accessing dictionary translations, and remove redundant locale props from server components.
Key changes:
- Introduced
useTranslatehook for client-side translation lookup from centralized dictionaries - Created reusable
FileCard,PageHeader,PageLoader, andEmptyStatecomponents - Expanded dictionary files (hu.json, en.json) with comprehensive translation keys
- Removed locale parameters from multiple server components and data-fetching functions
- Updated
LanguageProviderto pass dictionary to context for use byuseTranslatehook
Reviewed changes
Copilot reviewed 60 out of 63 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/normalizeString.ts | New utility for string normalization (removes accents, lowercases) |
| src/hooks/useTranslate.ts | New hook providing dictionary-based translation with legacy fallback support |
| src/dictionaries/hu.json, en.json | Significantly expanded with translation keys for all pages |
| src/components/common/FileCard.tsx | Enhanced reusable component for file display with view/download actions |
| src/components/common/PageHeader.tsx | New generic page header component |
| src/components/common/PageLoader.tsx | New loading spinner component with optional text |
| src/components/common/EmptyState.tsx | New empty state component |
| src/components/common/LanguageProvider.tsx | Updated to include dictionary in context and improved language toggle |
| src/components/regulations/* | Updated to use FileCard and useTranslate hook |
| src/app/(app)/[lang]/*/page.tsx | Multiple pages refactored to use getDictionary and PageHeader |
| src/app/(app)/[lang]//components/ | Client components updated to use useTranslate hook |
| src/lib/payload-cms.ts | Removed unused locale parameter from getRelatedNews |
Comments suppressed due to low confidence (1)
src/app/(app)/[lang]/hirek/[slug]/lib/news-utils.ts:44
- The
translateTagsfunction signature was changed to remove thelangparameter, but the implementation now just returns an empty array with a comment saying it should use the function from @/lib/utils. This is clearly broken - the function should either be removed entirely (and imports updated to use the one from @/lib/utils), or properly implemented. Currently, any code calling this function will receive an empty array instead of translated tags.
export function translateTags(tags: string[] | undefined): string[] {
if (!tags) return []
// This is a placeholder since the original translateTags was imported from @/lib/utils
// but we are creating a dedicated utils file. If translateTags is generic,
// we should import it here or just import it directly in components.
// Checking original code: it was imported from @/lib/utils.
// So we don't need to copy it here, just use it from @/lib/utils in components.
return []
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/app/(app)/[lang]/hatarozatok-tara/components/DecisionsArchiveClient.tsx
Outdated
Show resolved
Hide resolved
src/app/(app)/[lang]/kepviselok/components/RepresentativesGridClient.tsx
Show resolved
Hide resolved
src/app/(app)/[lang]/hatarozatok-tara/components/skeletons/LoadingDecisionsGrid.tsx
Show resolved
Hide resolved
src/app/(app)/[lang]/emlekeztetok/components/RemindersGridClient.tsx
Outdated
Show resolved
Hide resolved
src/app/(app)/[lang]/kepviselok/components/RepresentativesGrid.tsx
Outdated
Show resolved
Hide resolved
src/app/(app)/[lang]/kepviselok/components/RepresentativeCard.tsx
Outdated
Show resolved
Hide resolved
…`t()` calls, adding dictionary keys, and ensuring `useTranslate` handles non-string inputs.