fix: notifications sidebar returns 404 - #402
Conversation
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. 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, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRestyles the notifications page (mark-all-as-read button, divider, empty state) with explicit gray/white Tailwind classes, refactors NotificationItem from a clickable div to a button with a required onClick prop and renamed icon map, and updates the sidebar notifications link route. ChangesNotifications UI update
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
404
|
@emarc99 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Hi @emarc99 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/components/dashboard/NotificationItem.tsx`:
- Around line 30-52: The button in NotificationItem currently relies on the
default HTML button behavior, which can accidentally submit a parent form.
Update the button element in NotificationItem to explicitly use type="button" so
its onClick handler only triggers the notification action and not form
submission.
- Around line 48-50: The unread dot in NotificationItem is only a visual
indicator, so add an accessible text alternative for screen readers when read is
false. Update the conditional unread indicator markup in NotificationItem to
include a visually hidden label (for example using an sr-only element) that
announces the notification is unread, while keeping the existing dot for sighted
users.
🪄 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: 81483f50-a650-4a85-9018-7ef9147b2f14
📒 Files selected for processing (3)
src/app/dashboard/notifications/page.tsxsrc/components/dashboard/NotificationItem.tsxsrc/components/layouts/SideBar.tsx
| <button | ||
| onClick={onClick} | ||
| className={cn( | ||
| "flex items-start gap-3 rounded-lg border p-4 cursor-pointer", | ||
| "transition-colors hover:bg-accent dark:hover:bg-gray-800", | ||
| "w-full text-left rounded-lg border p-4 transition-colors", | ||
| read | ||
| ? "border-border bg-transparent" | ||
| : "border-border bg-accent/60 dark:bg-gray-800/60", | ||
| ? "border-gray-700 bg-transparent" | ||
| : "border-purple-700/40 bg-purple-900/10 hover:bg-purple-900/20" | ||
| )} | ||
| > | ||
| <div className="mt-0.5 shrink-0">{TYPE_ICON[type]}</div> | ||
|
|
||
| <div className="flex-1 space-y-0.5"> | ||
| <div className="flex items-center justify-between gap-2"> | ||
| <p | ||
| className={cn( | ||
| "text-sm font-medium", | ||
| read ? "text-muted-foreground" : "text-foreground", | ||
| )} | ||
| > | ||
| <div className="flex items-start gap-3"> | ||
| <div className="mt-0.5 shrink-0">{ICON_MAP[type]}</div> | ||
| <div className="flex-1 space-y-0.5"> | ||
| <p className={cn("text-sm font-medium", read ? "text-gray-300" : "text-white")}> | ||
| {title} | ||
| </p> | ||
| {!read && ( | ||
| <span className="h-2 w-2 rounded-full bg-purple-500 shrink-0" /> | ||
| )} | ||
| <p className="text-xs text-gray-400">{message}</p> | ||
| <p className="text-xs text-gray-500">{timestamp}</p> | ||
| </div> | ||
| <p className="text-xs text-muted-foreground">{message}</p> | ||
| <p className="text-xs text-muted-foreground">{timestamp}</p> | ||
| {!read && ( | ||
| <span className="mt-1 h-2 w-2 shrink-0 rounded-full bg-purple-500" /> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </button> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add type="button" to prevent unintended form submission.
HTML buttons default to type="submit". If NotificationItem is ever rendered inside a <form>, clicking it will trigger form submission. Explicitly set type="button" to guard against this.
🛡️ Proposed fix
<button
+ type="button"
onClick={onClick}
className={cn(📝 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.
| <button | |
| onClick={onClick} | |
| className={cn( | |
| "flex items-start gap-3 rounded-lg border p-4 cursor-pointer", | |
| "transition-colors hover:bg-accent dark:hover:bg-gray-800", | |
| "w-full text-left rounded-lg border p-4 transition-colors", | |
| read | |
| ? "border-border bg-transparent" | |
| : "border-border bg-accent/60 dark:bg-gray-800/60", | |
| ? "border-gray-700 bg-transparent" | |
| : "border-purple-700/40 bg-purple-900/10 hover:bg-purple-900/20" | |
| )} | |
| > | |
| <div className="mt-0.5 shrink-0">{TYPE_ICON[type]}</div> | |
| <div className="flex-1 space-y-0.5"> | |
| <div className="flex items-center justify-between gap-2"> | |
| <p | |
| className={cn( | |
| "text-sm font-medium", | |
| read ? "text-muted-foreground" : "text-foreground", | |
| )} | |
| > | |
| <div className="flex items-start gap-3"> | |
| <div className="mt-0.5 shrink-0">{ICON_MAP[type]}</div> | |
| <div className="flex-1 space-y-0.5"> | |
| <p className={cn("text-sm font-medium", read ? "text-gray-300" : "text-white")}> | |
| {title} | |
| </p> | |
| {!read && ( | |
| <span className="h-2 w-2 rounded-full bg-purple-500 shrink-0" /> | |
| )} | |
| <p className="text-xs text-gray-400">{message}</p> | |
| <p className="text-xs text-gray-500">{timestamp}</p> | |
| </div> | |
| <p className="text-xs text-muted-foreground">{message}</p> | |
| <p className="text-xs text-muted-foreground">{timestamp}</p> | |
| {!read && ( | |
| <span className="mt-1 h-2 w-2 shrink-0 rounded-full bg-purple-500" /> | |
| )} | |
| </div> | |
| </div> | |
| </button> | |
| <button | |
| type="button" | |
| onClick={onClick} | |
| className={cn( | |
| "w-full text-left rounded-lg border p-4 transition-colors", | |
| read | |
| ? "border-gray-700 bg-transparent" | |
| : "border-purple-700/40 bg-purple-900/10 hover:bg-purple-900/20" | |
| )} | |
| > | |
| <div className="flex items-start gap-3"> | |
| <div className="mt-0.5 shrink-0">{ICON_MAP[type]}</div> | |
| <div className="flex-1 space-y-0.5"> | |
| <p className={cn("text-sm font-medium", read ? "text-gray-300" : "text-white")}> | |
| {title} | |
| </p> | |
| <p className="text-xs text-gray-400">{message}</p> | |
| <p className="text-xs text-gray-500">{timestamp}</p> | |
| </div> | |
| {!read && ( | |
| <span className="mt-1 h-2 w-2 shrink-0 rounded-full bg-purple-500" /> | |
| )} | |
| </div> | |
| </button> |
🤖 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/dashboard/NotificationItem.tsx` around lines 30 - 52, The
button in NotificationItem currently relies on the default HTML button behavior,
which can accidentally submit a parent form. Update the button element in
NotificationItem to explicitly use type="button" so its onClick handler only
triggers the notification action and not form submission.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Pull Request for SafeTrust - Close Issue
❗ Pull Request Information
Homologates the notifications feature fix from
dApp-SafeTrust(Issue #191 / PR #195) intofrontend-SafeTrust. This resolves a 404 error when clicking the "Notifications" link in the sidebar by redirecting to a nested dashboard route and implementing the dedicated notifications page and item components.🌀 Summary of Changes
/notificationsto the nested/dashboard/notificationspath./dashboard/notificationsclient-side view featuring:🛠 Testing
Evidence After Solution
/dashboard/notifications(no longer 404)📂 Related Issue
This pull request will close #391 upon merging.
Make sure to follow the Git Guidelines for Atomic Commits and read Contributing Guide
The Pull request needs to have the format mentioned below in the Git Guideline
🎉 Thank you for reviewing this PR! 🎉
Summary by CodeRabbit