aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx')
-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>
+ );
+}