diff --git a/packages/views/runtimes/components/runtime-list.tsx b/packages/views/runtimes/components/runtime-list.tsx index ecdb6e575..6aefd36a4 100644 --- a/packages/views/runtimes/components/runtime-list.tsx +++ b/packages/views/runtimes/components/runtime-list.tsx @@ -1,8 +1,15 @@ -import { Server, ArrowUpCircle } from "lucide-react"; +import { Server, ArrowUpCircle, ChevronDown, Check } from "lucide-react"; import { useQuery } from "@tanstack/react-query"; import type { AgentRuntime, MemberWithUser } from "@multica/core/types"; import { useWorkspaceId } from "@multica/core/hooks"; import { memberListOptions } from "@multica/core/workspace/queries"; +import { + DropdownMenu, + DropdownMenuTrigger, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, +} from "@multica/ui/components/ui/dropdown-menu"; import { ActorAvatar } from "../../common/actor-avatar"; import { RuntimeModeIcon } from "./shared"; @@ -102,11 +109,19 @@ export function RuntimeList({ .filter(Boolean) as MemberWithUser[] : []; + // Count runtimes per owner + const ownerCounts = new Map(); + for (const r of runtimes) { + if (r.owner_id) ownerCounts.set(r.owner_id, (ownerCounts.get(r.owner_id) ?? 0) + 1); + } + // Apply client-side owner filter when in "all" mode const filteredRuntimes = filter === "all" && ownerFilter ? runtimes.filter((r) => r.owner_id === ownerFilter) : runtimes; + const selectedOwner = ownerFilter ? getOwnerMember(ownerFilter) : null; + return (
@@ -117,53 +132,75 @@ export function RuntimeList({
- {/* Filter toggle */} -
- - + {/* Filter bar */} +
+ {/* Scope toggle */} +
+ + +
- {/* Owner filter pills (shown in "all" mode when there are multiple owners) */} + {/* Owner dropdown (only in All mode with multiple owners) */} {filter === "all" && uniqueOwners.length > 1 && ( - <> -
- {uniqueOwners.map((m) => ( - - ))} - + All owners + {!ownerFilter && } + + + {uniqueOwners.map((m) => ( + onOwnerFilterChange(ownerFilter === m.user_id ? null : m.user_id)} + className="flex items-center justify-between" + > +
+ + {m.name} + {ownerCounts.get(m.user_id) ?? 0} +
+ {ownerFilter === m.user_id && } +
+ ))} + + )}