From 51c59e28b86145470307f306293613007b064be7 Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 23 Oct 2026 13:10:56 +0200 Subject: [PATCH] feat(assistant): TREK Studio's assistant floats in the planner's window instead of a column The column took the page's room and cut the spread off. The Studio now opens the same movable, resizable window as the planner, kept under its own key and below the Studio's bar; its frame moved into assistantFrame.ts and AssistantFrameEdges so both windows share it. --- .../Assistant/AssistantFrameEdges.tsx | 39 ++++++++++ .../components/Assistant/AssistantWindow.tsx | 77 ++++--------------- .../components/Assistant/assistantFrame.ts | 50 ++++++++++++ .../Studio/StudioAssistantPanel.test.tsx | 10 +-- .../Studio/StudioAssistantPanel.tsx | 77 ++++++++++++------- client/src/components/Studio/StudioShell.tsx | 4 +- client/src/styles/studio-assistant.css | 35 +-------- 7 files changed, 161 insertions(+), 131 deletions(-) create mode 100644 client/src/components/Assistant/AssistantFrameEdges.tsx create mode 100644 client/src/components/Assistant/assistantFrame.ts diff --git a/client/src/components/Assistant/AssistantFrameEdges.tsx b/client/src/components/Assistant/AssistantFrameEdges.tsx new file mode 100644 index 000000000..c51c6784e --- /dev/null +++ b/client/src/components/Assistant/AssistantFrameEdges.tsx @@ -0,0 +1,39 @@ +import type { ResizeEdge, useDragResize } from '../../hooks/useDragResize'; + +/** The invisible grips of the floating assistant window (assistantFrame.ts) along its edges and corners. */ + +const EDGES: { edge: ResizeEdge; className: string; cursor: 'ns' | 'ew' | 'corner-start' | 'corner-end' }[] = [ + { edge: 'n', className: 'inset-x-3 -top-1 h-2', cursor: 'ns' }, + { edge: 's', className: 'inset-x-3 -bottom-1 h-2', cursor: 'ns' }, + { edge: 'start', className: 'inset-y-3 -start-1 w-2', cursor: 'ew' }, + { edge: 'end', className: 'inset-y-3 -end-1 w-2', cursor: 'ew' }, + { edge: 'n-start', className: '-start-1 -top-1 h-4 w-4', cursor: 'corner-start' }, + { edge: 's-end', className: '-bottom-1 -end-1 h-4 w-4', cursor: 'corner-start' }, + { edge: 'n-end', className: '-end-1 -top-1 h-4 w-4', cursor: 'corner-end' }, + { edge: 's-start', className: '-bottom-1 -start-1 h-4 w-4', cursor: 'corner-end' }, +]; + +function edgeCursor(kind: (typeof EDGES)[number]['cursor'], rtl: boolean): string { + if (kind === 'ns') return 'ns-resize'; + if (kind === 'ew') return 'ew-resize'; + // The top-start corner is the top left in a left-to-right page and the top right in Arabic. + return (kind === 'corner-start') !== rtl ? 'nwse-resize' : 'nesw-resize'; +} + +/** The invisible grips along the frame's edges and corners. */ +export default function AssistantFrameEdges({ frame }: { frame: ReturnType }) { + const rtl = typeof document !== 'undefined' && document.documentElement.dir === 'rtl'; + return ( + <> + {EDGES.map(({ edge, className, cursor }) => ( +