Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/views/layout/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import { useDeletePin, useReorderPins } from "@multica/core/pins/mutations";
import { issueDetailOptions } from "@multica/core/issues/queries";
import { projectDetailOptions } from "@multica/core/projects/queries";
import { shipProjectsOptions, shipHubSummaryOptions } from "@multica/core/ship";
import { channelsListOptions } from "@multica/core/channels";
import type { PinnedItem } from "@multica/core/types";
import { useLogout } from "../auth";
import { ProjectIcon } from "../projects/components/project-icon";
Expand Down Expand Up @@ -487,6 +488,14 @@ export function AppSidebar({ topSlot, searchSlot, headerClassName, headerStyle }
const { data: shipSummary } = useQuery({
...shipHubSummaryOptions(wsId ?? "", shipEnabled && !!wsId),
});
const channelsEnabled = !!workspace?.channels_enabled;
const { data: channelsList } = useQuery({
...channelsListOptions(wsId ?? "", channelsEnabled && !!wsId),
});
const channelsUnreadCount = React.useMemo(
() => (channelsList ?? []).reduce((acc, c) => acc + (c.unread_count ?? 0), 0),
[channelsList],
);
const { data: pinnedItems = EMPTY_PINS } = useQuery({
...pinListOptions(wsId ?? "", userId ?? ""),
enabled: !!wsId && !!userId,
Expand Down Expand Up @@ -836,6 +845,12 @@ export function AppSidebar({ topSlot, searchSlot, headerClassName, headerStyle }
fallbackCount={shipOpenPrCount}
/>
)}
{item.key === "channels" && channelsUnreadCount > 0 && (
<span className="ml-auto inline-flex items-center gap-0.5 text-[11px] tabular-nums">
<span aria-hidden className="size-1.5 rounded-full bg-amber-500" />
{channelsUnreadCount > 99 ? "99+" : channelsUnreadCount}
</span>
)}
</SidebarMenuButton>
</SidebarMenuItem>
);
Expand Down
Loading