Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix: move quick action no target into picker (MUL-7990) (#9330)

Bohan Jiangdb2febc4b820
diff --git a/packages/views/autopilots/components/pickers/agent-picker.tsx b/packages/views/autopilots/components/pickers/agent-picker.tsx
index 3b9fd16710..06175b82e5 100644
--- a/packages/views/autopilots/components/pickers/agent-picker.tsx
+++ b/packages/views/autopilots/components/pickers/agent-picker.tsx
@@ -2,7 +2,7 @@
import { useMemo, useState } from "react";
import { useQuery } from "@tanstack/react-query";
-import { Bot } from "lucide-react";
+import { Bot, CircleDashed } from "lucide-react";
import { useWorkspaceId } from "@multica/core/hooks";
import { isAgentRuntimeBound } from "@multica/core/agents";
import { agentListOptions, squadListOptions } from "@multica/core/workspace/queries";
@@ -27,12 +27,14 @@ export function AgentPicker({
onChange,
trigger: customTrigger,
triggerRender,
+ emptyOption,
align = "start",
}: {
assignee: AssigneeSelection | null;
onChange: (next: AssigneeSelection) => void;
trigger?: React.ReactNode;
triggerRender?: React.ReactElement;
+ emptyOption?: { label: string; onSelect: () => void };
align?: "start" | "center" | "end";
}) {
const { t } = useT("autopilots");
@@ -92,6 +94,11 @@ export function AgentPicker({
/>
<span className="truncate">{selectedName}</span>
</>
+ ) : !assignee && emptyOption ? (
+ <>
+ <CircleDashed className="size-3 text-muted-foreground" />
+ <span>{emptyOption.label}</span>
+ </>
) : (
<>
<Bot className="size-3" />
@@ -102,6 +109,19 @@ export function AgentPicker({
)
}
>
+ {emptyOption && (
+ <PickerItem
+ emptyValue
+ selected={!assignee}
+ onClick={() => {
+ emptyOption.onSelect();
+ setOpen(false);
+ }}
+ >
+ <CircleDashed className="size-4 text-muted-foreground" />
+ <span>{emptyOption.label}</span>
+ </PickerItem>
+ )}
{filteredAgents.length === 0 && filteredSquads.length === 0 ? (
<PickerEmpty />
) : (
diff --git a/packages/views/settings/components/quick-actions-tab.tsx b/packages/views/settings/components/quick-actions-tab.tsx
index f794c9511e..69f42ea750 100644
--- a/packages/views/settings/components/quick-actions-tab.tsx
+++ b/packages/views/settings/components/quick-actions-tab.tsx
@@ -548,23 +548,27 @@ function QuickActionDialog({
</div>
<div className="space-y-1.5">
- <FieldLabel>{t(($) => $.quick_actions.field_target)}</FieldLabel>
- <div className="flex flex-wrap items-center gap-2">
- <Button
- type="button"
- variant={form.assigneeId ? "outline" : "secondary"}
- aria-pressed={!form.assigneeId}
- onClick={() => setForm((f) => ({ ...f, assigneeId: "" }))}
- >
- {t(($) => $.quick_actions.no_target)}
- </Button>
- <AgentPicker
- assignee={form.assigneeId ? { type: form.assigneeType, id: form.assigneeId } : null}
- onChange={(next) =>
- setForm((f) => ({ ...f, assigneeType: next.type, assigneeId: next.id }))
- }
- />
- </div>
+ <FieldLabel id="qa-target-label" htmlFor="qa-target">
+ {t(($) => $.quick_actions.field_target)}
+ </FieldLabel>
+ <AgentPicker
+ assignee={form.assigneeId ? { type: form.assigneeType, id: form.assigneeId } : null}
+ onChange={(next) =>
+ setForm((f) => ({ ...f, assigneeType: next.type, assigneeId: next.id }))
+ }
+ emptyOption={{
+ label: t(($) => $.quick_actions.no_target),
+ onSelect: () => setForm((f) => ({ ...f, assigneeId: "" })),
+ }}
+ triggerRender={
+ <Button
+ id="qa-target"
+ type="button"
+ variant="outline"
+ aria-labelledby="qa-target-label qa-target"
+ />
+ }
+ />
{/* Public promises "everyone can run this", so the server refuses a
target the team cannot invoke. Saying so here turns a 400 into
an expectation set before the user hits Save. */}