Skip to content

Sidebar Update: Share and Notifications#2084

Merged
prxt6529 merged 10 commits intomainfrom
sidebar-share-notifications
Mar 9, 2026
Merged

Sidebar Update: Share and Notifications#2084
prxt6529 merged 10 commits intomainfrom
sidebar-share-notifications

Conversation

@prxt6529
Copy link
Copy Markdown
Collaborator

@prxt6529 prxt6529 commented Mar 9, 2026

Summary by CodeRabbit

  • New Features

    • Notifications nav item in the sidebar with unread indicator
    • Desktop Share option in the user menu (opens share modal)
  • Improvements

    • Better accessibility: dynamic profile image labels
  • Tests

    • Test updates and renames to reflect renamed user menu component

prxt6529 added 2 commits March 9, 2026 12:10
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 9, 2026

Warning

Rate limit exceeded

@prxt6529 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc16d402-0fb4-4936-965b-f0504153d8df

📥 Commits

Reviewing files that changed from the base of the PR and between 382faf7 and 158585f.

📒 Files selected for processing (1)
  • components/nft-image/utils/arweave-fallback.ts
📝 Walkthrough

Walkthrough

Exports HeaderQRModal; adds Notifications nav item with unread indicator and integrates desktop share modal into user menu; renames HeaderUserProxyDropdown → HeaderUserMenuDropdown with onOpenShare prop and markup changes; introduces useIsMobileDeviceStatus hook; updates tests and minor CSS/class tweaks.

Changes

Cohort / File(s) Summary
Core Sharing Export
components/header/share/HeaderShare.tsx
Made HeaderQRModal exported (changed from non-exported to export function HeaderQRModal(...)).
Sidebar — Desktop & Mobile
components/layout/sidebar/WebSidebar.tsx, components/layout/sidebar/WebSidebarNav.tsx, components/layout/sidebar/WebSidebarUser.tsx
Added Notifications nav item with BellIcon and unread indicator (conditioned on address); removed bell usage from WebSidebarNav.tsx; integrated desktop share modal into WebSidebarUser.tsx and gated HeaderShare rendering by address/mobile state.
User Dropdown API & Markup
components/header/user/HeaderUserMenuDropdown.tsx, components/header/user/HeaderUserProxyDropdownItem.tsx
Renamed HeaderUserProxyDropdownHeaderUserMenuDropdown; added optional onOpenShare prop and Share button; converted divs to ul/li; updated avatar alt text and class ordering; minor CSS/class reordering in dropdown items.
Mobile Detection Hook
hooks/isMobileDevice.ts
Added useIsMobileDeviceStatus() (returns { isMobileDevice, isDeviceDetectionResolved }) and delegated default useIsMobileDevice() to it; introduced MOBILE_DEVICE_REGEX and detectIsMobileDevice() helper.
Tests & Imports
__tests__/components/header/user/HeaderUserMenuDropdown.test.tsx, __tests__/components/header/user/HeaderUserProxyDropdownItem.test.tsx
Updated tests to new component name and import paths, changed mock paths, normalized quote styles; no behavioral assertions changed.
Misc — Small Layout/Behavior Adjustments
components/header/share/..., components/header/user/... (related files)
Minor structural/markup and optional chaining updates for unread counts; added ShareIcon usage and share modal handlers; reordered sidebar/profile item placement.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #2046: Modifies WebSidebarUser.tsx and deals with unread-notification badges and connected account notification usage; closely related to sidebar/user notification/share integrations.

Suggested reviewers

  • simo6529
  • ragnep

Poem

🐰 I hopped in code through queues and flies,
I opened modals, nudged the bell — surprise!
Dropdowns got tidy, sharing now near,
Notifications whisper, "A rabbit is here!" 🥕🔔

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: sidebar updates to add share functionality and notifications features across multiple components.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sidebar-share-notifications

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.

Signed-off-by: prxt6529 <prxt@6529.io>
Copy link
Copy Markdown

@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 (2)
components/layout/sidebar/WebSidebarUser.tsx (1)

154-156: Use optional chaining for cleaner access.

Same pattern as in HeaderUserProxyDropdown.tsx - static analysis suggests optional chaining for improved readability.

♻️ Suggested change
   const hasUnreadOnOtherConnectedProfiles = connectedAccounts.some(
     (account) =>
       !account.isActive &&
-      ((connectedAccountUnreadNotifications ?? {})[
-        account.address.toLowerCase()
-      ] ?? 0) > 0
+      (connectedAccountUnreadNotifications?.[account.address.toLowerCase()] ??
+        0) > 0
   );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/layout/sidebar/WebSidebarUser.tsx` around lines 154 - 156, The
conditional accessing unread notifications uses manual null-coalescing and
bracket lookup; replace it with optional chaining to simplify and mirror
HeaderUserProxyDropdown.tsx — e.g., read the count via
connectedAccountUnreadNotifications?.[account.address.toLowerCase()] ?? 0 and
then compare > 0; update the expression in WebSidebarUser.tsx where
connectedAccountUnreadNotifications and account.address are referenced to use
optional chaining for cleaner, safer access.
components/header/user/proxy/HeaderUserProxyDropdown.tsx (1)

142-144: Use optional chaining for cleaner access.

Static analysis flagged this pattern. Optional chaining is more idiomatic and concise.

♻️ Suggested change
                          unreadNotificationsCount:
-                            (connectedAccountUnreadNotifications ?? {})[
-                              account.address.toLowerCase()
-                            ] ?? 0,
+                            connectedAccountUnreadNotifications?.[
+                              account.address.toLowerCase()
+                            ] ?? 0,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/header/user/proxy/HeaderUserProxyDropdown.tsx` around lines 142 -
144, Replace the manual nullish-coalesce-to-empty-object then bracket-lookup on
connectedAccountUnreadNotifications with optional chaining: access
connectedAccountUnreadNotifications using optional chaining when indexing by
account.address.toLowerCase(), and keep the existing fallback to 0; update the
expression in HeaderUserProxyDropdown (referencing
connectedAccountUnreadNotifications and account.address) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@components/header/user/proxy/HeaderUserProxyDropdown.tsx`:
- Around line 142-144: Replace the manual nullish-coalesce-to-empty-object then
bracket-lookup on connectedAccountUnreadNotifications with optional chaining:
access connectedAccountUnreadNotifications using optional chaining when indexing
by account.address.toLowerCase(), and keep the existing fallback to 0; update
the expression in HeaderUserProxyDropdown (referencing
connectedAccountUnreadNotifications and account.address) accordingly.

In `@components/layout/sidebar/WebSidebarUser.tsx`:
- Around line 154-156: The conditional accessing unread notifications uses
manual null-coalescing and bracket lookup; replace it with optional chaining to
simplify and mirror HeaderUserProxyDropdown.tsx — e.g., read the count via
connectedAccountUnreadNotifications?.[account.address.toLowerCase()] ?? 0 and
then compare > 0; update the expression in WebSidebarUser.tsx where
connectedAccountUnreadNotifications and account.address are referenced to use
optional chaining for cleaner, safer access.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a3c94885-0e20-4f25-b011-fdc478f1113d

📥 Commits

Reviewing files that changed from the base of the PR and between 26ae428 and b5275ad.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • components/header/share/HeaderShare.tsx
  • components/header/user/proxy/HeaderUserProxyDropdown.tsx
  • components/layout/sidebar/WebSidebar.tsx
  • components/layout/sidebar/WebSidebarNav.tsx
  • components/layout/sidebar/WebSidebarUser.tsx

prxt6529 added 5 commits March 9, 2026 12:44
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Copy link
Copy Markdown

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
__tests__/components/header/user/HeaderUserMenuDropdown.test.tsx (1)

161-167: ⚠️ Potential issue | 🟠 Major

The failure-path assertion is wrong.

HeaderUserMenuDropdown.runMenuAction() only calls onClose() after a successful action. When seizeSwitchConnectedAccount throws, the component keeps the menu open and only shows the error toast, so the expectation on Line 166 will fail.

Suggested fix
    await waitFor(() => {
      expect(seizeSwitchConnectedAccount).toHaveBeenCalledWith("0xdef");
      expect(setToast).toHaveBeenCalledWith(
        expect.objectContaining({ type: "error" })
      );
-      expect(onClose).toHaveBeenCalled();
+      expect(onClose).not.toHaveBeenCalled();
    });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@__tests__/components/header/user/HeaderUserMenuDropdown.test.tsx` around
lines 161 - 167, The test's failure-path assertion incorrectly expects onClose()
to be called; update the assertion in HeaderUserMenuDropdown.test for the error
case where seizeSwitchConnectedAccount throws to assert that setToast was called
with an error and that onClose was NOT called (or simply remove the onClose
assertion). Locate the test around the waitFor block that calls runMenuAction
and change the expectation referencing onClose to
expect(onClose).not.toHaveBeenCalled() (or remove it) while keeping the existing
expect(seizeSwitchConnectedAccount).toHaveBeenCalledWith("0xdef") and
expect(setToast).toHaveBeenCalledWith(expect.objectContaining({ type: "error"
})).
🧹 Nitpick comments (1)
__tests__/components/header/user/HeaderUserMenuDropdown.test.tsx (1)

40-71: Add coverage for the new Share branch.

This helper never passes onOpenShare, so the newly added Share action in HeaderUserMenuDropdown.tsx is still untested here. A small case for render/click behavior would catch regressions in one of the main features of this PR.

Example extension
 function renderDropdown(options: any) {
   mockConnect.mockReturnValue({
     address: options.address,
@@
   render(
     <AuthContext.Provider value={authValue}>
       <HeaderUserMenuDropdown
         isOpen
         profile={options.profile}
         onClose={onClose}
+        onOpenShare={options.onOpenShare}
       />
     </AuthContext.Provider>
   );
   return { onClose, ...authValue, ...mockConnect.mock.results[0].value };
 }
+
+it("calls onOpenShare when the Share action is clicked", () => {
+  const onOpenShare = jest.fn();
+  renderDropdown({
+    profile: profileBase,
+    address: "0xabc",
+    isConnected: true,
+    onOpenShare,
+  });
+
+  fireEvent.click(screen.getByRole("button", { name: "Share" }));
+  expect(onOpenShare).toHaveBeenCalled();
+});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@__tests__/components/header/user/HeaderUserMenuDropdown.test.tsx` around
lines 40 - 71, The test helper renderDropdown currently never supplies
onOpenShare, so add an onOpenShare mock to the returned props and to the
rendered HeaderUserMenuDropdown invocation: in renderDropdown, create const
onOpenShare = jest.fn(); pass onOpenShare to <HeaderUserMenuDropdown ...
onOpenShare={onOpenShare} />, include onOpenShare in the returned object, and
add/modify tests to call the Share action (e.g., find the Share button and
simulate click) and assert onOpenShare was called; this targets the
renderDropdown helper and HeaderUserMenuDropdown share branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/layout/sidebar/WebSidebarUser.tsx`:
- Around line 37-39: The desktop-share flag can be true briefly because
useIsMobileDevice() initializes false; update the logic in WebSidebarUser.tsx so
canUseDesktopShare only becomes true after device detection has settled: either
change useIsMobileDevice to return a tri-state (e.g. undefined | boolean) and
compute canUseDesktopShare = !capacitor.isCapacitor && isMobileDevice === false,
or add a separate isDeviceDetectionResolved boolean from the hook and compute
canUseDesktopShare = !capacitor.isCapacitor && isDeviceDetectionResolved &&
!isMobileDevice; update any UI that relies on canUseDesktopShare to respect the
resolved check so the Share action and QR modal are not shown until detection
completes.

---

Outside diff comments:
In `@__tests__/components/header/user/HeaderUserMenuDropdown.test.tsx`:
- Around line 161-167: The test's failure-path assertion incorrectly expects
onClose() to be called; update the assertion in HeaderUserMenuDropdown.test for
the error case where seizeSwitchConnectedAccount throws to assert that setToast
was called with an error and that onClose was NOT called (or simply remove the
onClose assertion). Locate the test around the waitFor block that calls
runMenuAction and change the expectation referencing onClose to
expect(onClose).not.toHaveBeenCalled() (or remove it) while keeping the existing
expect(seizeSwitchConnectedAccount).toHaveBeenCalledWith("0xdef") and
expect(setToast).toHaveBeenCalledWith(expect.objectContaining({ type: "error"
})).

---

Nitpick comments:
In `@__tests__/components/header/user/HeaderUserMenuDropdown.test.tsx`:
- Around line 40-71: The test helper renderDropdown currently never supplies
onOpenShare, so add an onOpenShare mock to the returned props and to the
rendered HeaderUserMenuDropdown invocation: in renderDropdown, create const
onOpenShare = jest.fn(); pass onOpenShare to <HeaderUserMenuDropdown ...
onOpenShare={onOpenShare} />, include onOpenShare in the returned object, and
add/modify tests to call the Share action (e.g., find the Share button and
simulate click) and assert onOpenShare was called; this targets the
renderDropdown helper and HeaderUserMenuDropdown share branch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bb7ef656-3a52-4797-a7ff-b3f8d6a86262

📥 Commits

Reviewing files that changed from the base of the PR and between 4e27ab4 and 1e03102.

📒 Files selected for processing (7)
  • __tests__/components/header/user/HeaderUserMenuDropdown.test.tsx
  • __tests__/components/header/user/HeaderUserProxyDropdownItem.test.tsx
  • components/header/user/HeaderUserMenuDropdown.tsx
  • components/header/user/HeaderUserProxyDropdownItem.tsx
  • components/layout/sidebar/WebSidebar.tsx
  • components/layout/sidebar/WebSidebarNav.tsx
  • components/layout/sidebar/WebSidebarUser.tsx
💤 Files with no reviewable changes (1)
  • components/layout/sidebar/WebSidebarNav.tsx
✅ Files skipped from review due to trivial changes (1)
  • tests/components/header/user/HeaderUserProxyDropdownItem.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/layout/sidebar/WebSidebar.tsx

Comment thread components/layout/sidebar/WebSidebarUser.tsx Outdated
prxt6529 added 2 commits March 9, 2026 13:54
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 9, 2026

@prxt6529 prxt6529 merged commit 8bb0347 into main Mar 9, 2026
7 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 10, 2026
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.

Substitute "share connection" icon with notification bell and put the sharing thing to the same place where sign in and out are

2 participants