Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(chat): support fullscreen expand mode (#2043)
Jiayuan Zhangfbf9460d5eb3
diff --git a/packages/views/chat/components/chat-window.tsx b/packages/views/chat/components/chat-window.tsxindex f48d4d9d9c..9ec45d3168 100644--- a/packages/views/chat/components/chat-window.tsx+++ b/packages/views/chat/components/chat-window.tsx@@ -2,6 +2,7 @@import React, { useCallback, useEffect, useMemo, useRef } from "react";import { useQuery, useQueryClient } from "@tanstack/react-query";+import { motion } from "motion/react";import { Minus, Maximize2, Minimize2, ChevronDown, Plus, Check } from "lucide-react";import { Button } from "@multica/ui/components/ui/button";import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";@@ -334,6 +335,8 @@ export function ChatWindow() {setOpen(false);}, [activeSessionId, pendingTaskId, setOpen]);+ const isExpanded = useChatStore((s) => s.isExpanded);+const windowRef = useRef<HTMLDivElement>(null);const { renderWidth, renderHeight, isAtMax, boundsReady, isDragging, toggleExpand, startDrag } = useChatResize(windowRef);@@ -341,24 +344,37 @@ export function ChatWindow() {// a real message, or a pending task whose timeline will stream in.const hasMessages = messages.length > 0 || !!pendingTaskId;- const isVisible = isOpen && boundsReady;+ const isVisible = isOpen && (isExpanded || boundsReady);- const containerClass = "absolute bottom-2 right-2 z-50 flex flex-col rounded-xl ring-1 ring-foreground/10 bg-sidebar shadow-2xl overflow-hidden";+ const containerClass = isExpanded+ ? "absolute inset-3 z-50 flex flex-col rounded-xl ring-1 ring-foreground/10 bg-sidebar shadow-2xl overflow-hidden"+ : "absolute bottom-2 right-2 z-50 flex flex-col rounded-xl ring-1 ring-foreground/10 bg-sidebar shadow-2xl overflow-hidden";const containerStyle: React.CSSProperties = {- width: `${renderWidth}px`,- height: `${renderHeight}px`,- opacity: isVisible ? 1 : 0,- transform: isVisible ? "scale(1)" : "scale(0.95)",+ ...(!isExpanded ? { width: renderWidth, height: renderHeight } : {}),transformOrigin: "bottom right",pointerEvents: isOpen ? "auto" : "none",- transition: isDragging- ? "none"- : "width 200ms ease-out, height 200ms ease-out, opacity 150ms ease-out, transform 150ms ease-out",};return (- <div ref={windowRef} className={containerClass} style={containerStyle}>- <ChatResizeHandles onDragStart={startDrag} />+ <motion.div+ ref={windowRef}+ className={containerClass}+ style={containerStyle}+ layout="position"+ initial={{ opacity: 0, scale: 0.95 }}+ animate={{+ opacity: isVisible ? 1 : 0,+ scale: isVisible ? 1 : 0.95,+ }}+ transition={{+ layout: isDragging+ ? { duration: 0 }+ : { type: "spring", duration: 0.3, bounce: 0 },+ opacity: { duration: 0.15 },+ scale: { type: "spring", duration: 0.2, bounce: 0 },+ }}+ >+ {!isExpanded && <ChatResizeHandles onDragStart={startDrag} />}{/* Header — ⊕ new + session dropdown | window tools */}<div className="flex items-center justify-between border-b px-4 py-2.5 gap-2"><div className="flex items-center gap-1 min-w-0">@@ -398,10 +414,10 @@ export function ChatWindow() {/>}>- {isAtMax ? <Minimize2 /> : <Maximize2 />}+ {isExpanded || isAtMax ? <Minimize2 /> : <Maximize2 />}</TooltipTrigger><TooltipContent side="top">- {isAtMax ? "Restore" : "Expand"}+ {isExpanded || isAtMax ? "Restore" : "Fullscreen"}</TooltipContent></Tooltip><Tooltip>@@ -474,7 +490,7 @@ export function ChatWindow() {}rightAdornment={<ContextAnchorButton />}/>- </div>+ </motion.div>);}diff --git a/packages/views/package.json b/packages/views/package.jsonindex 753e1564d5..630d4d9de5 100644--- a/packages/views/package.json+++ b/packages/views/package.json@@ -74,6 +74,7 @@"katex": "catalog:","lowlight": "^3.3.0","mermaid": "catalog:",+ "motion": "^12.38.0","react-markdown": "^10.1.0","react-resizable-panels": "^4.7.5","recharts": "3.8.0",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex c2093ae613..36de54b446 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -745,6 +745,9 @@ importers:mermaid:specifier: 'catalog:'version: 11.14.0+ motion:+ specifier: ^12.38.0react:specifier: 'catalog:'version: 19.2.3@@ -4499,6 +4502,20 @@ packages:resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}engines: {node: '>= 0.6'}+ resolution: {integrity: sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g==}+ peerDependencies:+ '@emotion/is-prop-valid': '*'+ react: ^18.0.0 || ^19.0.0+ react-dom: ^18.0.0 || ^19.0.0+ peerDependenciesMeta:+ '@emotion/is-prop-valid':+ optional: true+ react:+ optional: true+ react-dom:+ optional: true+resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}engines: {node: '>= 0.8'}@@ -5746,6 +5763,26 @@ packages:resolution: {integrity: sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==}+ resolution: {integrity: sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA==}++ resolution: {integrity: sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg==}++ resolution: {integrity: sha512-uYfXzeHlgThchzwz5Te47dlv5JOUC7OB4rjJ/7XTUgtBZD8CchMN8qEJ4ZVsUmTyYA44zjV0fBwsiktRuFnn+w==}+ peerDependencies:+ '@emotion/is-prop-valid': '*'+ react: ^18.0.0 || ^19.0.0+ react-dom: ^18.0.0 || ^19.0.0+ peerDependenciesMeta:+ '@emotion/is-prop-valid':+ optional: true+ react:+ optional: true+ react-dom:+ optional: true+resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}@@ -11490,6 +11527,15 @@ snapshots:+ dependencies:+ motion-dom: 12.38.0+ motion-utils: 12.36.0+ tslib: 2.8.1+ optionalDependencies:+ react: 19.2.3+ react-dom: 19.2.3([email protected])+@@ -13114,6 +13160,20 @@ snapshots:pkg-types: 1.3.1ufo: 1.6.3+ dependencies:+ motion-utils: 12.36.0++ [email protected]: {}++ dependencies:+ tslib: 2.8.1+ optionalDependencies:+ react: 19.2.3+ react-dom: 19.2.3([email protected])+