diff --git a/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx
index 6be4809cf..78bac3371 100644
--- a/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx
@@ -280,7 +280,7 @@ export function AllPrivateChatsSidebar({
Active
- {activeCount}
+ {activeCount}
Archived
- {archivedCount}
+ {archivedCount}
@@ -363,7 +363,7 @@ export function AllPrivateChatsSidebar({
{isDeleting ? (
) : (
-
+
)}
{t("more_options") || "More options"}
diff --git a/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx
index ea80cc920..e3b6174c3 100644
--- a/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx
@@ -280,7 +280,7 @@ export function AllSharedChatsSidebar({
Active
- {activeCount}
+ {activeCount}
Archived
- {archivedCount}
+ {archivedCount}
@@ -363,7 +363,7 @@ export function AllSharedChatsSidebar({
{isDeleting ? (
) : (
-
+
)}
{t("more_options") || "More options"}
diff --git a/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
index 9f5a50bc4..f81417a45 100644
--- a/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
@@ -11,7 +11,6 @@ import {
History,
Inbox,
ListFilter,
- Loader2,
MoreHorizontal,
RotateCcw,
Search,
@@ -34,6 +33,7 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Input } from "@/components/ui/input";
+import { Spinner } from "@/components/ui/spinner";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import type { InboxItem } from "@/hooks/use-inbox";
@@ -168,16 +168,24 @@ export function InboxSidebar({
return items;
}, [currentTabItems, activeFilter, searchQuery]);
- // Count unread items per tab
- const unreadMentionsCount = useMemo(
- () => mentionItems.filter((item) => !item.read).length,
- [mentionItems]
- );
+ // Count unread items per tab (filter-aware)
+ const unreadMentionsCount = useMemo(() => {
+ if (activeFilter === "archived") {
+ // In archived view, show unread archived items
+ return mentionItems.filter((item) => !item.read && item.archived === true).length;
+ }
+ // For "all" and "unread" filters, show unread non-archived items
+ return mentionItems.filter((item) => !item.read && item.archived !== true).length;
+ }, [mentionItems, activeFilter]);
- const unreadStatusCount = useMemo(
- () => statusItems.filter((item) => !item.read).length,
- [statusItems]
- );
+ const unreadStatusCount = useMemo(() => {
+ if (activeFilter === "archived") {
+ // In archived view, show unread archived items
+ return statusItems.filter((item) => !item.read && item.archived === true).length;
+ }
+ // For "all" and "unread" filters, show unread non-archived items
+ return statusItems.filter((item) => !item.read && item.archived !== true).length;
+ }, [statusItems, activeFilter]);
const handleItemClick = useCallback(
async (item: InboxItem) => {
@@ -283,7 +291,7 @@ export function InboxSidebar({
case "in_progress":
return (
-
+
);
case "completed":
@@ -363,7 +371,7 @@ export function InboxSidebar({
size="icon"
className="h-8 w-8 rounded-full"
>
-
+
{t("filter") || "Filter"}
@@ -413,7 +421,7 @@ export function InboxSidebar({
size="icon"
className="h-8 w-8 rounded-full"
>
-
+
{t("more_options") || "More options"}
@@ -466,11 +474,12 @@ export function InboxSidebar({
{t("mentions") || "Mentions"}
- {unreadMentionsCount > 0 && (
-
- {unreadMentionsCount}
-
- )}
+
+ {unreadMentionsCount || 0}
+
{t("status") || "Status"}
- {unreadStatusCount > 0 && (
-
- {unreadStatusCount}
-
- )}
+
+ {unreadStatusCount || 0}
+
@@ -493,7 +503,7 @@ export function InboxSidebar({
{loading ? (
-
+
) : filteredItems.length > 0 ? (
@@ -507,7 +517,7 @@ export function InboxSidebar({
- {isMarkingAsRead ? (
-
- ) : (
-
- )}
+
{t("mark_as_read") || "Mark as read"}
)}
@@ -566,7 +572,7 @@ export function InboxSidebar({
disabled={isArchiving}
>
{isArchiving ? (
-
+
) : isArchived ? (
) : (
@@ -623,10 +629,10 @@ export function InboxSidebar({
)}
disabled={isBusy}
>
- {isBusy ? (
-
+ {isArchiving ? (
+
) : (
-
+
)}
{t("more_options") || "More options"}
diff --git a/surfsense_web/components/ui/spinner.tsx b/surfsense_web/components/ui/spinner.tsx
new file mode 100644
index 000000000..483cdf73f
--- /dev/null
+++ b/surfsense_web/components/ui/spinner.tsx
@@ -0,0 +1,35 @@
+import { cn } from "@/lib/utils";
+
+interface SpinnerProps {
+ /** Size of the spinner */
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
+ /** Whether to hide the track behind the spinner arc */
+ hideTrack?: boolean;
+ /** Additional classes to apply */
+ className?: string;
+}
+
+const sizeClasses = {
+ xs: "h-3 w-3 border-[1.5px]",
+ sm: "h-4 w-4 border-2",
+ md: "h-6 w-6 border-2",
+ lg: "h-8 w-8 border-[3px]",
+ xl: "h-10 w-10 border-4",
+};
+
+export function Spinner({ size = "md", hideTrack = false, className }: SpinnerProps) {
+ return (
+
+ );
+}
+