Skip to content

Add invite notification count badge#542

Merged
braginini merged 2 commits intomainfrom
feature/invite-notification-badge
Jan 27, 2026
Merged

Add invite notification count badge#542
braginini merged 2 commits intomainfrom
feature/invite-notification-badge

Conversation

@braginini
Copy link
Copy Markdown
Contributor

@braginini braginini commented Jan 27, 2026

Summary by CodeRabbit

  • New Features
    • Added a notification badge to the "Show Invites" button that displays the number of active (non-expired) pending user invites, making outstanding invitations immediately visible in the Users table. The badge updates dynamically and respects the Show Invites setting.

✏️ Tip: You can customize this high-level summary in your review settings.

@braginini braginini requested a review from mlsmaycon January 27, 2026 09:10
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

Fetches /users/invites, computes non-expired invites, and displays that count in a NotificationCountBadge adjacent to the "Show Invites" button in the Users table UI.

Changes

Cohort / File(s) Summary
Users table UI & invite fetch
src/modules/users/UsersTable.tsx
Imported NotificationCountBadge and UserInvite; added useFetchApi<UserInvite[]>("/users/invites") gated by showInvitesToggle; computed validInvitesCount by filtering out expired invites; rendered badge on the Show Invites button.

Sequence Diagram(s)

sequenceDiagram
  participant UsersTable as UsersTable (UI)
  participant Hook as useFetchApi Hook
  participant API as /users/invites API
  participant Badge as NotificationCountBadge

  UsersTable->>Hook: request invites (when showInvitesToggle enabled)
  Hook->>API: GET /users/invites
  API-->>Hook: invites array
  Hook-->>UsersTable: invites data
  UsersTable->>UsersTable: filter non-expired invites -> validInvitesCount
  UsersTable->>Badge: render with validInvitesCount
  Badge-->>UsersTable: displayed badge next to Show Invites
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Adjust Invites API #541 — Changes to UserInvite type and /users/invites API usage that align with this PR's data fetching and type usage.

Suggested reviewers

  • mlsmaycon

Poem

🐰
A tiny badge upon the row,
Counts fresh invites that come and go,
No stale dates pass this rabbit's gaze,
New guests shine bright in invite arrays,
Hop, click, and let the list display! 🥕✨

🚥 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 'Add invite notification count badge' directly and specifically describes the main change: adding a notification badge to display pending invite counts in the UI.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@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

🤖 Fix all issues with AI agents
In `@src/modules/users/UsersTable.tsx`:
- Around line 153-156: The hook call currently passes null to useFetchApi to
disable fetching which breaks strict typing; change to always pass the string
"/users/invites" as the URL and use the hook's allowFetch (4th) parameter driven
by showInvitesToggle to conditionally enable fetching. Update the call to
useFetchApi<UserInvite[]> so the URL argument is "/users/invites" and set the
4th argument to showInvitesToggle (leaving optional 2nd/3rd args as before) so
invites and validInvitesCount logic can remain unchanged.

Comment thread src/modules/users/UsersTable.tsx
mlsmaycon
mlsmaycon previously approved these changes Jan 27, 2026
@braginini braginini merged commit a7c7800 into main Jan 27, 2026
4 checks passed
@braginini braginini deleted the feature/invite-notification-badge branch January 27, 2026 09:44
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.

2 participants