Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions packages/devtools/src/components/devtools-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ export function DevtoolsPanel({

// Resize functionality
const [isResizing, setIsResizing] = useState(false);
const [panelHeight, setPanelHeight] = useState(config.height || 300);
const [panelWidth, setPanelWidth] = useState(config.width || 500);
const panelRef = useRef<HTMLDivElement>(null);
const resizeRef = useRef<HTMLButtonElement>(null);
const minHeight = 400;
const minWidth = 500;

// Animation state for REC indicator
const [isReceivingEvents, setIsReceivingEvents] = useState(false);
Expand Down Expand Up @@ -227,14 +227,18 @@ export function DevtoolsPanel({

if (config.position === "bottom") {
const newHeight = window.innerHeight - e.clientY;
const minHeight = 200;
const maxHeight = window.innerHeight * 0.8;
setPanelHeight(Math.max(minHeight, Math.min(maxHeight, newHeight)));
const newPanelHeight = Math.max(minHeight, Math.min(maxHeight, newHeight));

document.documentElement.style.removeProperty('--ai-devtools-panel-width');
document.documentElement.style.setProperty('--ai-devtools-panel-height', `${newPanelHeight}px`);
} else {
const newWidth = window.innerWidth - e.clientX;
const minWidth = 500;
const maxWidth = window.innerWidth * 0.8;
setPanelWidth(Math.max(minWidth, Math.min(maxWidth, newWidth)));
const newPanelWidth = Math.max(minWidth, Math.min(maxWidth, newWidth));

document.documentElement.style.removeProperty('--ai-devtools-panel-height');
document.documentElement.style.setProperty('--ai-devtools-panel-width', `${newPanelWidth}px`);
}
},
[isResizing, config.position],
Expand Down Expand Up @@ -350,8 +354,8 @@ export function DevtoolsPanel({
ref={panelRef}
className={`ai-devtools-panel ai-devtools-panel-${config.position} ${className}`}
style={{
height: config.position === "bottom" ? panelHeight : undefined,
width: config.position === "right" ? panelWidth : undefined,
height: config.position === "bottom" ? `var(--ai-devtools-panel-height, ${minHeight}px)` : undefined,
width: config.position === "right" ? `var(--ai-devtools-panel-width, ${minWidth}px)` : undefined,
}}
>
{/* Resize Handle */}
Expand Down