Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
Improve UI animation transitions (MUL-5172) (#5718)
Jiayuan Zhange0e9383efeca
diff --git a/packages/ui/lib/motion.ts b/packages/ui/lib/motion.tsnew file mode 100644index 0000000000..41d4e82f77--- /dev/null+++ b/packages/ui/lib/motion.ts@@ -0,0 +1,7 @@+export const UI_EASE_OUT = [0.23, 1, 0.32, 1] as const;++export const UI_MOTION_DURATION = {+ micro: 0.1,+ fast: 0.15,+ standard: 0.2,+} as const;diff --git a/packages/ui/package.json b/packages/ui/package.jsonindex 789814a171..164d06a407 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -21,6 +21,7 @@"./lib/data-table": "./lib/data-table.ts","./lib/code-style": "./lib/code-style.ts","./lib/clipboard": "./lib/clipboard.ts",+ "./lib/motion": "./lib/motion.ts","./i18n-types": "./types/i18next.ts","./styles/tokens.css": "./styles/tokens.css","./styles/base.css": "./styles/base.css"diff --git a/packages/views/agents/components/agent-batch-toolbar.test.tsx b/packages/views/agents/components/agent-batch-toolbar.test.tsxindex ff5a244fa1..505c7cb5dc 100644--- a/packages/views/agents/components/agent-batch-toolbar.test.tsx+++ b/packages/views/agents/components/agent-batch-toolbar.test.tsx@@ -90,18 +90,23 @@ function makeRow(function renderToolbar(rows: AgentListRow[]) {const qc = new QueryClient({ defaultOptions: { queries: { retry: false } } });- return render(+ const ui = (nextRows: AgentListRow[]) => (<QueryClientProvider client={qc}><I18nProvider locale="en" resources={TEST_RESOURCES}><AgentBatchToolbar- rows={rows}+ rows={nextRows}members={[]}currentUserId="user-1"onClear={() => {}}/></I18nProvider>- </QueryClientProvider>,+ </QueryClientProvider>);+ const view = render(ui(rows));+ return {+ ...view,+ rerenderRows: (nextRows: AgentListRow[]) => view.rerender(ui(nextRows)),+ };}beforeEach(() => {@@ -127,6 +132,24 @@ describe("AgentBatchToolbar — action order", () => {});});+describe("AgentBatchToolbar — presence", () => {+ it("closes dialogs and removes the toolbar when selection becomes empty", async () => {+ const view = renderToolbar([makeRow("a", "user-1")]);++ fireEvent.click(screen.getByRole("button", { name: "Set access scope" }));+ await screen.findByText(/Applies to 1 agents/);++ view.rerenderRows([]);++ await waitFor(() => {+ expect(screen.queryByText(/Applies to 1 agents/)).not.toBeInTheDocument();+ expect(+ screen.queryByRole("button", { name: "Set access scope" }),+ ).not.toBeInTheDocument();+ });+ });+});+describe("AgentBatchToolbar — bulk Set access scope", () => {it("shows the Set access scope button for active owned agents", () => {renderToolbar([makeRow("a", "user-1")]);diff --git a/packages/views/agents/components/agent-batch-toolbar.tsx b/packages/views/agents/components/agent-batch-toolbar.tsxindex 0140cbe5aa..9c02f9b080 100644--- a/packages/views/agents/components/agent-batch-toolbar.tsx+++ b/packages/views/agents/components/agent-batch-toolbar.tsx@@ -1,6 +1,7 @@"use client";-import { useCallback, useState } from "react";+import { useCallback, useEffect, useState } from "react";+import { AnimatePresence, motion, useReducedMotion } from "motion/react";import { useQueryClient } from "@tanstack/react-query";import { toast } from "sonner";import type { MemberWithUser } from "@multica/core/types";@@ -8,6 +9,10 @@ import { api } from "@multica/core/api";import { useWorkspaceId } from "@multica/core/hooks";import { workspaceKeys } from "@multica/core/workspace/queries";import { Button } from "@multica/ui/components/ui/button";+import {+ UI_EASE_OUT,+ UI_MOTION_DURATION,+} from "@multica/ui/lib/motion";import {Dialog,DialogContent,@@ -45,6 +50,7 @@ export function AgentBatchToolbar({const { t } = useT("agents");const wsId = useWorkspaceId();const qc = useQueryClient();+ const shouldReduceMotion = useReducedMotion() ?? false;const [confirmArchive, setConfirmArchive] = useState(false);const [confirmAccess, setConfirmAccess] = useState(false);const [accessChange, setAccessChange] = useState<AccessChange | null>(null);@@ -67,8 +73,6 @@ export function AgentBatchToolbar({setConfirmAccess(open);}, []);- if (rows.length === 0) return null;-const allManageable = rows.every((r) => r.canManage);const ownedRows = rows.filter((r) => r.isOwnedByMe);const anyOwned = ownedRows.length > 0;@@ -80,6 +84,13 @@ export function AgentBatchToolbar({const accessConfirmEnabled = accessChange !== null;+ useEffect(() => {+ if (rows.length > 0) return;+ setConfirmArchive(false);+ setConfirmAccess(false);+ setAccessChange(null);+ }, [rows.length]);+const applyAccessBulk = async (change: AccessChange) => {const summary = await runBatch((id) =>@@ -125,7 +136,41 @@ export function AgentBatchToolbar({return (<>- <div className="absolute bottom-6 left-1/2 z-50 flex -translate-x-1/2 items-center gap-1 rounded-lg border bg-background px-2 py-1.5 shadow-lg">+ <AnimatePresence initial={false}>+ {rows.length > 0 && (+ <div+ key="agent-batch-toolbar"+ className="absolute bottom-6 left-1/2 z-50 -translate-x-1/2"+ >+ <motion.div+ className="flex items-center gap-1 rounded-lg border bg-background px-2 py-1.5 shadow-lg"+ initial={{+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateY(0)"+ : "translateY(8px)",+ }}+ animate={{+ opacity: 1,+ transform: "translateY(0)",+ transition: {+ duration: UI_MOTION_DURATION.fast,+ ease: UI_EASE_OUT,+ },+ }}+ exit={{+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateY(0)"+ : "translateY(8px)",+ transition: {+ duration: shouldReduceMotion+ ? UI_MOTION_DURATION.fast+ : UI_MOTION_DURATION.micro,+ ease: UI_EASE_OUT,+ },+ }}+ ><div className="mr-1 flex items-center gap-1.5 border-r pl-1 pr-2"><span className="text-sm font-medium">{t(($) => $.actions.selected, { count: rows.length })}@@ -179,10 +224,13 @@ export function AgentBatchToolbar({{t(($) => $.row_actions.archive)}</Button>)}- </div>+ </motion.div>+ </div>+ )}+ </AnimatePresence>{/* Archive confirm dialog */}- <Dialog open={confirmArchive} onOpenChange={setConfirmArchive}>+ {rows.length > 0 && <Dialog open={confirmArchive} onOpenChange={setConfirmArchive}><DialogContent className="sm:max-w-md"><DialogHeader><DialogTitle>@@ -227,12 +275,12 @@ export function AgentBatchToolbar({</Button></DialogFooter></DialogContent>- </Dialog>+ </Dialog>}{/* Bulk access dialog — AccessPicker's internal Save is hidden (hideFooter)so this dialog's Confirm button is the sole apply trigger via onChange.a11y: focus trap + restore via Dialog; aria-live summary; accessible name. */}- <Dialog open={confirmAccess} onOpenChange={setAccessDialogOpen}>+ {rows.length > 0 && <Dialog open={confirmAccess} onOpenChange={setAccessDialogOpen}><DialogContentclassName="sm:max-w-md"aria-describedby="bulk-access-summary"@@ -290,7 +338,7 @@ export function AgentBatchToolbar({</Button></DialogFooter></DialogContent>- </Dialog>+ </Dialog>}</>);}diff --git a/packages/views/agents/components/agent-creation-studio.test.ts b/packages/views/agents/components/agent-creation-studio.test.tsindex 3d9db4e051..aaafcf1e2f 100644--- a/packages/views/agents/components/agent-creation-studio.test.ts+++ b/packages/views/agents/components/agent-creation-studio.test.ts@@ -7,6 +7,7 @@ import {decodeBuilderInput,deriveDuplicateAccess,encodeBuilderInput,+ getAgentCreationScreenKey,mergeBuilderDraft,parseBuilderDraft,pickBuilderRestore,@@ -53,6 +54,15 @@ vi.mock("../../i18n", () => ({}),}));+describe("Agent creation studio screen keys", () => {+ it("groups configuration modes and separates the AI setup and builder", () => {+ expect(getAgentCreationScreenKey("blank", "")).toBe("configure");+ expect(getAgentCreationScreenKey("template", "")).toBe("configure");+ expect(getAgentCreationScreenKey("ai", "")).toBe("ai-setup");+ expect(getAgentCreationScreenKey("ai", "session-1")).toBe("ai-builder");+ });+});+const draft = (): AgentDraft => ({name: "Old name",description: "Old description",diff --git a/packages/views/agents/components/agent-creation-studio.tsx b/packages/views/agents/components/agent-creation-studio.tsxindex efcfc11468..fd604a0146 100644--- a/packages/views/agents/components/agent-creation-studio.tsx+++ b/packages/views/agents/components/agent-creation-studio.tsx@@ -1,6 +1,7 @@"use client";import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";+import { AnimatePresence, motion, useReducedMotion } from "motion/react";import { useQuery, useQueryClient } from "@tanstack/react-query";import {ArrowLeft,@@ -50,6 +51,10 @@ import { Button } from "@multica/ui/components/ui/button";import { Checkbox } from "@multica/ui/components/ui/checkbox";import { Input } from "@multica/ui/components/ui/input";import { Textarea } from "@multica/ui/components/ui/textarea";+import {+ UI_EASE_OUT,+ UI_MOTION_DURATION,+} from "@multica/ui/lib/motion";import { cn } from "@multica/ui/lib/utils";import { AvatarUploadControl } from "../../common/avatar-upload-control";import { useAppForeground } from "../../common/use-app-foreground";@@ -71,8 +76,24 @@ import { RuntimePicker, isRuntimeUsableForUser } from "./runtime-picker";import { SkillMultiSelect } from "./skill-multi-select";type StudioMode = "choose" | "templates" | "blank" | "template" | "ai";+type StudioScreenKey =+ | "choose"+ | "templates"+ | "configure"+ | "ai-setup"+ | "ai-builder";+type TransitionDirection = 1 | -1;type PermissionScope = "private" | "workspace" | "members";+export function getAgentCreationScreenKey(+ mode: StudioMode,+ builderSessionId: string,+): StudioScreenKey {+ if (mode === "blank" || mode === "template") return "configure";+ if (mode === "ai") return builderSessionId ? "ai-builder" : "ai-setup";+ return mode;+}+export interface AgentDraft {name: string;description: string;@@ -121,6 +142,7 @@ export function AgentCreationStudio() {const currentUser = useAuthStore((state) => state.user);const duplicateId = navigation.searchParams.get("duplicate");const squadId = navigation.searchParams.get("squad");+ const shouldReduceMotion = useReducedMotion() ?? false;const { data: agents = [] } = useQuery(agentListOptions(wsId));const { data: runtimes = [], isLoading: runtimesLoading } = useQuery(@@ -136,6 +158,8 @@ export function AgentCreationStudio() {? agents.find((agent) => agent.id === duplicateId) ?? null: null;const [mode, setMode] = useState<StudioMode>(duplicateId ? "blank" : "choose");+ const [transitionDirection, setTransitionDirection] =+ useState<TransitionDirection>(1);const [draft, setDraft] = useState<AgentDraft>(EMPTY_DRAFT);const [sourceTemplate, setSourceTemplate] = useState<AgentTemplateSummary | null>(null);const [selectedTemplate, setSelectedTemplate] = useState<AgentTemplateSummary | null>(null);@@ -388,6 +412,7 @@ export function AgentCreationStudio() {: t(($) => $.creation_studio.step_configure);const resetCreationMode = () => {+ setTransitionDirection(-1);setMode("choose");setSelectedTemplate(null);setSourceTemplate(null);@@ -403,7 +428,6 @@ export function AgentCreationStudio() {qc.removeQueries({ queryKey: chatKeys.messages(builderSessionId) });qc.removeQueries({ queryKey: chatKeys.pendingTask(builderSessionId) });builderSessionIdRef.current = "";- setBuilderSessionId("");return true;} catch (error) {setBuilderError(@@ -422,6 +446,7 @@ export function AgentCreationStudio() {navigation.push(paths.agents());return;}+ setTransitionDirection(-1);if (mode === "templates" && selectedTemplate) {setSelectedTemplate(null);return;@@ -441,9 +466,15 @@ export function AgentCreationStudio() {...EMPTY_DRAFT,runtimeId: current.runtimeId || usableRuntimes[0]?.id || "",}));+ setTransitionDirection(1);setMode("blank");};+ const chooseAI = () => {+ setTransitionDirection(1);+ setMode("ai");+ };+const applyTemplate = () => {const detail = templateDetailQuery.data;if (!selectedTemplate || !detail) return;@@ -455,6 +486,7 @@ export function AgentCreationStudio() {instructions: detail.instructions,runtimeId: current.runtimeId || usableRuntimes[0]?.id || "",}));+ setTransitionDirection(1);setMode("template");};@@ -468,6 +500,7 @@ export function AgentCreationStudio() {model: draft.model.trim() || undefined,});if (!session.session_id) throw new Error(t(($) => $.creation_studio.builder.start_failed));+ setTransitionDirection(1);setBuilderSessionId(session.session_id);} catch (error) {setBuilderError(@@ -648,6 +681,40 @@ export function AgentCreationStudio() {}};+ const screenKey = getAgentCreationScreenKey(mode, builderSessionId);+ const screenVariants = {+ initial: (direction: TransitionDirection) => ({+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateX(0)"+ : direction === 1+ ? "translateX(8px)"+ : "translateX(-8px)",+ }),+ animate: {+ opacity: 1,+ transform: "translateX(0)",+ transition: {+ duration: shouldReduceMotion+ ? UI_MOTION_DURATION.fast+ : UI_MOTION_DURATION.standard,+ ease: UI_EASE_OUT,+ },+ },+ exit: (direction: TransitionDirection) => ({+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateX(0)"+ : direction === 1+ ? "translateX(-8px)"+ : "translateX(8px)",+ transition: {+ duration: UI_MOTION_DURATION.fast,+ ease: UI_EASE_OUT,+ },+ }),+ };+return (<div className="flex min-h-0 flex-1 flex-col bg-background"><header className="flex h-14 shrink-0 items-center gap-3 border-b px-5">@@ -680,10 +747,24 @@ export function AgentCreationStudio() {)}</header>+ <AnimatePresence+ mode="wait"+ initial={false}+ custom={transitionDirection}+ >+ <motion.div+ key={screenKey}+ custom={transitionDirection}+ variants={screenVariants}+ initial="initial"+ animate="animate"+ exit="exit"+ className="flex min-h-0 flex-1 flex-col"+ >{mode === "choose" && (<ModeChooseronBlank={chooseBlank}- onAI={() => setMode("ai")}+ onAI={chooseAI}/>)}@@ -794,6 +875,8 @@ export function AgentCreationStudio() {</div></div>)}+ </motion.div>+ </AnimatePresence></div>);}diff --git a/packages/views/editor/attachment-preview-modal.test.tsx b/packages/views/editor/attachment-preview-modal.test.tsxindex a3b7b7a26f..fee7c881b9 100644--- a/packages/views/editor/attachment-preview-modal.test.tsx+++ b/packages/views/editor/attachment-preview-modal.test.tsx@@ -1,7 +1,7 @@import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { act, fireEvent, render as rtlRender, screen, waitFor } from "@testing-library/react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";-import type { ReactElement } from "react";+import { useState, type ReactElement } from "react";import type { Attachment } from "@multica/core/types";const openExternalMock = vi.hoisted(() => vi.fn());@@ -151,6 +151,17 @@ function makeAttachment(overrides: Partial<Attachment> = {}): Attachment {};}+function ClosablePreview({ attachment }: { attachment: Attachment }) {+ const [open, setOpen] = useState(true);+ return (+ <AttachmentPreviewModal+ source={{ kind: "full", attachment }}+ open={open}+ onClose={() => setOpen(false)}+ />+ );+}+beforeEach(() => {vi.clearAllMocks();navState.hasOpenInNewTab = true;@@ -457,6 +468,21 @@ describe("AttachmentPreviewModal — controls", () => {fireEvent.click(dialog);expect(onClose).toHaveBeenCalled();});++ it("keeps the dialog mounted for its exit and then removes it", async () => {+ const att = makeAttachment({+ filename: "manual.pdf",+ content_type: "application/pdf",+ });+ render(<ClosablePreview attachment={att} />);++ fireEvent.click(screen.getByTitle("Close"));++ expect(screen.getByRole("dialog")).toBeInTheDocument();+ await waitFor(() => {+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ });+ });});describe("AttachmentPreviewModal — URL-only source", () => {diff --git a/packages/views/editor/attachment-preview-modal.tsx b/packages/views/editor/attachment-preview-modal.tsxindex cb57dd5360..1b1d06a6f2 100644--- a/packages/views/editor/attachment-preview-modal.tsx+++ b/packages/views/editor/attachment-preview-modal.tsx@@ -38,6 +38,7 @@ import {type ReactNode,} from "react";import { createPortal } from "react-dom";+import { AnimatePresence, motion, useReducedMotion } from "motion/react";import {PreviewTooLargeError,PreviewUnsupportedError,@@ -46,6 +47,10 @@ import { Download, ExternalLink, FileText, Loader2, X } from "lucide-react";import type { Attachment } from "@multica/core/types";import { paths, useWorkspaceSlug } from "@multica/core/paths";import { resolvePublicFileUrl } from "@multica/core/workspace/avatar-url";+import {+ UI_EASE_OUT,+ UI_MOTION_DURATION,+} from "@multica/ui/lib/motion";import { useT } from "../i18n";import { useNavigation } from "../navigation";import { openExternal } from "../platform";@@ -162,8 +167,12 @@ export interface AttachmentPreviewHandle {export function useAttachmentPreview(): AttachmentPreviewHandle {const [current, setCurrent] = useState<PreviewSource | null>(null);+ const [previewOpen, setPreviewOpen] = useState(false);- const open = useCallback((source: PreviewSource) => setCurrent(source), []);+ const open = useCallback((source: PreviewSource) => {+ setCurrent(source);+ setPreviewOpen(true);+ }, []);const tryOpen = useCallback((source: PreviewSource) => {const state = normalize(source);const kind = getPreviewKind(state.contentType, state.filename);@@ -171,16 +180,22 @@ export function useAttachmentPreview(): AttachmentPreviewHandle {// URL-only sources cannot drive text kinds — the /content proxy is ID-keyed.if (source.kind === "url" && !URL_ONLY_KINDS.has(kind)) return false;setCurrent(source);+ setPreviewOpen(true);return true;}, []);- const modal = current ? (- <AttachmentPreviewModal- source={current}- open- onClose={() => setCurrent(null)}- />- ) : null;+ const modal = useMemo(+ () =>+ current ? (+ <AttachmentPreviewModal+ source={current}+ open={previewOpen}+ onClose={() => setPreviewOpen(false)}+ onExitComplete={() => setCurrent(null)}+ />+ ) : null,+ [current, previewOpen],+ );return useMemo(() => ({ open, tryOpen, modal }), [open, tryOpen, modal]);}@@ -193,9 +208,11 @@ export function AttachmentPreviewModal({source,open,onClose,-}: AttachmentPreviewModalProps) {+ onExitComplete,+}: AttachmentPreviewModalProps & { onExitComplete?: () => void }) {const { t } = useT("editor");const download = useDownloadAttachment();+ const shouldReduceMotion = useReducedMotion() ?? false;const state = normalize(source);// useWorkspaceSlug (not useWorkspacePaths) — returns null outside a// workspace route instead of throwing, so the new-tab button just hides.@@ -244,24 +261,61 @@ export function AttachmentPreviewModal({onClose();};- if (!open || typeof document === "undefined") return null;+ if (typeof document === "undefined") return null;return createPortal(- <div- className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4"- onClick={onClose}- role="dialog"- aria-modal="true"- aria-label={state.filename}- >- {/* Larger than the create-issue dialog (max-w-4xl, manualDialogContentClass)- because PDF / video previews want more room. Capped to viewport- minus the surrounding p-4 (1rem each side) so it never overflows- the screen on small displays / split panes. */}- <div- className="flex h-[min(90vh,calc(100vh-2rem))] w-full max-w-6xl flex-col overflow-hidden rounded-lg bg-background shadow-xl"- onClick={(e) => e.stopPropagation()}- >+ <AnimatePresence onExitComplete={onExitComplete}>+ {open && (+ <motion.div+ className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4"+ onClick={onClose}+ role="dialog"+ aria-modal="true"+ aria-label={state.filename}+ initial={{ opacity: 0 }}+ animate={{+ opacity: 1,+ transition: {+ duration: UI_MOTION_DURATION.fast,+ ease: UI_EASE_OUT,+ },+ }}+ exit={{+ opacity: 0,+ transition: {+ duration: UI_MOTION_DURATION.fast,+ ease: UI_EASE_OUT,+ },+ }}+ >+ {/* Larger than the create-issue dialog (max-w-4xl, manualDialogContentClass)+ because PDF / video previews want more room. Capped to viewport+ minus the surrounding p-4 (1rem each side) so it never overflows+ the screen on small displays / split panes. */}+ <motion.div+ className="flex h-[min(90vh,calc(100vh-2rem))] w-full max-w-6xl flex-col overflow-hidden rounded-lg bg-background shadow-xl"+ onClick={(e) => e.stopPropagation()}+ initial={{+ opacity: 0,+ transform: shouldReduceMotion ? "scale(1)" : "scale(0.95)",+ }}+ animate={{+ opacity: 1,+ transform: "scale(1)",+ transition: {+ duration: UI_MOTION_DURATION.standard,+ ease: UI_EASE_OUT,+ },+ }}+ exit={{+ opacity: 0,+ transform: shouldReduceMotion ? "scale(1)" : "scale(0.95)",+ transition: {+ duration: UI_MOTION_DURATION.fast,+ ease: UI_EASE_OUT,+ },+ }}+ ><div className="flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2"><FileText className="size-4 shrink-0 text-muted-foreground" /><p className="truncate text-sm font-medium">{state.filename}</p>@@ -300,16 +354,18 @@ export function AttachmentPreviewModal({</button></div></div>- <div className="min-h-0 flex-1 overflow-auto bg-background">- <PreviewContent- kind={kind}- source={source}- state={state}- onDownload={handleDownload}- />- </div>- </div>- </div>,+ <div className="min-h-0 flex-1 overflow-auto bg-background">+ <PreviewContent+ kind={kind}+ source={source}+ state={state}+ onDownload={handleDownload}+ />+ </div>+ </motion.div>+ </motion.div>+ )}+ </AnimatePresence>,document.body,);}diff --git a/packages/views/issues/components/batch-action-toolbar.test.tsx b/packages/views/issues/components/batch-action-toolbar.test.tsxindex 498f2a6ce4..703da00950 100644--- a/packages/views/issues/components/batch-action-toolbar.test.tsx+++ b/packages/views/issues/components/batch-action-toolbar.test.tsx@@ -1,5 +1,5 @@import { describe, it, expect, beforeEach, vi } from "vitest";-import { render, screen } from "@testing-library/react";+import { render, screen, waitFor } from "@testing-library/react";import type { Issue } from "@multica/core/types";import { BatchActionToolbar } from "./batch-action-toolbar";@@ -135,4 +135,18 @@ describe("BatchActionToolbar picker wiring", () => {render(<BatchActionToolbar issues={[makeIssue({ id: "a" })]} />);expect(screen.queryByTestId("status-picker")).toBeNull();});++ it("removes the toolbar after the final selected issue is cleared", async () => {+ const issues = [makeIssue({ id: "a" })];+ selection.selectedIds = new Set(["a"]);+ const view = render(<BatchActionToolbar issues={issues} />);++ expect(screen.getByTestId("status-picker")).toBeInTheDocument();+ selection.selectedIds = new Set();+ view.rerender(<BatchActionToolbar issues={issues} />);++ await waitFor(() => {+ expect(screen.queryByTestId("status-picker")).not.toBeInTheDocument();+ });+ });});diff --git a/packages/views/issues/components/batch-action-toolbar.tsx b/packages/views/issues/components/batch-action-toolbar.tsxindex fd25259fab..184bcff8d5 100644--- a/packages/views/issues/components/batch-action-toolbar.tsx+++ b/packages/views/issues/components/batch-action-toolbar.tsx@@ -1,6 +1,7 @@"use client";-import { useMemo, useState } from "react";+import { useEffect, useMemo, useState } from "react";+import { AnimatePresence, motion, useReducedMotion } from "motion/react";import { X, Trash2 } from "lucide-react";import { toast } from "sonner";import { Button } from "@multica/ui/components/ui/button";@@ -21,6 +22,10 @@ import { useModalStore } from "@multica/core/modals";import { StatusPicker, PriorityPicker, AssigneePicker } from "./pickers";import { useT } from "../../i18n";import { cn } from "@multica/ui/lib/utils";+import {+ UI_EASE_OUT,+ UI_MOTION_DURATION,+} from "@multica/ui/lib/motion";import { useIssueSurfaceActionsOptional } from "../surface/actions-context";import { useIssueSurfaceSelection } from "../surface/selection-context";@@ -47,6 +52,7 @@ export function BatchActionToolbar({const selection = useIssueSurfaceSelection();const selectedIds = selection.selectedIds;const clear = selection.clear;+ const shouldReduceMotion = useReducedMotion() ?? false;// The authoritative selection is selectedIds ∩ the visible universe. Acting// on raw selectedIds while other consumers (Export selected, common fields)@@ -77,11 +83,16 @@ export function BatchActionToolbar({const openModal = useModalStore((s) => s.open);const loading =surfaceActions?.isPending ?? (batchUpdate.isPending || batchDelete.isPending);-- if (count === 0) return null;-const ids = selectedIssues.map((issue) => issue.id);+ useEffect(() => {+ if (count > 0) return;+ setStatusOpen(false);+ setPriorityOpen(false);+ setAssigneeOpen(false);+ setDeleteOpen(false);+ }, [count]);+const handleBatchUpdate = async (updates: Partial<UpdateIssueRequest>) => {try {if (surfaceActions) {@@ -156,14 +167,46 @@ export function BatchActionToolbar({return (<>- <div- className={cn(- "z-50 flex items-center gap-1 rounded-lg border bg-background px-2 py-1.5 shadow-lg",- placement === "fixed-bottom"- ? "fixed bottom-6 left-1/2 -translate-x-1/2"- : "mb-2 w-fit",- )}- >+ <AnimatePresence initial={false}>+ {count > 0 && (+ <div+ key="issue-batch-toolbar"+ className={cn(+ "z-50",+ placement === "fixed-bottom"+ ? "fixed bottom-6 left-1/2 -translate-x-1/2"+ : "mb-2 w-fit",+ )}+ >+ <motion.div+ className="flex items-center gap-1 rounded-lg border bg-background px-2 py-1.5 shadow-lg"+ initial={{+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateY(0)"+ : "translateY(8px)",+ }}+ animate={{+ opacity: 1,+ transform: "translateY(0)",+ transition: {+ duration: UI_MOTION_DURATION.fast,+ ease: UI_EASE_OUT,+ },+ }}+ exit={{+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateY(0)"+ : "translateY(8px)",+ transition: {+ duration: shouldReduceMotion+ ? UI_MOTION_DURATION.fast+ : UI_MOTION_DURATION.micro,+ ease: UI_EASE_OUT,+ },+ }}+ ><div className="flex items-center gap-1.5 pl-1 pr-2 border-r mr-1"><span className="text-sm font-medium">{t(($) => $.batch.selected, { count })}</span><button@@ -221,9 +264,12 @@ export function BatchActionToolbar({<Trash2 className="size-3.5 mr-1" />{t(($) => $.batch.delete)}</Button>- </div>+ </motion.div>+ </div>+ )}+ </AnimatePresence>- <AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}>+ {count > 0 && <AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}><AlertDialogContent><AlertDialogHeader><AlertDialogTitle>@@ -246,7 +292,7 @@ export function BatchActionToolbar({</AlertDialogAction></AlertDialogFooter></AlertDialogContent>- </AlertDialog>+ </AlertDialog>}</>);}diff --git a/packages/views/runtimes/components/connect-remote-dialog.test.tsx b/packages/views/runtimes/components/connect-remote-dialog.test.tsxindex e3fb74a636..01131fbfda 100644--- a/packages/views/runtimes/components/connect-remote-dialog.test.tsx+++ b/packages/views/runtimes/components/connect-remote-dialog.test.tsx@@ -1,6 +1,6 @@import { QueryClient, QueryClientProvider } from "@tanstack/react-query";-import { render } from "@testing-library/react";-import { describe, expect, it, vi } from "vitest";+import { act, render, screen, waitFor } from "@testing-library/react";+import { beforeEach, describe, expect, it, vi } from "vitest";import { I18nProvider } from "@multica/core/i18n/react";import { configStore } from "@multica/core/config";import enCommon from "../../locales/en/common.json";@@ -23,8 +23,14 @@ vi.mock("@multica/core/paths", () => ({useWorkspaceSlug: () => "workspace-test",}));+const wsEventState = vi.hoisted(() => ({+ handler: null as ((payload: unknown) => void) | null,+}));+vi.mock("@multica/core/realtime", () => ({- useWSEvent: vi.fn(),+ useWSEvent: (_event: string, handler: (payload: unknown) => void) => {+ wsEventState.handler = handler;+ },}));vi.mock("../../navigation", () => ({@@ -66,6 +72,10 @@ const ligatureClasses = [];describe("ConnectRemoteDialog", () => {+ beforeEach(() => {+ wsEventState.handler = null;+ });+it("uses cloud setup commands by default", () => {const { baseElement } = renderDialog();@@ -115,4 +125,21 @@ describe("ConnectRemoteDialog", () => {expect(tokenCode).toHaveClass(...ligatureClasses);});++ it("transitions from setup instructions to the connected state", async () => {+ const { baseElement } = renderDialog();++ expect(baseElement).toHaveTextContent("multica setup");+ act(() => {+ wsEventState.handler?.({ runtime_id: "rt-test" });+ });++ await waitFor(() => {+ expect(screen.getByText("Computer connected")).toBeInTheDocument();+ expect(+ screen.getByRole("button", { name: "Create an agent" }),+ ).toBeInTheDocument();+ });+ expect(baseElement).not.toHaveTextContent("multica setup");+ });});diff --git a/packages/views/runtimes/components/connect-remote-dialog.tsx b/packages/views/runtimes/components/connect-remote-dialog.tsxindex 81c0d6f1a6..d1fd39ef85 100644--- a/packages/views/runtimes/components/connect-remote-dialog.tsx+++ b/packages/views/runtimes/components/connect-remote-dialog.tsx@@ -1,6 +1,7 @@"use client";import { useCallback, useEffect, useRef, useState } from "react";+import { AnimatePresence, motion, useReducedMotion } from "motion/react";import { Check, ChevronRight, Copy, Terminal } from "lucide-react";import { useQueryClient } from "@tanstack/react-query";import { useWorkspaceId } from "@multica/core/hooks";@@ -19,6 +20,10 @@ import {import { Button } from "@multica/ui/components/ui/button";import { CODE_LIGATURE_CLASS } from "@multica/ui/lib/code-style";import { copyText } from "@multica/ui/lib/clipboard";+import {+ UI_EASE_OUT,+ UI_MOTION_DURATION,+} from "@multica/ui/lib/motion";import { cn } from "@multica/ui/lib/utils";import { useNavigation } from "../../navigation";import { useT } from "../../i18n";@@ -62,6 +67,7 @@ export function ConnectRemoteDialog({ onClose }: { onClose: () => void }) {const slug = useWorkspaceSlug();const qc = useQueryClient();const navigation = useNavigation();+ const shouldReduceMotion = useReducedMotion() ?? false;const newRuntimeIdRef = useRef<string | null>(null);// `multica setup` is one blocking command that handles config + login@@ -100,15 +106,51 @@ export function ConnectRemoteDialog({ onClose }: { onClose: () => void }) {return (<Dialog open onOpenChange={(v) => !v && onClose()}><DialogContent className="flex max-h-[85vh] flex-col gap-0 p-0 sm:max-w-lg">- {step === "instructions" && <InstructionsStep onClose={onClose} />}- {step === "success" && (- <SuccessStep- onGoToAgents={handleGoToAgents}- onGoToRuntime={- newRuntimeIdRef.current ? handleGoToRuntime : undefined- }- />- )}+ <AnimatePresence mode="wait" initial={false}>+ <motion.div+ key={step}+ className="flex min-h-0 flex-1 flex-col"+ initial={{+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateY(0)"+ : "translateY(8px)",+ }}+ animate={{+ opacity: 1,+ transform: "translateY(0)",+ transition: {+ duration: shouldReduceMotion+ ? UI_MOTION_DURATION.fast+ : UI_MOTION_DURATION.standard,+ ease: UI_EASE_OUT,+ },+ }}+ exit={{+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateY(0)"+ : "translateY(-8px)",+ transition: {+ duration: shouldReduceMotion+ ? UI_MOTION_DURATION.fast+ : UI_MOTION_DURATION.micro,+ ease: UI_EASE_OUT,+ },+ }}+ >+ {step === "instructions" ? (+ <InstructionsStep onClose={onClose} />+ ) : (+ <SuccessStep+ onGoToAgents={handleGoToAgents}+ onGoToRuntime={+ newRuntimeIdRef.current ? handleGoToRuntime : undefined+ }+ />+ )}+ </motion.div>+ </AnimatePresence></DialogContent></Dialog>);@@ -270,7 +312,6 @@ function TroubleshootingDetails({ tokenCmd }: { tokenCmd: string }) {<li className="flex items-center gap-1.5"><span>{t(($) => $.connect.trouble_check_status)}</span>{/* CLI command — literal shell string, not i18n content. */}- {/* eslint-disable-next-line i18next/no-literal-string */}<codeclassName={cn("rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground",@@ -283,7 +324,6 @@ function TroubleshootingDetails({ tokenCmd }: { tokenCmd: string }) {<li className="flex items-center gap-1.5"><span>{t(($) => $.connect.trouble_view_logs)}</span>{/* CLI command — literal shell string, not i18n content. */}- {/* eslint-disable-next-line i18next/no-literal-string */}<codeclassName={cn("rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground",diff --git a/packages/views/skills/components/runtime-local-skill-import-panel.tsx b/packages/views/skills/components/runtime-local-skill-import-panel.tsxindex 59977960c9..0f0edf6a99 100644--- a/packages/views/skills/components/runtime-local-skill-import-panel.tsx+++ b/packages/views/skills/components/runtime-local-skill-import-panel.tsx@@ -1,6 +1,7 @@"use client";import { useEffect, useMemo, useRef, useState } from "react";+import { AnimatePresence, motion, useReducedMotion } from "motion/react";import { useQuery, useQueryClient } from "@tanstack/react-query";import {AlertCircle,@@ -49,6 +50,10 @@ import {} from "@multica/ui/components/ui/select";import { Skeleton } from "@multica/ui/components/ui/skeleton";import { useScrollFade } from "@multica/ui/hooks/use-scroll-fade";+import {+ UI_EASE_OUT,+ UI_MOTION_DURATION,+} from "@multica/ui/lib/motion";import { useT } from "../../i18n";import { HighlightText } from "../../search/highlight-text";import { isNameConflictError } from "../lib/utils";@@ -506,6 +511,7 @@ export function RuntimeLocalSkillImportPanel({const wsId = useWorkspaceId();const qc = useQueryClient();const userId = useAuthStore((s) => s.user?.id ?? null);+ const shouldReduceMotion = useReducedMotion() ?? false;const { data: runtimes = [] } = useQuery(runtimeListOptions(wsId));const localRuntimes = useMemo(@@ -1148,6 +1154,86 @@ export function RuntimeLocalSkillImportPanel({}};+ const footerContent =+ bulkState.phase === "done" || bulkState.phase === "cancelled" ? (+ <>+ <div className="min-w-0 flex-1 text-xs text-muted-foreground">+ {bulkState.phase === "cancelled"+ ? t(($) => $.runtime_import.bulk_cancelled_hint)+ : t(($) => $.runtime_import.bulk_complete_hint)}+ </div>+ <Button type="button" size="sm" onClick={handleDone}>+ {t(($) => $.runtime_import.bulk_done_button)}+ </Button>+ </>+ ) : resolvingConflicts ? (+ <>+ <div className="min-w-0 flex-1 text-xs text-muted-foreground">+ {t(($) => $.runtime_import.conflict_footer, {+ count: pendingConflicts.length,+ })}+ </div>+ <Button+ type="button"+ size="sm"+ onClick={() => void handleApplyConflictResolutions()}+ disabled={!canApplyConflictResolutions}+ >+ {t(($) => $.runtime_import.conflict_apply_button)}+ </Button>+ </>+ ) : importing ? (+ <>+ <div className="min-w-0 flex-1 text-xs text-muted-foreground">+ {t(($) => $.runtime_import.bulk_progress, {+ completed: bulkState.completed,+ total: bulkState.total,+ })}+ </div>+ <Button+ type="button"+ size="sm"+ variant="outline"+ onClick={handleCancel}+ >+ {t(($) => $.runtime_import.bulk_cancel_button)}+ </Button>+ </>+ ) : (+ <>+ <div className="min-w-0 flex-1 text-xs text-muted-foreground">+ {singleSelectedSkill ? (+ <>+ {t(($) => $.runtime_import.ready)}{" "}+ <span className="font-medium text-foreground">+ {editName.trim() || singleSelectedSkill.name}+ </span>{" "}+ {t(($) => $.runtime_import.into_workspace)}+ </>+ ) : selectedKeys.size > 1 ? (+ t(($) => $.runtime_import.bulk_ready, {+ count: selectedKeys.size,+ })+ ) : (+ t(($) => $.runtime_import.select_skill)+ )}+ </div>+ <Button+ type="button"+ size="sm"+ onClick={handleBulkImport}+ disabled={!canImport}+ >+ <Download className="h-3 w-3" />+ {selectedKeys.size > 1+ ? t(($) => $.runtime_import.bulk_import_button, {+ count: selectedKeys.size,+ })+ : t(($) => $.runtime_import.import_button)}+ </Button>+ </>+ );+return (<div className="flex min-h-0 flex-1 flex-col">{/* Sticky top: runtime picker + status */}@@ -1210,94 +1296,73 @@ export function RuntimeLocalSkillImportPanel({importing && bulkState.phase !== "importing" ? "pointer-events-none opacity-60" : ""}`}>- {middle}- {bulkState.phase === "idle" && (- <p className="mt-3 text-xs text-muted-foreground">- {t(($) => $.runtime_import.ignored_files_hint)}- </p>- )}+ <AnimatePresence mode="wait" initial={false}>+ <motion.div+ key={bulkState.phase}+ initial={{+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateY(0)"+ : "translateY(8px)",+ }}+ animate={{+ opacity: 1,+ transform: "translateY(0)",+ transition: {+ duration: shouldReduceMotion+ ? UI_MOTION_DURATION.fast+ : UI_MOTION_DURATION.standard,+ ease: UI_EASE_OUT,+ },+ }}+ exit={{+ opacity: 0,+ transform: shouldReduceMotion+ ? "translateY(0)"+ : "translateY(-8px)",+ transition: {+ duration: shouldReduceMotion+ ? UI_MOTION_DURATION.fast+ : UI_MOTION_DURATION.micro,+ ease: UI_EASE_OUT,+ },+ }}+ >+ {middle}+ {bulkState.phase === "idle" && (+ <p className="mt-3 text-xs text-muted-foreground">+ {t(($) => $.runtime_import.ignored_files_hint)}+ </p>+ )}+ </motion.div>+ </AnimatePresence></div>{/* Sticky bottom: contextual actions per phase */}<div className="flex shrink-0 items-center gap-3 border-t bg-muted/30 px-5 py-3">- {bulkState.phase === "done" || bulkState.phase === "cancelled" ? (- <>- <div className="min-w-0 flex-1 text-xs text-muted-foreground">- {bulkState.phase === "cancelled"- ? t(($) => $.runtime_import.bulk_cancelled_hint)- : t(($) => $.runtime_import.bulk_complete_hint)}- </div>- <Button type="button" size="sm" onClick={handleDone}>- {t(($) => $.runtime_import.bulk_done_button)}- </Button>- </>- ) : resolvingConflicts ? (- <>- <div className="min-w-0 flex-1 text-xs text-muted-foreground">- {t(($) => $.runtime_import.conflict_footer, {- count: pendingConflicts.length,- })}- </div>- <Button- type="button"- size="sm"- onClick={() => void handleApplyConflictResolutions()}- disabled={!canApplyConflictResolutions}- >- {t(($) => $.runtime_import.conflict_apply_button)}- </Button>- </>- ) : importing ? (- <>- <div className="min-w-0 flex-1 text-xs text-muted-foreground">- {t(($) => $.runtime_import.bulk_progress, {- completed: bulkState.completed,- total: bulkState.total,- })}- </div>- <Button- type="button"- size="sm"- variant="outline"- onClick={handleCancel}- >- {t(($) => $.runtime_import.bulk_cancel_button)}- </Button>- </>- ) : (- <>- <div className="min-w-0 flex-1 text-xs text-muted-foreground">- {singleSelectedSkill ? (- <>- {t(($) => $.runtime_import.ready)}{" "}- <span className="font-medium text-foreground">- {editName.trim() || singleSelectedSkill.name}- </span>{" "}- {t(($) => $.runtime_import.into_workspace)}- </>- ) : selectedKeys.size > 1 ? (- t(($) => $.runtime_import.bulk_ready, {- count: selectedKeys.size,- })- ) : (- t(($) => $.runtime_import.select_skill)- )}- </div>- <Button- type="button"- size="sm"- onClick={handleBulkImport}- disabled={!canImport}- >- <Download className="h-3 w-3" />- {selectedKeys.size > 1- ? t(($) => $.runtime_import.bulk_import_button, {- count: selectedKeys.size,- })- : t(($) => $.runtime_import.import_button)}- </Button>- </>- )}+ <AnimatePresence mode="wait" initial={false}>+ <motion.div+ key={bulkState.phase}+ className="flex min-w-0 flex-1 items-center gap-3"+ initial={{ opacity: 0 }}+ animate={{+ opacity: 1,+ transition: {+ duration: UI_MOTION_DURATION.fast,+ ease: UI_EASE_OUT,+ },+ }}+ exit={{+ opacity: 0,+ transition: {+ duration: UI_MOTION_DURATION.micro,+ ease: UI_EASE_OUT,+ },+ }}+ >+ {footerContent}+ </motion.div>+ </AnimatePresence></div></div>);