Skip to content

feat: improve mobile layout for materials#121

Open
BIA3IA wants to merge 2 commits into
mainfrom
bianca/materials-mobile
Open

feat: improve mobile layout for materials#121
BIA3IA wants to merge 2 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

The pull request updates the Materials component's featured card section to be responsive. The featuredCards data objects are refactored to use a caption field, and the component rendering is split into desktop and mobile sections using responsive breakpoints, showing CardIcon on desktop and CardCaption on mobile.

Changes

Featured Cards Responsive Rendering

Layer / File(s) Summary
Featured card data shape
src/components/home/materials.tsx
The first two featuredCards entries are updated to use a caption field for the rendered card text instead of the previous shape.
Responsive card rendering with breakpoints
src/components/home/materials.tsx
The Materials component is refactored to split featured card rendering into separate desktop and mobile sections; desktop renders featuredCards with CardIcon in a grid, while mobile renders with CardCaption using sm:hidden breakpoints and adjusted container layout classes.

Possibly related PRs

  • PoliNetworkOrg/web#59: Both PRs modify src/components/home/materials.tsx around the featuredCards metadata and card rendering logic, switching card text field names and adjusting CardIcon/caption rendering.
  • PoliNetworkOrg/web#102: Materials now renders featuredCards with CardIcon/CardCaption in breakpoint-specific layouts, which directly depends on the responsive card-icon component changes introduced in this 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 title 'feat: improve mobile layout for materials' directly summarizes the main change: responsive layout improvements for the Materials component, specifically enhancing mobile rendering with separate mobile/desktop card components.
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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

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.

1 participant