Skip to content

fix: notifications sidebar returns 404 - #402

Merged
sotoJ24 merged 3 commits into
safetrustcr:developfrom
emarc99:fix/notifications-sidebar
Jul 9, 2026
Merged

fix: notifications sidebar returns 404#402
sotoJ24 merged 3 commits into
safetrustcr:developfrom
emarc99:fix/notifications-sidebar

Conversation

@emarc99

@emarc99 emarc99 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Pull Request for SafeTrust - Close Issue

Pull Request Information

Homologates the notifications feature fix from dApp-SafeTrust (Issue #191 / PR #195) into frontend-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

  • SideBar Update: Updated the Notifications navigation link target from the root /notifications to the nested /dashboard/notifications path.
  • Notifications Page: Implemented the nested /dashboard/notifications client-side view featuring:
    • A mock list of success, info, and warning notifications.
    • State management for marking individual items or all items as read.
    • Empty state visualization when all notifications are cleared.
  • NotificationItem Component: Created a reusable component for displaying notifications with specific icons, layouts, and style modifiers (distinguishing read and unread states).

🛠 Testing

Evidence After Solution

  • Bell icon in Sidebar navigates to /dashboard/notifications (no longer 404)
Screenshot 2026-07-08 231709
  • "Mark as read" works
Screenshot 2026-07-08 231745
  • "Mark all as read" works correctly
Screenshot 2026-07-08 231903
  • Empty state renders successfully when cleared
Screenshot 2026-07-08 233211

📂 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

  • Bug Fixes
    • Improved the notifications page styling for the “Mark all as read” action, divider, and empty state for a cleaner, more consistent look.
    • Updated notification items to behave as proper buttons, improving click interaction and accessibility.
    • Refined notification text, icon, and unread-state styling for better readability.
    • Fixed the sidebar Notifications link to open the correct dashboard notifications page.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@emarc99, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c6cbf7c9-b402-4ead-8b48-f2ba089bc5f0

📥 Commits

Reviewing files that changed from the base of the PR and between 50c9f6f and a75e248.

📒 Files selected for processing (1)
  • src/components/dashboard/NotificationItem.tsx
📝 Walkthrough

Walkthrough

Restyles 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.

Changes

Notifications UI update

Layer / File(s) Summary
NotificationItem contract and rendering refactor
src/components/dashboard/NotificationItem.tsx
Converts the clickable <div> to a <button>, makes onClick required, renames TYPE_ICON to ICON_MAP with new icons/sizes, removes "use client", and restyles title/message/timestamp and unread indicator.
Notifications page and sidebar styling/route updates
src/app/dashboard/notifications/page.tsx, src/components/layouts/SideBar.tsx
Switches mark-all-as-read button, divider, and empty-state classes to gray/white Tailwind styles, and updates the sidebar Notifications link to /dashboard/notifications.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

  • safetrustcr/frontend-SafeTrust#380: Directly relates to the original creation of the notifications page and NotificationItem component now being restyled and refactored.

Suggested reviewers: sotoJ24

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main fix: the notifications sidebar 404 issue.
Description check ✅ Passed The description mostly follows the template with PR info, summary, testing evidence, and linked issue, though the before-solution Loom link is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@emarc99 emarc99 changed the title fix(sidebar): update notifications link to /dashboard/notifications fix: notifications sidebar returns 404 Jun 30, 2026
@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@emarc99
emarc99 marked this pull request as draft June 30, 2026 18:41
@sotoJ24

sotoJ24 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Hi @emarc99

@emarc99
emarc99 marked this pull request as ready for review July 8, 2026 22:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between ca92f59 and 50c9f6f.

📒 Files selected for processing (3)
  • src/app/dashboard/notifications/page.tsx
  • src/components/dashboard/NotificationItem.tsx
  • src/components/layouts/SideBar.tsx

Comment on lines +30 to +52
<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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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.

Suggested change
<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.

Comment thread src/components/dashboard/NotificationItem.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@sotoJ24
sotoJ24 self-requested a review July 9, 2026 00:37

@sotoJ24 sotoJ24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well done @emarc99

@sotoJ24
sotoJ24 merged commit 0b30aa7 into safetrustcr:develop Jul 9, 2026
1 check passed
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.

🐞[Bug] Notifications sidebar link returns 404 - homologate fix from dApp-SafeTrust PR #195

2 participants