112 implement redesigned news detail page and update payload schema#154
112 implement redesigned news detail page and update payload schema#154DankaMarci wants to merge 5 commits into
Conversation
- Updated RepresentativeCard component to enhance accessibility and visual design. - Refactored RepresentativeModal to streamline layout and improve user experience. - Modified RepresentativesGrid to accept title and description props for better context. - Enhanced RepresentativesGridClient with a back button and improved loading states. - Created a new helpers file for common representative functions and styles. - Improved loading skeletons for representative cards and grid. - Updated page structure in RepresentativesPage for better layout and responsiveness.
… table - Created a new migration to add `representative_id` and `contact_email` columns to the `news` table. - Added foreign key constraint for `representative_id` referencing the `representatives` table. - Created an index on `representative_id` for improved query performance. - Updated the payload types to include optional `representative` and `contactEmail` fields in the News interface.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 48 minutes and 22 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughExtends the ChangesNews schema extension, news detail redesign, representatives overhaul, and decisions archive updates
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/app/`(app)/[lang]/hirek/[slug]/components/NewsDetailMain.tsx:
- Around line 29-37: The formatDate function uses local timezone methods to
parse and format dates, which can cause off-by-one day discrepancies depending
on the user's timezone, especially with UTC or date-only payloads. Replace the
timezone-dependent methods in the formatDate function with their UTC
equivalents: use getUTCFullYear(), getUTCMonth(), and getUTCDate() instead of
getFullYear(), getMonth(), and getDate() when extracting year, month, and day
components for the non-English date format (the return statement with y, m, and
day variables).
In `@src/app/`(app)/[lang]/hirek/[slug]/components/RelatedNewsClient.tsx:
- Around line 12-20: The formatDate function uses local timezone methods which
causes dates to shift for users in UTC-negative regions. Replace the local date
methods with their UTC equivalents: use getUTCFullYear(), getUTCMonth(), and
getUTCDate() instead of getFullYear(), getMonth(), and getDate() in the non-EN
locale branch. Additionally, add the timeZone parameter set to 'UTC' in the
toLocaleDateString call for the EN locale branch to ensure consistent date
display across all timezones.
In `@src/app/`(app)/[lang]/kepviselok/components/RepresentativeCard.tsx:
- Around line 31-35: The onKeyDown handler in the RepresentativeCard component
is responding to Enter/Space keys even when the focus is on the nested email
link element, causing conflicting actions. Modify the keyboard event handler to
stop propagation or return early if the event originates from the email link
element (the nested anchor tag), preventing the onClickAction from being
triggered when users interact with the email link using keyboard navigation.
This will ensure only the email link's default behavior fires when focus is on
it, not the card's click action.
In `@src/app/`(app)/[lang]/kepviselok/components/RepresentativeModal.tsx:
- Line 216: The fileTitle fallback text in RepresentativeModal is hardcoded as
Hungarian ("Dokumentum"), which prevents proper localization for non-Hungarian
users. Replace the hardcoded "Dokumentum" string with a localized version using
the t() function that provides both a translation key and an English fallback
value (e.g., t("Dokumentum", "Document")), ensuring the fallback text displays
in the user's selected language.
- Line 45: The className attribute uses Tailwind v3 prefix syntax for the
important modifier (!max-w-[1272px] and sm:!max-w-[1272px]) which is deprecated
in Tailwind v4. Update both instances of the important modifier by moving the
exclamation mark from the prefix position to the end of the utility class names,
so !max-w-[1272px] becomes max-w-[1272px]! and sm:!max-w-[1272px] becomes
sm:max-w-[1272px]!. This ensures the code follows Tailwind v4 best practices.
In `@src/app/`(app)/[lang]/kepviselok/components/representatives.helpers.ts:
- Around line 75-79: The filesize property assignment uses the `||` operator
which treats zero as falsy and converts valid zero-byte filesizes to null,
breaking downstream formatting. In the return statement of the file
normalization function, replace the `||` operator with the nullish coalescing
operator `??` for the filesize property to preserve zero values while still
handling null or undefined cases correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 639979da-d905-473b-8d6e-1b8a7a279983
📒 Files selected for processing (27)
src/app/(app)/[lang]/hatarozatok-tara/components/DecisionsArchiveClient.tsxsrc/app/(app)/[lang]/hirek/[slug]/components/BackNav.tsxsrc/app/(app)/[lang]/hirek/[slug]/components/FileIcon.tsxsrc/app/(app)/[lang]/hirek/[slug]/components/NewsDetail.tsxsrc/app/(app)/[lang]/hirek/[slug]/components/NewsDetailClient.tssrc/app/(app)/[lang]/hirek/[slug]/components/NewsDetailMain.tsxsrc/app/(app)/[lang]/hirek/[slug]/components/NewsDetailSidebar.tsxsrc/app/(app)/[lang]/hirek/[slug]/components/RelatedNewsClient.tsxsrc/app/(app)/[lang]/hirek/[slug]/components/ShareButton.tsxsrc/app/(app)/[lang]/hirek/[slug]/lib/news-utils.tssrc/app/(app)/[lang]/kepviselok/components/RepresentativeCard.tsxsrc/app/(app)/[lang]/kepviselok/components/RepresentativeModal.tsxsrc/app/(app)/[lang]/kepviselok/components/RepresentativesGrid.tsxsrc/app/(app)/[lang]/kepviselok/components/RepresentativesGridClient.tsxsrc/app/(app)/[lang]/kepviselok/components/representatives.helpers.tssrc/app/(app)/[lang]/kepviselok/components/skeletons/LoadingRepresentativeCard.tsxsrc/app/(app)/[lang]/kepviselok/components/skeletons/LoadingRepresentativesGrid.tsxsrc/app/(app)/[lang]/kepviselok/page.tsxsrc/collections/News.tssrc/dictionaries/en/news.jsonsrc/dictionaries/en/regulations.jsonsrc/dictionaries/hu/news.jsonsrc/dictionaries/hu/regulations.jsonsrc/migrations/20260619_105937_add_news_representative_and_contact_email.jsonsrc/migrations/20260619_105937_add_news_representative_and_contact_email.tssrc/migrations/index.tssrc/payload-types.ts
💤 Files with no reviewable changes (5)
- src/app/(app)/[lang]/hirek/[slug]/components/BackNav.tsx
- src/app/(app)/[lang]/hirek/[slug]/components/ShareButton.tsx
- src/app/(app)/[lang]/hirek/[slug]/components/FileIcon.tsx
- src/app/(app)/[lang]/hirek/[slug]/lib/news-utils.ts
- src/app/(app)/[lang]/hirek/[slug]/components/NewsDetailClient.ts
Summary by CodeRabbit
New Features
Improvements