aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard
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
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/AllLists.tsx2
-rw-r--r--apps/web/components/dashboard/sidebar/InvitationNotificationBadge.tsx25
2 files changed, 27 insertions, 0 deletions
diff --git a/apps/web/components/dashboard/sidebar/AllLists.tsx b/apps/web/components/dashboard/sidebar/AllLists.tsx
index f8b80cba..306bf4b4 100644
--- a/apps/web/components/dashboard/sidebar/AllLists.tsx
+++ b/apps/web/components/dashboard/sidebar/AllLists.tsx
@@ -24,6 +24,7 @@ import { ZBookmarkListTreeNode } from "@karakeep/shared/utils/listUtils";
import { CollapsibleBookmarkLists } from "../lists/CollapsibleBookmarkLists";
import { EditListModal } from "../lists/EditListModal";
import { ListOptions } from "../lists/ListOptions";
+import { InvitationNotificationBadge } from "./InvitationNotificationBadge";
export default function AllLists({
initialData,
@@ -90,6 +91,7 @@ export default function AllLists({
path={`/dashboard/lists`}
linkClassName="py-0.5"
className="px-0.5"
+ right={<InvitationNotificationBadge />}
/>
<SidebarItem
logo={<span className="text-lg">⭐️</span>}
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>
+ );
+}