Skip to content

feat: improve mobile layout for materials#121

Merged
toto04 merged 4 commits into
mainfrom
bianca/materials-mobile
Jun 2, 2026
Merged

feat: improve mobile layout for materials#121
toto04 merged 4 commits into
mainfrom
bianca/materials-mobile

Conversation

@BIA3IA
Copy link
Copy Markdown
Contributor

@BIA3IA BIA3IA commented May 25, 2026

Enhance the mobile layout of the materials section and address a biome-related bug.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Review Change Stack

Walkthrough

Materials imports CardCaption and refactors featured-card rendering into responsive sections: desktop shows CardIcon cards in a sm:grid, mobile shows CardCaption cards (sm:hidden) with each caption taken from the card's description.

Changes

Featured Cards Responsive Rendering

Layer / File(s) Summary
Add CardCaption import
src/components/home/materials.tsx
Adds an import for CardCaption used for mobile caption rendering.
Split featuredCards into desktop and mobile render paths
src/components/home/materials.tsx
Refactors featured-card area into desktop (sm:grid, CardIcon) and mobile (sm:hidden, CardCaption with caption = card.description) blocks and updates container/spacing classes.

Possibly related PRs

  • PoliNetworkOrg/web#59: Both PRs modify src/components/home/materials.tsx’s Materials rendering logic for featured cards—feat: Materials component and update Home page layout #59 introduces the Materials component with CardIcon-based grids, and the main PR updates that same layout to add CardCaption for mobile using each card’s description.
  • PoliNetworkOrg/web#41: The main PR’s Materials page now renders featured items via the newly introduced CardCaption component (passing each card’s description into CardCaption’s caption prop), directly matching the CardCaption addition in the retrieved PR.
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title 'feat: improve mobile layout for materials' accurately describes the main change: enhancing the mobile layout of the materials section by splitting featured card rendering into responsive sections.
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

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/home/materials.tsx (1)

11-24: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use one source field for featured card copy to avoid breakpoint-specific text drift.

description and caption now duplicate the same content, but desktop reads description (Line 43) while mobile reads caption (Line 49). The strings already differ, so users see different text depending on viewport. Keep only caption in the data and map it to CardIcon.description at render time.

💡 Proposed simplification
 const featuredCards = [
   {
     title: "Carica",
-    description:
-      "Hai appunti, dispense o temi d'esame che vuoi condividere? Caricali qui! Il tuo contributo é prezioso per aiutare migliaia di colleghi con materiale aggiornato!",
     caption:
       "Hai appunti, dispense o temi d'esame che vuoi condividere? Caricali qui! Il tuo contributo è prezioso per aiutare migliaia di colleghi con materiale aggiornato!",
@@
   {
     title: "Visualizza",
-    description:
-      "Cerca cio che ti serve per il tuo prossimo esame. Naviga tra i corsi di studio e trova facilmente appunti, esercizi e dispense condivisi da altri studenti come te.",
     caption:
-      "Cerca cio che ti serve per il tuo prossimo esame. Naviga tra i corsi di studio e trova facilmente appunti, esercizi e dispense condivisi da altri studenti come te.",
+      "Cerca ciò che ti serve per il tuo prossimo esame. Naviga tra i corsi di studio e trova facilmente appunti, esercizi e dispense condivisi da altri studenti come te.",
@@
           {featuredCards.map((card) => (
-            <CardIcon key={card.title} {...card} className="h-full" />
+            <CardIcon key={card.title} {...card} description={card.caption} className="h-full" />
           ))}
🤖 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/components/home/materials.tsx` around lines 11 - 24, The data object uses
both description and caption causing breakpoint-specific text drift; remove the
duplicated description field from the material entries and ensure the render
maps the single caption field into the CardIcon component's description prop
(i.e., use caption as the sole source and pass it to CardIcon.description where
the list is rendered), so desktop and mobile show the same copy consistently.
🤖 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.

Outside diff comments:
In `@src/components/home/materials.tsx`:
- Around line 11-24: The data object uses both description and caption causing
breakpoint-specific text drift; remove the duplicated description field from the
material entries and ensure the render maps the single caption field into the
CardIcon component's description prop (i.e., use caption as the sole source and
pass it to CardIcon.description where the list is rendered), so desktop and
mobile show the same copy consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 97cb321f-c6c4-4687-8173-87c6328b03d1

📥 Commits

Reviewing files that changed from the base of the PR and between 1080199 and ddc7bef.

📒 Files selected for processing (1)
  • src/components/home/materials.tsx

Comment thread src/components/home/materials.tsx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/home/materials.tsx (1)

42-46: ⚡ Quick win

Avoid redundant spread props when rendering CardCaption

CardCaption only accepts title, caption, icon, iconPosition, and className, so {...card} forwarding description, size, and href is redundant (no caption duplication happens). Forward only the props CardCaption actually uses and keep caption={card.description}.

🤖 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/components/home/materials.tsx` around lines 42 - 46, The CardCaption
rendering forwards the entire card object via {...card}, which leaks unused
props (description, size, href); update the featuredCards map to stop spreading
and instead pass only the props CardCaption expects: title, icon, iconPosition,
className, plus caption={card.description}; specifically replace <CardCaption
key={card.title} {...card} caption={card.description} ... /> with an explicit
prop list (title={card.title} icon={card.icon} iconPosition={card.iconPosition}
caption={card.description} className="h-full w-fit") so only the required fields
are forwarded.
🤖 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.

Nitpick comments:
In `@src/components/home/materials.tsx`:
- Around line 42-46: The CardCaption rendering forwards the entire card object
via {...card}, which leaks unused props (description, size, href); update the
featuredCards map to stop spreading and instead pass only the props CardCaption
expects: title, icon, iconPosition, className, plus caption={card.description};
specifically replace <CardCaption key={card.title} {...card}
caption={card.description} ... /> with an explicit prop list (title={card.title}
icon={card.icon} iconPosition={card.iconPosition} caption={card.description}
className="h-full w-fit") so only the required fields are forwarded.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6a20b557-fc3e-4685-abbe-95a211702e3e

📥 Commits

Reviewing files that changed from the base of the PR and between ddc7bef and 0673a93.

📒 Files selected for processing (1)
  • src/components/home/materials.tsx

@toto04 toto04 merged commit b66b55b into main Jun 2, 2026
2 checks passed
@toto04 toto04 deleted the bianca/materials-mobile branch June 2, 2026 23:24
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