aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-11-30 15:46:31 +0000
committerMohamed Bassem <me@mbassem.com>2025-11-30 15:46:44 +0000
commit3c6b8e97be4a2b4c793ddfcc5009fc1e0f00b9bb (patch)
tree61f7025a655098b2a56a4f609b4b9ffa2847d4c7 /apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx
parent9a33938529ebf4005ef260aaa1485e8a27789e66 (diff)
downloadkarakeep-3c6b8e97be4a2b4c793ddfcc5009fc1e0f00b9bb.tar.zst
feat: add a notification badge for list invitations
Diffstat (limited to '')
-rw-r--r--apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx b/apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx
new file mode 100644
index 00000000..e4d7b39f
--- /dev/null
+++ b/apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx
@@ -0,0 +1,25 @@
+"use client";
+
+import { api } from "@/lib/trpc";
+
+export function InvitationNotificationBadge() {
+ const { data: pendingInvitations } = api.lists.getPendingInvitations.useQuery(
+ undefined,
+ {
+ refetchInterval: 1000 * 60 * 5,
+ },
+ );
+ const pendingInvitationsCount = pendingInvitations?.length ?? 0;
+
+ if (pendingInvitationsCount === 0) {
+ return null;
+ }
+
+ return (
+ <div className="flex items-center px-1">
+ <span className="rounded-full bg-blue-500 px-2 py-0.5 text-center text-xs text-white">
+ {pendingInvitationsCount}
+ </span>
+ </div>
+ );
+}