Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
Refine Quick Create agent modal (#1879)
Multica Eveb9118ae9b86b
diff --git a/packages/ui/components/common/file-upload-button.tsx b/packages/ui/components/common/file-upload-button.tsxindex fdbe34021b..cb2d44f80a 100644--- a/packages/ui/components/common/file-upload-button.tsx+++ b/packages/ui/components/common/file-upload-button.tsx@@ -36,6 +36,8 @@ function FileUploadButton({type="button"onClick={() => inputRef.current?.click()}disabled={disabled}+ aria-label="Attach file"+ title="Attach file"className={cn("inline-flex items-center justify-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground transition-colors disabled:opacity-50 disabled:pointer-events-none",btnSize,diff --git a/packages/views/modals/create-issue.test.tsx b/packages/views/modals/create-issue.test.tsxindex acbe4f8b09..6955447d79 100644--- a/packages/views/modals/create-issue.test.tsx+++ b/packages/views/modals/create-issue.test.tsx@@ -9,6 +9,7 @@ const mockCreateIssue = vi.hoisted(() => vi.fn());const mockSetDraft = vi.hoisted(() => vi.fn());const mockClearDraft = vi.hoisted(() => vi.fn());const mockSetLastAssignee = vi.hoisted(() => vi.fn());+const mockSetKeepOpen = vi.hoisted(() => vi.fn());const mockToastCustom = vi.hoisted(() => vi.fn());const mockToastDismiss = vi.hoisted(() => vi.fn());const mockToastError = vi.hoisted(() => vi.fn());@@ -30,6 +31,11 @@ const mockDraftStore = {setLastAssignee: mockSetLastAssignee,};+const mockQuickCreateStore = {+ keepOpen: false,+ setKeepOpen: mockSetKeepOpen,+};+vi.mock("../navigation", () => ({useNavigation: () => ({ push: mockPush }),}));@@ -60,6 +66,11 @@ vi.mock("@multica/core/issues/stores/draft-store", () => ({),}));+vi.mock("@multica/core/issues/stores/quick-create-store", () => ({+ useQuickCreateStore: (selector?: (state: typeof mockQuickCreateStore) => unknown) =>+ (selector ? selector(mockQuickCreateStore) : mockQuickCreateStore),+}));+vi.mock("@multica/core/issues/mutations", () => ({useCreateIssue: () => ({ mutateAsync: mockCreateIssue }),useUpdateIssue: () => ({ mutate: vi.fn() }),@@ -79,6 +90,10 @@ vi.mock("../editor", () => {const [value, setValue] = useState(defaultValue || "");useImperativeHandle(ref, () => ({getMarkdown: () => valueRef.current,+ clearContent: () => {+ valueRef.current = "";+ setValue("");+ },uploadFile: vi.fn(),}));return (@@ -178,6 +193,23 @@ vi.mock("@multica/ui/components/ui/button", () => ({),}));+vi.mock("@multica/ui/components/ui/switch", () => ({+ Switch: ({+ checked,+ onCheckedChange,+ }: {+ checked: boolean;+ onCheckedChange: (v: boolean) => void;+ }) => (+ <input+ aria-label="Create another"+ type="checkbox"+ checked={checked}+ onChange={(e) => onCheckedChange(e.target.checked)}+ />+ ),+}));+vi.mock("@multica/ui/components/common/file-upload-button", () => ({FileUploadButton: ({ onSelect }: { onSelect: (file: File) => void }) => (<button type="button" onClick={() => onSelect(new File(["test"], "test.txt"))}>@@ -210,6 +242,10 @@ function renderModal(element: React.ReactElement) {describe("CreateIssueModal", () => {beforeEach(() => {vi.clearAllMocks();+ mockQuickCreateStore.keepOpen = false;+ mockSetKeepOpen.mockImplementation((v: boolean) => {+ mockQuickCreateStore.keepOpen = v;+ });mockCreateIssue.mockResolvedValue({id: "issue-123",identifier: "TES-123",@@ -261,4 +297,44 @@ describe("CreateIssueModal", () => {expect(mockPush).toHaveBeenCalledWith("/ws-test/issues/issue-123");expect(mockToastDismiss).toHaveBeenCalledWith("toast-1");});++ it("keeps manual mode open and clears content when create another is enabled", async () => {+ const user = userEvent.setup();+ const onClose = vi.fn();+ mockQuickCreateStore.keepOpen = true;++ renderModal(<CreateIssueModal onClose={onClose} />);++ await user.type(screen.getByPlaceholderText("Issue title"), "First follow-up issue");+ await user.type(screen.getByPlaceholderText("Add description..."), "Description to clear");+ await user.click(screen.getByRole("button", { name: "Create Issue" }));++ await waitFor(() => {+ expect(mockCreateIssue).toHaveBeenCalledWith({+ title: "First follow-up issue",+ description: "Description to clear",+ status: "todo",+ priority: "none",+ assignee_type: undefined,+ assignee_id: undefined,+ due_date: undefined,+ attachment_ids: undefined,+ parent_issue_id: undefined,+ project_id: undefined,+ });+ });++ expect(onClose).not.toHaveBeenCalled();+ expect(screen.getByPlaceholderText("Issue title")).toHaveValue("");+ expect(screen.getByPlaceholderText("Add description...")).toHaveValue("");+ expect(mockSetDraft).toHaveBeenCalledWith({+ title: "",+ description: "",+ status: "todo",+ priority: "none",+ assigneeType: undefined,+ assigneeId: undefined,+ dueDate: null,+ });+ });});diff --git a/packages/views/modals/create-issue.tsx b/packages/views/modals/create-issue.tsxindex 09a3b24bd0..9462238eb7 100644--- a/packages/views/modals/create-issue.tsx+++ b/packages/views/modals/create-issue.tsx@@ -30,6 +30,7 @@ import {} from "@multica/ui/components/ui/dropdown-menu";import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";import { Button } from "@multica/ui/components/ui/button";+import { Switch } from "@multica/ui/components/ui/switch";import { ContentEditor, type ContentEditorRef, TitleEditor, useFileDropZone, FileDropOverlay } from "../editor";import { StatusIcon, StatusPicker, PriorityPicker, AssigneePicker, DueDatePicker } from "../issues/components";import { BacklogAgentHintContent } from "../issues/components/backlog-agent-hint-dialog";@@ -38,6 +39,7 @@ import { useCurrentWorkspace, useWorkspacePaths } from "@multica/core/paths";import { useWorkspaceId } from "@multica/core/hooks";import { useIssueDraftStore } from "@multica/core/issues/stores/draft-store";import { useCreateModeStore } from "@multica/core/issues/stores/create-mode-store";+import { useQuickCreateStore } from "@multica/core/issues/stores/quick-create-store";import { issueDetailOptions } from "@multica/core/issues/queries";import { useCreateIssue, useUpdateIssue } from "@multica/core/issues/mutations";import { useFileUpload } from "@multica/core/hooks/use-file-upload";@@ -84,8 +86,11 @@ export function ManualCreatePanel({const clearDraft = useIssueDraftStore((s) => s.clearDraft);const setLastAssignee = useIssueDraftStore((s) => s.setLastAssignee);const setLastMode = useCreateModeStore((s) => s.setLastMode);+ const keepOpen = useQuickCreateStore((s) => s.keepOpen);+ const setKeepOpen = useQuickCreateStore((s) => s.setKeepOpen);const [title, setTitle] = useState(draft.title);+ const [formResetKey, setFormResetKey] = useState(0);const descEditorRef = useRef<ContentEditorRef>(null);const { isDragOver: descDragOver, dropZoneProps: descDropZoneProps } = useFileDropZone({onDrop: (files) => files.forEach((f) => descEditorRef.current?.uploadFile(f)),@@ -138,6 +143,28 @@ export function ManualCreatePanel({const createIssueMutation = useCreateIssue();const updateIssueMutation = useUpdateIssue();+ const resetForNextIssue = () => {+ setTitle("");+ setStatus("todo");+ setPriority("none");+ setDueDate(null);+ setProjectId(undefined);+ setParentIssueId(undefined);+ setChildIssues([]);+ setAttachmentIds([]);+ setDraft({+ title: "",+ description: "",+ status: "todo",+ priority: "none",+ assigneeType,+ assigneeId,+ dueDate: null,+ });+ descEditorRef.current?.clearContent();+ setFormResetKey((key) => key + 1);+ };+const handleSubmit = async () => {if (!title.trim() || submitting) return;setSubmitting(true);@@ -186,6 +213,8 @@ export function ManualCreatePanel({if (shouldShowBacklogHint) {setBacklogHintIssueId(issue.id);+ } else if (keepOpen) {+ resetForNextIssue();} else {onClose();}@@ -304,6 +333,7 @@ export function ManualCreatePanel({{/* Title */}<div className="px-5 pb-2 shrink-0"><TitleEditor+ key={formResetKey}autoFocusdefaultValue={draft.title}placeholder="Issue title"@@ -494,20 +524,30 @@ export function ManualCreatePanel({/>{/* Footer */}- <div className="flex items-center justify-between px-4 py-3 border-t shrink-0">- <FileUploadButton- onSelect={(file) => descEditorRef.current?.uploadFile(file)}- />- <div className="flex items-center gap-2">+ <div className="flex flex-col gap-2 border-t px-4 py-3 shrink-0 sm:flex-row sm:items-center sm:justify-between">+ <div className="flex min-h-7 items-center gap-2">+ <FileUploadButton+ onSelect={(file) => descEditorRef.current?.uploadFile(file)}+ />+ </div>+ <div className="flex flex-wrap items-center justify-end gap-2"><buttontype="button"onClick={switchToAgent}title="Switch to create with agent — describe in one line and let the agent file it"- className="flex items-center gap-1.5 text-xs px-2 py-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors cursor-pointer"+ className="flex shrink-0 items-center gap-1.5 text-xs px-2 py-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors cursor-pointer"><ArrowLeftRight className="size-3.5" />- Switch to agent+ Switch to Agent</button>+ <label className="flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none">+ <Switch+ size="sm"+ checked={keepOpen}+ onCheckedChange={setKeepOpen}+ />+ Create another+ </label><Button size="sm" onClick={handleSubmit} disabled={!title.trim() || submitting}>{submitting ? "Creating..." : "Create Issue"}</Button>diff --git a/packages/views/modals/quick-create-issue.tsx b/packages/views/modals/quick-create-issue.tsxindex a0f6c7831a..77d8666234 100644--- a/packages/views/modals/quick-create-issue.tsx+++ b/packages/views/modals/quick-create-issue.tsx@@ -252,6 +252,7 @@ export function AgentCreatePanel({on the first focusable element on mount, causing the tooltip toauto-pop every open. */}<button+ type="button"onClick={onClose}title="Close"aria-label="Close"@@ -268,6 +269,7 @@ export function AgentCreatePanel({render={<buttontype="button"+ aria-label="Select agent"className="flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer rounded-sm px-1.5 py-1 -ml-1.5 hover:bg-accent/60"><span>Created by</span>@@ -307,6 +309,9 @@ export function AgentCreatePanel({size={16}/><span className="flex-1 truncate">{a.name}</span>+ {agentId === a.id && (+ <Check className="size-3.5 text-muted-foreground" />+ )}</DropdownMenuItem>)))}@@ -350,30 +355,30 @@ export function AgentCreatePanel({)}{/* Footer */}- <div className="flex items-center justify-between px-4 py-3 border-t shrink-0">- <div className="flex items-center gap-1.5">+ <div className="flex flex-col gap-2 border-t px-4 py-3 shrink-0 sm:flex-row sm:items-center sm:justify-between">+ <div className="flex min-h-7 items-center gap-2"><FileUploadButtonsize="sm"+ disabled={uploading}onSelect={(file) => editorRef.current?.uploadFile(file)}/>- <span className="text-xs text-muted-foreground">- {keepOpen && sentCount > 0 && (- <span className="text-emerald-600 dark:text-emerald-400">{sentCount} sent · </span>- )}- ⌘↵ to submit- </span>+ {keepOpen && sentCount > 0 && (+ <span className="text-xs text-emerald-600 dark:text-emerald-400">+ {sentCount} sent+ </span>+ )}</div>- <div className="flex items-center gap-2">+ <div className="flex flex-wrap items-center justify-end gap-2"><buttontype="button"onClick={switchToManual}title="Switch to manual create — fill the fields yourself"- className="flex items-center gap-1.5 text-xs px-2 py-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors cursor-pointer"+ className="flex shrink-0 items-center gap-1.5 text-xs px-2 py-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors cursor-pointer"><ArrowLeftRight className="size-3.5" />- Switch to manual+ Switch to Manual</button>- <label className="flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none">+ <label className="flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none"><Switchsize="sm"checked={keepOpen}@@ -390,11 +395,11 @@ export function AgentCreatePanel({? `Daemon CLI must be ≥ ${versionCheck.min}`: undefined}- className={justSent ? "!bg-emerald-600 !text-white" : undefined}+ className={justSent ? "min-w-28 !bg-emerald-600 !text-white" : "min-w-28"}>{submitting ? "Sending…" : uploading ? "Uploading…" : justSent ? (<span className="flex items-center gap-1"><Check className="size-3.5" />Sent</span>- ) : "Create"}+ ) : "Create (⌘↵)"}</Button></div></div>