Skip to content

122#160

Merged
peterlipt merged 3 commits into
mainfrom
122
Jun 22, 2026
Merged

122#160
peterlipt merged 3 commits into
mainfrom
122

Conversation

@DankaMarci

@DankaMarci DankaMarci commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Accordion component now supports customizable heading levels and granular styling options for better design control
    • Enhanced expand/collapse animations with improved accessibility features
    • Increased flexibility with optional headers and alternative title configuration

@DankaMarci DankaMarci requested a review from peterlipt June 20, 2026 12:17
@DankaMarci DankaMarci self-assigned this Jun 20, 2026
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ehk Ready Ready Preview, Comment Jun 22, 2026 10:31am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 52ec7f46-0de2-4b7c-9956-56043c66e617

📥 Commits

Reviewing files that changed from the base of the PR and between 5bead71 and a5c46ce.

📒 Files selected for processing (1)
  • src/components/common/Accordion.tsx

📝 Walkthrough

Walkthrough

Accordion.tsx gains a new AccordionHeadingLevel type and optional title/headingLevel/className props across AccordionItemProps, AccordionEntry, and AccordionItem. The render is refactored to use a dynamic heading element, data-state, aria-hidden+inert (replacing hidden), opacity animation, and cn for class composition. The Accordion wrapper forwards all new props.

Accordion API and rendering enhancements

Layer / File(s) Summary
AccordionHeadingLevel type and updated props contracts
src/components/common/Accordion.tsx
Introduces AccordionHeadingLevel union type and cn import. AccordionItemProps gains optional header, title alias, headingLevel, and four fine-grained className props (buttonClassName, headerClassName, contentClassName, iconClassName). AccordionEntry mirrors all the same additions.
AccordionItem render and Accordion wrapper wiring
src/components/common/Accordion.tsx
AccordionItem selects the heading element from headingLevel, applies data-state, replaces hidden with aria-hidden/inert, adds opacity to the expand/collapse animation, and uses cn throughout. Accordion wrapper composes its class via cn and forwards all new header/title and className props to each AccordionItem.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A heading tag now bends to your will,
With headingLevel picking two, three, or four.
The inert hides secrets when folded up still,
While cn weaves classNames with elegant lore.
No more bare hidden—just opacity's grace,
The accordion hops open with style and with pace! 🎶

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.82% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title '122' is a vague numeric reference that does not meaningfully describe any aspect of the changeset, making it impossible to understand the primary change from the PR history. Replace the title with a clear, specific description of the main change. For example: 'Refactor UI components to use Accordion, FileCard, and EmptyState patterns' or 'Update news, permissions, and scholarship features with new content structure and components.'
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 122

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
src/app/(app)/[lang]/kepviselok/components/RepresentativeCard.tsx (1)

23-23: ⚡ Quick win

Use dictionary-backed label for both languages.

Line 23 hardcodes HU text while EN uses translation lookup, which can cause copy drift. Prefer one dictionary key path for both locales.

Proposed refactor
-    const detailsLabel = lang === "EN" ? t('representatives.view_details') : "Részletek"
+    const detailsLabel = t('representatives.view_details')
🤖 Prompt for 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.

In `@src/app/`(app)/[lang]/kepviselok/components/RepresentativeCard.tsx at line
23, The detailsLabel variable in RepresentativeCard.tsx uses inconsistent
translation logic - it calls t('representatives.view_details') for English but
hardcodes the Hungarian text "Részletas" directly. This creates copy drift and
maintenance issues. Replace the entire conditional with a single translation
lookup using t('representatives.view_details') for both languages, allowing the
translation system to handle language selection automatically instead of
hardcoding language-specific strings.
🤖 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]/engedelyek/components/PermissionsListClient.tsx:
- Around line 16-21: The `hasRichText` function currently only checks if the
root node has children in the array, but does not verify if those children
contain actual text content. A Lexical editor can have empty structural elements
that pass this check but display no meaningful content. Modify the `hasRichText`
function to recursively inspect the children nodes and check for the presence of
actual text content in the nested structure, ensuring that at least one text
node exists before returning true. This will prevent rendering the section
header when the richtext is structurally present but functionally empty. Note
that this same pattern may also appear in the code around lines 78-86.

In `@src/app/`(app)/[lang]/hirek/[slug]/components/RelatedNewsClient.tsx:
- Around line 61-63: The Link component in RelatedNewsClient.tsx is using a href
that points to `/hirek/${article.id}` without including the language segment,
which breaks routing since the page is located under the `[lang]` route
structure. Update the href attribute to include the language parameter by
constructing the path as `/${lang}/hirek/${article.id}` instead, ensuring you
capture the lang parameter (likely from useParams or route context) and include
it in the generated link path.

In `@src/app/`(app)/[lang]/kepviselok/components/representatives.helpers.ts:
- Around line 82-99: The formatFileSize function does not handle negative file
size values. When negative bytes are passed, Math.log of a negative number
returns NaN, causing the function to output "NaN undefined". Add a guard
condition in the formatFileSize function after the existing null and zero checks
to validate that bytes is not negative (bytes < 0), and return null in that case
before reaching the Math.log calculation to ensure malformed metadata does not
destabilize the UI.

In `@src/collections/Permissions.ts`:
- Around line 100-108: The externalLink field in the Permissions collection
currently accepts any free text without validation. Add a collection-level
validate function or field-level validation to the externalLink field that
checks the input is an absolute URL using only safe schemes (http or https).
This can be done by implementing a validation function that tests the URL format
using URL parsing or regex patterns, rejecting any malformed URLs or unsafe
schemes, and returning a validation error message if the URL doesn't match the
required pattern.

---

Nitpick comments:
In `@src/app/`(app)/[lang]/kepviselok/components/RepresentativeCard.tsx:
- Line 23: The detailsLabel variable in RepresentativeCard.tsx uses inconsistent
translation logic - it calls t('representatives.view_details') for English but
hardcodes the Hungarian text "Részletas" directly. This creates copy drift and
maintenance issues. Replace the entire conditional with a single translation
lookup using t('representatives.view_details') for both languages, allowing the
translation system to handle language selection automatically instead of
hardcoding language-specific strings.
🪄 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: cac05654-1c5b-464f-bab6-ac8b44364ce1

📥 Commits

Reviewing files that changed from the base of the PR and between 6844674 and 5bead71.

📒 Files selected for processing (58)
  • src/app/(app)/[lang]/emlekeztetok/components/YearSection.tsx
  • src/app/(app)/[lang]/engedelyek/components/PermissionsListClient.tsx
  • src/app/(app)/[lang]/engedelyek/page.tsx
  • src/app/(app)/[lang]/hatarozatok-tara/components/DecisionsArchiveClient.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/BackNav.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/FileIcon.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/NewsDetail.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/NewsDetailClient.ts
  • src/app/(app)/[lang]/hirek/[slug]/components/NewsDetailMain.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/NewsDetailSidebar.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/RelatedNewsClient.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/ShareButton.tsx
  • src/app/(app)/[lang]/hirek/[slug]/lib/news-utils.ts
  • src/app/(app)/[lang]/kepviselok/components/RepresentativeCard.tsx
  • src/app/(app)/[lang]/kepviselok/components/RepresentativeModal.tsx
  • src/app/(app)/[lang]/kepviselok/components/RepresentativesGrid.tsx
  • src/app/(app)/[lang]/kepviselok/components/RepresentativesGridClient.tsx
  • src/app/(app)/[lang]/kepviselok/components/representatives.helpers.ts
  • src/app/(app)/[lang]/kepviselok/components/skeletons/LoadingRepresentativeCard.tsx
  • src/app/(app)/[lang]/kepviselok/components/skeletons/LoadingRepresentativesGrid.tsx
  • src/app/(app)/[lang]/kepviselok/page.tsx
  • src/app/(app)/[lang]/kisokosok/components/HelpPageList.tsx
  • src/app/(app)/[lang]/kisokosok/components/skeletons/LoadingHelpPageGrid.tsx
  • src/app/(app)/[lang]/kisokosok/page.tsx
  • src/app/(app)/[lang]/nyelvoktatas/components/LanguageEducationContent.tsx
  • src/app/(app)/[lang]/nyelvoktatas/page.tsx
  • src/app/(app)/[lang]/oktatasi-szabalyzatok/loading.tsx
  • src/app/(app)/[lang]/oktatasi-szabalyzatok/page.tsx
  • src/app/(app)/[lang]/tanulmanyi-osztondij/components/StudyScholarshipContent.tsx
  • src/app/(app)/[lang]/tanulmanyi-osztondij/page.tsx
  • src/app/(app)/globals.css
  • src/collections/News.ts
  • src/collections/Permissions.ts
  • src/components/common/Accordion.tsx
  • src/components/common/FileCard.tsx
  • src/components/regulations/RegulationsListClient.tsx
  • src/components/regulations/skeletons/LoadingRegulationsGrid.tsx
  • src/dictionaries/en/language_education.json
  • src/dictionaries/en/news.json
  • src/dictionaries/en/permissions.json
  • src/dictionaries/en/regulations.json
  • src/dictionaries/en/scholarships.json
  • src/dictionaries/hu/language_education.json
  • src/dictionaries/hu/news.json
  • src/dictionaries/hu/permissions.json
  • src/dictionaries/hu/regulations.json
  • src/dictionaries/hu/scholarships.json
  • src/globals/AcademicScholarshipFAQ.ts
  • src/lib/payload-cms.ts
  • src/migrations/20260619_105937_add_news_representative_and_contact_email.json
  • src/migrations/20260619_105937_add_news_representative_and_contact_email.ts
  • src/migrations/20260619_141957_add_permissions_submission_and_external_link.json
  • src/migrations/20260619_141957_add_permissions_submission_and_external_link.ts
  • src/migrations/20260619_173736_academic_scholarship_faq.json
  • src/migrations/20260619_173736_academic_scholarship_faq.ts
  • src/migrations/index.ts
  • src/payload-types.ts
  • src/payload.config.ts
💤 Files with no reviewable changes (5)
  • src/app/(app)/[lang]/hirek/[slug]/components/ShareButton.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/FileIcon.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/BackNav.tsx
  • src/app/(app)/[lang]/hirek/[slug]/components/NewsDetailClient.ts
  • src/app/(app)/[lang]/hirek/[slug]/lib/news-utils.ts

Comment on lines +16 to +21
// Lexical richtext can be "empty" (a root with no real content). Only render when there is something.
type LexicalData = Permission["submissionProcess_hu"];
const hasRichText = (data: LexicalData): data is NonNullable<LexicalData> => {
const children = data?.root?.children;
return Array.isArray(children) && children.length > 0;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

hasRichText can return true for structurally-empty Lexical content.

The current guard checks only top-level child count, which can still be non-empty for blank editor state. This may show the section header with no real text. Check nested text content before rendering.

Suggested guard update
 type LexicalData = Permission["submissionProcess_hu"];
 const hasRichText = (data: LexicalData): data is NonNullable<LexicalData> => {
-  const children = data?.root?.children;
-  return Array.isArray(children) && children.length > 0;
+  const children = data?.root?.children;
+  if (!Array.isArray(children) || children.length === 0) return false;
+
+  const hasText = (nodes: unknown[]): boolean =>
+    nodes.some((node: any) => {
+      if (typeof node?.text === "string" && node.text.trim().length > 0) return true;
+      if (Array.isArray(node?.children)) return hasText(node.children);
+      return false;
+    });
+
+  return hasText(children as unknown[]);
 };

Also applies to: 78-86

🤖 Prompt for 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.

In `@src/app/`(app)/[lang]/engedelyek/components/PermissionsListClient.tsx around
lines 16 - 21, The `hasRichText` function currently only checks if the root node
has children in the array, but does not verify if those children contain actual
text content. A Lexical editor can have empty structural elements that pass this
check but display no meaningful content. Modify the `hasRichText` function to
recursively inspect the children nodes and check for the presence of actual text
content in the nested structure, ensuring that at least one text node exists
before returning true. This will prevent rendering the section header when the
richtext is structurally present but functionally empty. Note that this same
pattern may also appear in the code around lines 78-86.

Comment on lines +61 to +63
<Link
href={`/hirek/${article.id}`}
className="inline-flex items-center justify-between gap-4 text-xs font-bold text-[#862633]"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve the [lang] segment in related-news links.

Line 62 links to /hirek/${article.id}, but this page is under /[lang]/hirek/[slug]. Dropping the locale segment can route users to a non-existent path.

Proposed fix
 import { ArrowRight } from "lucide-react"
 import Link from "next/link"
+import { useParams } from "next/navigation"
 
 export function RelatedNewsClient({ relatedArticles }: { relatedArticles: News[] }) {
   const { t, lang } = useTranslate()
+  const { lang: langParam } = useParams<{ lang: string }>()
@@
               <Link
-                href={`/hirek/${article.id}`}
+                href={`/${langParam}/hirek/${article.id}`}
                 className="inline-flex items-center justify-between gap-4 text-xs font-bold text-[`#862633`]"
               >
🤖 Prompt for 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.

In `@src/app/`(app)/[lang]/hirek/[slug]/components/RelatedNewsClient.tsx around
lines 61 - 63, The Link component in RelatedNewsClient.tsx is using a href that
points to `/hirek/${article.id}` without including the language segment, which
breaks routing since the page is located under the `[lang]` route structure.
Update the href attribute to include the language parameter by constructing the
path as `/${lang}/hirek/${article.id}` instead, ensuring you capture the lang
parameter (likely from useParams or route context) and include it in the
generated link path.

Comment thread src/collections/Permissions.ts
@DankaMarci DankaMarci linked an issue Jun 20, 2026 that may be closed by this pull request
4 tasks
@peterlipt peterlipt merged commit 5c1a3a0 into main Jun 22, 2026
2 of 3 checks passed
@peterlipt peterlipt deleted the 122 branch June 22, 2026 10:32
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.

Create Reusable Accordion Component

2 participants