Fix desktop badge workspace parity

This commit is contained in:
Mohamed Boudra
2026-04-10 19:14:31 +07:00
parent 01af138939
commit a315021c75
3 changed files with 69 additions and 17 deletions
@@ -0,0 +1,16 @@
import type { WorkspaceDescriptor } from "@/stores/session-store";
export type DesktopBadgeWorkspaceStatus = WorkspaceDescriptor["status"];
export function isWorkspaceActionableForDesktopBadge(
status: DesktopBadgeWorkspaceStatus,
): boolean {
return status === "attention" || status === "needs_input" || status === "failed";
}
export function deriveMacDockBadgeCountFromWorkspaceStatuses(
statuses: readonly DesktopBadgeWorkspaceStatus[],
): number | undefined {
const actionableCount = statuses.filter(isWorkspaceActionableForDesktopBadge).length;
return actionableCount > 0 ? actionableCount : undefined;
}