feat: add New Arrivals widget to Home#2169
Conversation
Show up to three curated latest apps in a New Arrivals card. Place it in the left Home column above Alby Go. Made-with: Cursor
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@frontend/src/components/home/widgets/NewArrivalsWidget.tsx`:
- Around line 46-50: The <img> uses app.logo which is optional on AppStoreApp
and can produce broken images; update NewArrivalsWidget (where app is
mapped/rendered) to either filter out apps with no logo before rendering or
render conditionally and supply a fallback (e.g., a defaultLogoUrl or a
placeholder component) when app.logo is undefined; ensure you reference the
mapped variable (app) and the <img> that currently uses src={app.logo} and
alt={`${app.title} logo`} so the UI never tries to load an undefined src.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9799f903-9dfe-43ed-bd47-3a371d44dce8
📒 Files selected for processing (2)
frontend/src/components/home/widgets/NewArrivalsWidget.tsxfrontend/src/screens/Home.tsx
| <img | ||
| src={app.logo} | ||
| alt={`${app.title} logo`} | ||
| className="size-[60px] rounded-[9px] object-cover" | ||
| /> |
There was a problem hiding this comment.
Handle potentially undefined app.logo.
According to the AppStoreApp type definition, logo is optional (logo?: string). If an app doesn't have a logo defined, this will render a broken image. Consider adding a fallback or filtering out apps without logos.
🛡️ Proposed fix with fallback
- <img
- src={app.logo}
- alt={`${app.title} logo`}
- className="size-[60px] rounded-[9px] object-cover"
- />
+ {app.logo ? (
+ <img
+ src={app.logo}
+ alt={`${app.title} logo`}
+ className="size-[60px] rounded-[9px] object-cover"
+ />
+ ) : (
+ <div className="size-[60px] rounded-[9px] bg-muted flex items-center justify-center text-muted-foreground text-xs">
+ {app.title.charAt(0)}
+ </div>
+ )}Alternatively, filter out apps without logos in the data processing:
const latestApps = latestAppStoreAppIds
.map((id) => appStoreApps.find((app) => app.id === id))
- .filter((app): app is AppStoreApp => !!app)
+ .filter((app): app is AppStoreApp => !!app && !!app.logo)
.slice(0, 3);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <img | |
| src={app.logo} | |
| alt={`${app.title} logo`} | |
| className="size-[60px] rounded-[9px] object-cover" | |
| /> | |
| {app.logo ? ( | |
| <img | |
| src={app.logo} | |
| alt={`${app.title} logo`} | |
| className="size-[60px] rounded-[9px] object-cover" | |
| /> | |
| ) : ( | |
| <div className="size-[60px] rounded-[9px] bg-muted flex items-center justify-center text-muted-foreground text-xs"> | |
| {app.title.charAt(0)} | |
| </div> | |
| )} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@frontend/src/components/home/widgets/NewArrivalsWidget.tsx` around lines 46 -
50, The <img> uses app.logo which is optional on AppStoreApp and can produce
broken images; update NewArrivalsWidget (where app is mapped/rendered) to either
filter out apps with no logo before rendering or render conditionally and supply
a fallback (e.g., a defaultLogoUrl or a placeholder component) when app.logo is
undefined; ensure you reference the mapped variable (app) and the <img> that
currently uses src={app.logo} and alt={`${app.title} logo`} so the UI never
tries to load an undefined src.
| CardTitle, | ||
| } from "src/components/ui/card"; | ||
|
|
||
| const latestAppStoreAppIds = [ |
| "wherostr", | ||
| ] as const; | ||
|
|
||
| function getAppDestination(app: AppStoreApp) { |
There was a problem hiding this comment.
This seems duplicated, isn't there a utility method somewhere?
| const latestApps = latestAppStoreAppIds | ||
| .map((id) => appStoreApps.find((app) => app.id === id)) | ||
| .filter((app): app is AppStoreApp => !!app) | ||
| .slice(0, 3); |
There was a problem hiding this comment.
why do we slice here? then shouldn't we just have a list of 3 apps?
Summary
NewArrivalsWidgetcard for HomeTest plan
cd frontend && yarn tsc:compile/internal-apps/:idor/appstore/:idcorrectlyMade with Cursor
Summary by CodeRabbit
New Features