Skip to content

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

Go

feat(motion): Wave 3 motion polish across issue detail, docs/editor, inbox, and chat (MUL-9953) (#11301)

Jiayuan Zhang17ccb642973a
diff --git a/packages/ui/components/common/__tests__/submit-button.test.tsx b/packages/ui/components/common/__tests__/submit-button.test.tsx
new file mode 100644
index 0000000000..1ead193539
--- /dev/null
+++ b/packages/ui/components/common/__tests__/submit-button.test.tsx
@@ -0,0 +1,70 @@
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { SubmitButton } from "../submit-button";
+import { ReactionBar } from "../reaction-bar";
+
+afterEach(cleanup);
+
+describe("SubmitButton", () => {
+ it("keeps the same button element across send, loading, and stop modes", () => {
+ const onClick = vi.fn();
+ const onStop = vi.fn();
+ const { rerender } = render(
+ <SubmitButton onClick={onClick} onStop={onStop} ariaLabel="Send" stopAriaLabel="Stop" />,
+ );
+ const initialButton = screen.getByRole("button", { name: "Send" });
+ fireEvent.click(initialButton);
+ expect(onClick).toHaveBeenCalledTimes(1);
+
+ rerender(
+ <SubmitButton onClick={onClick} onStop={onStop} loading ariaLabel="Send" stopAriaLabel="Stop" />,
+ );
+ const loadingButton = screen.getByRole("button", { name: "Send" });
+ expect(loadingButton).toBe(initialButton);
+ expect(loadingButton).toHaveAttribute("aria-busy", "true");
+
+ rerender(
+ <SubmitButton onClick={onClick} onStop={onStop} running ariaLabel="Send" stopAriaLabel="Stop" />,
+ );
+ const stopButton = screen.getByRole("button", { name: "Stop" });
+ expect(stopButton).toBe(initialButton);
+ fireEvent.click(stopButton);
+ expect(onStop).toHaveBeenCalledTimes(1);
+ });
+});
+
+describe("ReactionBar", () => {
+ it("only applies pop-in animation to newly added reactions", () => {
+ const initial = [
+ { id: "r1", actor_type: "member", actor_id: "u1", emoji: "👍" },
+ ];
+ const { rerender } = render(
+ <ReactionBar
+ reactions={initial}
+ currentUserId="u1"
+ onToggle={vi.fn()}
+ getActorName={() => "Alice"}
+ showPicker={false}
+ />,
+ );
+ const initialBtn = screen.getByRole("button");
+ expect(initialBtn.className).not.toContain("animate-in");
+
+ rerender(
+ <ReactionBar
+ reactions={[
+ ...initial,
+ { id: "r2", actor_type: "member", actor_id: "u1", emoji: "🔥" },
+ ]}
+ currentUserId="u1"
+ onToggle={vi.fn()}
+ getActorName={() => "Alice"}
+ showPicker={false}
+ />,
+ );
+ const buttons = screen.getAllByRole("button");
+ expect(buttons[0]?.className).not.toContain("animate-in");
+ expect(buttons[1]?.className).toContain("animate-in");
+ expect(buttons[1]?.className).toContain("motion-reduce:animate-none");
+ });
+});
diff --git a/packages/ui/components/common/reaction-bar.tsx b/packages/ui/components/common/reaction-bar.tsx
index a3a9073fa0..0aa73785ba 100644
--- a/packages/ui/components/common/reaction-bar.tsx
+++ b/packages/ui/components/common/reaction-bar.tsx
@@ -1,6 +1,9 @@
"use client";
+import { useEffect, useRef } from "react";
+import { NumberFlow } from "@multica/ui/components/ui/number-flow";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
+import { cn } from "@multica/ui/lib/utils";
import { QuickEmojiPicker } from "./quick-emoji-picker";
interface ReactionItem {
@@ -52,33 +55,48 @@ function ReactionBar({
showPicker = true,
}: ReactionBarProps) {
const grouped = groupReactions(reactions, currentUserId);
+ // Track emojis seen on mount so only newly added reactions pop in.
+ const seenRef = useRef<Set<string> | null>(null);
+ if (seenRef.current === null) {
+ seenRef.current = new Set(grouped.map((g) => g.emoji));
+ }
+ useEffect(() => {
+ const next = new Set(grouped.map((g) => g.emoji));
+ seenRef.current = next;
+ });
+
if (!showPicker && grouped.length === 0) return null;
return (
- <div className={`flex flex-wrap items-center gap-1.5 ${className ?? ""}`}>
- {grouped.map((g) => (
- <Tooltip key={g.emoji}>
- <TooltipTrigger
- render={
- <button
- type="button"
- onClick={() => onToggle(g.emoji)}
- className={`inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-caption transition-colors hover:bg-brand/15 ${
- g.reacted
- ? "border-brand/30 bg-brand/8 text-brand"
- : "border-brand/10 bg-brand/4 text-muted-foreground"
- }`}
- >
- <span>{g.emoji}</span>
- <span>{g.count}</span>
- </button>
- }
- />
- <TooltipContent side="top">
- {g.actors.map((a) => getActorName(a.type, a.id)).join(", ")}
- </TooltipContent>
- </Tooltip>
- ))}
+ <div className={cn("flex flex-wrap items-center gap-1.5", className)}>
+ {grouped.map((g) => {
+ const isNew = !seenRef.current?.has(g.emoji);
+ return (
+ <Tooltip key={g.emoji}>
+ <TooltipTrigger
+ render={
+ <button
+ type="button"
+ onClick={() => onToggle(g.emoji)}
+ className={cn(
+ "inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-caption transition-[background-color,border-color,color,transform] duration-100 ease-[cubic-bezier(0.23,1,0.32,1)] hover:bg-brand/15 active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100",
+ g.reacted
+ ? "border-brand/30 bg-brand/8 text-brand"
+ : "border-brand/10 bg-brand/4 text-muted-foreground",
+ isNew && "animate-in fade-in zoom-in-95 duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:animate-none",
+ )}
+ >
+ <span>{g.emoji}</span>
+ <NumberFlow value={g.count} className="leading-none" />
+ </button>
+ }
+ />
+ <TooltipContent side="top">
+ {g.actors.map((a) => getActorName(a.type, a.id)).join(", ")}
+ </TooltipContent>
+ </Tooltip>
+ );
+ })}
{showPicker && <QuickEmojiPicker onSelect={onToggle} />}
</div>
);
diff --git a/packages/ui/components/common/submit-button.tsx b/packages/ui/components/common/submit-button.tsx
index 4dbc4a962b..38be6c8ac8 100644
--- a/packages/ui/components/common/submit-button.tsx
+++ b/packages/ui/components/common/submit-button.tsx
@@ -67,70 +67,72 @@ function SubmitButton({
stopAriaLabel,
className,
}: SubmitButtonProps) {
- if (running) {
- const stopButton = (
- <Button
- size="icon-sm"
- // eslint-disable-next-line no-restricted-syntax -- composer send button, the one round button
- className="rounded-full"
- onPointerDown={keepFocusInComposer}
- onMouseDown={keepFocusInComposer}
- onClick={onStop}
- aria-label={stopAriaLabel}
- >
- <Square className="fill-current" aria-hidden="true" />
- </Button>
- );
- return stopTooltip ? (
- <Tooltip>
- <TooltipTrigger render={stopButton} />
- <TooltipContent side="top">{stopTooltip}</TooltipContent>
- </Tooltip>
- ) : stopButton;
- }
+ const mode = running ? "stop" : loading || busy ? "loading" : "send";
+ const isDisabled = !running && !!(disabled || loading || busy);
+ const showReason = !running && isDisabled && !loading && disabledReason != null && disabledReason !== false;
+ const iconLayerClass =
+ "col-start-1 row-start-1 flex items-center justify-center transition-[opacity,transform] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none";
- const isDisabled = !!(disabled || loading || busy);
- const showReason = isDisabled && !loading && disabledReason != null && disabledReason !== false;
- const submitButton = (
+ const button = (
<Button
size="icon-sm"
className={cn(
// eslint-disable-next-line no-restricted-syntax -- composer send button, the one round button
"rounded-full",
showReason && "aria-disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:active:translate-y-0",
- className,
+ !running && className,
)}
disabled={isDisabled}
focusableWhenDisabled={showReason}
- {...(busy && !showReason ? { "aria-disabled": true } : {})}
- aria-busy={loading || busy || undefined}
+ {...(!running && busy && !showReason ? { "aria-disabled": true } : {})}
+ aria-busy={!running && (loading || busy) ? true : undefined}
onPointerDown={keepFocusInComposer}
onMouseDown={keepFocusInComposer}
- onClick={onClick}
- aria-label={ariaLabel}
+ onClick={running ? onStop : onClick}
+ aria-label={running ? stopAriaLabel : ariaLabel}
>
- {loading || busy ? (
- // `busy` spins too, not just greys out: an upload can be running with
- // nothing else on screen to explain the disabled control (a reopened
- // composer is still rebuilding its placeholder, or the user deleted
- // it). A spinner says "waiting on something" without a hover; the
- // tooltip says what.
- <Loader2 className="animate-spin" aria-hidden="true" />
- ) : (
- <ArrowUp aria-hidden="true" />
- )}
+ <span className="grid place-items-center" aria-hidden="true">
+ <span
+ className={cn(
+ iconLayerClass,
+ mode === "stop" ? "scale-100 opacity-100" : "pointer-events-none scale-75 opacity-0",
+ )}
+ >
+ <Square className="fill-current" />
+ </span>
+ <span
+ className={cn(
+ iconLayerClass,
+ mode === "loading" ? "scale-100 opacity-100" : "pointer-events-none scale-75 opacity-0",
+ )}
+ >
+ {/* `busy` spins too, not just greys out: an upload can be running with
+ nothing else on screen to explain the disabled control (a reopened
+ composer is still rebuilding its placeholder, or the user deleted
+ it). A spinner says "waiting on something" without a hover; the
+ tooltip says what. */}
+ <Loader2 className={cn(mode === "loading" && "animate-spin motion-reduce:animate-none")} />
+ </span>
+ <span
+ className={cn(
+ iconLayerClass,
+ mode === "send" ? "scale-100 opacity-100" : "pointer-events-none scale-75 opacity-0",
+ )}
+ >
+ <ArrowUp />
+ </span>
+ </span>
</Button>
);
- const tooltipContent = showReason ? disabledReason : tooltip;
- const submitControl = !tooltipContent
- ? submitButton
- : (
- <Tooltip>
- <TooltipTrigger render={submitButton} />
- <TooltipContent side="top">{tooltipContent}</TooltipContent>
- </Tooltip>
- );
- return submitControl;
+
+ const tooltipContent = running ? stopTooltip : showReason ? disabledReason : tooltip;
+ if (!tooltipContent) return button;
+ return (
+ <Tooltip>
+ <TooltipTrigger render={button} />
+ <TooltipContent side="top">{tooltipContent}</TooltipContent>
+ </Tooltip>
+ );
}
export { SubmitButton, type SubmitButtonProps };
diff --git a/packages/ui/components/ui/checkbox.tsx b/packages/ui/components/ui/checkbox.tsx
index 2ebca04fb3..8880530881 100644
--- a/packages/ui/components/ui/checkbox.tsx
+++ b/packages/ui/components/ui/checkbox.tsx
@@ -18,7 +18,7 @@ function Checkbox({ className, indeterminate, ...props }: CheckboxPrimitive.Root
>
<CheckboxPrimitive.Indicator
data-slot="checkbox-indicator"
- className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
+ className="grid place-content-center text-current transition-[transform,opacity] duration-100 ease-[cubic-bezier(0.23,1,0.32,1)] data-[starting-style]:scale-75 data-[starting-style]:opacity-0 data-[ending-style]:scale-75 data-[ending-style]:opacity-0 motion-reduce:transition-none [&>svg]:size-3.5"
>
{indeterminate ? <MinusIcon /> : <CheckIcon />}
</CheckboxPrimitive.Indicator>
diff --git a/packages/views/chat/chat-page.tsx b/packages/views/chat/chat-page.tsx
index 3fa52ca6f4..5774f65509 100644
--- a/packages/views/chat/chat-page.tsx
+++ b/packages/views/chat/chat-page.tsx
@@ -1,13 +1,11 @@
"use client";
-import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
-import { AnimatePresence, motion } from "motion/react";
+import { useEffect, useMemo, useRef, useState } from "react";
import { ArrowLeft, Bot, MessageSquare, Plus } from "@multica/ui/icons";
import { toast } from "sonner";
import { Button } from "@multica/ui/components/ui/button";
import { IconButton } from "@multica/ui/components/common/icon-button";
import { useIsCompact } from "@multica/ui/hooks/use-mobile";
-import { UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { useReducedMotion } from "@multica/core/appearance";
import { useRequiredWorkspaceSlug, useWorkspacePaths } from "@multica/core/paths";
@@ -48,47 +46,7 @@ import { AgentAccessRevokedBanner } from "./components/agent-access-revoked-bann
import { RuntimeRequiredBanner } from "./components/runtime-required-banner";
import { ChatAppRequests } from "../common/app-requests";
import { useRegisterCommandBarContext } from "../search/register-context";
-
-/**
- * Smoothly expands/collapses an optional status strip above the composer so
- * async or session-dependent banners do not snap the message viewport.
- * Keying on `slotKey` keeps height steady when two consecutive sessions both
- * show a banner in the same slot.
- */
-function CollapsibleSlot({
- slotKey,
- visible,
- children,
-}: {
- slotKey: string;
- visible: boolean;
- children: ReactNode;
-}) {
- const reduceMotion = useReducedMotion();
- const duration = reduceMotion ? 0 : UI_MOTION_DURATION.fast;
-
- return (
- <AnimatePresence initial={false}>
- {visible && (
- <motion.div
- key={slotKey}
- data-slot={slotKey}
- initial={{ opacity: 0, height: 0, overflow: "hidden" }}
- animate={{
- opacity: 1,
- height: "auto",
- transitionEnd: { overflow: "visible" },
- }}
- exit={{ opacity: 0, height: 0, overflow: "hidden" }}
- transition={{ duration, ease: UI_EASE_OUT }}
- className="shrink-0"
- >
- {children}
- </motion.div>
- )}
- </AnimatePresence>
- );
-}
+import { CollapsibleSlot } from "./components/collapsible-slot";
/**
* Chat tab — the first-class two-pane surface (thread list on the left,
diff --git a/packages/views/chat/components/chat-bar.tsx b/packages/views/chat/components/chat-bar.tsx
index b7874af817..da60c8aea6 100644
--- a/packages/views/chat/components/chat-bar.tsx
+++ b/packages/views/chat/components/chat-bar.tsx
@@ -1,8 +1,11 @@
"use client";
import { useEffect, useMemo, useRef, useState } from "react";
+import { AnimatePresence, motion, useIsPresent } from "motion/react";
import { useQuery } from "@tanstack/react-query";
+import { useReducedMotion } from "@multica/core/appearance";
import { Loader2, X } from "@multica/ui/icons";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { useChatStore } from "@multica/core/chat";
import { chatSessionsOptions, pendingChatTasksOptions } from "@multica/core/chat/queries";
import { useWorkspaceId } from "@multica/core/hooks";
@@ -80,6 +83,80 @@ function SessionMark({ item }: { item: ChatBarSession }) {
);
}
+/**
+ * One chat chip. It clips only while it grows or shrinks, so the focus rings
+ * of its buttons show once it has settled, and it ignores the pointer while
+ * it leaves.
+ */
+function ChatBarChip({
+ item,
+ title,
+ state,
+ closeLabel,
+ onToggle,
+ onClose,
+}: {
+ item: ChatBarSession;
+ title: string;
+ state: string | null;
+ closeLabel: string;
+ onToggle: () => void;
+ onClose: () => void;
+}) {
+ const reduceMotion = useReducedMotion();
+ const isPresent = useIsPresent();
+ return (
+ <motion.span
+ initial={reduceMotion ? false : { opacity: 0, width: 0, scale: 0.95, overflow: "hidden" }}
+ animate={{
+ opacity: 1,
+ width: "auto",
+ scale: 1,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ transitionEnd: { overflow: "visible" },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ width: 0,
+ scale: 0.95,
+ overflow: "hidden",
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className={cn("group/chip relative flex shrink-0", !isPresent && "pointer-events-none")}
+ >
+ <TooltipHint label={state ? `${title} · ${state}` : title}>
+ <button
+ type="button"
+ data-chat-anchor={item.session.id}
+ aria-pressed={item.open}
+ aria-label={state ? `${title}, ${state}` : title}
+ onClick={onToggle}
+ className={cn(BOTTOM_BAR_ITEM_CLASS, "gap-1 pl-1.5")}
+ >
+ <SessionMark item={item} />
+ {/* The close button sits over the end of the title rather than
+ beside it, so showing it never changes the chip's width. */}
+ <span className="max-w-32 truncate group-focus-within/chip:[mask-image:linear-gradient(to_right,black_calc(100%-26px),transparent_calc(100%-14px))] group-hover/chip:[mask-image:linear-gradient(to_right,black_calc(100%-26px),transparent_calc(100%-14px))]">
+ {title}
+ </span>
+ </button>
+ </TooltipHint>
+ <button
+ type="button"
+ aria-label={closeLabel}
+ onClick={onClose}
+ className="absolute top-1 right-1 flex size-4 cursor-pointer items-center justify-center rounded-sm text-muted-foreground opacity-0 outline-none transition-opacity hover:bg-surface-hover hover:text-foreground focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-ring group-hover/chip:opacity-100 motion-reduce:transition-none [&_svg]:size-3"
+ >
+ <X aria-hidden />
+ </button>
+ </motion.span>
+ );
+}
+
/**
* Quick chat in the bottom bar: a chip per chat that needs watching or was
* opened here, then Ask Multica, which starts a new chat, and the history.
@@ -161,39 +238,23 @@ export function ChatBar() {
return (
<div ref={rootRef} data-slot="chat-bar" className="flex min-w-0 shrink-0 items-center gap-0.5">
- {visible.map((item) => {
- const title = titleOf(item.session);
- const state = stateOf(item);
- return (
- <span key={item.session.id} className="group/chip relative flex shrink-0">
- <TooltipHint label={state ? `${title} · ${state}` : title}>
- <button
- type="button"
- data-chat-anchor={item.session.id}
- aria-pressed={item.open}
- aria-label={state ? `${title}, ${state}` : title}
- onClick={() => toggleSession(item.session)}
- className={cn(BOTTOM_BAR_ITEM_CLASS, "gap-1 pl-1.5")}
- >
- <SessionMark item={item} />
- {/* The close button sits over the end of the title rather than
- beside it, so showing it never changes the chip's width. */}
- <span className="max-w-32 truncate group-focus-within/chip:[mask-image:linear-gradient(to_right,black_calc(100%-26px),transparent_calc(100%-14px))] group-hover/chip:[mask-image:linear-gradient(to_right,black_calc(100%-26px),transparent_calc(100%-14px))]">
- {title}
- </span>
- </button>
- </TooltipHint>
- <button
- type="button"
- aria-label={t(($) => $.bar.close_chip, { title })}
- onClick={() => closeChip(item)}
- className="absolute top-1 right-1 flex size-4 cursor-pointer items-center justify-center rounded-sm text-muted-foreground opacity-0 outline-none transition-opacity hover:bg-surface-hover hover:text-foreground focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-ring group-hover/chip:opacity-100 [&_svg]:size-3"
- >
- <X aria-hidden />
- </button>
- </span>
- );
- })}
+ <AnimatePresence initial={false}>
+ {visible.map((item) => {
+ const title = titleOf(item.session);
+ const state = stateOf(item);
+ return (
+ <ChatBarChip
+ key={item.session.id}
+ item={item}
+ title={title}
+ state={state}
+ closeLabel={t(($) => $.bar.close_chip, { title })}
+ onToggle={() => toggleSession(item.session)}
+ onClose={() => closeChip(item)}
+ />
+ );
+ })}
+ </AnimatePresence>
{overflow.length > 0 && (
<DropdownMenu>
<DropdownMenuTrigger
diff --git a/packages/views/chat/components/chat-fab.tsx b/packages/views/chat/components/chat-fab.tsx
index b70d8066b6..709d8ecc1e 100644
--- a/packages/views/chat/components/chat-fab.tsx
+++ b/packages/views/chat/components/chat-fab.tsx
@@ -1,7 +1,10 @@
"use client";
+import { AnimatePresence, motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
import { MessageCircle } from "@multica/ui/icons";
import { useQuery } from "@tanstack/react-query";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { useChatStore } from "@multica/core/chat";
import {
@@ -47,7 +50,8 @@ export function ChatFab() {
enabled: !isOpen && isMobile,
});
- if (isOpen || !isMobile) return null;
+ const reduceMotion = useReducedMotion();
+ const visible = !isOpen && isMobile;
const unreadSessionCount = countUnreadChatSessions(sessions);
const isRunning = hasPending?.has_pending ?? false;
@@ -66,25 +70,49 @@ export function ChatFab() {
: t(($) => $.fab.default);
return (
- <Tooltip>
- <TooltipTrigger
- onClick={handleClick}
- aria-label={tooltip}
- className={cn(
- // Geometry comes from the shared tokens so the clearance pages
- // reserve for this corner is derived from the same numbers.
- "absolute bottom-[var(--chat-launcher-inset)] right-[var(--chat-launcher-inset)] z-50 flex size-[var(--chat-launcher-size)] touch-manipulation items-center justify-center rounded-full bg-surface-raised text-muted-foreground shadow-[var(--floating-shadow)] ring-1 ring-surface-border transition-[background-color,color,box-shadow] hover:bg-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-page-canvas active:bg-surface-hover",
- // Impulse the button itself while a chat task is running — no
- // outer ring to keep things calm.
- isRunning && "animate-chat-impulse",
- )}
- >
- <MessageCircle className="size-5" />
- </TooltipTrigger>
- <TooltipContent side="top" sideOffset={10}>
- {tooltip}
- {shortcut ? <ShortcutKeycaps shortcut={shortcut} className="ml-1.5" /> : null}
- </TooltipContent>
- </Tooltip>
+ <AnimatePresence initial={false}>
+ {visible && (
+ <motion.div
+ key="chat-fab"
+ initial={reduceMotion ? false : { opacity: 0, scale: 0.85 }}
+ animate={{
+ opacity: 1,
+ scale: 1,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ scale: 0.85,
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className="absolute bottom-[var(--chat-launcher-inset)] right-[var(--chat-launcher-inset)] z-50"
+ >
+ <Tooltip>
+ <TooltipTrigger
+ onClick={handleClick}
+ aria-label={tooltip}
+ className={cn(
+ // Geometry comes from the shared tokens so the clearance pages
+ // reserve for this corner is derived from the same numbers.
+ "flex size-[var(--chat-launcher-size)] touch-manipulation items-center justify-center rounded-full bg-surface-raised text-muted-foreground shadow-[var(--floating-shadow)] ring-1 ring-surface-border transition-[background-color,color,box-shadow] hover:bg-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-page-canvas active:bg-surface-hover",
+ // Impulse the button itself while a chat task is running — no
+ // outer ring to keep things calm.
+ isRunning && "animate-chat-impulse",
+ )}
+ >
+ <MessageCircle className="size-5" />
+ </TooltipTrigger>
+ <TooltipContent side="top" sideOffset={10}>
+ {tooltip}
+ {shortcut ? <ShortcutKeycaps shortcut={shortcut} className="ml-1.5" /> : null}
+ </TooltipContent>
+ </Tooltip>
+ </motion.div>
+ )}
+ </AnimatePresence>
);
}
diff --git a/packages/views/chat/components/chat-input.tsx b/packages/views/chat/components/chat-input.tsx
index 9721ef0016..abdcd15ce2 100644
--- a/packages/views/chat/components/chat-input.tsx
+++ b/packages/views/chat/components/chat-input.tsx
@@ -2,6 +2,9 @@
import type { ReactNode } from "react";
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
+import { AnimatePresence, motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { Scan, TriangleAlert, X } from "@multica/ui/icons";
import { IconButton } from "@multica/ui/components/common/icon-button";
import { toast } from "sonner";
@@ -41,6 +44,7 @@ import {
VoiceMicButton,
VoiceSetupDialog,
VoiceStrip,
+ type ComposerVoice,
} from "../../voice";
import { useCommentDraftStore } from "@multica/core/issues/stores";
import { composeAnnotatedReply, EMPTY_REPLY_ANNOTATIONS, hasReplyIntent } from "@multica/core/drafts/reply-annotation";
@@ -905,13 +909,16 @@ export function ChatInput({
className="mx-2 mb-1"
/>
)}
- {voice.showStrip && (
- <div className="absolute inset-x-1.5 bottom-1 flex items-center">
- <VoiceStrip voice={voice} />
- </div>
- )}
- {!voice.showStrip && (uploadEnabled || projectSelectionEnabled || leftAdornment) && (
- <div className="absolute bottom-1.5 left-1.5 flex items-center gap-1">
+ <ChatInputVoiceOverlay voice={voice} />
+ {(uploadEnabled || projectSelectionEnabled || leftAdornment) && (
+ <div
+ aria-hidden={voice.showStrip || undefined}
+ inert={voice.showStrip}
+ className={cn(
+ "absolute bottom-1.5 left-1.5 flex items-center gap-1 transition-opacity duration-150 motion-reduce:transition-none",
+ voice.showStrip && "pointer-events-none opacity-0",
+ )}
+ >
{(uploadEnabled || projectSelectionEnabled) && (
<ChatAddMenu
onSelectFile={uploadEnabled
@@ -926,7 +933,14 @@ export function ChatInput({
{leftAdornment}
</div>
)}
- <div className={cn("absolute bottom-1 right-1.5 flex items-center gap-1", voice.showStrip && "hidden")}>
+ <div
+ aria-hidden={voice.showStrip || undefined}
+ inert={voice.showStrip}
+ className={cn(
+ "absolute bottom-1 right-1.5 flex items-center gap-1 transition-opacity duration-150 motion-reduce:transition-none",
+ voice.showStrip && "pointer-events-none opacity-0",
+ )}
+ >
<VoiceMicButton voice={voice} />
{pageContext && (
<IconButton
@@ -985,3 +999,28 @@ export function ChatInput({
</>
);
}
+
+function ChatInputVoiceOverlay({ voice }: { voice: ComposerVoice }) {
+ const reduceMotion = useReducedMotion();
+ return (
+ <AnimatePresence initial={false}>
+ {voice.showStrip && (
+ <motion.div
+ key="voice-strip"
+ initial={reduceMotion ? false : { opacity: 0 }}
+ animate={{
+ opacity: 1,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ exit={{
+ opacity: 0,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }}
+ className="absolute inset-x-1.5 bottom-1 flex items-center"
+ >
+ <VoiceStrip voice={voice} />
+ </motion.div>
+ )}
+ </AnimatePresence>
+ );
+}
diff --git a/packages/views/chat/components/chat-message-list.tsx b/packages/views/chat/components/chat-message-list.tsx
index 59e25951f6..c887428234 100644
--- a/packages/views/chat/components/chat-message-list.tsx
+++ b/packages/views/chat/components/chat-message-list.tsx
@@ -1,6 +1,7 @@
"use client";
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { AnimatePresence } from "motion/react";
import { toast } from "sonner";
import { useQuery } from "@tanstack/react-query";
import { Virtuoso, type Components, type VirtuosoHandle } from "react-virtuoso";
@@ -482,13 +483,17 @@ export function ChatMessageList({
)}
</div>
</div>
- {jumpToLiveEnd.visible && (
- <JumpToLiveEndButton
- hasNewReply={jumpToLiveEnd.hasNewReply}
- onClick={jumpToLiveEnd.jump}
- className="absolute bottom-3 left-1/2 z-10 -translate-x-1/2"
- />
- )}
+ <div className="pointer-events-none absolute inset-x-0 bottom-3 z-10 flex justify-center">
+ <AnimatePresence initial={false}>
+ {jumpToLiveEnd.visible && (
+ <JumpToLiveEndButton
+ key="jump-to-live-end"
+ hasNewReply={jumpToLiveEnd.hasNewReply}
+ onClick={jumpToLiveEnd.jump}
+ />
+ )}
+ </AnimatePresence>
+ </div>
</div>
</PreviewSequenceProvider>
);
diff --git a/packages/views/chat/components/chat-window.tsx b/packages/views/chat/components/chat-window.tsx
index a70feafb20..8cdede5e75 100644
--- a/packages/views/chat/components/chat-window.tsx
+++ b/packages/views/chat/components/chat-window.tsx
@@ -5,6 +5,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
import { AnimatePresence, motion } from "motion/react";
import { Minus, Maximize2, Minimize2, ChevronDown, Plus, Check, Archive, Pencil, Loader2, Square, X } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
import {
@@ -36,6 +37,7 @@ import { NoAgentBanner } from "./no-agent-banner";
import { ArchivedAgentBanner } from "./archived-agent-banner";
import { AgentAccessRevokedBanner } from "./agent-access-revoked-banner";
import { RuntimeRequiredBanner } from "./runtime-required-banner";
+import { CollapsibleSlot } from "./collapsible-slot";
import {
pendingChatTasksOptions,
chatKeys,
@@ -234,6 +236,26 @@ export function ChatWindow() {
const closeLabel = t(($) => $.window.close_tooltip);
const sizeTransition =
isDragging || reduceMotion ? { duration: 0 } : { type: "spring" as const, duration: 0.3, bounce: 0 };
+ const visibilityTransition = reduceMotion
+ ? { duration: 0 }
+ : isVisible
+ ? { duration: UI_MOTION_DURATION.fast, ease: UI_EASE_OUT }
+ : { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN };
+ const hiddenScale = isMobile || reduceMotion ? 1 : 0.96;
+ const hiddenY = reduceMotion ? 0 : 8;
+
+ const statusBanner = c.noAgent ? (
+ <NoAgentBanner />
+ ) : c.isAgentAccessRevoked ? (
+ <AgentAccessRevokedBanner agentName={activeAgent?.name} />
+ ) : c.isAgentArchived ? (
+ <ArchivedAgentBanner agentName={activeAgent?.name} />
+ ) : !c.isAgentRuntimeBound && activeAgent ? (
+ <RuntimeRequiredBanner agentId={activeAgent.id} agentName={activeAgent.name} />
+ ) : c.availability === "offline" || c.availability === "unstable" ? (
+ <OfflineBanner agentName={activeAgent?.name} availability={c.availability} />
+ ) : null;
+ const hasActiveWakeup = !!activeSessionId && wakeups.some((w) => w.status === "active");
return (
<motion.div
@@ -243,15 +265,19 @@ export function ChatWindow() {
aria-hidden={!isOpen}
className={containerClass}
style={containerStyle}
- initial={{ opacity: 0, ...motionSize }}
+ initial={{ opacity: 0, scale: hiddenScale, y: hiddenY, ...motionSize }}
animate={{
opacity: isVisible ? 1 : 0,
+ scale: isVisible ? 1 : hiddenScale,
+ y: isVisible ? 0 : hiddenY,
...motionSize,
}}
transition={{
width: sizeTransition,
height: sizeTransition,
- opacity: { duration: 0.15 },
+ opacity: visibilityTransition,
+ scale: visibilityTransition,
+ y: visibilityTransition,
}}
>
{!isMobile && <ChatResizeHandles onDragStart={startDrag} />}
@@ -382,26 +408,17 @@ export function ChatWindow() {
* We key off `noAgent` (the resolved-empty state) rather than
* `!activeAgent`, so the loading window between mount and the
* first agent-list response stays banner-free. */}
- {c.noAgent ? (
- <NoAgentBanner />
- ) : c.isAgentAccessRevoked ? (
- <AgentAccessRevokedBanner agentName={activeAgent?.name} />
- ) : c.isAgentArchived ? (
- <ArchivedAgentBanner agentName={activeAgent?.name} />
- ) : !c.isAgentRuntimeBound && activeAgent ? (
- <RuntimeRequiredBanner
- agentId={activeAgent.id}
- agentName={activeAgent.name}
- />
- ) : (
- <OfflineBanner agentName={activeAgent?.name} availability={c.availability} />
- )}
+ <CollapsibleSlot slotKey="chat-status-banner" visible={statusBanner !== null}>
+ {statusBanner}
+ </CollapsibleSlot>
<div className="px-4">
<ChatAppRequests sessionId={activeSessionId} />
</div>
- <ChatWakeupStrip sessionId={activeSessionId} wakeups={wakeups} />
+ <CollapsibleSlot slotKey="chat-wakeup-slot" visible={hasActiveWakeup}>
+ <ChatWakeupStrip sessionId={activeSessionId} wakeups={wakeups} />
+ </CollapsibleSlot>
<ChatQueue
tasks={queuedTasks}
diff --git a/packages/views/chat/components/collapsible-slot.tsx b/packages/views/chat/components/collapsible-slot.tsx
new file mode 100644
index 0000000000..7b318047e2
--- /dev/null
+++ b/packages/views/chat/components/collapsible-slot.tsx
@@ -0,0 +1,41 @@
+"use client";
+
+import type { ReactNode } from "react";
+import { AnimatePresence, motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
+import { UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
+
+export function CollapsibleSlot({
+ slotKey,
+ visible,
+ children,
+}: {
+ slotKey: string;
+ visible: boolean;
+ children: ReactNode;
+}) {
+ const reduceMotion = useReducedMotion();
+ const duration = reduceMotion ? 0 : UI_MOTION_DURATION.fast;
+
+ return (
+ <AnimatePresence initial={false}>
+ {visible && (
+ <motion.div
+ key={slotKey}
+ data-slot={slotKey}
+ initial={{ opacity: 0, height: 0, overflow: "hidden" }}
+ animate={{
+ opacity: 1,
+ height: "auto",
+ transitionEnd: { overflow: "visible" },
+ }}
+ exit={{ opacity: 0, height: 0, overflow: "hidden" }}
+ transition={{ duration, ease: UI_EASE_OUT }}
+ className="shrink-0"
+ >
+ {children}
+ </motion.div>
+ )}
+ </AnimatePresence>
+ );
+}
diff --git a/packages/views/chat/components/jump-to-live-end.tsx b/packages/views/chat/components/jump-to-live-end.tsx
index beb92bd7f1..72a3e130a3 100644
--- a/packages/views/chat/components/jump-to-live-end.tsx
+++ b/packages/views/chat/components/jump-to-live-end.tsx
@@ -1,9 +1,12 @@
"use client";
import { useCallback, useEffect, useRef, useState } from "react";
+import { AnimatePresence, motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
import { ArrowDown } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
-import { IconButton } from "@multica/ui/components/common/icon-button";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { distanceFromBottom, isAtLiveEnd } from "./stick-to-bottom";
import { useT } from "../../i18n";
@@ -139,31 +142,76 @@ export function JumpToLiveEndButton({
className?: string;
}) {
const { t } = useT("chat");
- if (hasNewReply) {
- return (
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={onClick}
- className={cn(FLOATING, className)}
- >
- <span aria-hidden="true" className="size-1.5 rounded-full bg-brand" />
- {t(($) => $.message_list.new_reply)}
- <ArrowDown />
- </Button>
- );
- }
- return (
- <IconButton
+ const reduceMotion = useReducedMotion();
+ const label = hasNewReply
+ ? t(($) => $.message_list.new_reply)
+ : t(($) => $.message_list.jump_to_latest);
+
+ const button = (
+ <Button
type="button"
variant="outline"
- size="icon"
- label={t(($) => $.message_list.jump_to_latest)}
+ size="sm"
+ aria-label={hasNewReply ? undefined : label}
onClick={onClick}
- className={cn(FLOATING, className)}
+ className={cn(
+ FLOATING,
+ "pointer-events-auto gap-0 transition-[padding] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ hasNewReply ? "h-8 px-3" : "size-8 px-0",
+ )}
+ >
+ <AnimatePresence initial={false}>
+ {hasNewReply && (
+ <motion.span
+ key="new-reply-pill"
+ initial={reduceMotion ? false : { opacity: 0, width: 0 }}
+ animate={{
+ opacity: 1,
+ width: "auto",
+ transition: { duration: reduceMotion ? 0 : 0.16, ease: UI_EASE_OUT },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ width: 0,
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className="inline-flex items-center overflow-hidden whitespace-nowrap"
+ >
+ <span aria-hidden="true" className="mr-1.5 size-1.5 shrink-0 rounded-full bg-brand" />
+ <span className="mr-1.5">{t(($) => $.message_list.new_reply)}</span>
+ </motion.span>
+ )}
+ </AnimatePresence>
+ <ArrowDown className="shrink-0" />
+ </Button>
+ );
+
+ return (
+ <motion.div
+ initial={reduceMotion ? false : { opacity: 0, y: 8, scale: 0.92 }}
+ animate={{
+ opacity: 1,
+ y: 0,
+ scale: 1,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ y: 6,
+ scale: 0.92,
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className={cn("pointer-events-none", className)}
>
- <ArrowDown />
- </IconButton>
+ {hasNewReply ? button : <TooltipHint label={label}>{button}</TooltipHint>}
+ </motion.div>
);
}
diff --git a/packages/views/common/task-transcript/agent-transcript-dialog.tsx b/packages/views/common/task-transcript/agent-transcript-dialog.tsx
index 4bc9b1ff0c..9f2cb1e6be 100644
--- a/packages/views/common/task-transcript/agent-transcript-dialog.tsx
+++ b/packages/views/common/task-transcript/agent-transcript-dialog.tsx
@@ -1,7 +1,10 @@
"use client";
import { useState, useRef, useCallback, useEffect, useLayoutEffect, useMemo, forwardRef } from "react";
+import { AnimatePresence, motion } from "motion/react";
+import { prefersReducedMotion, useReducedMotion } from "@multica/core/appearance";
import { useWorkspaceId } from "@multica/core/hooks";
+import { UI_EASE_IN, UI_EASE_OUT, UI_EASE_OUT_CSS, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { useTraceIssueLabels } from "./use-trace-issue-labels";
import { Virtuoso, type VirtuosoHandle, type Components } from "react-virtuoso";
import {
@@ -27,6 +30,7 @@ import {
GitBranch,
} from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
+import { useIsMobile } from "@multica/ui/hooks/use-mobile";
import { copyText } from "@multica/ui/lib/clipboard";
import { Button } from "@multica/ui/components/ui/button";
import { CopyCheckIcon } from "@multica/ui/components/common/copy-check-icon";
@@ -626,6 +630,30 @@ export function AgentTranscriptDialog({
return () => { cancelled = true; };
}, [open, task.agent_id, task.runtime_id]);
+ const reduceMotion = useReducedMotion();
+ const isMobile = useIsMobile();
+ // Track rows that arrive live while the transcript is open so only newly
+ // streamed steps fade in (never historical rows mounted during Virtuoso scroll).
+ const knownSeqsRef = useRef<{ taskId: string; seqs: Set<number> } | null>(null);
+ const [enteringSeqs, setEnteringSeqs] = useState<ReadonlySet<number>>(() => new Set());
+ useEffect(() => {
+ if (!knownSeqsRef.current || knownSeqsRef.current.taskId !== task.id) {
+ knownSeqsRef.current = { taskId: task.id, seqs: new Set(displayRows.map((row) => row.seq)) };
+ setEnteringSeqs((prev) => (prev.size === 0 ? prev : new Set()));
+ return;
+ }
+ const added: number[] = [];
+ for (const row of displayRows) {
+ if (!knownSeqsRef.current.seqs.has(row.seq)) {
+ knownSeqsRef.current.seqs.add(row.seq);
+ if (isLive) added.push(row.seq);
+ }
+ }
+ if (added.length > 0) {
+ setEnteringSeqs((prev) => new Set([...prev, ...added]));
+ }
+ }, [task.id, displayRows, isLive]);
+
// Elapsed time for live tasks
useEffect(() => {
if (!isLive || (!task.started_at && !task.dispatched_at)) return;
@@ -1277,6 +1305,7 @@ export function AgentTranscriptDialog({
formatText={formatText}
runStartMs={runStartMs}
isLive={isLive}
+ entering={isLive && enteringSeqs.has(row.seq)}
selectedSeq={selectedSeq}
expanded={row.kind === "group" && expandedGroups.has(row.seq)}
onToggleGroup={handleToggleGroup}
@@ -1286,13 +1315,38 @@ export function AgentTranscriptDialog({
/>
)}
</div>
- {selectedStep && (
- <StepInspector
- step={selectedStep}
- runStartMs={runStartMs}
- onClose={() => setSelectedSeq(null)}
- />
- )}
+ <AnimatePresence initial={false}>
+ {selectedStep && (
+ <motion.div
+ key="step-inspector-drawer"
+ // Width is always owned by motion: below md the inspector
+ // fills the dialog (its close button must stay in view), so
+ // it only fades; from md up it slides in as a drawer.
+ initial={reduceMotion ? false : { opacity: 0, width: isMobile ? "100%" : 0 }}
+ animate={{
+ opacity: 1,
+ width: isMobile ? "100%" : "auto",
+ transition: { duration: reduceMotion ? 0 : 0.2, ease: UI_EASE_OUT },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ ...(isMobile ? {} : { width: 0 }),
+ transition: { duration: UI_MOTION_DURATION.fast, ease: UI_EASE_IN },
+ }
+ }
+ className="flex shrink-0 overflow-hidden"
+ >
+ <StepInspector
+ step={selectedStep}
+ runStartMs={runStartMs}
+ onClose={() => setSelectedSeq(null)}
+ />
+ </motion.div>
+ )}
+ </AnimatePresence>
</div>
</DialogContent>
</Dialog>
@@ -1416,6 +1470,7 @@ interface TranscriptRowProps {
row: TraceRow;
runStartMs?: number;
isLive: boolean;
+ entering?: boolean;
selectedSeq: number | null;
expanded: boolean;
onToggleGroup: (seq: number) => void;
@@ -1423,10 +1478,27 @@ interface TranscriptRowProps {
}
function TranscriptRow(props: TranscriptRowProps) {
- const { row } = props;
- if (isGroupRow(row)) return <GroupRow {...props} row={row} />;
- if (!isCallStep(row) && row.kind === "text") return <ProseRow {...props} row={row} />;
- return <StepRow {...props} row={row} />;
+ const { row, entering } = props;
+ const rowRef = useRef<HTMLDivElement>(null);
+ const animatedRef = useRef(false);
+ useLayoutEffect(() => {
+ if (!entering || animatedRef.current) return;
+ animatedRef.current = true;
+ const el = rowRef.current;
+ if (!el || typeof el.animate !== "function" || prefersReducedMotion()) return;
+ const anim = el.animate(
+ [{ opacity: 0, transform: "translateY(3px)" }, { opacity: 1, transform: "translateY(0)" }],
+ { duration: 140, easing: UI_EASE_OUT_CSS },
+ );
+ return () => { anim.cancel(); };
+ }, [entering]);
+
+ const content = isGroupRow(row)
+ ? <GroupRow {...props} row={row} />
+ : !isCallStep(row) && row.kind === "text"
+ ? <ProseRow {...props} row={row} />
+ : <StepRow {...props} row={row} />;
+ return entering ? <div ref={rowRef}>{content}</div> : content;
}
/** The offset column: where in the run this happened. */
@@ -1720,6 +1792,7 @@ function StepInspector({
onClose: () => void;
}) {
const { t } = useT("agents");
+ const reduceMotion = useReducedMotion();
const [copied, showCopied] = useCopyFeedback();
const at = timeMs(step.startedAt);
@@ -1794,24 +1867,31 @@ function StepInspector({
</IconButton>
</div>
<div className="min-h-0 flex-1 overflow-y-auto">
- {call ? (
- <>
- {call.call && (
- <InspectorSection label={t(($) => $.transcript.step_input)}>
- <StepBody item={call.call} />
- </InspectorSection>
- )}
- {call.result && (
- <InspectorSection label={t(($) => $.transcript.step_result)}>
- <StepBody item={call.result} />
- </InspectorSection>
- )}
- </>
- ) : (
- <InspectorSection label={title}>
- <ToolDetailSurface text={redactSecrets(message?.item.content ?? "")} />
- </InspectorSection>
- )}
+ <motion.div
+ key={step.seq}
+ initial={reduceMotion ? false : { opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: reduceMotion ? 0 : 0.12, ease: UI_EASE_OUT }}
+ >
+ {call ? (
+ <>
+ {call.call && (
+ <InspectorSection label={t(($) => $.transcript.step_input)}>
+ <StepBody item={call.call} />
+ </InspectorSection>
+ )}
+ {call.result && (
+ <InspectorSection label={t(($) => $.transcript.step_result)}>
+ <StepBody item={call.result} />
+ </InspectorSection>
+ )}
+ </>
+ ) : (
+ <InspectorSection label={title}>
+ <ToolDetailSurface text={redactSecrets(message?.item.content ?? "")} />
+ </InspectorSection>
+ )}
+ </motion.div>
</div>
</aside>
);
diff --git a/packages/views/common/task-transcript/run-timeline.tsx b/packages/views/common/task-transcript/run-timeline.tsx
index b9ecdcdf78..123c9f17da 100644
--- a/packages/views/common/task-transcript/run-timeline.tsx
+++ b/packages/views/common/task-transcript/run-timeline.tsx
@@ -246,7 +246,7 @@ export function RunTimeline({
aria-hidden
// Ends on the lanes, not below them: the track clips its own
// vertical overflow now, so an overhang would only be cropped.
- className="pointer-events-none absolute bottom-0 top-2.5 w-0.5 rounded-full bg-brand"
+ className="pointer-events-none absolute bottom-0 top-2.5 w-0.5 rounded-full bg-brand transition-[left] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none"
style={{
left: `${
(Math.min(Math.max(selectedOffsetMs, 0), lanes.totalMs) / lanes.totalMs) * 100
diff --git a/packages/views/docs/components/doc-comments-panel.tsx b/packages/views/docs/components/doc-comments-panel.tsx
index fd1b47afe1..472f5a28a6 100644
--- a/packages/views/docs/components/doc-comments-panel.tsx
+++ b/packages/views/docs/components/doc-comments-panel.tsx
@@ -1,8 +1,11 @@
"use client";
import { useEffect, useRef, useState } from "react";
+import { AnimatePresence, motion } from "motion/react";
import { toast } from "sonner";
+import { useReducedMotion } from "@multica/core/appearance";
import { AlertTriangle, Check, MessageSquare, RotateCcw, Trash2, X } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
+import { UI_EASE_OUT } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { useAuthStore } from "@multica/core/auth";
import {
@@ -110,7 +113,7 @@ function Message({ comment, onDelete }: { comment: DocComment; onDelete?: () =>
type="button"
aria-label={t(($) => $.comments.delete)}
title={t(($) => $.comments.delete)}
- className="ml-auto rounded-sm p-0.5 text-muted-foreground opacity-0 hover:text-destructive focus-visible:opacity-100 group-hover/message:opacity-100"
+ className="ml-auto rounded-sm p-0.5 text-muted-foreground opacity-0 transition-opacity duration-100 hover:text-destructive focus-visible:opacity-100 group-hover/message:opacity-100 motion-reduce:transition-none"
onClick={(e) => {
e.stopPropagation();
onDelete();
@@ -166,6 +169,7 @@ function ThreadCard({
onResolvedChange: (resolved: boolean) => void;
}) {
const { t } = useT("docs");
+ const reduceMotion = useReducedMotion();
const { getActorName } = useActorName();
const userId = useAuthStore((s) => s.user?.id);
const reply = useCreateDocComment(docId);
@@ -226,29 +230,41 @@ function ThreadCard({
</Button>
</div>
) : (
- active && (
- <>
- <Composer
- placeholder={t(($) => $.comments.reply_placeholder)}
- submitLabel={t(($) => $.comments.reply)}
- onSubmit={(content) => reply.mutateAsync({ content, parentId: thread.root.id })}
- />
- <div className="mt-2 flex justify-end">
- <Button
- size="xs"
- variant="outline"
- disabled={resolve.isPending}
- onClick={(e) => {
- e.stopPropagation();
- void setResolved(true);
- }}
- >
- <Check />
- {t(($) => $.comments.resolve)}
- </Button>
- </div>
- </>
- )
+ <AnimatePresence initial={false}>
+ {active && (
+ <motion.div
+ key="thread-reply-box"
+ initial={reduceMotion ? false : { opacity: 0, height: 0, overflow: "hidden" }}
+ animate={{
+ opacity: 1,
+ height: "auto",
+ transitionEnd: { overflow: "visible" },
+ }}
+ exit={{ opacity: 0, height: 0, overflow: "hidden" }}
+ transition={{ duration: reduceMotion ? 0 : 0.18, ease: UI_EASE_OUT }}
+ >
+ <Composer
+ placeholder={t(($) => $.comments.reply_placeholder)}
+ submitLabel={t(($) => $.comments.reply)}
+ onSubmit={(content) => reply.mutateAsync({ content, parentId: thread.root.id })}
+ />
+ <div className="mt-2 flex justify-end">
+ <Button
+ size="xs"
+ variant="outline"
+ disabled={resolve.isPending}
+ onClick={(e) => {
+ e.stopPropagation();
+ void setResolved(true);
+ }}
+ >
+ <Check />
+ {t(($) => $.comments.resolve)}
+ </Button>
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
)}
{!resolved && !active && thread.replies.length > 0 && (
<div className="mt-2 text-caption text-muted-foreground">
@@ -315,7 +331,7 @@ export function DocCommentsPanel({
aria-selected={tab === key}
onClick={() => setTab(key)}
className={cn(
- "rounded-md px-2 py-1",
+ "rounded-md px-2 py-1 transition-colors",
tab === key ? "bg-surface-selected text-foreground" : "text-muted-foreground hover:text-foreground",
)}
>
diff --git a/packages/views/docs/components/doc-history-page.tsx b/packages/views/docs/components/doc-history-page.tsx
index 6a0b32c2ea..1dede866af 100644
--- a/packages/views/docs/components/doc-history-page.tsx
+++ b/packages/views/docs/components/doc-history-page.tsx
@@ -1,8 +1,11 @@
"use client";
import { useState } from "react";
+import { motion } from "motion/react";
import { useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
+import { useReducedMotion } from "@multica/core/appearance";
import { Button } from "@multica/ui/components/ui/button";
+import { UI_EASE_OUT } from "@multica/ui/lib/motion";
import {
docDetailOptions,
docVersionsOptions,
@@ -30,6 +33,7 @@ export function DocHistoryPage({ docId }: { docId: string }) {
function DocHistoryPageContent({ docId }: { docId: string }) {
const { t } = useT("docs");
+ const reduceMotion = useReducedMotion();
const wsId = useWorkspaceId();
const p = useWorkspacePaths();
const { push } = useNavigation();
@@ -87,7 +91,7 @@ function DocHistoryPageContent({ docId }: { docId: string }) {
key={v.number}
onClick={() => setSelected(v.number)}
aria-pressed={number === v.number}
- className={`mb-1 block w-full rounded-md p-3 text-left text-body ${number === v.number ? "bg-surface-selected text-surface-selected-foreground" : "hover:bg-surface-hover"}`}
+ className={`mb-1 block w-full rounded-md p-3 text-left text-body transition-colors ${number === v.number ? "bg-surface-selected text-surface-selected-foreground" : "hover:bg-surface-hover"}`}
>
<span className="font-medium">
{t(($) => $.version_number, { number: v.number })}
@@ -124,7 +128,12 @@ function DocHistoryPageContent({ docId }: { docId: string }) {
{t(($) => $.editor.retry)}
</Button>
) : version.data ? (
- <>
+ <motion.div
+ key={version.data.number}
+ initial={reduceMotion ? false : { opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: reduceMotion ? 0 : 0.12, ease: UI_EASE_OUT }}
+ >
<div className="mb-6 flex items-start justify-between gap-3">
<h1 className="min-w-0 flex-1 text-display-sm font-semibold leading-snug wrap-anywhere">
{version.data.title || t(($) => $.untitled)}
@@ -145,7 +154,7 @@ function DocHistoryPageContent({ docId }: { docId: string }) {
</Button>
</div>
<ReadonlyContent content={version.data.content ?? ""} />
- </>
+ </motion.div>
) : (
t(($) => $.history.loading)
)}
diff --git a/packages/views/docs/components/doc-page.tsx b/packages/views/docs/components/doc-page.tsx
index 778a759260..15a96b9bdc 100644
--- a/packages/views/docs/components/doc-page.tsx
+++ b/packages/views/docs/components/doc-page.tsx
@@ -1,6 +1,9 @@
"use client";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { AnimatePresence, motion } from "motion/react";
import { useQuery } from "@tanstack/react-query";
+import { useReducedMotion } from "@multica/core/appearance";
+import { UI_EASE_OUT } from "@multica/ui/lib/motion";
import {
History,
Link as LinkIcon,
@@ -310,6 +313,7 @@ function DocEditor({ doc }: { doc: Doc }) {
const outline = useDocOutline(bodyRef, scrollRef, bodyKey);
const showOutline = outline.headings.length >= MIN_OUTLINE_HEADINGS;
+ const reduceMotion = useReducedMotion();
// Discussions. A link from the inbox names one with ?thread=.
const { data: comments } = useQuery(docCommentsOptions(wsId, doc.id));
const threads = useMemo(() => groupDocThreads(comments ?? []), [comments]);
@@ -536,7 +540,14 @@ function DocEditor({ doc }: { doc: Doc }) {
</TooltipContent>
</Tooltip>
</div>
- <div ref={bodyRef} onClick={onBodyClick}>
+ <motion.div
+ key={doc.id}
+ ref={bodyRef}
+ onClick={onBodyClick}
+ initial={reduceMotion ? false : { opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: reduceMotion ? 0 : 0.12, ease: UI_EASE_OUT }}
+ >
{!solo ? (
<>
{!showLiveEditor && <ReadonlyContent content={doc.content} className="min-h-80" />}
@@ -572,7 +583,7 @@ function DocEditor({ doc }: { doc: Doc }) {
className="min-h-80"
/>
)}
- </div>
+ </motion.div>
</div>
</div>
{/* The discussions panel takes the right side; the outline yields. */}
@@ -587,25 +598,39 @@ function DocEditor({ doc }: { doc: Doc }) {
)}
</div>
</div>
- {commentsOpen && (
- <DocCommentsPanel
- docId={doc.id}
- threads={threads}
- missing={highlights.missing}
- activeId={activeThread}
- draft={newAnchor}
- onActivate={activateThread}
- onDeactivate={() => setActiveThread(null)}
- onDraftDone={(id) => {
- setNewAnchor(null);
- if (id) setActiveThread(id);
- }}
- onClose={() => {
- setCommentsOpen(false);
- setNewAnchor(null);
- }}
- />
- )}
+ <AnimatePresence initial={false}>
+ {commentsOpen && (
+ <motion.div
+ key="doc-comments-panel"
+ initial={reduceMotion ? false : { width: 0, opacity: 0 }}
+ animate={{ width: 360, opacity: 1 }}
+ exit={{ width: 0, opacity: 0 }}
+ transition={{
+ duration: reduceMotion ? 0 : 0.22,
+ ease: [0.22, 1, 0.36, 1],
+ }}
+ className="flex h-full shrink-0 overflow-hidden"
+ >
+ <DocCommentsPanel
+ docId={doc.id}
+ threads={threads}
+ missing={highlights.missing}
+ activeId={activeThread}
+ draft={newAnchor}
+ onActivate={activateThread}
+ onDeactivate={() => setActiveThread(null)}
+ onDraftDone={(id) => {
+ setNewAnchor(null);
+ if (id) setActiveThread(id);
+ }}
+ onClose={() => {
+ setCommentsOpen(false);
+ setNewAnchor(null);
+ }}
+ />
+ </motion.div>
+ )}
+ </AnimatePresence>
</div>
<MoveDialog
target={moving ? { kind: "doc", id: doc.id, title: doc.title } : null}
diff --git a/packages/views/docs/components/doc-tree.dnd.test.tsx b/packages/views/docs/components/doc-tree.dnd.test.tsx
index 21f1102c5c..00ba286167 100644
--- a/packages/views/docs/components/doc-tree.dnd.test.tsx
+++ b/packages/views/docs/components/doc-tree.dnd.test.tsx
@@ -64,7 +64,7 @@ afterEach(() => { cleanup(); qc.clear(); });
function mount(children: React.ReactNode) {
return render(<QueryClientProvider client={qc}><I18nProvider locale="en" resources={{ en: { docs: enDocs, editor: enEditor, issues: enIssues } }}>{children}</I18nProvider></QueryClientProvider>);
}
-function folder(title: string) { return screen.getByText(title, { exact: true }).closest("summary")!; }
+function folder(title: string) { return screen.getByText(title, { exact: true }).closest("[data-doc-folder]")!; }
function dragDrop(source: Element, target: Element) {
const dataTransfer = { setData: vi.fn(), effectAllowed: "", dropEffect: "" };
fireEvent.dragStart(source, { dataTransfer });
diff --git a/packages/views/docs/components/doc-tree.panel.test.tsx b/packages/views/docs/components/doc-tree.panel.test.tsx
index 39b872b6c2..52a4b3f69a 100644
--- a/packages/views/docs/components/doc-tree.panel.test.tsx
+++ b/packages/views/docs/components/doc-tree.panel.test.tsx
@@ -1,4 +1,4 @@
-import { cleanup, render, screen } from "@testing-library/react";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { I18nProvider } from "@multica/core/i18n/react";
@@ -58,3 +58,19 @@ it("renders the shared panel title and lights the open doc's nav row", () => {
expect(link.closest('[data-mc="nav-item"]')?.getAttribute("data-active")).toBe("false");
}
});
+
+it("folder row actions are siblings of the disclosure and never fold the folder", () => {
+ render(<QueryClientProvider client={qc}><I18nProvider locale="en" resources={{ en: { docs: enDocs } }}><DocTree /></I18nProvider></QueryClientProvider>);
+
+ const toggle = screen.getByRole("button", { name: "Specs" });
+ const more = screen.getByRole("button", { name: "More actions for Specs" });
+ expect(toggle.getAttribute("aria-expanded")).toBe("true");
+ expect(toggle.contains(more)).toBe(false);
+
+ fireEvent.click(more);
+ expect(toggle.getAttribute("aria-expanded")).toBe("true");
+ expect(screen.getByRole("link", { name: "Inside" })).toBeTruthy();
+
+ fireEvent.click(toggle);
+ expect(toggle.getAttribute("aria-expanded")).toBe("false");
+});
diff --git a/packages/views/docs/components/doc-tree.tsx b/packages/views/docs/components/doc-tree.tsx
index 35319f48dc..b5a3405bd7 100644
--- a/packages/views/docs/components/doc-tree.tsx
+++ b/packages/views/docs/components/doc-tree.tsx
@@ -1,8 +1,11 @@
"use client";
-import { useMemo, useState, type DragEvent } from "react";
+import { useMemo, useState, type DragEvent, type ReactNode } from "react";
+import { AnimatePresence, motion } from "motion/react";
import { useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
+import { useReducedMotion } from "@multica/core/appearance";
import {
+ ChevronRight,
FileText,
Folder,
FolderInput,
@@ -11,6 +14,7 @@ import {
Plus,
Trash2,
} from "@multica/ui/icons";
+import { UI_EASE_OUT } from "@multica/ui/lib/motion";
import { Button } from "@multica/ui/components/ui/button";
import { IconButton } from "@multica/ui/components/common/icon-button";
import { cn } from "@multica/ui/lib/utils";
@@ -385,46 +389,31 @@ export function DocTree() {
{tree.data?.folders
.filter((f) => f.parentId === parent && !ancestors.has(f.id))
.map((folder) => (
- <li key={folder.id}>
- <details open>
- <summary
- {...dragProps({ kind: "folder", item: folder })}
- {...dropProps(folder.id)}
- className={cn(
- PANEL_ROW_CLASS,
- panelRowStateClass(false),
- "group/row cursor-pointer",
- dropTarget === folder.id && "bg-nav-item-hover ring-1 ring-ring",
- )}
- >
- <Folder className="size-4 shrink-0" />
- <TruncatedTooltip content={folder.title} side="right">
- <span className="min-w-0 flex-1 truncate">{folder.title}</span>
- </TruncatedTooltip>
+ <DocFolderItem
+ key={folder.id}
+ folderId={folder.id}
+ title={folder.title}
+ isDropTarget={dropTarget === folder.id}
+ dragProps={dragProps({ kind: "folder", item: folder })}
+ dropProps={dropProps(folder.id)}
+ actions={
+ <>
<button
type="button"
aria-label={t(($) => $.tree.new_doc_in, { title: folder.title })}
title={t(($) => $.actions.new_doc)}
className={ROW_ACTION_CLASS}
disabled={createDoc.isPending}
- onClick={(event) => {
- // Inside <summary>: a click would also fold the folder.
- event.preventDefault();
- void newDoc(folder.id);
- }}
+ onClick={() => void newDoc(folder.id)}
>
<Plus className="size-3.5" />
</button>
{menu({ kind: "folder", item: folder })}
- </summary>
- <div
- className="ml-5 border-l border-surface-border pl-[5px]"
- {...dropProps(folder.id)}
- >
- {branch(folder.id, new Set([...ancestors, folder.id]))}
- </div>
- </details>
- </li>
+ </>
+ }
+ >
+ {branch(folder.id, new Set([...ancestors, folder.id]))}
+ </DocFolderItem>
))}
{tree.data?.docs
.filter((d) => d.folderId === parent)
@@ -582,3 +571,84 @@ export function DocTree() {
</>
);
}
+
+function DocFolderItem({
+ folderId,
+ title,
+ isDropTarget,
+ dragProps,
+ dropProps,
+ actions,
+ children,
+}: {
+ folderId: string;
+ title: string;
+ isDropTarget: boolean;
+ dragProps: Record<string, unknown>;
+ dropProps: Record<string, unknown>;
+ actions: ReactNode;
+ children: ReactNode;
+}) {
+ const [open, setOpen] = useState(true);
+ const reduceMotion = useReducedMotion();
+
+ return (
+ <li>
+ <div
+ data-doc-folder={folderId}
+ {...dragProps}
+ {...dropProps}
+ className={cn(
+ PANEL_ROW_CLASS,
+ panelRowStateClass(false),
+ "group/row relative transition-[background-color,box-shadow] duration-150 motion-reduce:transition-none",
+ isDropTarget && "bg-nav-item-hover ring-1 ring-ring",
+ )}
+ >
+ <ChevronRight
+ aria-hidden="true"
+ className={cn(
+ "size-3 shrink-0 text-faint-foreground transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ open && "rotate-90",
+ )}
+ />
+ <Folder className="size-4 shrink-0" />
+ <TruncatedTooltip content={title} side="right">
+ {/* Stretched over the row, under its actions, so the whole row
+ toggles the folder while the actions stay sibling controls. */}
+ <button
+ type="button"
+ aria-expanded={open}
+ onClick={() => setOpen((v) => !v)}
+ className="min-w-0 flex-1 cursor-pointer truncate text-left outline-none after:absolute after:inset-0 after:rounded-nav-item focus-visible:after:outline-2 focus-visible:after:outline-ring"
+ >
+ {title}
+ </button>
+ </TruncatedTooltip>
+ {actions}
+ </div>
+ <AnimatePresence initial={false}>
+ {open && (
+ <motion.div
+ key="folder-branch"
+ initial={reduceMotion ? false : { opacity: 0, height: 0, overflow: "hidden" }}
+ animate={{
+ opacity: 1,
+ height: "auto",
+ transitionEnd: { overflow: "visible" },
+ }}
+ exit={{ opacity: 0, height: 0, overflow: "hidden" }}
+ transition={{ duration: reduceMotion ? 0 : 0.16, ease: UI_EASE_OUT }}
+ >
+ <div
+ className="ml-5 border-l border-surface-border pl-[5px]"
+ {...dropProps}
+ >
+ {children}
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </li>
+ );
+}
diff --git a/packages/views/editor/block-handle.tsx b/packages/views/editor/block-handle.tsx
index 8d23a7fd7f..039d9e0c6a 100644
--- a/packages/views/editor/block-handle.tsx
+++ b/packages/views/editor/block-handle.tsx
@@ -7,6 +7,9 @@ import {
type DragEvent as ReactDragEvent,
type RefObject,
} from "react";
+import { AnimatePresence, motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import type { Editor } from "@tiptap/core";
import type { EditorView } from "@tiptap/pm/view";
import { NodeSelection } from "@tiptap/pm/state";
@@ -143,9 +146,13 @@ export function BlockHandle({
containerRef: RefObject<HTMLDivElement | null>;
}) {
const { t } = useT("editor");
+ const reduceMotion = useReducedMotion();
const [position, setPosition] = useState<HandlePosition | null>(null);
const [menuOpen, setMenuOpen] = useState(false);
const gripRef = useRef<HTMLButtonElement>(null);
+ const hadPositionRef = useRef(false);
+ const shouldGlide = hadPositionRef.current && position !== null;
+ hadPositionRef.current = position !== null;
// While the menu is open or a drag is in flight the handle must stay on its
// block; the listeners read these without re-subscribing.
const pinnedRef = useRef(false);
@@ -201,10 +208,6 @@ export function BlockHandle({
};
}, [editor, containerRef]);
- if (!position) return null;
- const { target } = position;
- const current = targetKind(editor, target);
-
const run = (action: () => void) => {
action();
setMenuOpen(false);
@@ -212,6 +215,8 @@ export function BlockHandle({
};
const onDragStart = (event: ReactDragEvent<HTMLButtonElement>) => {
+ if (!position) return;
+ const { target } = position;
const { view } = editor;
// Not dispatched as the editor selection: a selected block would raise the
// formatting toolbar over the drop targets for the whole drag.
@@ -236,99 +241,124 @@ export function BlockHandle({
setPosition(null);
};
+ const target = position?.target ?? null;
+ const current = target ? targetKind(editor, target) : null;
+
return (
- <div
- data-block-handle=""
- className="absolute z-10"
- style={{
- top: position.top,
- left: position.left,
- width: position.width,
- height: position.height,
- }}
- >
- <div
- className="absolute left-0 flex items-center gap-0.5"
- style={{ top: position.buttonTop, height: HANDLE_HEIGHT }}
- >
- <button
- type="button"
- aria-label={t(($) => $.block_handle.add)}
- title={t(($) => $.block_handle.add)}
- className="flex size-6 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
- // Keep the caret in the editor; the click places it on the new line.
- onMouseDown={(event) => event.preventDefault()}
- onClick={() => run(() => openInsertMenuBelow(editor, target))}
- >
- <Plus className="size-4" />
- </button>
- <button
- ref={gripRef}
- type="button"
- draggable
- aria-label={t(($) => $.block_handle.options)}
- title={t(($) => $.block_handle.options)}
- aria-haspopup="menu"
- aria-expanded={menuOpen}
- className="flex h-6 w-4 cursor-grab items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground active:cursor-grabbing"
- onClick={() => setMenuOpen(true)}
- onDragStart={onDragStart}
- onDragEnd={onDragEnd}
- >
- <GripVertical className="size-4" />
- </button>
- </div>
- <DropdownMenu
- open={menuOpen}
- onOpenChange={(open) => {
- setMenuOpen(open);
- if (!open) setPosition(null);
- }}
- >
- <DropdownMenuContent anchor={gripRef} align="start" className="min-w-44">
- {canTurnInto(target.node) && (
- <>
- <DropdownMenuGroup>
- <DropdownMenuLabel>{t(($) => $.block_handle.turn_into)}</DropdownMenuLabel>
- {/* A submenu would be closed as a "sibling" of this anchored,
- trigger-less menu, so the block types sit inline as icons. */}
- <div className="grid grid-cols-5 gap-0.5 px-1 pb-1">
- {TEXT_BLOCK_KINDS.map((kind) => {
- const Icon = KIND_ICONS.get(kind);
- const label = t(($) => $.block_menu.blocks[kind]);
- return (
- <DropdownMenuItem
- key={kind}
- aria-label={label}
- title={label}
- className={cn(
- "size-8 justify-center p-0",
- current === kind && "bg-accent text-accent-foreground",
- )}
- onClick={() => run(() => turnBlockInto(editor, target, kind))}
- >
- {Icon && <Icon />}
- </DropdownMenuItem>
- );
- })}
- </div>
- </DropdownMenuGroup>
- <DropdownMenuSeparator />
- </>
+ <AnimatePresence>
+ {position && target && (
+ <motion.div
+ key="block-handle"
+ data-block-handle=""
+ initial={reduceMotion ? false : { opacity: 0 }}
+ animate={{
+ opacity: 1,
+ transition: { duration: reduceMotion ? 0 : 0.12, ease: UI_EASE_OUT },
+ }}
+ exit={{
+ opacity: 0,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }}
+ className={cn(
+ "absolute z-10",
+ shouldGlide &&
+ "transition-[top,left] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
)}
- <DropdownMenuItem onClick={() => run(() => duplicateBlock(editor, target))}>
- <Copy />
- {t(($) => $.block_handle.duplicate)}
- </DropdownMenuItem>
- <DropdownMenuItem
- variant="destructive"
- onClick={() => run(() => deleteBlock(editor, target))}
+ style={{
+ top: position.top,
+ left: position.left,
+ width: position.width,
+ height: position.height,
+ }}
+ >
+ <div
+ className={cn(
+ "absolute left-0 flex items-center gap-0.5",
+ shouldGlide &&
+ "transition-[top] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ )}
+ style={{ top: position.buttonTop, height: HANDLE_HEIGHT }}
+ >
+ <button
+ type="button"
+ aria-label={t(($) => $.block_handle.add)}
+ title={t(($) => $.block_handle.add)}
+ className="flex size-6 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
+ // Keep the caret in the editor; the click places it on the new line.
+ onMouseDown={(event) => event.preventDefault()}
+ onClick={() => run(() => openInsertMenuBelow(editor, target))}
+ >
+ <Plus className="size-4" />
+ </button>
+ <button
+ ref={gripRef}
+ type="button"
+ draggable
+ aria-label={t(($) => $.block_handle.options)}
+ title={t(($) => $.block_handle.options)}
+ aria-haspopup="menu"
+ aria-expanded={menuOpen}
+ className="flex h-6 w-4 cursor-grab items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground active:cursor-grabbing"
+ onClick={() => setMenuOpen(true)}
+ onDragStart={onDragStart}
+ onDragEnd={onDragEnd}
+ >
+ <GripVertical className="size-4" />
+ </button>
+ </div>
+ <DropdownMenu
+ open={menuOpen}
+ onOpenChange={(open) => {
+ setMenuOpen(open);
+ if (!open) setPosition(null);
+ }}
>
- <Trash2 />
- {t(($) => $.block_handle.delete)}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
+ <DropdownMenuContent anchor={gripRef} align="start" className="min-w-44">
+ {canTurnInto(target.node) && (
+ <>
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>{t(($) => $.block_handle.turn_into)}</DropdownMenuLabel>
+ {/* A submenu would be closed as a "sibling" of this anchored,
+ trigger-less menu, so the block types sit inline as icons. */}
+ <div className="grid grid-cols-5 gap-0.5 px-1 pb-1">
+ {TEXT_BLOCK_KINDS.map((kind) => {
+ const Icon = KIND_ICONS.get(kind);
+ const label = t(($) => $.block_menu.blocks[kind]);
+ return (
+ <DropdownMenuItem
+ key={kind}
+ aria-label={label}
+ title={label}
+ className={cn(
+ "size-8 justify-center p-0",
+ current === kind && "bg-accent text-accent-foreground",
+ )}
+ onClick={() => run(() => turnBlockInto(editor, target, kind))}
+ >
+ {Icon && <Icon />}
+ </DropdownMenuItem>
+ );
+ })}
+ </div>
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ </>
+ )}
+ <DropdownMenuItem onClick={() => run(() => duplicateBlock(editor, target))}>
+ <Copy />
+ {t(($) => $.block_handle.duplicate)}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => run(() => deleteBlock(editor, target))}
+ >
+ <Trash2 />
+ {t(($) => $.block_handle.delete)}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </motion.div>
+ )}
+ </AnimatePresence>
);
}
diff --git a/packages/views/editor/bubble-menu.tsx b/packages/views/editor/bubble-menu.tsx
index 12d32fcdc0..c86ba8be56 100644
--- a/packages/views/editor/bubble-menu.tsx
+++ b/packages/views/editor/bubble-menu.tsx
@@ -20,6 +20,7 @@
*/
import { useState, useEffect, useCallback, useRef, useMemo } from "react";
+import { useReducedMotion } from "@multica/core/appearance";
import {
computePosition,
offset,
@@ -571,6 +572,7 @@ function EditorBubbleMenu({
}).then(({ x, y, middlewareData }) => {
if (!el.isConnected) return;
const hidden = middlewareData.hide?.referenceHidden;
+ el.dataset.state = hidden ? "closed" : "open";
el.style.visibility = hidden ? "hidden" : "visible";
el.style.left = `${x}px`;
el.style.top = `${y}px`;
@@ -609,11 +611,19 @@ function EditorBubbleMenu({
[editor],
);
+ const reduceMotion = useReducedMotion();
+ const prevModeRef = useRef(mode);
+ const modeChanged = prevModeRef.current !== mode;
+ useEffect(() => {
+ prevModeRef.current = mode;
+ }, [mode]);
+
return (
<div
ref={floatingRef}
data-mc="editor-toolbar"
data-mode={mode === "link-edit" ? "link" : "format"}
+ data-state={visible ? "open" : "closed"}
style={{
position: "fixed",
zIndex: 50,
@@ -622,6 +632,14 @@ function EditorBubbleMenu({
}}
onMouseDown={(e) => e.preventDefault()}
>
+ <div
+ key={mode}
+ className={
+ modeChanged && !reduceMotion
+ ? "animate-in fade-in duration-[120ms] ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:animate-none"
+ : undefined
+ }
+ >
{mode === "link-edit" ? (
<LinkEditBar editor={editor} onClose={() => { setMode("toolbar"); editor.commands.focus(); }} />
) : (
@@ -713,6 +731,7 @@ function EditorBubbleMenu({
</div>
</TooltipProvider>
)}
+ </div>
</div>
);
}
diff --git a/packages/views/editor/dynamic-block.tsx b/packages/views/editor/dynamic-block.tsx
index 02f95073dd..b6536a3e67 100644
--- a/packages/views/editor/dynamic-block.tsx
+++ b/packages/views/editor/dynamic-block.tsx
@@ -22,12 +22,14 @@
import {
useCallback,
+ useEffect,
useLayoutEffect,
useRef,
useState,
type ReactNode,
type Ref,
} from "react";
+import { prefersReducedMotion } from "@multica/core/appearance";
import {
AppWindow,
ChevronDown,
@@ -457,6 +459,47 @@ function DynamicBlockTitleInput({
* its own layout height when `collapsed`), so expanding only lifts the clip
* — an HTML preview or diagram is not rebuilt.
*/
+function useSmoothExpandStyle(collapsed: boolean, innerRef: React.RefObject<HTMLDivElement | null>) {
+ const prevCollapsedRef = useRef(collapsed);
+ const [animatingHeight, setAnimatingHeight] = useState<number | null>(null);
+
+ useLayoutEffect(() => {
+ const wasCollapsed = prevCollapsedRef.current;
+ prevCollapsedRef.current = collapsed;
+ if (!wasCollapsed || collapsed) return;
+ if (prefersReducedMotion()) return;
+ const el = innerRef.current;
+ const targetHeight = el?.scrollHeight ?? 0;
+ if (targetHeight <= DYNAMIC_BLOCK_COLLAPSE_AT_PX) return;
+ setAnimatingHeight(DYNAMIC_BLOCK_COLLAPSE_AT_PX);
+ const frame = requestAnimationFrame(() => {
+ setAnimatingHeight(targetHeight);
+ });
+ return () => cancelAnimationFrame(frame);
+ }, [collapsed, innerRef]);
+
+ useEffect(() => {
+ if (animatingHeight === null) return;
+ const timer = window.setTimeout(() => setAnimatingHeight(null), 240);
+ return () => window.clearTimeout(timer);
+ }, [animatingHeight]);
+
+ const maxHeight = collapsed
+ ? DYNAMIC_BLOCK_COLLAPSE_AT_PX
+ : animatingHeight !== null
+ ? animatingHeight
+ : undefined;
+
+ return {
+ style: maxHeight !== undefined ? { maxHeight } : undefined,
+ onTransitionEnd: (e: React.TransitionEvent<HTMLDivElement>) => {
+ if (e.target === e.currentTarget && e.propertyName === "max-height" && !collapsed) {
+ setAnimatingHeight(null);
+ }
+ },
+ };
+}
+
function CollapsibleBody({
collapsed,
onExpand,
@@ -470,14 +513,25 @@ function CollapsibleBody({
children: ReactNode;
}) {
const { t } = useT("editor");
+ const innerRef = useRef<HTMLDivElement | null>(null);
+ const setInnerRef = useCallback(
+ (node: HTMLDivElement | null) => {
+ innerRef.current = node;
+ if (typeof measureRef === "function") measureRef(node);
+ else if (measureRef && "current" in measureRef) (measureRef as React.MutableRefObject<HTMLDivElement | null>).current = node;
+ },
+ [measureRef],
+ );
+ const expandProps = useSmoothExpandStyle(collapsed, innerRef);
return (
<div
- className="relative overflow-hidden"
+ className="relative overflow-hidden transition-[max-height] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none"
data-collapsed={collapsed ? "" : undefined}
- style={collapsed ? { maxHeight: DYNAMIC_BLOCK_COLLAPSE_AT_PX } : undefined}
+ style={expandProps.style}
+ onTransitionEnd={expandProps.onTransitionEnd}
>
- <div ref={measureRef}>{children}</div>
+ <div ref={setInnerRef}>{children}</div>
{collapsed && (
<>
<div className="pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-gradient-to-b from-transparent to-surface" />
@@ -527,12 +581,14 @@ function SelfCollapsingBody({ children }: { children: ReactNode }) {
}, [measure]);
const collapsed = !expanded && contentHeight > DYNAMIC_BLOCK_COLLAPSE_AT_PX;
+ const expandProps = useSmoothExpandStyle(collapsed, contentRef);
return (
<div
- className="relative overflow-hidden"
+ className="relative overflow-hidden transition-[max-height] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none"
data-collapsed={collapsed ? "" : undefined}
- style={collapsed ? { maxHeight: DYNAMIC_BLOCK_COLLAPSE_AT_PX } : undefined}
+ style={expandProps.style}
+ onTransitionEnd={expandProps.onTransitionEnd}
>
<div ref={contentRef}>{children}</div>
{collapsed && (
diff --git a/packages/views/editor/extensions/suggestion-popup.tsx b/packages/views/editor/extensions/suggestion-popup.tsx
index 4c46423e5f..3afaf6f8ce 100644
--- a/packages/views/editor/extensions/suggestion-popup.tsx
+++ b/packages/views/editor/extensions/suggestion-popup.tsx
@@ -5,7 +5,9 @@ import { autoUpdate, computePosition, flip, offset, shift, size } from "@floatin
import { ReactRenderer } from "@tiptap/react";
import { exitSuggestion, type SuggestionKeyDownProps, type SuggestionProps } from "@tiptap/suggestion";
import type { PluginKey } from "@tiptap/pm/state";
+import { prefersReducedMotion } from "@multica/core/appearance";
import { contextMenuOrigin } from "@multica/ui/lib/context-menu-origin";
+import { UI_EASE_OUT_CSS, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
interface SuggestionPopupRenderOptions<
TItem,
@@ -46,19 +48,42 @@ export function createSuggestionPopupRender<
let removeAutoUpdate: (() => void) | null = null;
let unsubscribe: (() => void) | undefined;
let currentProps: SuggestionProps<TItem, TSelected> | null = null;
+ let entered = false;
const cleanup = () => {
unsubscribe?.();
unsubscribe = undefined;
currentProps = null;
+ entered = false;
removeOutsideListeners?.();
removeOutsideListeners = null;
removeAutoUpdate?.();
removeAutoUpdate = null;
- renderer?.destroy();
- renderer = null;
- popup?.remove();
+ const exitingPopup = popup;
+ const exitingRenderer = renderer;
popup = null;
+ renderer = null;
+ if (exitingPopup && typeof exitingPopup.animate === "function" && !prefersReducedMotion()) {
+ const side = exitingPopup.dataset.side === "bottom" ? "bottom" : "top";
+ const dy = side === "top" ? 4 : -4;
+ exitingPopup.style.pointerEvents = "none";
+ const anim = exitingPopup.animate(
+ [
+ { opacity: 1, transform: "translateY(0) scale(1)" },
+ { opacity: 0, transform: `translateY(${dy}px) scale(0.97)` },
+ ],
+ { duration: UI_MOTION_DURATION.micro * 1000, easing: "cubic-bezier(0.4, 0, 1, 1)", fill: "forwards" },
+ );
+ const finish = () => {
+ exitingRenderer?.destroy();
+ exitingPopup.remove();
+ };
+ anim.onfinish = finish;
+ anim.oncancel = finish;
+ } else {
+ exitingRenderer?.destroy();
+ exitingPopup?.remove();
+ }
};
const requestExit = (props: SuggestionProps<TItem, TSelected>) => {
@@ -154,7 +179,23 @@ export function createSuggestionPopupRender<
if (popup !== el) return;
el.style.left = `${x}px`;
el.style.top = `${y}px`;
- el.dataset.side = placement.startsWith("top") ? "top" : "bottom";
+ const side = placement.startsWith("top") ? "top" : "bottom";
+ el.dataset.side = side;
+ if (!entered) {
+ entered = true;
+ el.style.opacity = "";
+ el.style.transformOrigin = side === "top" ? "bottom left" : "top left";
+ if (typeof el.animate === "function" && !prefersReducedMotion()) {
+ const dy = side === "top" ? 4 : -4;
+ el.animate(
+ [
+ { opacity: 0, transform: `translateY(${dy}px) scale(0.97)` },
+ { opacity: 1, transform: "translateY(0) scale(1)" },
+ ],
+ { duration: UI_MOTION_DURATION.fast * 1000, easing: UI_EASE_OUT_CSS },
+ );
+ }
+ }
});
};
@@ -188,6 +229,9 @@ export function createSuggestionPopupRender<
popup = doc.createElement("div");
popup.style.position = "fixed";
popup.style.zIndex = "50";
+ if (typeof popup.animate === "function" && !prefersReducedMotion()) {
+ popup.style.opacity = "0";
+ }
const owner = props.editor.view.dom.closest("[data-editor-overlay-owner]")?.getAttribute("data-editor-overlay-owner");
if (owner) popup.setAttribute("data-editor-overlay-owner", owner);
popup.appendChild(renderer.element);
diff --git a/packages/views/editor/file-drop-overlay.tsx b/packages/views/editor/file-drop-overlay.tsx
index a7500604a7..bf6981184a 100644
--- a/packages/views/editor/file-drop-overlay.tsx
+++ b/packages/views/editor/file-drop-overlay.tsx
@@ -1,6 +1,6 @@
function FileDropOverlay() {
return (
- <div className="absolute inset-0 z-10 rounded-[inherit] border border-dashed border-brand/20 bg-brand/[0.02] pointer-events-none" />
+ <div className="pointer-events-none absolute inset-0 z-10 rounded-[inherit] border border-dashed border-brand/20 bg-brand/[0.02] animate-in fade-in duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:animate-none" />
);
}
diff --git a/packages/views/editor/link-hover-card.tsx b/packages/views/editor/link-hover-card.tsx
index fb2f1d43a9..aa82d00309 100644
--- a/packages/views/editor/link-hover-card.tsx
+++ b/packages/views/editor/link-hover-card.tsx
@@ -11,11 +11,14 @@
import { useState, useEffect, useCallback, useRef } from "react";
import { createPortal } from "react-dom";
+import { AnimatePresence, motion } from "motion/react";
import { computePosition, offset, flip, shift } from "@floating-ui/dom";
+import { useReducedMotion } from "@multica/core/appearance";
import { ExternalLink, Copy } from "@multica/ui/icons";
import { toast } from "sonner";
import { IconButton } from "@multica/ui/components/common/icon-button";
import { copyText } from "@multica/ui/lib/clipboard";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { useWorkspaceSlug } from "@multica/core/paths";
import { useAppOrigin } from "../navigation";
import { useT } from "../i18n";
@@ -143,6 +146,7 @@ function LinkHoverCard({
}) {
const [pos, setPos] = useState({ top: 0, left: 0 });
const [positioned, setPositioned] = useState(false);
+ const reduceMotion = useReducedMotion();
const slug = useWorkspaceSlug();
const appOrigin = useAppOrigin();
const { t } = useT("editor");
@@ -199,50 +203,75 @@ function LinkHoverCard({
return (
<>
{attachmentLink.modal}
- {visible && anchorEl
- ? createPortal(
- <div
- ref={setCardRef}
- className="link-hover-card"
- data-editor-overlay-owner={overlayOwner}
- style={{
- position: "fixed",
- top: pos.top,
- left: pos.left,
- zIndex: 50,
- display: positioned ? undefined : "none",
- }}
- onMouseEnter={onCardEnter}
- onMouseLeave={onCardLeave}
- >
- <span
- className="min-w-0 flex-1 truncate text-caption text-muted-foreground px-1"
- title={href}
+ {typeof document !== "undefined" &&
+ createPortal(
+ <AnimatePresence>
+ {visible && anchorEl && (
+ <motion.div
+ key="link-hover-card"
+ ref={setCardRef}
+ className="link-hover-card"
+ data-editor-overlay-owner={overlayOwner}
+ initial={reduceMotion ? false : { opacity: 0, y: 4, scale: 0.97 }}
+ animate={
+ positioned
+ ? {
+ opacity: 1,
+ y: 0,
+ scale: 1,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }
+ : { opacity: 0 }
+ }
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ y: 3,
+ scale: 0.97,
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ style={{
+ position: "fixed",
+ top: pos.top,
+ left: pos.left,
+ zIndex: 50,
+ visibility: positioned ? "visible" : "hidden",
+ }}
+ onMouseEnter={onCardEnter}
+ onMouseLeave={onCardLeave}
>
- {truncateUrl(href)}
- </span>
- <IconButton
- size="icon-xs"
- variant="ghost"
- className="text-muted-foreground"
- onClick={handleCopy}
- label={t(($) => $.link_hover.copy_link)}
- >
- <Copy className="size-3.5" />
- </IconButton>
- <IconButton
- size="icon-xs"
- variant="ghost"
- className="text-muted-foreground"
- onClick={handleOpen}
- label={t(($) => $.link_hover.open_link)}
- >
- <ExternalLink className="size-3.5" />
- </IconButton>
- </div>,
- document.body,
- )
- : null}
+ <span
+ className="min-w-0 flex-1 truncate text-caption text-muted-foreground px-1"
+ title={href}
+ >
+ {truncateUrl(href)}
+ </span>
+ <IconButton
+ size="icon-xs"
+ variant="ghost"
+ className="text-muted-foreground"
+ onClick={handleCopy}
+ label={t(($) => $.link_hover.copy_link)}
+ >
+ <Copy className="size-3.5" />
+ </IconButton>
+ <IconButton
+ size="icon-xs"
+ variant="ghost"
+ className="text-muted-foreground"
+ onClick={handleOpen}
+ label={t(($) => $.link_hover.open_link)}
+ >
+ <ExternalLink className="size-3.5" />
+ </IconButton>
+ </motion.div>
+ )}
+ </AnimatePresence>,
+ document.body,
+ )}
</>
);
}
diff --git a/packages/views/editor/styles/shell.css b/packages/views/editor/styles/shell.css
index 23de28897f..9cc7ea7be8 100644
--- a/packages/views/editor/styles/shell.css
+++ b/packages/views/editor/styles/shell.css
@@ -51,6 +51,37 @@
}
/* Bubble menu — floating toolbar pill */
+[data-mc="editor-toolbar"] {
+ transform-origin: bottom center;
+ transition:
+ opacity 130ms cubic-bezier(0.23, 1, 0.32, 1),
+ transform 130ms cubic-bezier(0.23, 1, 0.32, 1),
+ visibility 0ms linear;
+}
+
+[data-mc="editor-toolbar"][data-state="closed"] {
+ opacity: 0;
+ transform: translateY(4px) scale(0.97);
+ pointer-events: none;
+ transition:
+ opacity 90ms cubic-bezier(0.4, 0, 1, 1),
+ transform 90ms cubic-bezier(0.4, 0, 1, 1),
+ visibility 0ms linear 90ms;
+}
+
+[data-mc="editor-toolbar"][data-state="open"] {
+ opacity: 1;
+ transform: translateY(0) scale(1);
+}
+
+@media (prefers-reduced-motion: reduce) {
+ [data-mc="editor-toolbar"],
+ [data-mc="editor-toolbar"][data-state="closed"] {
+ transition: none;
+ transform: none;
+ }
+}
+
.bubble-menu {
display: flex;
align-items: center;
diff --git a/packages/views/inbox/components/inbox-bar.tsx b/packages/views/inbox/components/inbox-bar.tsx
index db45817886..ac57e9e15f 100644
--- a/packages/views/inbox/components/inbox-bar.tsx
+++ b/packages/views/inbox/components/inbox-bar.tsx
@@ -1,10 +1,13 @@
"use client";
import type { ComponentProps, ReactNode } from "react";
+import { motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
import { Archive, ArchiveRestore } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
+import { UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import type { ShortcutActionId } from "@multica/core/shortcuts";
import type { InboxItem } from "@multica/core/types";
@@ -26,17 +29,26 @@ import { useTimeAgo } from "./inbox-list-item";
* first, then the notification's actions, the time, and the issue's values.
*/
export function InboxBar({ settled = false, children }: { settled?: boolean; children: ReactNode }) {
+ const reduceMotion = useReducedMotion();
return (
<div
role={settled ? "status" : undefined}
data-inbox-bar={settled ? "settled" : "open"}
className={cn(
- "@container/inbox-bar relative flex h-10 shrink-0 items-center gap-1 border-b",
+ "@container/inbox-bar relative flex h-10 shrink-0 items-center border-b transition-colors duration-150 motion-reduce:transition-none",
settled && "bg-muted/40",
PAGE_GUTTER,
)}
>
- {children}
+ <motion.div
+ key={settled ? "settled" : "open"}
+ initial={reduceMotion ? false : { opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT }}
+ className="flex min-w-0 flex-1 items-center gap-1"
+ >
+ {children}
+ </motion.div>
</div>
);
}
diff --git a/packages/views/inbox/components/inbox-empty-state.tsx b/packages/views/inbox/components/inbox-empty-state.tsx
index 995b7e0b58..053cb23a7d 100644
--- a/packages/views/inbox/components/inbox-empty-state.tsx
+++ b/packages/views/inbox/components/inbox-empty-state.tsx
@@ -3,6 +3,8 @@
import { useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
+import { useReducedMotion } from "@multica/core/appearance";
+import { cn } from "@multica/ui/lib/utils";
import {
AlarmClock,
Archive,
@@ -158,6 +160,7 @@ export function InboxEmptyState({
const showsUndo = isLive && visibleCount === 0 && !!lastCleared && canUndoCleared(lastCleared);
useInboxUndoShortcut(showsUndo && lastCleared ? () => void handleUndoCleared(lastCleared) : null);
const undoKeycaps = !isCompact && <ActionShortcutKeycaps action="undoInboxAction" />;
+ const reduceMotion = useReducedMotion();
// Desktop prompt when active notifications exist in the Work panel.
if (visibleCount > 0) {
@@ -235,7 +238,13 @@ export function InboxEmptyState({
enterDelay={rises ? 0.2 : undefined}
className="pointer-events-none absolute -right-[14%] -bottom-[26%] w-[min(560px,58%)] text-muted"
/>
- <div className="relative z-10 -mt-8 flex max-w-md flex-col items-center">
+ <div
+ key={`card-${bleedKey}`}
+ className={cn(
+ "relative z-10 -mt-8 flex max-w-md flex-col items-center",
+ reduceMotion ? "animate-inbox-enter-fade" : rises ? "animate-inbox-enter-next" : "animate-inbox-enter-fade",
+ )}
+ >
<div
aria-hidden
className="mb-4 flex size-11 items-center justify-center rounded-xl border border-surface-border bg-surface text-success shadow-[var(--surface-shadow)]"
diff --git a/packages/views/inbox/components/inbox-filter-options.tsx b/packages/views/inbox/components/inbox-filter-options.tsx
index 77637a9e31..0fe2130a4a 100644
--- a/packages/views/inbox/components/inbox-filter-options.tsx
+++ b/packages/views/inbox/components/inbox-filter-options.tsx
@@ -1,6 +1,9 @@
"use client";
+import { AnimatePresence, motion } from "motion/react";
import { useQuery } from "@tanstack/react-query";
+import { useReducedMotion } from "@multica/core/appearance";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import {
Activity,
AtSign,
@@ -187,27 +190,55 @@ export function useInboxFilterChips(wsId: string, filters: InboxFilters): Filter
*/
export function InboxFilterChipsBar({ wsId, filters }: { wsId: string; filters: InboxFilters }) {
const { t } = useT("inbox");
+ const reduceMotion = useReducedMotion();
const chips = useInboxFilterChips(wsId, filters);
const clearFilters = useInboxFilterStore((state) => state.clearFilters);
- if (chips.length === 0) return null;
return (
- <div
- data-testid="inbox-filter-chips"
- className="mx-3 mb-2 flex shrink-0 flex-wrap items-center gap-1.5 rounded-lg bg-muted/50 px-1.5 py-1.5"
- >
- {chips.map((chip) => (
- <ChipSpan key={chip.key} chip={chip} compact />
- ))}
- <Button
- variant="ghost"
- size="icon-xs"
- aria-label={t(($) => $.filters.clear)}
- title={t(($) => $.filters.clear)}
- className="ml-auto text-muted-foreground"
- onClick={() => clearFilters(wsId)}
- >
- <X className="size-3" />
- </Button>
- </div>
+ <AnimatePresence initial={false}>
+ {chips.length > 0 && (
+ <motion.div
+ key="inbox-filter-chips"
+ initial={reduceMotion ? false : { opacity: 0, height: 0, marginBottom: 0, overflow: "hidden" }}
+ animate={{
+ opacity: 1,
+ height: "auto",
+ marginBottom: 8,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ transitionEnd: { overflow: "visible" },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ height: 0,
+ marginBottom: 0,
+ overflow: "hidden",
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className="mx-3 shrink-0"
+ >
+ <div
+ data-testid="inbox-filter-chips"
+ className="flex flex-wrap items-center gap-1.5 rounded-lg bg-muted/50 px-1.5 py-1.5"
+ >
+ {chips.map((chip) => (
+ <ChipSpan key={chip.key} chip={chip} compact />
+ ))}
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ aria-label={t(($) => $.filters.clear)}
+ title={t(($) => $.filters.clear)}
+ className="ml-auto text-muted-foreground"
+ onClick={() => clearFilters(wsId)}
+ >
+ <X className="size-3" />
+ </Button>
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
);
}
diff --git a/packages/views/inbox/components/inbox-list-item.test.tsx b/packages/views/inbox/components/inbox-list-item.test.tsx
index bb621e9c6f..04d60237ca 100644
--- a/packages/views/inbox/components/inbox-list-item.test.tsx
+++ b/packages/views/inbox/components/inbox-list-item.test.tsx
@@ -235,7 +235,7 @@ describe("InboxListItem keyboard semantics", () => {
const actionButton = container.querySelector("button")!;
expect(actionButton.className).toContain(
- "[@media(hover:hover)]:group-hover:inline-flex",
+ "[@media(hover:hover)]:group-hover:opacity-100",
);
expect(actionButton.className).not.toMatch(/(^|\s)(sm|md|lg|xl|2xl):group-/);
});
diff --git a/packages/views/inbox/components/inbox-list-item.tsx b/packages/views/inbox/components/inbox-list-item.tsx
index 28105de38d..0f2bdf503a 100644
--- a/packages/views/inbox/components/inbox-list-item.tsx
+++ b/packages/views/inbox/components/inbox-list-item.tsx
@@ -1,6 +1,9 @@
"use client";
+import { AnimatePresence, motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
+import { UI_EASE_OUT } from "@multica/ui/lib/motion";
import { StatusIcon } from "../../issues/components/status-icon";
import {
IssueAgentActivityIndicator,
@@ -57,6 +60,7 @@ export function InboxListItem({
onAction: () => void;
}) {
const { t } = useT("inbox");
+ const reduceMotion = useReducedMotion();
const timeAgo = useTimeAgo();
const typeLabels = useTypeLabels();
// Inbox is a cross-workspace surface, so the catalog is read against the
@@ -145,11 +149,25 @@ export function InboxListItem({
<div className="min-w-0 flex-1">
<div className="flex items-center justify-between gap-2">
<div className="flex min-w-0 items-center gap-1.5">
- {showUnread && (
- <span data-mc="unread-dot" className="h-1.5 w-1.5 shrink-0 rounded-full bg-brand" />
- )}
+ <AnimatePresence initial={false}>
+ {showUnread && (
+ <motion.span
+ key="unread-dot"
+ data-mc="unread-dot"
+ initial={false}
+ animate={{ opacity: 1, scale: 1, width: 6 }}
+ exit={{
+ opacity: 0,
+ scale: 0,
+ width: 0,
+ transition: { duration: reduceMotion ? 0 : 0.12, ease: UI_EASE_OUT },
+ }}
+ className="h-1.5 shrink-0 rounded-full bg-brand"
+ />
+ )}
+ </AnimatePresence>
<span
- className={`truncate text-body ${showUnread ? "font-medium" : "text-muted-foreground"}`}
+ className={`truncate text-body transition-colors ${showUnread ? "font-medium" : "text-muted-foreground"}`}
>
{displayTitle}
</span>
@@ -169,7 +187,7 @@ export function InboxListItem({
e.stopPropagation();
onAction();
}}
- className="hidden rounded-xs p-0.5 text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring [@media(hover:hover)]:group-hover:inline-flex [@media(hover:hover)]:group-focus-within:inline-flex"
+ className="hidden rounded-xs p-0.5 text-muted-foreground outline-none transition-opacity duration-100 hover:bg-accent hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring motion-reduce:transition-none [@media(hover:hover)]:pointer-events-none [@media(hover:hover)]:inline-flex [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover:pointer-events-auto [@media(hover:hover)]:group-hover:opacity-100 [@media(hover:hover)]:group-focus-within:pointer-events-auto [@media(hover:hover)]:group-focus-within:opacity-100"
>
<ActionIcon className="h-3.5 w-3.5" />
</button>
diff --git a/packages/views/inbox/components/inbox-page.tsx b/packages/views/inbox/components/inbox-page.tsx
index 39ce8ebc1a..f9b2013312 100644
--- a/packages/views/inbox/components/inbox-page.tsx
+++ b/packages/views/inbox/components/inbox-page.tsx
@@ -1101,7 +1101,7 @@ export function InboxPage() {
) : detailItem ? (
<>
{keptNotice}
- <div className="p-6">
+ <div key={detailItem.id} className="animate-inbox-enter-fade p-6">
<h2 className="text-title font-semibold">
{isAutopilotQuotaNotice(detailItem.type)
? typeLabels[detailItem.type]
diff --git a/packages/views/issue-views/view-header.tsx b/packages/views/issue-views/view-header.tsx
index 324f452551..1b22a6cb50 100644
--- a/packages/views/issue-views/view-header.tsx
+++ b/packages/views/issue-views/view-header.tsx
@@ -1,6 +1,9 @@
"use client";
import { useEffect, useMemo, useState, type ReactNode } from "react";
+import { AnimatePresence, motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { useStore } from "zustand";
import { toast } from "sonner";
import {
@@ -147,6 +150,7 @@ export function IssueViewHeader({
trailing?: ReactNode;
}) {
const { t } = useT("issues");
+ const reduceMotion = useReducedMotion();
const wsId = useWorkspaceId();
// A guest (MUL-9420) cannot create issues.
const guest = useIsGuest(wsId);
@@ -542,25 +546,47 @@ export function IssueViewHeader({
{...filterMenuProps}
/>
- {dirty && !needsSetup && (
- <span className="flex shrink-0 items-center gap-1">
- <Button variant="ghost" size="sm" className="h-7 px-2 text-muted-foreground" onClick={reset}>
- {t(($) => $.views.reset)}
- </Button>
- {activeView && canManage ? (
- <SaveSplitButton
- viewName={activeView.name}
- shared={activeView.visibility === "workspace"}
- onSave={saveActive}
- onSaveAsNew={saveAsNew}
- />
- ) : (
- <Button size="sm" className="h-7 px-2.5" onClick={saveAsNew}>
- {activeView ? t(($) => $.views.save_as_new) : t(($) => $.views.save_as_view)}
+ <AnimatePresence initial={false}>
+ {dirty && !needsSetup && (
+ <motion.span
+ key="dirty-actions"
+ initial={reduceMotion ? false : { opacity: 0, x: -4, scale: 0.97 }}
+ animate={{
+ opacity: 1,
+ x: 0,
+ scale: 1,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ x: -4,
+ scale: 0.97,
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className="flex shrink-0 items-center gap-1"
+ >
+ <Button variant="ghost" size="sm" className="h-7 px-2 text-muted-foreground" onClick={reset}>
+ {t(($) => $.views.reset)}
</Button>
- )}
- </span>
- )}
+ {activeView && canManage ? (
+ <SaveSplitButton
+ viewName={activeView.name}
+ shared={activeView.visibility === "workspace"}
+ onSave={saveActive}
+ onSaveAsNew={saveAsNew}
+ />
+ ) : (
+ <Button size="sm" className="h-7 px-2.5" onClick={saveAsNew}>
+ {activeView ? t(($) => $.views.save_as_new) : t(($) => $.views.save_as_view)}
+ </Button>
+ )}
+ </motion.span>
+ )}
+ </AnimatePresence>
</div>
<div className="flex shrink-0 items-center gap-1">
@@ -606,29 +632,53 @@ export function IssueViewHeader({
onConfirm={actions.remove}
/>
</PageHeader>
- {needsSetup && (
- <ViewSetupBar
- filterMenu={
- <IssueFilterMenu
- {...filterMenuProps}
- summaryTitle={undefined}
- align="start"
- open={setupFilterOpen}
- onOpenChange={setSetupFilterOpen}
- trigger={
- <Button variant="outline" size="xs" className="bg-background">
- <Plus />
- {t(($) => $.views.add_filter)}
- </Button>
+ <AnimatePresence initial={false}>
+ {needsSetup && (
+ <motion.div
+ key="view-setup-bar"
+ initial={reduceMotion ? false : { opacity: 0, height: 0, overflow: "hidden" }}
+ animate={{
+ opacity: 1,
+ height: "auto",
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ transitionEnd: { overflow: "visible" },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ height: 0,
+ overflow: "hidden",
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className="shrink-0"
+ >
+ <ViewSetupBar
+ filterMenu={
+ <IssueFilterMenu
+ {...filterMenuProps}
+ summaryTitle={undefined}
+ align="start"
+ open={setupFilterOpen}
+ onOpenChange={setSetupFilterOpen}
+ trigger={
+ <Button variant="outline" size="xs" className="bg-background">
+ <Plus />
+ {t(($) => $.views.add_filter)}
+ </Button>
+ }
+ />
}
+ chips={filterChips}
+ dirty={dirty}
+ onClear={reset}
+ onSave={saveActive}
/>
- }
- chips={filterChips}
- dirty={dirty}
- onClear={reset}
- onSave={saveActive}
- />
- )}
+ </motion.div>
+ )}
+ </AnimatePresence>
</>
);
}
diff --git a/packages/views/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsx
index b951fca4c0..a0ee1fb1bc 100644
--- a/packages/views/issues/components/comment-card.tsx
+++ b/packages/views/issues/components/comment-card.tsx
@@ -1,6 +1,8 @@
"use client";
-import { Fragment, memo, useCallback, useEffect, useRef, useState, type ReactNode } from "react";
+import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from "react";
+import { UI_MOTION_DURATION } from "@multica/ui/lib/motion";
+import { revealElement } from "./use-run-comment-motion";
import { CheckCircle2, ChevronRight, CornerUpLeft, ListChevronsDownUp, Copy, Link2, Loader2, MessageSquare, MessageSquarePlus, MoreHorizontal, Pencil, Plus, RotateCcw, SmilePlus, Trash2 } from "@multica/ui/icons";
import { toast } from "sonner";
import { Card } from "@multica/ui/components/ui/card";
@@ -1208,10 +1210,23 @@ function CommentCardImpl({
const isCollapsed = useCommentCollapseStore((s) => s.isCollapsed(issueId, entry.id));
const toggleCollapse = useCommentCollapseStore((s) => s.toggle);
const open = !isCollapsed;
- const handleToggle = useCallback(
- () => toggleCollapse(issueId, entry.id),
- [toggleCollapse, issueId, entry.id],
- );
+ // One-shot WAAPI reveal on explicit user toggles only — Virtuoso scroll
+ // remounts stay completely still.
+ const bodyRevealRef = useRef<HTMLDivElement>(null);
+ const cardElRef = useRef<HTMLDivElement | null>(null);
+ const userToggledOpenRef = useRef(false);
+ const userExpandedRepliesRef = useRef(false);
+ const handleToggle = useCallback(() => {
+ userToggledOpenRef.current = true;
+ toggleCollapse(issueId, entry.id);
+ }, [toggleCollapse, issueId, entry.id]);
+ useLayoutEffect(() => {
+ if (!userToggledOpenRef.current) return;
+ userToggledOpenRef.current = false;
+ if (!open) return;
+ const anim = revealElement(bodyRevealRef.current, UI_MOTION_DURATION.fast * 1000, -3);
+ return () => { anim?.cancel(); };
+ }, [open]);
const edit = useEditAttachmentState(issueId, entry, onEdit);
@@ -1261,6 +1276,7 @@ function CommentCardImpl({
} : null);
const annotationCardRef = annotation.cardRef;
const cardRef = useCallback((node: HTMLDivElement | null) => {
+ cardElRef.current = node;
annotationCardRef(node);
threadScopeRef(node);
}, [annotationCardRef, threadScopeRef]);
@@ -1345,6 +1361,19 @@ function CommentCardImpl({
const replyResolutionId = resolution.kind === "reply" ? resolution.resolutionId : null;
const threadExpanded = !!expandedResolvedIds?.has(entry.id);
const replyFolded = replyResolutionId != null && !threadExpanded;
+ useLayoutEffect(() => {
+ if (!userExpandedRepliesRef.current) return;
+ userExpandedRepliesRef.current = false;
+ if (replyFolded) return;
+ const replies = cardElRef.current?.querySelectorAll<HTMLElement>('[data-mc="comment-reply"]');
+ if (!replies || replies.length === 0) return;
+ const anims: Animation[] = [];
+ for (const el of replies) {
+ const anim = revealElement(el, UI_MOTION_DURATION.fast * 1000, -3);
+ if (anim) anims.push(anim);
+ }
+ return () => { for (const anim of anims) anim.cancel(); };
+ }, [replyFolded]);
const foldedReplies = replyResolutionId
? visibleReplies.filter((r) => r.id !== replyResolutionId)
: visibleReplies;
@@ -1556,7 +1585,7 @@ function CommentCardImpl({
`[id^="comment-"]` ancestor to a comment id, so a reading anchor
taken inside the body would name a comment that does not exist. */}
{open && !deleted && (
- <div id={`root-comment-body-${entry.id}`} className="px-4 max-md:px-3 pb-3">
+ <div ref={bodyRevealRef} id={`root-comment-body-${entry.id}`} className="px-4 max-md:px-3 pb-3">
{edit.editing ? (
<div
{...edit.dropZoneProps}
@@ -1686,7 +1715,10 @@ function CommentCardImpl({
<div className="border-t border-border/50 px-4 max-md:px-3 py-2.5">
<CommentsFoldBar
replies={foldedReplies}
- onExpand={() => onResolvedExpandChange?.(entry.id, true)}
+ onExpand={() => {
+ userExpandedRepliesRef.current = true;
+ onResolvedExpandChange?.(entry.id, true);
+ }}
/>
</div>
)}
diff --git a/packages/views/issues/components/comment-selection-bubble.tsx b/packages/views/issues/components/comment-selection-bubble.tsx
index 57e2aa5f24..a2644c30f1 100644
--- a/packages/views/issues/components/comment-selection-bubble.tsx
+++ b/packages/views/issues/components/comment-selection-bubble.tsx
@@ -2,7 +2,10 @@
import { useEffect, useRef, type ReactNode } from "react";
import { createPortal } from "react-dom";
+import { usePresence } from "motion/react";
import { autoUpdate, computePosition, flip, hide, offset, shift } from "@floating-ui/dom";
+import { prefersReducedMotion } from "@multica/core/appearance";
+import { UI_EASE_OUT_CSS, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
/** Match the description's EditorBubbleMenu geometry for readonly selections. */
export function CommentSelectionBubble({ range, source, children, owner, markerRanges, markerZIndex = 20, onPositioned, keepVisibleWhenDetached = false }: {
@@ -18,9 +21,12 @@ export function CommentSelectionBubble({ range, source, children, owner, markerR
}) {
const ref = useRef<HTMLDivElement>(null);
const marker = !!markerRanges;
+ const [isPresent, safeToRemove] = usePresence();
+ const wasVisibleRef = useRef(false);
+
useEffect(() => {
const element = ref.current;
- if (!element) return;
+ if (!element || !isPresent) return;
let active = true;
const anchor = {
contextElement: source,
@@ -56,22 +62,61 @@ export function CommentSelectionBubble({ range, source, children, owner, markerR
}).then(({ x, y, middlewareData }) => {
if (!active || currentRevision !== revision || !element.isConnected) return;
const rect = range.getBoundingClientRect();
- element.style.visibility = !source.isConnected || !range.startContainer.isConnected ||
- (rect.width === 0 && rect.height === 0) || middlewareData.hide?.referenceHidden ? "hidden" : "visible";
+ const isVisible = !(!source.isConnected || !range.startContainer.isConnected ||
+ (rect.width === 0 && rect.height === 0) || middlewareData.hide?.referenceHidden);
+ const becameVisible = isVisible && !wasVisibleRef.current;
+ wasVisibleRef.current = isVisible;
+ element.style.visibility = isVisible ? "visible" : "hidden";
element.style.left = `${x}px`;
element.style.top = `${y}px`;
- if (element.style.visibility === "visible") onPositioned?.();
+ if (becameVisible && typeof element.animate === "function" && !prefersReducedMotion()) {
+ const fromTransform = marker ? "translateX(-4px) scale(0.96)" : "translateY(4px) scale(0.96)";
+ element.animate(
+ [
+ { opacity: 0, transform: fromTransform },
+ { opacity: 1, transform: "translate(0, 0) scale(1)" },
+ ],
+ { duration: UI_MOTION_DURATION.fast * 1000, easing: UI_EASE_OUT_CSS },
+ );
+ }
+ if (isVisible) onPositioned?.();
});
};
// Sidebar transitions and font/content reflow can move a Range without
// resizing its source element or triggering a window resize.
const cleanup = autoUpdate(anchor, element, update, { animationFrame: true });
return () => { active = false; cleanup(); };
- }, [range, source, marker, markerRanges, onPositioned, keepVisibleWhenDetached]);
+ }, [range, source, marker, markerRanges, onPositioned, keepVisibleWhenDetached, isPresent]);
+
+ useEffect(() => {
+ if (isPresent) return;
+ const element = ref.current;
+ if (element && wasVisibleRef.current && typeof element.animate === "function" && !prefersReducedMotion()) {
+ const toTransform = marker ? "translateX(-4px) scale(0.96)" : "translateY(4px) scale(0.96)";
+ const anim = element.animate(
+ [
+ { opacity: 1, transform: "translate(0, 0) scale(1)" },
+ { opacity: 0, transform: toTransform },
+ ],
+ { duration: UI_MOTION_DURATION.micro * 1000, easing: "cubic-bezier(0.4, 0, 1, 1)", fill: "forwards" },
+ );
+ let done = false;
+ const finish = () => {
+ if (done) return;
+ done = true;
+ safeToRemove();
+ };
+ anim.onfinish = finish;
+ anim.oncancel = finish;
+ return () => { anim.cancel(); };
+ }
+ safeToRemove();
+ return undefined;
+ }, [isPresent, marker, safeToRemove]);
return createPortal(
<div ref={ref} data-reply-annotation-overlay={owner} data-editor-overlay-owner={owner}
- style={{ position: "fixed", zIndex: marker ? markerZIndex : 50, visibility: "hidden", width: "max-content" }}>
+ style={{ position: "fixed", zIndex: marker ? markerZIndex : 50, visibility: "hidden", width: "max-content", pointerEvents: isPresent ? undefined : "none" }}>
{children}
</div>,
document.body,
diff --git a/packages/views/issues/components/deliverables/deliverables-section.tsx b/packages/views/issues/components/deliverables/deliverables-section.tsx
index 5f5ae41781..e42d1d64ee 100644
--- a/packages/views/issues/components/deliverables/deliverables-section.tsx
+++ b/packages/views/issues/components/deliverables/deliverables-section.tsx
@@ -1,6 +1,6 @@
"use client";
-import { IssueSidebarSectionHeader } from "../issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "../issue-sidebar-section";
import { useMemo, useState } from "react";
import { LayoutGrid, Link2 } from "@multica/ui/icons";
@@ -59,7 +59,7 @@ export function DeliverablesSection({
<IssueSidebarSectionHeader title={t(($) => $.deliverables.section_title)} open={open} onOpenChange={setOpen} count={files.length} actions={
<IconButton size="icon-xs" label={t(($) => $.deliverables.view_all, { count: files.length })} onClick={onOpenOverview}><LayoutGrid /></IconButton>
} />
- {open && (
+ <IssueSidebarCollapsible open={open}>
<div className="px-2">
{images.length > 0 && (
<div className="mx-2 mb-1.5 grid grid-cols-3 gap-1.5">
@@ -91,7 +91,7 @@ export function DeliverablesSection({
))}
</div>
- )}
+ </IssueSidebarCollapsible>
{modal}
</div>
);
diff --git a/packages/views/issues/components/execution-log-section.tsx b/packages/views/issues/components/execution-log-section.tsx
index 09e0663429..f8e1d2a704 100644
--- a/packages/views/issues/components/execution-log-section.tsx
+++ b/packages/views/issues/components/execution-log-section.tsx
@@ -24,7 +24,7 @@ import { AgentAvatarStack } from "../../agents/components/agent-avatar-stack";
import { formatDuration } from "../../agents/components/agent-activity-hover-content";
import { TranscriptButton } from "../../common/task-transcript";
import { cancellationActorLabel, cancelReasonLabel, failureReasonLabel } from "../../agents/components/tabs/task-failure";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
import { useT } from "../../i18n";
import { compareActiveIssueTasks } from "./active-task-order";
import { formatDuration as formatAgentTime } from "../../dashboard/utils";
@@ -177,7 +177,7 @@ export function ExecutionLogSection({
</span>
) : undefined}
/>
- {open && (
+ <IssueSidebarCollapsible open={open}>
<div className="space-y-2 px-2">
{(timeline.pricedCount > 0 || timeline.agentMs > 0) && (
<div className="space-y-0.5 pt-2">
@@ -226,7 +226,7 @@ export function ExecutionLogSection({
</div>
)}
</div>
- )}
+ </IssueSidebarCollapsible>
<IssueRunsDialog
open={runsOpen}
onOpenChange={setRunsOpen}
diff --git a/packages/views/issues/components/filter-chips-bar.tsx b/packages/views/issues/components/filter-chips-bar.tsx
index 150f12c051..c58de6c23e 100644
--- a/packages/views/issues/components/filter-chips-bar.tsx
+++ b/packages/views/issues/components/filter-chips-bar.tsx
@@ -1,8 +1,11 @@
"use client";
+import { AnimatePresence, motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import { useStatusLabel } from "../utils/status-label";
import { useMemo, type ReactNode } from "react";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import {
Bot,
CalendarClock,
@@ -777,35 +780,62 @@ export function FilterChipsBar({
viewBaseline?: IssueViewBaseline;
}) {
const { t } = useT("issues");
+ const reduceMotion = useReducedMotion();
const { chips, hasAny, clearAll } = useFilterChips(dateFilter, onDateFilterChange, viewBaseline);
- if (!hasAny) return null;
-
return (
- <div className="mx-4 mb-2 flex shrink-0 flex-wrap items-center gap-1.5 rounded-lg bg-muted/50 px-2 py-1.5">
- {chips.map((chip) => (
- <ChipSpan key={chip.key} chip={chip} />
- ))}
- <span className="ml-auto flex items-center gap-1.5">
- <Button
- variant="ghost"
- size="sm"
- onClick={clearAll}
- className="h-6 px-2 text-caption text-muted-foreground"
+ <AnimatePresence initial={false}>
+ {hasAny && (
+ <motion.div
+ key="filter-chips-bar"
+ initial={reduceMotion ? false : { opacity: 0, height: 0, marginBottom: 0, overflow: "hidden" }}
+ animate={{
+ opacity: 1,
+ height: "auto",
+ marginBottom: 8,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ transitionEnd: { overflow: "visible" },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ height: 0,
+ marginBottom: 0,
+ overflow: "hidden",
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className="mx-4 shrink-0"
>
- {t(($) => $.filters.chip_clear)}
- </Button>
- {onSave && (
- <Button
- variant="outline"
- size="sm"
- onClick={onSave}
- className="h-6 px-2 text-caption"
- >
- {saveLabel ?? t(($) => $.filters.chip_save)}
- </Button>
- )}
- </span>
- </div>
+ <div className="flex flex-wrap items-center gap-1.5 rounded-lg bg-muted/50 px-2 py-1.5">
+ {chips.map((chip) => (
+ <ChipSpan key={chip.key} chip={chip} />
+ ))}
+ <span className="ml-auto flex items-center gap-1.5">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={clearAll}
+ className="h-6 px-2 text-caption text-muted-foreground"
+ >
+ {t(($) => $.filters.chip_clear)}
+ </Button>
+ {onSave && (
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={onSave}
+ className="h-6 px-2 text-caption"
+ >
+ {saveLabel ?? t(($) => $.filters.chip_save)}
+ </Button>
+ )}
+ </span>
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
);
}
diff --git a/packages/views/issues/components/find-bar.tsx b/packages/views/issues/components/find-bar.tsx
index ce859c5ab9..21a2e35ecd 100644
--- a/packages/views/issues/components/find-bar.tsx
+++ b/packages/views/issues/components/find-bar.tsx
@@ -1,10 +1,13 @@
"use client";
import type { KeyboardEvent } from "react";
+import { motion } from "motion/react";
+import { useReducedMotion } from "@multica/core/appearance";
import { isImeComposing } from "@multica/core/utils";
import { ChevronDown, ChevronUp, Search, X } from "@multica/ui/icons";
import { Input } from "@multica/ui/components/ui/input";
import { IconButton } from "@multica/ui/components/common/icon-button";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../../i18n";
import type { UseInPageFindResult } from "../hooks/use-in-page-find";
@@ -22,6 +25,7 @@ export function FindBar({
className?: string;
}) {
const { t } = useT("issues");
+ const reduceMotion = useReducedMotion();
const {
query,
matchCount,
@@ -57,9 +61,26 @@ export function FindBar({
};
return (
- <div
+ <motion.div
data-find-ignore
role="search"
+ initial={reduceMotion ? false : { opacity: 0, y: -6, scale: 0.98 }}
+ animate={{
+ opacity: 1,
+ y: 0,
+ scale: 1,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ y: -4,
+ scale: 0.98,
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
className={cn(
"flex items-center gap-1 rounded-lg border bg-popover/95 p-1 pl-2 shadow-md backdrop-blur supports-[backdrop-filter]:bg-popover/80",
className,
@@ -113,6 +134,6 @@ export function FindBar({
<X />
</IconButton>
</div>
- </div>
+ </motion.div>
);
}
diff --git a/packages/views/issues/components/inline-comment-run.tsx b/packages/views/issues/components/inline-comment-run.tsx
index 521063d479..2e0089747c 100644
--- a/packages/views/issues/components/inline-comment-run.tsx
+++ b/packages/views/issues/components/inline-comment-run.tsx
@@ -241,7 +241,7 @@ export function InlineCommentRun({ run, className, viewState, showIdentity = fal
{rawError}
</p>
</TruncatedTooltip>}
- {expanded && <div id={regionId} className="mt-2 min-w-0 space-y-1">
+ {expanded && <div ref={state.disclosure.contentRef} id={regionId} className="mt-2 min-w-0 space-y-1">
{isPending && <p className="text-caption text-muted-foreground">{t(($) => $.inline_run.loading)}</p>}
{isError && <div role="alert" className="text-caption text-destructive">{t(($) => $.inline_run.load_failed)}
<button className="ml-2 underline" type="button" onClick={() => void refetch()}>{t(($) => $.inline_run.try_again)}</button></div>}
@@ -361,7 +361,7 @@ function InlineStep({ row, live, formatText }: { row: TraceRow; live: boolean; f
<ChevronRight ref={disclosure.chevronRef} aria-hidden className={cn("size-3 shrink-0 text-muted-foreground", open && "rotate-90")} />
</summary>
</TruncatedTooltip>
- {open && <div className="min-w-0 space-y-2 overflow-hidden pl-5.5">
+ {open && <div ref={disclosure.contentRef} className="min-w-0 space-y-2 overflow-hidden pl-5.5">
{grouped ? <>
{row.steps.length > limit && <button type="button" className="py-1 text-muted-foreground" onClick={() => setLimit((value) => value + 12)}>
{t(($) => $.inline_run.show_earlier, { count: row.steps.length - limit })}</button>}
diff --git a/packages/views/issues/components/issue-apps-section.tsx b/packages/views/issues/components/issue-apps-section.tsx
index ef73373292..be8ed5ad18 100644
--- a/packages/views/issues/components/issue-apps-section.tsx
+++ b/packages/views/issues/components/issue-apps-section.tsx
@@ -5,7 +5,7 @@ import type { AppAccountScope, IssueAppCall } from "@multica/core/types";
import { ComposioToolkitLogo } from "../../common/composio-toolkit-logo";
import { useT } from "../../i18n";
import { OutcomeIcon, outcomeLabel, toolLabel, useIssueAppCalls } from "./app-call-chips";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
type AppGroup = {
key: string;
@@ -52,7 +52,7 @@ export function IssueAppsSection({ issueId }: { issueId: string }) {
onOpenChange={setOpen}
count={groups.length}
/>
- {open && (
+ <IssueSidebarCollapsible open={open}>
<div className="px-2">
{groups.map((group) => {
const name = appName(group.toolkit);
@@ -90,7 +90,7 @@ export function IssueAppsSection({ issueId }: { issueId: string }) {
);
})}
</div>
- )}
+ </IssueSidebarCollapsible>
</div>
);
}
diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
index 3df1cd1c43..7cff760519 100644
--- a/packages/views/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -11,7 +11,9 @@ import { IssueAppRequests } from "../../common/app-requests";
import { useStatusLabel } from "../utils/status-label";
import { formatActivity, type ActivityT } from "./activity-text";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
-import { useState, useEffect, useCallback, useMemo, useRef, useId, Fragment, type ComponentProps, type ReactNode } from "react";
+import { useState, useEffect, useLayoutEffect, useCallback, useMemo, useRef, useId, Fragment, type ComponentProps, type ReactNode } from "react";
+import { AnimatePresence, motion } from "motion/react";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { Virtuoso, type ListRange, type VirtuosoHandle } from "react-virtuoso";
import { useDefaultLayout, usePanelRef } from "react-resizable-panels";
import { AppLink, useBackOrReplace } from "../../navigation";
@@ -110,7 +112,7 @@ import { SubIssuesAgentWorkingChip } from "./sub-issues-agent-working-chip";
import { IssueProjectPicker } from "../../projects/components/issue-project-picker";
import { IssuePropertyPills } from "./issue-property-pills";
import { LocalDirectoryHint } from "../../projects/components/local-directory-hint";
-import { useNewRunIds } from "./use-run-comment-motion";
+import { revealElement, useNewRunIds } from "./use-run-comment-motion";
import { AgentRunComment, CommentCard } from "./comment-card";
import { EMPTY_COMMENT_RUNS, buildCommentRunView, orderTimelineWithRuns, type CommentRun } from "./comment-runs";
import { issueTasksOptions } from "@multica/core/issues/queries";
@@ -211,7 +213,7 @@ import { useShowInSidebar } from "../../layout/panels/show-in-sidebar";
import { ProgressRing } from "./progress-ring";
import { matchesPinyin } from "../../editor/extensions/pinyin-match";
import { MetadataSection } from "./metadata-section";
-import { IssueSidebarSectionHeader, IssueSidebarPropertyGrid } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader, IssueSidebarPropertyGrid } from "./issue-sidebar-section";
import { IssueSidebarSections, letSidebarSettingsDragKeysThrough } from "./issue-sidebar-settings";
import { useT } from "../../i18n";
import { useIssueDetailScrollRestore } from "../hooks/use-issue-detail-scroll-restore";
@@ -515,27 +517,49 @@ function JumpToLatestButton({
/** New comments arrived while the reader was away; `label` counts them. */
hasNew?: boolean;
}) {
+ const reduceMotion = useReducedMotion();
return (
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={onClick}
- className="absolute bottom-full left-1/2 mb-6 -translate-x-1/2 bg-background shadow-md dark:bg-background dark:hover:bg-muted"
+ <motion.div
+ initial={reduceMotion ? false : { opacity: 0, y: 8, scale: 0.96 }}
+ animate={{
+ opacity: 1,
+ y: 0,
+ scale: 1,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ y: 6,
+ scale: 0.96,
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className="pointer-events-none absolute inset-x-0 bottom-full mb-6 flex justify-center"
>
- {hasNew ? (
- <>
- <span aria-hidden="true" className="size-1.5 rounded-full bg-brand" />
- {label}
- <ArrowDown />
- </>
- ) : (
- <>
- <ArrowDown />
- {label}
- </>
- )}
- </Button>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={onClick}
+ className="pointer-events-auto bg-background shadow-md dark:bg-background dark:hover:bg-muted"
+ >
+ {hasNew ? (
+ <>
+ <span aria-hidden="true" className="size-1.5 rounded-full bg-brand" />
+ {label}
+ <ArrowDown />
+ </>
+ ) : (
+ <>
+ <ArrowDown />
+ {label}
+ </>
+ )}
+ </Button>
+ </motion.div>
);
}
@@ -585,6 +609,28 @@ function flattenGroups(
return out;
}
+function ResolvedToggleReveal({
+ id,
+ domId,
+ toggledRef,
+ className,
+ children,
+}: {
+ id: string;
+ domId?: string;
+ toggledRef: React.RefObject<Set<string>>;
+ className?: string;
+ children: ReactNode;
+}) {
+ const ref = useRef<HTMLDivElement>(null);
+ useLayoutEffect(() => {
+ if (!toggledRef.current.delete(id)) return;
+ const anim = revealElement(ref.current, UI_MOTION_DURATION.fast * 1000, -3);
+ return () => { anim?.cancel(); };
+ }, [id, toggledRef]);
+ return <div ref={ref} id={domId} className={className}>{children}</div>;
+}
+
function TimelineSkeleton() {
return (
<div className="mt-4 flex flex-col gap-3">
@@ -659,23 +705,8 @@ function ActivityBlock({
requesterName?: string;
}) {
const wakeupText = useWakeupText();
- if (!expanded) {
- const count = entries.length;
- return (
- <div className="pb-3 px-4 max-md:px-3">
- <button
- type="button"
- onClick={onToggle}
- className="flex items-center gap-1.5 text-label text-muted-foreground transition-colors hover:text-foreground"
- >
- <ChevronRight className="h-3 w-3 shrink-0" />
- <span>{t(($) => $.activity.activity_count, { count })}</span>
- </button>
- </div>
- );
- }
const hiddenOlderCount =
- truncateOlder && !showOlder && entries.length > LAST_ACTIVITY_BLOCK_VISIBLE_LIMIT
+ expanded && truncateOlder && !showOlder && entries.length > LAST_ACTIVITY_BLOCK_VISIBLE_LIMIT
? entries.length - LAST_ACTIVITY_BLOCK_VISIBLE_LIMIT
: 0;
const visibleEntries =
@@ -686,20 +717,25 @@ function ActivityBlock({
// looked like nested folds and added visual noise without value. Once the
// user explicitly reveals older entries, the header reappears so they can
// fold the whole block back to a single count line.
- const showHeader = hiddenOlderCount === 0;
+ const showHeader = !expanded || hiddenOlderCount === 0;
return (
- <div className="pb-3 px-4 max-md:px-3 flex flex-col gap-3">
+ <div className={cn("pb-3 px-4 max-md:px-3", expanded && "flex flex-col gap-3")}>
{showHeader && (
<button
type="button"
onClick={onToggle}
className="flex items-center gap-1.5 text-label text-muted-foreground transition-colors hover:text-foreground"
>
- <ChevronDown className="h-3 w-3 shrink-0" />
+ <ChevronRight
+ className={cn(
+ "h-3 w-3 shrink-0 transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ expanded && "rotate-90",
+ )}
+ />
<span>{t(($) => $.activity.activity_count, { count: entries.length })}</span>
</button>
)}
- {hiddenOlderCount > 0 && (
+ {expanded && hiddenOlderCount > 0 && (
<button
type="button"
onClick={onToggleShowOlder}
@@ -709,7 +745,7 @@ function ActivityBlock({
<span>{t(($) => $.activity.show_more_activities, { count: hiddenOlderCount })}</span>
</button>
)}
- {visibleEntries.map((entry) => {
+ {expanded && visibleEntries.map((entry) => {
const details = (entry.details ?? {}) as Record<string, string>;
// Duplicate rows replace the status rows of the same write, so they
// carry the status glyph those rows would have had.
@@ -1673,7 +1709,11 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
// all-comments commands can drive it from outside this page.
const expandedResolved = useResolvedExpandStore(selectExpandedResolved(id));
const setResolvedExpanded = useResolvedExpandStore((s) => s.setExpanded);
+ // One-shot WAAPI reveal for user-clicked resolved thread expand/collapse only
+ // (Virtuoso scroll remounts never read a populated id).
+ const recentResolvedToggleRef = useRef<Set<string>>(new Set());
const toggleResolvedExpand = useCallback((commentId: string, expand: boolean) => {
+ recentResolvedToggleRef.current.add(commentId);
setResolvedExpanded(id, commentId, expand);
// On collapse the thread shrinks and the viewport would jump to whatever was
// below; pull the just-folded thread back into view with the smallest
@@ -3372,30 +3412,28 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
const guestProperties = (
<div>
<IssueSidebarSectionHeader title={t(($) => $.detail.section_properties)} open={propertiesOpen} onOpenChange={setPropertiesOpen} />
- {propertiesOpen && (
- <>
- <IssueSidebarPropertyGrid>
- <PropRow interactive={false} label={t(($) => $.detail.prop_status)}>
- {locked(<StatusPicker status={issue.status} onUpdate={handleUpdateField} align="start" projectId={issue.project_id} issue={issue} />)}
- </PropRow>
- <PropRow interactive={false} label={t(($) => $.detail.prop_assignee)}>
- {locked(<AssigneePicker assigneeType={issue.assignee_type} assigneeId={issue.assignee_id} onUpdate={handleUpdateField} align="start" />)}
- </PropRow>
- <PropRow interactive={false} label={t(($) => $.detail.prop_priority)}>
- {locked(<PriorityPicker priority={issue.priority} onUpdate={handleUpdateField} align="start" />)}
- </PropRow>
- <PropRow interactive={false} label={t(($) => $.detail.prop_project)}>
- {locked(<IssueProjectPicker projectId={issue.project_id} onUpdate={handleUpdateField} issue={issue} />)}
+ <IssueSidebarCollapsible open={propertiesOpen}>
+ <IssueSidebarPropertyGrid>
+ <PropRow interactive={false} label={t(($) => $.detail.prop_status)}>
+ {locked(<StatusPicker status={issue.status} onUpdate={handleUpdateField} align="start" projectId={issue.project_id} issue={issue} />)}
+ </PropRow>
+ <PropRow interactive={false} label={t(($) => $.detail.prop_assignee)}>
+ {locked(<AssigneePicker assigneeType={issue.assignee_type} assigneeId={issue.assignee_id} onUpdate={handleUpdateField} align="start" />)}
+ </PropRow>
+ <PropRow interactive={false} label={t(($) => $.detail.prop_priority)}>
+ {locked(<PriorityPicker priority={issue.priority} onUpdate={handleUpdateField} align="start" />)}
+ </PropRow>
+ <PropRow interactive={false} label={t(($) => $.detail.prop_project)}>
+ {locked(<IssueProjectPicker projectId={issue.project_id} onUpdate={handleUpdateField} issue={issue} />)}
+ </PropRow>
+ {attachedLabels.length > 0 && (
+ <PropRow interactive={false} label={t(($) => $.detail.prop_labels)}>
+ {locked(<LabelPicker issueId={issue.id} align="start" />)}
</PropRow>
- {attachedLabels.length > 0 && (
- <PropRow interactive={false} label={t(($) => $.detail.prop_labels)}>
- {locked(<LabelPicker issueId={issue.id} align="start" />)}
- </PropRow>
- )}
- </IssueSidebarPropertyGrid>
- <p className="px-4 pt-2 text-caption text-muted-foreground">{t(($) => $.detail.guest_readonly_note)}</p>
- </>
- )}
+ )}
+ </IssueSidebarPropertyGrid>
+ <p className="px-4 pt-2 text-caption text-muted-foreground">{t(($) => $.detail.guest_readonly_note)}</p>
+ </IssueSidebarCollapsible>
</div>
);
@@ -3403,7 +3441,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
properties: guest ? guestProperties : (
<div>
<IssueSidebarSectionHeader title={t(($) => $.detail.section_properties)} open={propertiesOpen} onOpenChange={setPropertiesOpen} />
- {propertiesOpen && <IssueSidebarPropertyGrid>
+ <IssueSidebarCollapsible open={propertiesOpen}><IssueSidebarPropertyGrid>
{/* Core props — always rendered. */}
<PropRow label={t(($) => $.detail.prop_status)}>
<StatusPicker
@@ -3511,7 +3549,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
))}
{addPropertyRow}
- </IssueSidebarPropertyGrid>}
+ </IssueSidebarPropertyGrid></IssueSidebarCollapsible>
</div>
),
quick_actions: <QuickActionsSection issueId={issue.id} />,
@@ -3531,7 +3569,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
<div>
<IssueSidebarSectionHeader title={t(($) => $.detail.section_parent_issue)} open={parentIssueOpen} onOpenChange={setParentIssueOpen}
actions={<IconButton size="icon-xs" label={t(($) => $.actions.remove_parent_issue)} onClick={() => actions.removeParent()}><Unlink /></IconButton>} />
- {parentIssueOpen && <div className="px-2">
+ <IssueSidebarCollapsible open={parentIssueOpen}><div className="px-2">
<div className="flex items-center gap-0.5 rounded-md px-2 hover:bg-accent/50 transition-colors group">
<AppLink
href={paths.issueDetail(issueRouteRef(parentIssue))}
@@ -3549,7 +3587,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
</AppLink>
</div>
- </div>}
+ </div></IssueSidebarCollapsible>
</div>
),
sub_issues: childIssuesLoaded && childIssues.length > 0 && (
@@ -3573,7 +3611,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
</span>
}
/>
- {sidebarSubIssuesOpen && (
+ <IssueSidebarCollapsible open={sidebarSubIssuesOpen}>
<ul id={sidebarSubIssuesListId} className="px-2">
{sidebarChildIssues.map((child) => (
<li key={child.id}>
@@ -3615,7 +3653,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
</li>
)}
</ul>
- )}
+ </IssueSidebarCollapsible>
</div>
),
duplicates: <IssueDuplicatesSection issueId={issue.id} />,
@@ -3652,7 +3690,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
details: (
<div>
<IssueSidebarSectionHeader title={t(($) => $.detail.section_details)} open={detailsOpen} onOpenChange={setDetailsOpen} />
- {detailsOpen && <IssueSidebarPropertyGrid>
+ <IssueSidebarCollapsible open={detailsOpen}><IssueSidebarPropertyGrid>
<PropRow
interactive={false}
label={t(($) => $.detail.prop_created_by)}
@@ -3685,7 +3723,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
<PropRow interactive={false} label={t(($) => $.detail.prop_updated)}>
<span className="text-muted-foreground">{shortDate(issue.updated_at, locale)}</span>
</PropRow>
- </IssueSidebarPropertyGrid>}
+ </IssueSidebarPropertyGrid></IssueSidebarCollapsible>
</div>
),
metadata: <MetadataSection metadata={issue.metadata ?? {}} />,
@@ -3734,19 +3772,19 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
}
if (item.kind === "resolved-bar") {
return (
- <div className="pb-3" id={`comment-${item.id}`}>
+ <ResolvedToggleReveal id={item.id} toggledRef={recentResolvedToggleRef} className="pb-3" domId={`comment-${item.id}`}>
<ResolvedThreadBar
entry={item.entry}
replies={timelineView.threadReplies.get(item.id) ?? EMPTY_REPLIES}
onExpand={() => toggleResolvedExpand(item.id, true)}
/>
- </div>
+ </ResolvedToggleReveal>
);
}
if (item.kind === "comment") {
const isResolved = !!item.entry.resolved_at;
return (
- <div className="pb-3" id={`comment-${item.id}`}>
+ <ResolvedToggleReveal id={item.id} toggledRef={recentResolvedToggleRef} className="pb-3" domId={`comment-${item.id}`}>
<CommentCard
issueId={id}
replyScrollParent={scrollContainerEl}
@@ -3770,7 +3808,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
onResolvedExpandChange={toggleResolvedExpand}
highlightedCommentId={highlightedId}
/>
- </div>
+ </ResolvedToggleReveal>
);
}
// activity-group
@@ -3860,12 +3898,15 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
its close button (MUL-4414). On desktop it also steps inside the
thread rail's right-edge strip, so an open find bar can't cover
the topmost ticks. */}
- {find.open && (
- <FindBar
- find={find}
- className={cn("absolute top-14 z-30", isMobile ? "right-4" : "right-10")}
- />
- )}
+ <AnimatePresence initial={false}>
+ {find.open && (
+ <FindBar
+ key="find-bar"
+ find={find}
+ className={cn("absolute top-14 z-30", isMobile ? "right-4" : "right-10")}
+ />
+ )}
+ </AnimatePresence>
<BreadcrumbHeader
className="@container/issue-header"
leading={leadingAction}
@@ -4308,7 +4349,7 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
>
<ChevronDown
className={cn(
- "h-3.5 w-3.5 text-muted-foreground transition-transform",
+ "h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
subIssuesCollapsed && "-rotate-90",
)}
/>
@@ -4367,34 +4408,36 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
/>
{/* List */}
- {!subIssuesCollapsed && (() => {
- const groups = groupSubIssuesByStage(childIssues);
- const staged = childIssues.some((c) => c.stage != null);
- return (
- <div className="overflow-hidden rounded-lg border bg-card/30 divide-y divide-border/60">
- {groups.map(({ stage: groupStage, items }) => (
- <Fragment key={groupStage ?? "unstaged"}>
- {staged && (
- <div className="bg-muted/40 px-3 py-1 text-micro font-medium uppercase tracking-wider text-muted-foreground">
- {groupStage == null
- ? t(($) => $.stage.none)
- : t(($) => $.stage.value, { n: groupStage })}
- </div>
- )}
- {items.map((child) => (
- <SubIssueRow
- key={child.id}
- child={child}
- childProgress={subIssueProgress?.get(child.id)}
- rowProps={subIssueRowProps}
- customProperties={subIssueCustomProps}
- />
- ))}
- </Fragment>
- ))}
- </div>
- );
- })()}
+ <IssueSidebarCollapsible open={!subIssuesCollapsed}>
+ {(() => {
+ const groups = groupSubIssuesByStage(childIssues);
+ const staged = childIssues.some((c) => c.stage != null);
+ return (
+ <div className="overflow-hidden rounded-lg border bg-card/30 divide-y divide-border/60">
+ {groups.map(({ stage: groupStage, items }) => (
+ <Fragment key={groupStage ?? "unstaged"}>
+ {staged && (
+ <div className="bg-muted/40 px-3 py-1 text-micro font-medium uppercase tracking-wider text-muted-foreground">
+ {groupStage == null
+ ? t(($) => $.stage.none)
+ : t(($) => $.stage.value, { n: groupStage })}
+ </div>
+ )}
+ {items.map((child) => (
+ <SubIssueRow
+ key={child.id}
+ child={child}
+ childProgress={subIssueProgress?.get(child.id)}
+ rowProps={subIssueRowProps}
+ customProperties={subIssueCustomProps}
+ />
+ ))}
+ </Fragment>
+ ))}
+ </div>
+ );
+ })()}
+ </IssueSidebarCollapsible>
</div>
</IssueSurfaceSelectionProvider>
</IssueContextMenuProvider>
@@ -4617,10 +4660,18 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
composer's top edge. With the sticky composer it rides the
composer itself; without it, a zero-height sticky anchor pins
it to the viewport bottom until the composer scrolls in. */}
- {!stickyComposer && jumpToLatest.visible && (
- <div className="sticky bottom-0 z-10 h-0">
- <JumpToLatestButton onClick={onJumpToLatest} label={jumpToLatestLabel} hasNew={!!firstNewCommentId} />
- </div>
+ {!stickyComposer && (
+ <AnimatePresence initial={false}>
+ {jumpToLatest.visible && (
+ <motion.div
+ key="jump-to-latest-anchor"
+ exit={{ opacity: 0, transition: { duration: UI_MOTION_DURATION.micro } }}
+ className="sticky bottom-0 z-10 h-0"
+ >
+ <JumpToLatestButton onClick={onJumpToLatest} label={jumpToLatestLabel} hasNew={!!firstNewCommentId} />
+ </motion.div>
+ )}
+ </AnimatePresence>
)}
<IssueAppRequests issueId={id} highlightId={highlightAppRequestId} highlightToken={highlightRequestToken} />
<div
@@ -4637,9 +4688,11 @@ export function IssueDetail({ issueId, onDelete, inbox, defaultSidebarOpen = tru
keeps the previous issue's in-memory content and the
next keystroke would flush it into the new issue's
draft key. */}
- {stickyComposer && jumpToLatest.visible && (
- <JumpToLatestButton onClick={onJumpToLatest} label={jumpToLatestLabel} hasNew={!!firstNewCommentId} />
- )}
+ <AnimatePresence initial={false}>
+ {stickyComposer && jumpToLatest.visible && (
+ <JumpToLatestButton key="jump-to-latest" onClick={onJumpToLatest} label={jumpToLatestLabel} hasNew={!!firstNewCommentId} />
+ )}
+ </AnimatePresence>
{!landingChromeHeld && (
<CommentInput
key={id}
diff --git a/packages/views/issues/components/issue-duplicates.tsx b/packages/views/issues/components/issue-duplicates.tsx
index 8f076b0a9a..bec7406c2c 100644
--- a/packages/views/issues/components/issue-duplicates.tsx
+++ b/packages/views/issues/components/issue-duplicates.tsx
@@ -1,6 +1,6 @@
"use client";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
@@ -102,7 +102,7 @@ export function IssueDuplicatesSection({ issueId }: { issueId: string }) {
return (
<div>
<IssueSidebarSectionHeader title={t(($) => $.duplicates.section_title)} open={open} onOpenChange={setOpen} count={duplicates.length} />
- {open && (
+ <IssueSidebarCollapsible open={open}>
<div className="px-2">
{duplicates.map((duplicate) => (
<AppLink
@@ -121,7 +121,7 @@ export function IssueDuplicatesSection({ issueId }: { issueId: string }) {
</AppLink>
))}
</div>
- )}
+ </IssueSidebarCollapsible>
</div>
);
}
diff --git a/packages/views/issues/components/issue-environments-section.tsx b/packages/views/issues/components/issue-environments-section.tsx
index 48261efe2a..7360278306 100644
--- a/packages/views/issues/components/issue-environments-section.tsx
+++ b/packages/views/issues/components/issue-environments-section.tsx
@@ -81,7 +81,7 @@ import {
runOrdinals,
} from "./environment-model";
import { EnvironmentStartMenu, type DeclaredState } from "./environment-start-menu";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
type IssuesT = ReturnType<typeof useT<"issues">>["t"];
@@ -414,7 +414,7 @@ export function IssueEnvironmentsSection({
/>
}
/>
- {open && (
+ <IssueSidebarCollapsible open={open}>
<div className="px-2">
{(preparingShown || justRequested) && preparingAgentName && (
<StatusRow
@@ -441,18 +441,20 @@ export function IssueEnvironmentsSection({
className="flex w-full items-center gap-1 rounded-md px-2 py-1 text-left text-micro text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
>
{t(($) => $.environments.ended_count, { count: ended.length })}
- <ChevronRight aria-hidden="true" className={cn("size-3 text-faint-foreground transition-transform motion-reduce:transition-none", showEnded && "rotate-90")} />
+ <ChevronRight aria-hidden="true" className={cn("size-3 text-faint-foreground transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none", showEnded && "rotate-90")} />
</button>
- {showEnded && groupBy(ended, (env) => env.runtime_id).map((group) => (
- <div key={group.key}>
- {renderGroupHeader(group)}
- {group.items.map((env) => renderEnv(env, group))}
- </div>
- ))}
+ <IssueSidebarCollapsible open={showEnded}>
+ {groupBy(ended, (env) => env.runtime_id).map((group) => (
+ <div key={group.key}>
+ {renderGroupHeader(group)}
+ {group.items.map((env) => renderEnv(env, group))}
+ </div>
+ ))}
+ </IssueSidebarCollapsible>
</>
)}
</div>
- )}
+ </IssueSidebarCollapsible>
</div>
);
}
diff --git a/packages/views/issues/components/issue-runs-dialog.tsx b/packages/views/issues/components/issue-runs-dialog.tsx
index d3dde4b38d..2488bf64c4 100644
--- a/packages/views/issues/components/issue-runs-dialog.tsx
+++ b/packages/views/issues/components/issue-runs-dialog.tsx
@@ -1,9 +1,12 @@
"use client";
import { useId, useMemo, useRef, useState } from "react";
+import { AnimatePresence, motion } from "motion/react";
import { useQuery } from "@tanstack/react-query";
+import { useReducedMotion } from "@multica/core/appearance";
import { issueTasksOptions } from "@multica/core/issues/queries";
import { ArrowRight, Ban, ChevronRight, XCircle } from "@multica/ui/icons";
+import { UI_EASE_OUT } from "@multica/ui/lib/motion";
import type { AgentTask } from "@multica/core/types";
import { cn } from "@multica/ui/lib/utils";
import { Checkbox } from "@multica/ui/components/ui/checkbox";
@@ -1004,17 +1007,42 @@ function RunListRow({ run, issueId, showIssue, costWidth }: { run: TimelineRun;
onClick={() => setExpanded((v) => !v)}
className="flex size-6 items-center justify-center rounded-xs text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50"
>
- <ChevronRight aria-hidden className={cn("size-3.5 transition-transform", expanded && "rotate-90")} />
+ <ChevronRight aria-hidden className={cn("size-3.5 transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none", expanded && "rotate-90")} />
</button>
}
/>
</span>
</div>
- {expanded && <RunDetails id={detailsId} run={run} reason={reason} />}
+ <RunDetailsDisclosure open={expanded}>
+ <RunDetails id={detailsId} run={run} reason={reason} />
+ </RunDetailsDisclosure>
</div>
);
}
+function RunDetailsDisclosure({ open, children }: { open: boolean; children: React.ReactNode }) {
+ const reduceMotion = useReducedMotion();
+ return (
+ <AnimatePresence initial={false}>
+ {open && (
+ <motion.div
+ key="run-details"
+ initial={reduceMotion ? false : { opacity: 0, height: 0, overflow: "hidden" }}
+ animate={{
+ opacity: 1,
+ height: "auto",
+ transitionEnd: { overflow: "visible" },
+ }}
+ exit={{ opacity: 0, height: 0, overflow: "hidden" }}
+ transition={{ duration: reduceMotion ? 0 : 0.18, ease: UI_EASE_OUT }}
+ >
+ {children}
+ </motion.div>
+ )}
+ </AnimatePresence>
+ );
+}
+
function RunDetails({ id, run, reason }: { id: string; run: TimelineRun; reason: string | null }) {
const { t } = useT("issues");
const formatSpend = useFormatSpend();
diff --git a/packages/views/issues/components/issue-sidebar-section.test.tsx b/packages/views/issues/components/issue-sidebar-section.test.tsx
index cace172cd2..6c3f19118f 100644
--- a/packages/views/issues/components/issue-sidebar-section.test.tsx
+++ b/packages/views/issues/components/issue-sidebar-section.test.tsx
@@ -1,8 +1,12 @@
import { useState } from "react";
import { fireEvent, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { describe, expect, it, vi } from "vitest";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
+
+afterEach(() => {
+ vi.unstubAllGlobals();
+});
describe("issue sidebar disclosure", () => {
it("keeps an empty title static while its add action remains available", () => {
@@ -43,4 +47,29 @@ describe("issue sidebar disclosure", () => {
await userEvent.keyboard("{Enter}");
expect(screen.getByText("Linked item")).toBeVisible();
});
+
+ it("toggles IssueSidebarCollapsible content and honors reduced motion", () => {
+ vi.stubGlobal("matchMedia", vi.fn(() => ({
+ matches: true,
+ addEventListener: vi.fn(),
+ removeEventListener: vi.fn(),
+ })));
+ function CollapsibleExample() {
+ const [open, setOpen] = useState(true);
+ return <>
+ <IssueSidebarSectionHeader title="Details" open={open} onOpenChange={setOpen} />
+ <IssueSidebarCollapsible open={open}>
+ <p>Detail row</p>
+ </IssueSidebarCollapsible>
+ </>;
+ }
+ const { container } = render(<CollapsibleExample />);
+ expect(screen.getByText("Detail row")).toBeVisible();
+ const panel = container.querySelector('[data-slot="collapsible-content"]');
+ expect(panel?.className).toContain("transition-none");
+ fireEvent.click(screen.getByRole("button", { name: "Details" }));
+ expect(screen.queryByText("Detail row")).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Details" }));
+ expect(screen.getByText("Detail row")).toBeVisible();
+ });
});
diff --git a/packages/views/issues/components/issue-sidebar-section.tsx b/packages/views/issues/components/issue-sidebar-section.tsx
index c7e7c28246..954c65267a 100644
--- a/packages/views/issues/components/issue-sidebar-section.tsx
+++ b/packages/views/issues/components/issue-sidebar-section.tsx
@@ -1,8 +1,10 @@
"use client";
import type { ReactNode } from "react";
+import { useReducedMotion } from "@multica/core/appearance";
import { ChevronRight } from "@multica/ui/icons";
import { Button, buttonVariants } from "@multica/ui/components/ui/button";
+import { Collapsible, CollapsibleContent } from "@multica/ui/components/ui/collapsible";
import { cn } from "@multica/ui/lib/utils";
/**
@@ -36,7 +38,7 @@ export function IssueSidebarSectionHeader({
className={cn("min-w-0 flex-1 shrink justify-start px-[7px] font-medium aria-expanded:bg-transparent active:not-aria-[haspopup]:translate-y-0", !open && "text-muted-foreground")}
>
<span className="truncate">{title}</span>
- <ChevronRight aria-hidden="true" className={cn("!size-3 shrink-0 text-faint-foreground transition-transform motion-reduce:transition-none", open && "rotate-90")} />
+ <ChevronRight aria-hidden="true" className={cn("!size-3 shrink-0 text-faint-foreground transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none", open && "rotate-90")} />
{count !== undefined && count > 0 && (
<>
{" "}
@@ -54,6 +56,27 @@ export function IssueSidebarSectionHeader({
);
}
+/** Shared smooth height + opacity collapse for issue sidebar & detail sections. */
+export function IssueSidebarCollapsible({
+ open,
+ children,
+ className,
+}: {
+ open: boolean;
+ children: ReactNode;
+ className?: string;
+}) {
+ const reduceMotion = useReducedMotion();
+
+ return (
+ <Collapsible open={open}>
+ <CollapsibleContent className={cn(reduceMotion && "transition-none", className)}>
+ {children}
+ </CollapsibleContent>
+ </Collapsible>
+ );
+}
+
/** Shared spacing separates rendered sections without adding divider lines. */
export function IssueSidebarStack({ children, className }: { children: ReactNode; className?: string }) {
return <div className={cn("flex flex-col gap-6 [overflow-anchor:none] [&>*]:flow-root", className)}>{children}</div>;
diff --git a/packages/views/issues/components/list-row.tsx b/packages/views/issues/components/list-row.tsx
index 6f82783546..6c236e3b8f 100644
--- a/packages/views/issues/components/list-row.tsx
+++ b/packages/views/issues/components/list-row.tsx
@@ -125,15 +125,21 @@ function ListRowContent({
{storeProperties.priority && issue.priority !== "none" && (
<PriorityIcon
priority={issue.priority}
- className={selected ? "hidden" : "group-hover/row:hidden"}
+ className={`transition-opacity duration-100 motion-reduce:transition-none ${
+ selected
+ ? "opacity-0"
+ : "group-hover/row:opacity-0 group-focus-within/row:opacity-0"
+ }`}
/>
)}
<input
type="checkbox"
checked={selected}
onChange={() => toggle(issue.id)}
- className={`absolute inset-0 cursor-pointer accent-primary ${
- selected ? "" : "hidden group-hover/row:block"
+ className={`absolute inset-0 cursor-pointer accent-primary transition-opacity duration-100 motion-reduce:transition-none ${
+ selected
+ ? "opacity-100"
+ : "opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100"
}`}
/>
</div>
diff --git a/packages/views/issues/components/metadata-section.tsx b/packages/views/issues/components/metadata-section.tsx
index 853b5d79ed..f865b5544f 100644
--- a/packages/views/issues/components/metadata-section.tsx
+++ b/packages/views/issues/components/metadata-section.tsx
@@ -9,7 +9,7 @@ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, Di
import { copyText } from "@multica/ui/lib/clipboard";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../../i18n";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
export function MetadataSection({ metadata }: { metadata: IssueMetadata }) {
const { t } = useT("issues");
@@ -35,11 +35,13 @@ export function MetadataSection({ metadata }: { metadata: IssueMetadata }) {
{copyButton()}
<DialogTrigger render={<IconButton size="icon-xs" label={t(($) => $.detail.metadata_view)}><Maximize2 /></IconButton>} />
</>} />
- {open && <div className="px-2">
- <div className="max-h-64 overflow-auto overscroll-contain px-2" role="region" aria-label={t(($) => $.detail.section_metadata)} tabIndex={0}>
- <MetadataEntries metadata={metadata} />
+ <IssueSidebarCollapsible open={open}>
+ <div className="px-2">
+ <div className="max-h-64 overflow-auto overscroll-contain px-2" role="region" aria-label={t(($) => $.detail.section_metadata)} tabIndex={0}>
+ <MetadataEntries metadata={metadata} />
+ </div>
</div>
- </div>}
+ </IssueSidebarCollapsible>
<DialogContent showCloseButton={false} className={cn("flex flex-col overflow-hidden sm:max-w-3xl", expanded && "h-[calc(100%-2rem)] sm:max-w-[calc(100%-2rem)]")}>
<DialogHeader className="shrink-0">
<div className="flex min-w-0 items-center justify-between gap-2">
diff --git a/packages/views/issues/components/progress-ring.tsx b/packages/views/issues/components/progress-ring.tsx
index 459c195461..ec5169c577 100644
--- a/packages/views/issues/components/progress-ring.tsx
+++ b/packages/views/issues/components/progress-ring.tsx
@@ -22,7 +22,7 @@ export function ProgressRing({
width={size}
height={size}
viewBox={`0 0 ${size} ${size}`}
- className={isComplete ? "text-info" : "text-primary"}
+ className={`transition-colors duration-200 motion-reduce:transition-none ${isComplete ? "text-info" : "text-primary"}`}
aria-hidden="true"
>
<circle
@@ -45,6 +45,7 @@ export function ProgressRing({
strokeDashoffset={offset}
strokeLinecap="round"
transform={`rotate(-90 ${size / 2} ${size / 2})`}
+ className="transition-[stroke-dashoffset] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none"
/>
</svg>
);
diff --git a/packages/views/issues/components/pull-requests-section.tsx b/packages/views/issues/components/pull-requests-section.tsx
index 02ce748bae..dff7c05336 100644
--- a/packages/views/issues/components/pull-requests-section.tsx
+++ b/packages/views/issues/components/pull-requests-section.tsx
@@ -1,6 +1,6 @@
"use client";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
@@ -64,11 +64,11 @@ export function PullRequestsSection({
<AutoCompleteMenu issueId={issueId} disabled={data?.auto_complete?.issue_disabled ?? false} workspaceEnabled={data?.auto_complete?.workspace_enabled ?? true} />
</> : undefined}
/>
- {open && (count > 0 || isLoading || isError) && (
+ <IssueSidebarCollapsible open={open && (count > 0 || isLoading || isError)}>
<div className="px-2">
<PullRequestList issueId={issueId} identifier={identifier} />
</div>
- )}
+ </IssueSidebarCollapsible>
</div>
);
}
diff --git a/packages/views/issues/components/quick-actions-section.tsx b/packages/views/issues/components/quick-actions-section.tsx
index 482c46d6d7..48dcc30212 100644
--- a/packages/views/issues/components/quick-actions-section.tsx
+++ b/packages/views/issues/components/quick-actions-section.tsx
@@ -29,7 +29,7 @@ import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { Tooltip, TooltipContent, TooltipTrigger } from "@multica/ui/components/ui/tooltip";
import { cn } from "@multica/ui/lib/utils";
import { ActorAvatar } from "../../common/actor-avatar";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
import { useT } from "../../i18n";
// Quick Actions sidebar section (MUL-5465).
@@ -79,7 +79,7 @@ export function QuickActionsSection({ issueId }: { issueId: string }) {
return (
<div>
<IssueSidebarSectionHeader title={t(($) => $.detail.section_quick_actions)} count={actions.length} open={open} onOpenChange={setOpen} />
- {open ? (
+ <IssueSidebarCollapsible open={open}>
<div className="space-y-0.5 px-2">
{isError && <button type="button" className="flex min-h-8 w-full items-center rounded-md px-2 py-1.5 text-left text-caption text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring" onClick={() => void refetch()}>
{t(($) => $.detail.section_load_failed_retry)}
@@ -102,7 +102,7 @@ export function QuickActionsSection({ issueId }: { issueId: string }) {
</button>
)}
</div>
- ) : null}
+ </IssueSidebarCollapsible>
<QuickActionBlockedDialog action={blocked} onClose={() => setBlocked(null)} />
</div>
diff --git a/packages/views/issues/components/table-view.tsx b/packages/views/issues/components/table-view.tsx
index d82022fcc7..54a4805bbb 100644
--- a/packages/views/issues/components/table-view.tsx
+++ b/packages/views/issues/components/table-view.tsx
@@ -741,11 +741,12 @@ export function InlineTitle({
}}
onAuxClick={stopRowNavigation}
>
- {row.collapsed ? (
- <ChevronRight className="size-3.5" />
- ) : (
- <ChevronDown className="size-3.5" />
- )}
+ <ChevronRight
+ className={cn(
+ "size-3.5 transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ !row.collapsed && "rotate-90",
+ )}
+ />
</button>
}
/>
@@ -925,11 +926,12 @@ export function IssueTableGroupRow({
type="button"
className="sticky left-4 flex w-fit items-center gap-2 text-caption font-medium"
>
- {group.collapsed ? (
- <ChevronRight className="size-3.5" />
- ) : (
- <ChevronDown className="size-3.5" />
- )}
+ <ChevronRight
+ className={cn(
+ "size-3.5 transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ !group.collapsed && "rotate-90",
+ )}
+ />
{group.label}
<span className="font-normal tabular-nums text-muted-foreground">
{group.count}
diff --git a/packages/views/issues/components/thread-minimap.tsx b/packages/views/issues/components/thread-minimap.tsx
index 93d5de1bf8..e33de3b37f 100644
--- a/packages/views/issues/components/thread-minimap.tsx
+++ b/packages/views/issues/components/thread-minimap.tsx
@@ -1,9 +1,11 @@
-import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode, type RefObject } from "react";
+import { AnimatePresence, usePresence } from "motion/react";
import { CheckCircle2, ChevronRight } from "@multica/ui/icons";
import type { TimelineEntry } from "@multica/core/types";
import { isDeletedComment } from "@multica/core/issues/comment-deletion";
import { useActorName } from "@multica/core/workspace/hooks";
import { useReducedMotion } from "@multica/core/appearance";
+import { UI_EASE_OUT_CSS, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";
import { resolvePublicFileUrl } from "@multica/core/workspace/avatar-url";
@@ -25,6 +27,80 @@ import { ProgressRing } from "./progress-ring";
* thread. Past this, ticks compressed to their minimum pitch stop being
* individually targetable; the outline still lists every reply.
*/
+function MinimapOutlineCard({
+ cardRef,
+ reducedMotion,
+ onPointerEnter,
+ onPointerLeave,
+ onFocusCapture,
+ onBlurCapture,
+ children,
+}: {
+ cardRef: RefObject<HTMLDivElement | null>;
+ reducedMotion: boolean;
+ onPointerEnter: () => void;
+ onPointerLeave: () => void;
+ onFocusCapture: () => void;
+ onBlurCapture: () => void;
+ children: ReactNode;
+}) {
+ const [isPresent, safeToRemove] = usePresence();
+
+ useLayoutEffect(() => {
+ const el = cardRef.current;
+ if (!el || reducedMotion || typeof el.animate !== "function") return;
+ const anim = el.animate(
+ [
+ { opacity: 0, translate: "6px 0", scale: "0.97" },
+ { opacity: 1, translate: "0 0", scale: "1" },
+ ],
+ { duration: UI_MOTION_DURATION.fast * 1000, easing: UI_EASE_OUT_CSS },
+ );
+ return () => { anim.cancel(); };
+ }, [cardRef, reducedMotion]);
+
+ useEffect(() => {
+ if (isPresent) return;
+ const el = cardRef.current;
+ if (el && !reducedMotion && typeof el.animate === "function") {
+ const anim = el.animate(
+ [
+ { opacity: 1, translate: "0 0", scale: "1" },
+ { opacity: 0, translate: "4px 0", scale: "0.97" },
+ ],
+ { duration: UI_MOTION_DURATION.micro * 1000, easing: "cubic-bezier(0.4, 0, 1, 1)", fill: "forwards" },
+ );
+ let done = false;
+ const finish = () => {
+ if (done) return;
+ done = true;
+ safeToRemove();
+ };
+ anim.onfinish = finish;
+ anim.oncancel = finish;
+ return () => { anim.cancel(); };
+ }
+ safeToRemove();
+ return undefined;
+ }, [cardRef, isPresent, reducedMotion, safeToRemove]);
+
+ return (
+ <div
+ ref={cardRef}
+ onPointerEnter={onPointerEnter}
+ onPointerLeave={onPointerLeave}
+ onFocusCapture={onFocusCapture}
+ onBlurCapture={onBlurCapture}
+ className={cn(
+ "absolute top-1/2 right-8 max-h-[calc(100%-3rem)] w-80 max-w-[calc(100vw-4rem)] -translate-y-1/2 origin-right overflow-y-auto overscroll-contain rounded-xl bg-popover p-2 text-body text-popover-foreground shadow-lg ring-1 ring-foreground/10",
+ isPresent ? "pointer-events-auto" : "pointer-events-none",
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
export const MAX_RAIL_TICKS = 80;
/** Intent delay before the card first appears; gliding afterwards is instant. */
@@ -688,15 +764,17 @@ export function ThreadMinimap({
})}
</nav>
- {previewIndex !== undefined && (
- <div
- ref={cardRef}
- onPointerEnter={cancelClose}
- onPointerLeave={scheduleClose}
- onFocusCapture={cancelClose}
- onBlurCapture={scheduleClose}
- className="pointer-events-auto absolute right-8 top-1/2 max-h-[calc(100%-3rem)] w-80 max-w-[calc(100vw-4rem)] -translate-y-1/2 overflow-y-auto overscroll-contain rounded-xl bg-popover p-2 text-body text-popover-foreground shadow-lg ring-1 ring-foreground/10"
- >
+ <AnimatePresence initial={false}>
+ {previewIndex !== undefined && (
+ <MinimapOutlineCard
+ key="minimap-outline"
+ cardRef={cardRef}
+ reducedMotion={reducedMotion}
+ onPointerEnter={cancelClose}
+ onPointerLeave={scheduleClose}
+ onFocusCapture={cancelClose}
+ onBlurCapture={scheduleClose}
+ >
{/* One <li> per item, sections and replies included, so row index === item index. */}
<ul>
{items.map((item, index) => {
@@ -851,8 +929,9 @@ export function ThreadMinimap({
);
})}
</ul>
- </div>
- )}
+ </MinimapOutlineCard>
+ )}
+ </AnimatePresence>
</div>
);
}
diff --git a/packages/views/issues/components/use-comment-annotations.tsx b/packages/views/issues/components/use-comment-annotations.tsx
index e974ba33be..7fb3690eb2 100644
--- a/packages/views/issues/components/use-comment-annotations.tsx
+++ b/packages/views/issues/components/use-comment-annotations.tsx
@@ -1,6 +1,7 @@
"use client";
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
+import { AnimatePresence } from "motion/react";
import { MessageSquarePlus } from "@multica/ui/icons";
import { toast } from "sonner";
import { isImeComposing } from "@multica/core/utils";
@@ -325,45 +326,49 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onA
}, [enabled, selection, editingId, highlightName]);
const renderComposer = (controls?: AnnotationSendControls) => {
- return enabled && selection ? <CommentSelectionBubble range={selection.range} source={selection.root} owner={draftKey} onPositioned={focusNote} keepVisibleWhenDetached={!!editing}>
- <div className="bubble-menu max-w-[calc(100vw-16px)] focus-within:outline-1 focus-within:outline-ring">
- {editing ? <AnnotationComposer key={`${draftKey}:${editing.id}`} issueId={issueId} owner={draftKey}
- annotation={editing} existing={editingExisting}
- number={annotations.findIndex((a) => a.id === editing.id) + 1}
- editorRef={inputRef} controls={controls}
- sourceMissing={!sources.some((source) => source.id === editing.sourceCommentId)}
- sourceChanged={sources.some((source) => source.id === editing.sourceCommentId &&
- source.revision !== undefined && editing.sourceRevision !== undefined && source.revision !== editing.sourceRevision)}
- canSave={editingExisting || annotations.length < MAX_REPLY_ANNOTATIONS}
- onChange={(note) => {
- if (dismissedRef.current || submittingRef.current) return;
- const nextAnnotation = { ...editing, note };
- const store = useCommentDraftStore.getState();
- if (note.trim()) store.setPendingAnnotation(draftKey, { annotation: nextAnnotation, existing: editingExisting });
- else store.clearPendingAnnotation(draftKey);
- if (mountedRef.current) {
- setEditor({ annotation: nextAnnotation, existing: editingExisting });
- setError(false);
- }
- }}
- onSave={confirmNote} onBusyChange={(busy) => {
- if (busy && editingRef.current?.id === editing.id) submittingRef.current = editing.id;
- else if (!busy && submittingRef.current === editing.id) submittingRef.current = null;
- }}
- onRemove={editingExisting ? () => {
- useCommentDraftStore.getState().removeAnnotation(draftKey, editing.id);
- close(true);
- } : undefined} /> : <Button ref={actionRef} variant="ghost" size="sm"
- onMouseDown={(event) => event.preventDefault()} onClick={() => add(selection)}>
- <MessageSquarePlus />{t(($) => editable ? $.reply.annotations.add_comment : $.reply.annotations.add)}
- </Button>}
- </div>
- {error && <p role="alert" className="mt-1 max-w-72 rounded-lg bg-popover p-2 text-caption text-destructive shadow-[var(--menu-shadow)]">
- {selection.quote.length > MAX_ANNOTATION_QUOTE_LENGTH
- ? t(($) => $.reply.annotations.quote_limit, { count: MAX_ANNOTATION_QUOTE_LENGTH })
- : t(($) => $.reply.annotations.count_limit, { count: MAX_REPLY_ANNOTATIONS })}
- </p>}
- </CommentSelectionBubble> : null;
+ return (
+ <AnimatePresence initial={false}>
+ {enabled && selection ? <CommentSelectionBubble key="selection-bubble" range={selection.range} source={selection.root} owner={draftKey} onPositioned={focusNote} keepVisibleWhenDetached={!!editing}>
+ <div className="bubble-menu max-w-[calc(100vw-16px)] focus-within:outline-1 focus-within:outline-ring">
+ {editing ? <AnnotationComposer key={`${draftKey}:${editing.id}`} issueId={issueId} owner={draftKey}
+ annotation={editing} existing={editingExisting}
+ number={annotations.findIndex((a) => a.id === editing.id) + 1}
+ editorRef={inputRef} controls={controls}
+ sourceMissing={!sources.some((source) => source.id === editing.sourceCommentId)}
+ sourceChanged={sources.some((source) => source.id === editing.sourceCommentId &&
+ source.revision !== undefined && editing.sourceRevision !== undefined && source.revision !== editing.sourceRevision)}
+ canSave={editingExisting || annotations.length < MAX_REPLY_ANNOTATIONS}
+ onChange={(note) => {
+ if (dismissedRef.current || submittingRef.current) return;
+ const nextAnnotation = { ...editing, note };
+ const store = useCommentDraftStore.getState();
+ if (note.trim()) store.setPendingAnnotation(draftKey, { annotation: nextAnnotation, existing: editingExisting });
+ else store.clearPendingAnnotation(draftKey);
+ if (mountedRef.current) {
+ setEditor({ annotation: nextAnnotation, existing: editingExisting });
+ setError(false);
+ }
+ }}
+ onSave={confirmNote} onBusyChange={(busy) => {
+ if (busy && editingRef.current?.id === editing.id) submittingRef.current = editing.id;
+ else if (!busy && submittingRef.current === editing.id) submittingRef.current = null;
+ }}
+ onRemove={editingExisting ? () => {
+ useCommentDraftStore.getState().removeAnnotation(draftKey, editing.id);
+ close(true);
+ } : undefined} /> : <Button ref={actionRef} variant="ghost" size="sm"
+ onMouseDown={(event) => event.preventDefault()} onClick={() => add(selection)}>
+ <MessageSquarePlus />{t(($) => editable ? $.reply.annotations.add_comment : $.reply.annotations.add)}
+ </Button>}
+ </div>
+ {error && <p role="alert" className="mt-1 max-w-72 rounded-lg bg-popover p-2 text-caption text-destructive shadow-[var(--menu-shadow)]">
+ {selection.quote.length > MAX_ANNOTATION_QUOTE_LENGTH
+ ? t(($) => $.reply.annotations.quote_limit, { count: MAX_ANNOTATION_QUOTE_LENGTH })
+ : t(($) => $.reply.annotations.count_limit, { count: MAX_REPLY_ANNOTATIONS })}
+ </p>}
+ </CommentSelectionBubble> : null}
+ </AnimatePresence>
+ );
};
return {
@@ -390,17 +395,19 @@ export function useCommentAnnotations({ issueId, draftKey, sources, enabled, onA
},
popup: <>
{(annotations.length > 0 || editing) && <style>{`::highlight(${highlightName}), ::highlight(${highlightName}-selection) { background: color-mix(in srgb, var(--brand) 20%, transparent); }`}</style>}
- {enabled && anchors.map((anchor) => {
- const index = annotations.findIndex((a) => a.id === anchor.id);
- if (index < 0) return null;
- return <CommentSelectionBubble key={anchor.id} range={anchor.range} source={anchor.root} owner={draftKey}
- markerRanges={markerRanges.get(anchor.root)} markerZIndex={markerZIndex}>
- <IconButton variant="brandSubtle" size="icon-sm" className="size-6 text-caption tabular-nums aria-expanded:ring-2 aria-expanded:ring-brand"
- aria-expanded={editingId === anchor.id}
- label={t(($) => $.reply.annotations.edit, { number: index + 1 })}
- onClick={() => editAnnotation(anchor.id)}>{index + 1}</IconButton>
- </CommentSelectionBubble>;
- })}
+ <AnimatePresence initial={false}>
+ {enabled && anchors.map((anchor) => {
+ const index = annotations.findIndex((a) => a.id === anchor.id);
+ if (index < 0) return null;
+ return <CommentSelectionBubble key={anchor.id} range={anchor.range} source={anchor.root} owner={draftKey}
+ markerRanges={markerRanges.get(anchor.root)} markerZIndex={markerZIndex}>
+ <IconButton variant="brandSubtle" size="icon-sm" className="size-6 text-caption tabular-nums aria-expanded:ring-2 aria-expanded:ring-brand"
+ aria-expanded={editingId === anchor.id}
+ label={t(($) => $.reply.annotations.edit, { number: index + 1 })}
+ onClick={() => editAnnotation(anchor.id)}>{index + 1}</IconButton>
+ </CommentSelectionBubble>;
+ })}
+ </AnimatePresence>
{!editing && renderComposer()}
</>,
};
diff --git a/packages/views/issues/components/use-run-comment-motion.test.tsx b/packages/views/issues/components/use-run-comment-motion.test.tsx
index fb3ca21617..f07d452178 100644
--- a/packages/views/issues/components/use-run-comment-motion.test.tsx
+++ b/packages/views/issues/components/use-run-comment-motion.test.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import { act, cleanup, fireEvent, render, renderHook, screen, waitFor } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { AgentTask } from "@multica/core/types";
-import { useNewRunIds, useRunAnimationVisibility, useRunCommentMotion, useRunDisclosureMotion } from "./use-run-comment-motion";
+import { revealElement, useNewRunIds, useRunAnimationVisibility, useRunCommentMotion, useRunDisclosureMotion } from "./use-run-comment-motion";
const animate = vi.fn((_frames: Keyframe[], _options: KeyframeAnimationOptions) => ({ cancel: vi.fn() }));
const originalAnimate = Object.getOwnPropertyDescriptor(Element.prototype, "animate");
@@ -189,4 +189,18 @@ describe("run comment motion", () => {
for (const animation of firstAnimations) expect(animation.cancel).toHaveBeenCalled();
style.mockRestore();
});
+
+ it("reveals an element via WAAPI once and skips under reduced motion", () => {
+ const el = document.createElement("div");
+ const anim = revealElement(el, 150, -3);
+ expect(anim).not.toBeNull();
+ expect(animate).toHaveBeenCalledWith(
+ [{ opacity: 0, transform: "translateY(-3px)" }, { opacity: 1, transform: "translateY(0)" }],
+ expect.objectContaining({ duration: 150, easing: "cubic-bezier(0.23, 1, 0.32, 1)" }),
+ );
+ animate.mockClear();
+ reduced = true;
+ expect(revealElement(el, 150, -3)).toBeUndefined();
+ expect(animate).not.toHaveBeenCalled();
+ });
});
diff --git a/packages/views/issues/components/use-run-comment-motion.ts b/packages/views/issues/components/use-run-comment-motion.ts
index 8c43ab754a..5314d96966 100644
--- a/packages/views/issues/components/use-run-comment-motion.ts
+++ b/packages/views/issues/components/use-run-comment-motion.ts
@@ -1,13 +1,13 @@
import { useCallback, useEffect, useLayoutEffect, useRef, useState, type MouseEvent } from "react";
+import { prefersReducedMotion } from "@multica/core/appearance";
import type { AgentTask } from "@multica/core/types";
import { UI_EASE_OUT_CSS, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
const EMPTY_IDS: ReadonlySet<string> = new Set();
-function reveal(element: HTMLElement | null, duration: number, translate = 0) {
+export function revealElement(element: HTMLElement | null, duration: number, translate = 0) {
if (!element?.animate) return;
- const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
- if (reduced) return;
+ if (prefersReducedMotion()) return;
return element.animate(
translate
? [{ opacity: 0, transform: `translateY(${translate}px)` }, { opacity: 1, transform: "translateY(0)" }]
@@ -63,13 +63,13 @@ export function useRunCommentMotion(entering: boolean, replyId: string | undefin
previous.current = { entering, replyId, status };
const animations: (Animation | undefined)[] = [];
if (entering && !before.entering) {
- animations.push(reveal(ref.current, UI_MOTION_DURATION.fast * 1000, 4));
+ animations.push(revealElement(ref.current, UI_MOTION_DURATION.fast * 1000, 4));
} else if (replyId && replyId !== before.replyId) {
const body = Array.from(ref.current?.querySelectorAll<HTMLElement>("[data-comment-content]") ?? [])
.find((element) => element.dataset.commentContent === replyId);
- animations.push(reveal(body ?? null, UI_MOTION_DURATION.fast * 1000));
+ animations.push(revealElement(body ?? null, UI_MOTION_DURATION.fast * 1000));
} else if (status !== before.status) {
- animations.push(reveal(ref.current?.querySelector("[data-run-status]") ?? null, UI_MOTION_DURATION.micro * 1000));
+ animations.push(revealElement(ref.current?.querySelector("[data-run-status]") ?? null, UI_MOTION_DURATION.micro * 1000));
}
return () => { for (const animation of animations) animation?.cancel(); };
}, [entering, replyId, status]);
@@ -79,6 +79,7 @@ export function useRunCommentMotion(entering: boolean, replyId: string | undefin
/** Animate the toggle itself, including when historical runs mount a new trigger. */
export function useRunDisclosureMotion(open: boolean) {
const chevronRef = useRef<SVGSVGElement>(null);
+ const contentRef = useRef<HTMLDivElement>(null);
const pending = useRef(false);
const focusedTrigger = useRef<HTMLElement | null>(null);
const fromRotation = useRef("0deg");
@@ -91,17 +92,21 @@ export function useRunDisclosureMotion(open: boolean) {
chevronRef.current?.closest<HTMLElement>("button, summary")?.focus({ preventScroll: true });
}
if (!requested) return;
- const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
- if (reduced) return;
+ if (prefersReducedMotion()) return;
const duration = (open ? UI_MOTION_DURATION.fast : UI_MOTION_DURATION.micro) * 1000;
const arrow = chevronRef.current?.animate?.(
[{ rotate: fromRotation.current }, { rotate: open ? "90deg" : "0deg" }],
{ duration, easing: UI_EASE_OUT_CSS },
);
- return () => { arrow?.cancel(); };
+ const content = open ? revealElement(contentRef.current, UI_MOTION_DURATION.fast * 1000, -3) : undefined;
+ return () => {
+ arrow?.cancel();
+ content?.cancel();
+ };
}, [open]);
return {
chevronRef,
+ contentRef,
onTrigger(event: MouseEvent<HTMLElement>) {
pending.current = event.detail > 0;
focusedTrigger.current = event.detail === 0 && document.activeElement === event.currentTarget ? event.currentTarget : null;
diff --git a/packages/views/issues/components/wakeups-section.tsx b/packages/views/issues/components/wakeups-section.tsx
index a858f9ec1d..a98d3a2b05 100644
--- a/packages/views/issues/components/wakeups-section.tsx
+++ b/packages/views/issues/components/wakeups-section.tsx
@@ -1,6 +1,6 @@
"use client";
-import { IssueSidebarSectionHeader } from "./issue-sidebar-section";
+import { IssueSidebarCollapsible, IssueSidebarSectionHeader } from "./issue-sidebar-section";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
@@ -443,7 +443,7 @@ export function WakeupsSection({
collapsible={hasContent}
actions={!closed ? <WakeupCreate workspaceId={workspaceId} issueId={issueId} defaultAgentId={defaultAgentId} /> : undefined}
/>
- {open && hasContent && (
+ <IssueSidebarCollapsible open={open && hasContent}>
<div className="px-2">
{isError && (
<button
@@ -467,24 +467,22 @@ export function WakeupsSection({
type="button"
aria-expanded={historyOpen}
onClick={() => setHistoryOpen(!historyOpen)}
- className="flex min-h-9 w-full items-center gap-1 rounded-md px-2 py-1 text-label text-muted-foreground hover:bg-accent/50 focus-visible:outline-2 focus-visible:outline-ring"
+ className="flex min-h-9 w-full items-center gap-1 rounded-md px-2 py-1 text-label text-muted-foreground transition-colors hover:bg-accent/50 focus-visible:outline-2 focus-visible:outline-ring"
>
<ChevronRight
- className={`size-3 ${historyOpen ? "rotate-90" : ""}`}
+ className={`size-3 transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none ${historyOpen ? "rotate-90" : ""}`}
aria-hidden="true"
/>
{t(($) => $.wakeups.ended, { count: historyCount })}
</button>
- {historyOpen && (
- <>
- {offSystemRules.map(systemRow)}
- {history.map(row)}
- </>
- )}
+ <IssueSidebarCollapsible open={historyOpen}>
+ {offSystemRules.map(systemRow)}
+ {history.map(row)}
+ </IssueSidebarCollapsible>
</>
)}
</div>
- )}
+ </IssueSidebarCollapsible>
</section>
);
}
diff --git a/packages/views/layout/panels/inbox-section.tsx b/packages/views/layout/panels/inbox-section.tsx
index 26d01dc1db..14d48daf7c 100644
--- a/packages/views/layout/panels/inbox-section.tsx
+++ b/packages/views/layout/panels/inbox-section.tsx
@@ -813,7 +813,28 @@ const InboxRow = memo(function InboxRow({
<IssueAgentBadge agents={agents} />
</span>
);
- const dot = <span data-mc="unread-dot" aria-hidden className="size-1.5 shrink-0 rounded-full bg-brand" />;
+ const isPresent = useIsPresent();
+ const reduceMotion = useReducedMotion();
+ const dot = (
+ <AnimatePresence initial={false}>
+ {unread && (
+ <motion.span
+ key="unread-dot"
+ data-mc="unread-dot"
+ aria-hidden
+ initial={false}
+ animate={{ opacity: 1, scale: 1, width: 6 }}
+ exit={{
+ opacity: 0,
+ scale: 0,
+ width: 0,
+ transition: { duration: reduceMotion ? 0 : 0.12, ease: UI_EASE_OUT },
+ }}
+ className="h-1.5 shrink-0 rounded-full bg-brand"
+ />
+ )}
+ </AnimatePresence>
+ );
// Leads the row like a Pinned or tree issue row. Display only: the link
// covers the row, and the hover card already names the status.
const statusIcon = status && (
@@ -843,8 +864,6 @@ const InboxRow = memo(function InboxRow({
</ShimmerText>
);
- const isPresent = useIsPresent();
- const reduceMotion = useReducedMotion();
const rowChildren = (
<>
<HoverCard
@@ -910,7 +929,10 @@ const InboxRow = memo(function InboxRow({
) : unread ? (
<span className={cn("flex shrink-0 items-center", yields)}>{dot}</span>
) : (
- !agents && time
+ <>
+ <span className={cn("flex shrink-0 items-center", yields)}>{dot}</span>
+ {!agents && time}
+ </>
)}
</>
) : (
@@ -936,7 +958,7 @@ const InboxRow = memo(function InboxRow({
</span>
{/* The agents hold the title line's time slot, so the time moves down. */}
{agents && <span className={timeClass}>{timeAgo(at)}</span>}
- {unread && dot}
+ {dot}
</span>
</>
)}
@@ -985,7 +1007,7 @@ const InboxRow = memo(function InboxRow({
className={cn(
rowButtonClass(compact),
"right-7",
- snoozeOpen && "flex bg-surface-selected text-foreground",
+ snoozeOpen && "pointer-events-auto opacity-100 bg-surface-selected text-foreground",
)}
onClick={(event) => event.stopPropagation()}
>
@@ -999,7 +1021,7 @@ const InboxRow = memo(function InboxRow({
<button
type="button"
aria-label={archiveLabel}
- className={cn(rowButtonClass(compact), "right-1.5", snoozeOpen && "flex")}
+ className={cn(rowButtonClass(compact), "right-1.5", snoozeOpen && "pointer-events-auto opacity-100")}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
@@ -1124,15 +1146,17 @@ function SnoozedSectionList({
return (
<>
<PanelList data-sidebar-list={INBOX_LIST}>
- {shown.map((entry) => (
- <SnoozedSectionRow
- key={entry.issue_id}
- wsId={wsId}
- entry={entry}
- active={entry.issue_id === openKey}
- onUnsnooze={() => unsnooze(entry.item_id, entry.issue_id)}
- />
- ))}
+ <AnimatePresence initial={false}>
+ {shown.map((entry) => (
+ <SnoozedSectionRow
+ key={entry.issue_id}
+ wsId={wsId}
+ entry={entry}
+ active={entry.issue_id === openKey}
+ onUnsnooze={() => unsnooze(entry.item_id, entry.issue_id)}
+ />
+ ))}
+ </AnimatePresence>
</PanelList>
{more && <SectionMoreButton expanded={expanded} hidden={list.rows.length - limit} onToggle={toggle} />}
</>
@@ -1158,8 +1182,23 @@ function SnoozedSectionRow({
const backAt = formatSnoozeTime(new Date(entry.snoozed_until), new Date(), locale);
const title = issue?.title ?? entry.issue_identifier ?? "";
const unsnoozeLabel = t(($) => $.snooze.unsnooze);
+ const isPresent = useIsPresent();
+ const reduceMotion = useReducedMotion();
return (
- <li data-inbox-snoozed-row className="group/inbox relative">
+ <motion.li
+ data-inbox-snoozed-row={isPresent ? "" : undefined}
+ aria-hidden={!isPresent || undefined}
+ initial={false}
+ exit={{
+ opacity: 0,
+ height: 0,
+ marginTop: 0,
+ marginBottom: 0,
+ overflow: "hidden",
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ className={cn("group/inbox relative", !isPresent && "pointer-events-none")}
+ >
<div {...panelRowAnchor(active)} className={cn(PANEL_ROW_CLASS, panelRowStateClass(active), "relative")}>
<span aria-hidden className="flex size-3.5 shrink-0">
{issue && (
@@ -1203,7 +1242,7 @@ function SnoozedSectionRow({
<AlarmClock className="size-3" />
</button>
</TooltipHint>
- </li>
+ </motion.li>
);
}
@@ -1246,14 +1285,16 @@ function ArchivedSectionList({
return (
<>
<PanelList data-sidebar-list={INBOX_LIST}>
- {shown.map((item) => (
- <ArchivedSectionRow
- key={item.id}
- item={item}
- active={inboxRowKey(item) === openKey}
- onRestore={() => restore(item)}
- />
- ))}
+ <AnimatePresence initial={false}>
+ {shown.map((item) => (
+ <ArchivedSectionRow
+ key={item.id}
+ item={item}
+ active={inboxRowKey(item) === openKey}
+ onRestore={() => restore(item)}
+ />
+ ))}
+ </AnimatePresence>
</PanelList>
{more && <SectionMoreButton expanded={expanded} hidden={items.length - limit} onToggle={toggle} />}
{expanded && query.hasNextPage && (
@@ -1289,8 +1330,23 @@ function ArchivedSectionRow({
const status = item.issue_status;
const restoreLabel = t(($) => $.detail.restore);
const requestLanding = useInboxSelectionStore((s) => s.requestLanding);
+ const isPresent = useIsPresent();
+ const reduceMotion = useReducedMotion();
return (
- <li data-inbox-archived-row className="group/inbox relative">
+ <motion.li
+ data-inbox-archived-row={isPresent ? "" : undefined}
+ aria-hidden={!isPresent || undefined}
+ initial={false}
+ exit={{
+ opacity: 0,
+ height: 0,
+ marginTop: 0,
+ marginBottom: 0,
+ overflow: "hidden",
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ className={cn("group/inbox relative", !isPresent && "pointer-events-none")}
+ >
<div {...panelRowAnchor(active)} className={cn(PANEL_ROW_CLASS, panelRowStateClass(active), "relative")}>
{status ? (
<span aria-hidden className="flex shrink-0">
@@ -1338,14 +1394,14 @@ function ArchivedSectionRow({
<ArchiveRestore className="size-3" />
</button>
</TooltipHint>
- </li>
+ </motion.li>
);
}
/** A row's hover button. */
function rowButtonClass(compact: boolean) {
return cn(
- "absolute z-10 hidden size-5 items-center justify-center rounded-md text-muted-foreground group-hover/inbox:flex group-focus-within/inbox:flex hover:bg-surface-selected hover:text-foreground",
+ "pointer-events-none absolute z-10 flex size-5 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity duration-100 group-hover/inbox:pointer-events-auto group-hover/inbox:opacity-100 group-focus-within/inbox:pointer-events-auto group-focus-within/inbox:opacity-100 hover:bg-surface-selected hover:text-foreground motion-reduce:transition-none",
// On the title's line, where the time was.
compact ? "top-1/2 -translate-y-1/2" : "top-1.5",
);
diff --git a/packages/views/onboarding/components/step-shell.tsx b/packages/views/onboarding/components/step-shell.tsx
index a18e82dc7c..8ef96f1b85 100644
--- a/packages/views/onboarding/components/step-shell.tsx
+++ b/packages/views/onboarding/components/step-shell.tsx
@@ -116,7 +116,7 @@ export function StepShell({
const fadeStyle = useScrollFade(mainRef);
return (
- <div className="animate-onboarding-enter flex h-full min-h-0 flex-col bg-background">
+ <div className="flex h-full min-h-0 flex-col bg-background">
{/* One strip across the whole window, as the first flex child — the
shape the desktop shell rule asks for, and the fix for an overlap:
the rail is a dark inset panel that started at the window's top-left
@@ -147,7 +147,9 @@ export function StepShell({
backDisabled={backDisabled}
footer={chromeFooter}
/>
- {children}
+ <div key={currentStep} className="animate-onboarding-enter flex min-h-0 flex-1 flex-col">
+ {children}
+ </div>
</div>
</main>
</div>
diff --git a/packages/views/plugins/plugin-panel-section.tsx b/packages/views/plugins/plugin-panel-section.tsx
index 455dcabf8b..b92e520065 100644
--- a/packages/views/plugins/plugin-panel-section.tsx
+++ b/packages/views/plugins/plugin-panel-section.tsx
@@ -6,6 +6,7 @@ import { pluginInstallationsOptions } from "@multica/core/plugins";
import { useCurrentWorkspace } from "@multica/core/paths";
import { useFeatureEnabled } from "@multica/core/config";
import { PLUGINS_V1_FLAG } from "@multica/core/feature-flags";
+import { cn } from "@multica/ui/lib/utils";
import { useT } from "../i18n";
import { isDesktopShell } from "../platform/local-directory";
import { IssueSidebarSectionHeader } from "../issues/components/issue-sidebar-section";
@@ -48,16 +49,28 @@ export function PluginPanelSection({ issueId }: { issueId: string }) {
return (
<section>
<IssueSidebarSectionHeader title={t(($) => $.plugins.panels)} open={open} onOpenChange={setOpen} count={panels.length} />
- <div hidden={!open} className="space-y-2 px-2">
- {panels.map(({ installation, surface }) => (
- <PluginSurfaceFrame
- key={`${installation.id}:${surface.key}`}
- wsId={wsId}
- installation={installation}
- surface={surface}
- issueId={issueId}
- />
- ))}
+ <div
+ inert={!open}
+ aria-hidden={!open}
+ style={{ visibility: open ? "visible" : "hidden" }}
+ className={cn(
+ "grid transition-[grid-template-rows,opacity,visibility] duration-[180ms] ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ open ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0",
+ )}
+ >
+ <div className="min-h-0 overflow-hidden">
+ <div className="space-y-2 px-2">
+ {panels.map(({ installation, surface }) => (
+ <PluginSurfaceFrame
+ key={`${installation.id}:${surface.key}`}
+ wsId={wsId}
+ installation={installation}
+ surface={surface}
+ issueId={issueId}
+ />
+ ))}
+ </div>
+ </div>
</div>
</section>
);
diff --git a/packages/views/projects/components/project-progress-section.tsx b/packages/views/projects/components/project-progress-section.tsx
index 5642c08923..bf2a54c730 100644
--- a/packages/views/projects/components/project-progress-section.tsx
+++ b/packages/views/projects/components/project-progress-section.tsx
@@ -4,6 +4,7 @@ import { useState, type ReactNode } from "react";
import { useQuery } from "@tanstack/react-query";
import { Plus, User } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
+import { NumberFlow } from "@multica/ui/components/ui/number-flow";
import { Tabs, TabsList, TabsTrigger } from "@multica/ui/components/ui/tabs";
import { cn } from "@multica/ui/lib/utils";
import type {
@@ -119,7 +120,7 @@ function ProgressSummary({ progress }: { progress: ProjectProgress }) {
return (
<div className="space-y-2">
<div className="flex items-baseline gap-2">
- <span className="text-title font-semibold tabular-nums">{progress.percent}%</span>
+ <NumberFlow value={progress.percent} suffix="%" className="text-title font-semibold tabular-nums" />
<span className="text-caption text-muted-foreground">
{t(($) => $.detail.progress_panel.summary, { count: progress.scope, completed: progress.completed })}
</span>
@@ -129,8 +130,8 @@ function ProgressSummary({ progress }: { progress: ProjectProgress }) {
role="img"
aria-label={legend.map((item) => `${item.label} ${item.count}`).join(", ")}
>
- <div className="h-full bg-info transition-all" style={{ width: share(progress.completed) }} />
- <div className="h-full bg-warning transition-all" style={{ width: share(progress.started) }} />
+ <div className="h-full bg-info transition-[width] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none" style={{ width: share(progress.completed) }} />
+ <div className="h-full bg-warning transition-[width] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none" style={{ width: share(progress.started) }} />
</div>
<div className="flex flex-wrap gap-x-3 gap-y-1 text-caption text-muted-foreground">
{legend.map((item) => (
@@ -341,7 +342,7 @@ function BreakdownRow({
</span>
<span className="h-1.5 w-16 shrink-0 overflow-hidden rounded-full bg-muted">
<span
- className="block h-full rounded-full bg-info"
+ className="block h-full rounded-full bg-info transition-[width] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none"
style={{ width: `${scope > 0 ? (completed / scope) * 100 : 0}%` }}
/>
</span>
diff --git a/packages/views/rich-content/rich-table.tsx b/packages/views/rich-content/rich-table.tsx
index 63f8ee3ff1..5f02e3c7d6 100644
--- a/packages/views/rich-content/rich-table.tsx
+++ b/packages/views/rich-content/rich-table.tsx
@@ -485,20 +485,24 @@ export function RichTableFrame({ model, getMarkdown, tableRef: onTable, children
</div>
{/* Columns continue past the edge: a shadow, not a fade to a background
colour, because the same table renders on cards, pages and chat. */}
- {overflow.start && (
- <div
- aria-hidden
- className="pointer-events-none absolute inset-y-px left-px w-3 rounded-l-[var(--radius)]"
- style={{ background: `linear-gradient(to right, ${SCROLL_SHADOW}, transparent)` }}
- />
- )}
- {overflow.end && (
- <div
- aria-hidden
- className="pointer-events-none absolute inset-y-px right-px w-3 rounded-r-[var(--radius)]"
- style={{ background: `linear-gradient(to left, ${SCROLL_SHADOW}, transparent)` }}
- />
- )}
+ <div
+ aria-hidden
+ data-overflow-shadow={overflow.start ? "start" : undefined}
+ className={cn(
+ "pointer-events-none absolute inset-y-px left-px w-3 rounded-l-[var(--radius)] transition-opacity duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ overflow.start ? "opacity-100" : "opacity-0",
+ )}
+ style={{ background: `linear-gradient(to right, ${SCROLL_SHADOW}, transparent)` }}
+ />
+ <div
+ aria-hidden
+ data-overflow-shadow={overflow.end ? "end" : undefined}
+ className={cn(
+ "pointer-events-none absolute inset-y-px right-px w-3 rounded-r-[var(--radius)] transition-opacity duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ overflow.end ? "opacity-100" : "opacity-0",
+ )}
+ style={{ background: `linear-gradient(to left, ${SCROLL_SHADOW}, transparent)` }}
+ />
</div>
{expanded && (
<RichTableDialog model={model} open={expanded} onOpenChange={setExpanded} getMarkdown={getMarkdown} />
diff --git a/packages/views/runtimes/components/rate-limit-section.tsx b/packages/views/runtimes/components/rate-limit-section.tsx
index 45bac2d756..020dd5503b 100644
--- a/packages/views/runtimes/components/rate-limit-section.tsx
+++ b/packages/views/runtimes/components/rate-limit-section.tsx
@@ -203,7 +203,10 @@ function Meter({
className={cn("relative h-2 rounded-full bg-foreground/10", className)}
>
<div
- className={cn("absolute inset-y-0 left-0 rounded-full", FILL_TONE[view.tone])}
+ className={cn(
+ "absolute inset-y-0 left-0 rounded-full transition-[width,background-color] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none",
+ FILL_TONE[view.tone],
+ )}
style={{ width: `${Math.min(used, 100)}%` }}
/>
{view.elapsedPercent !== undefined && !view.limited && (
@@ -212,7 +215,7 @@ function Meter({
<div
aria-hidden="true"
data-slot="rate-limit-pace"
- className="absolute -inset-y-1 w-0.5 -translate-x-1/2 rounded-full bg-foreground/50"
+ className="absolute -inset-y-1 w-0.5 -translate-x-1/2 rounded-full bg-foreground/50 transition-[left] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none"
style={{ left: `${view.elapsedPercent}%` }}
/>
)}
diff --git a/packages/views/settings/components/settings-layout.tsx b/packages/views/settings/components/settings-layout.tsx
index 2081f55634..8b64880a85 100644
--- a/packages/views/settings/components/settings-layout.tsx
+++ b/packages/views/settings/components/settings-layout.tsx
@@ -8,7 +8,8 @@ import {
type ReactNode,
} from "react";
import { createPortal } from "react-dom";
-import { motion } from "motion/react";
+import { AnimatePresence, motion } from "motion/react";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import {
AlertCircle,
Building2,
@@ -462,12 +463,12 @@ export function SettingsSaveState({
savedLabel: string;
errorLabel: string;
}) {
- if (status === "idle") return null;
+ const reduceMotion = useReducedMotion();
const content =
status === "saving" ? (
<>
- <Loader2 className="size-3 animate-spin" />
+ <Loader2 className="size-3 animate-spin motion-reduce:animate-none" />
{savingLabel}
</>
) : status === "saved" ? (
@@ -475,22 +476,37 @@ export function SettingsSaveState({
<Check className="size-3 text-success" />
{savedLabel}
</>
- ) : (
+ ) : status === "error" ? (
<>
<AlertCircle className="size-3 text-destructive" />
{errorLabel}
</>
- );
+ ) : null;
return (
- <span
- role="status"
- className={cn(
- "inline-flex items-center gap-1.5 text-caption text-muted-foreground",
- status === "error" && "text-destructive",
+ <AnimatePresence mode="wait" initial={false}>
+ {status !== "idle" && (
+ <motion.span
+ key={status}
+ role="status"
+ initial={reduceMotion ? false : { opacity: 0, y: 2 }}
+ animate={{
+ opacity: 1,
+ y: 0,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast, ease: UI_EASE_OUT },
+ }}
+ exit={{
+ opacity: 0,
+ transition: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }}
+ className={cn(
+ "inline-flex items-center gap-1.5 text-caption text-muted-foreground",
+ status === "error" && "text-destructive",
+ )}
+ >
+ {content}
+ </motion.span>
)}
- >
- {content}
- </span>
+ </AnimatePresence>
);
}
diff --git a/packages/views/voice/voice-ui.tsx b/packages/views/voice/voice-ui.tsx
index 667eeef452..1547972c30 100644
--- a/packages/views/voice/voice-ui.tsx
+++ b/packages/views/voice/voice-ui.tsx
@@ -8,7 +8,7 @@ import { Button } from "@multica/ui/components/ui/button";
import { IconButton } from "@multica/ui/components/common/icon-button";
import { ShimmerText } from "@multica/ui/components/common/shimmer-text";
import { SubmitButton } from "@multica/ui/components/common/submit-button";
-import { UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
+import { UI_EASE_IN, UI_EASE_OUT, UI_MOTION_DURATION } from "@multica/ui/lib/motion";
import { cn } from "@multica/ui/lib/utils";
import { createShortcutChord } from "@multica/core/shortcuts";
import {
@@ -290,48 +290,66 @@ export function VoiceStrip({ voice }: { voice: ComposerVoice }) {
*/
export function VoiceHud({ voice }: { voice: ComposerVoice }) {
const { t } = useT("editor");
- const prefersReducedMotion = useReducedMotion();
+ const reduceMotion = useReducedMotion();
const phase = voice.session?.phase;
+ const isRecording = phase === "recording";
+
return (
- <div className="pointer-events-none absolute bottom-full left-1/2 z-30 mb-3 -translate-x-1/2">
+ <div className="pointer-events-none absolute inset-x-0 bottom-full z-30 mb-3 flex justify-center">
<AnimatePresence>
{voice.showHud && (
<motion.div
key="voice-hud"
+ layout={!reduceMotion}
role="status"
- initial={{
- opacity: 0,
- y: prefersReducedMotion ? 0 : 6,
- scale: prefersReducedMotion ? 1 : 0.96,
- }}
- animate={{ opacity: 1, y: 0, scale: 1 }}
- exit={{
- opacity: 0,
- y: prefersReducedMotion ? 0 : 6,
- scale: prefersReducedMotion ? 1 : 0.96,
+ initial={reduceMotion ? false : { opacity: 0, y: 6, scale: 0.96 }}
+ animate={{
+ opacity: 1,
+ y: 0,
+ scale: 1,
+ transition: {
+ duration: reduceMotion ? 0 : UI_MOTION_DURATION.fast,
+ ease: UI_EASE_OUT,
+ layout: { duration: reduceMotion ? 0 : UI_MOTION_DURATION.standard, ease: UI_EASE_OUT },
+ },
}}
- transition={{
- duration: prefersReducedMotion ? 0 : UI_MOTION_DURATION.fast,
- ease: UI_EASE_OUT,
- }}
- className="flex h-10 items-center gap-2.5 whitespace-nowrap rounded-full bg-multica-ink pl-3.5 pr-4 text-multica-paper shadow-[var(--floating-shadow)]"
+ exit={
+ reduceMotion
+ ? { opacity: 0, transition: { duration: 0 } }
+ : {
+ opacity: 0,
+ y: 4,
+ scale: 0.96,
+ transition: { duration: UI_MOTION_DURATION.micro, ease: UI_EASE_IN },
+ }
+ }
+ className="flex h-10 items-center overflow-hidden whitespace-nowrap rounded-full bg-multica-ink pl-3.5 pr-4 text-multica-paper shadow-[var(--floating-shadow)]"
>
- {phase === "recording" ? (
- <>
- <RecDot className="bg-[#ff5a52]" />
- <span className="sr-only">{t(($) => $.voice.recording)}</span>
- <Waveform density="hud" className="w-[86px]" />
- <Elapsed className="opacity-70" />
- <span className="text-caption opacity-70">{t(($) => $.voice.release_to_insert)}</span>
- </>
- ) : (
- <>
- <Mic className="size-4 opacity-70" />
- <span className="text-caption opacity-80">
- {phase === "transcribing" ? t(($) => $.voice.transcribing) : t(($) => $.voice.requesting)}
- </span>
- </>
- )}
+ <motion.div
+ key={isRecording ? "recording" : phase ?? "idle"}
+ layout={false}
+ initial={reduceMotion ? false : { opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: reduceMotion ? 0 : 0.12, ease: UI_EASE_OUT }}
+ className="flex items-center gap-2.5"
+ >
+ {isRecording ? (
+ <>
+ <RecDot className="bg-[#ff5a52]" />
+ <span className="sr-only">{t(($) => $.voice.recording)}</span>
+ <Waveform density="hud" className="w-[86px]" />
+ <Elapsed className="opacity-70" />
+ <span className="text-caption opacity-70">{t(($) => $.voice.release_to_insert)}</span>
+ </>
+ ) : (
+ <>
+ <Mic className="size-4 opacity-70" />
+ <span className="text-caption opacity-80">
+ {phase === "transcribing" ? t(($) => $.voice.transcribing) : t(($) => $.voice.requesting)}
+ </span>
+ </>
+ )}
+ </motion.div>
</motion.div>
)}
</AnimatePresence>