Skip to content

Commit 0970d03

Browse files
committed
update simple search agent
1 parent 20549b7 commit 0970d03

File tree

4 files changed

+9
-599
lines changed

4 files changed

+9
-599
lines changed

visual-tree-search-app/components/LiveBrowserView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React from 'react';
22

33
interface LiveBrowserViewProps {
44
liveBrowserUrl: string | null;
5-
splitPosition: number;
5+
width: string;
66
}
77

8-
const LiveBrowserView: React.FC<LiveBrowserViewProps> = ({ liveBrowserUrl, splitPosition }) => {
8+
const LiveBrowserView: React.FC<LiveBrowserViewProps> = ({ liveBrowserUrl, width }) => {
99
return (
1010
<div
11-
className="absolute top-0 bottom-0 left-0 overflow-hidden bg-white dark:bg-slate-800 rounded-l-lg"
12-
style={{ width: `${splitPosition}%` }}
11+
className="bg-white dark:bg-slate-800 rounded-l-lg overflow-hidden"
12+
style={{ width }}
1313
>
1414
<div className="p-3 border-b border-slate-200 dark:border-slate-700 bg-gradient-to-r from-sky-50 to-white dark:from-slate-900 dark:to-slate-800">
1515
<h2 className="text-lg font-semibold text-sky-950 dark:text-sky-100 flex items-center">

visual-tree-search-app/pages/SimpleSearchAgent.tsx

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,8 @@ const TreeSearchPlayground = () => {
8888
maxDepth: 3
8989
});
9090

91-
// Add sessionId state
9291
const [sessionId, setSessionId] = useState<string | null>(null);
93-
94-
// Remove these unused states
95-
// const [showParameters, setShowParameters] = useState(true); // Remove this line
96-
const [splitPosition, setSplitPosition] = useState(70);
97-
const [isDragging, setIsDragging] = useState(false);
9892
const [isSearching, setIsSearching] = useState(false);
99-
const splitPaneRef = useRef<HTMLDivElement>(null);
10093

10194
// Initialize backend URL from env variable
10295
useEffect(() => {
@@ -342,40 +335,6 @@ const TreeSearchPlayground = () => {
342335
}));
343336
};
344337

345-
// Handle resizing
346-
const handleMouseDown = (e: React.MouseEvent) => {
347-
e.preventDefault();
348-
setIsDragging(true);
349-
};
350-
351-
useEffect(() => {
352-
const handleMouseMove = (e: MouseEvent) => {
353-
if (!isDragging || !splitPaneRef.current) return;
354-
355-
const containerRect = splitPaneRef.current.getBoundingClientRect();
356-
const newPosition = ((e.clientX - containerRect.left) / containerRect.width) * 100;
357-
358-
// Limit the split position between 30% and 70%
359-
if (newPosition >= 30 && newPosition <= 80) {
360-
setSplitPosition(newPosition);
361-
}
362-
};
363-
364-
const handleMouseUp = () => {
365-
setIsDragging(false);
366-
};
367-
368-
if (isDragging) {
369-
document.addEventListener('mousemove', handleMouseMove);
370-
document.addEventListener('mouseup', handleMouseUp);
371-
}
372-
373-
return () => {
374-
document.removeEventListener('mousemove', handleMouseMove);
375-
document.removeEventListener('mouseup', handleMouseUp);
376-
};
377-
}, [isDragging]);
378-
379338
return (
380339
<div className="min-h-screen bg-gradient-to-b from-sky-50 to-white dark:from-slate-900 dark:to-slate-800 pb-4 w-full flex flex-col">
381340
<ControlPanel
@@ -387,29 +346,17 @@ const TreeSearchPlayground = () => {
387346
connected={connected}
388347
/>
389348

390-
{/* Main content area - Resizable Split View */}
349+
{/* Main content area - Split View */}
391350
<div className="flex-1 px-4 mt-4 overflow-hidden">
392-
<div ref={splitPaneRef} className="relative h-[calc(100vh-270px)] rounded-lg overflow-hidden shadow-lg">
351+
<div className="flex h-[calc(100vh-270px)] rounded-lg overflow-hidden shadow-lg">
393352
{/* Browser View Container */}
394353
<LiveBrowserView
395354
liveBrowserUrl={liveBrowserUrl}
396-
splitPosition={splitPosition}
355+
width="70%"
397356
/>
398357

399-
{/* Resizable handle - Absolute positioned */}
400-
<div
401-
className="absolute top-0 bottom-0 w-4 cursor-col-resize flex items-center justify-center hover:bg-sky-100 dark:hover:bg-sky-900/30 transition-colors z-10"
402-
style={{ left: `calc(${splitPosition}% - 8px)` }}
403-
onMouseDown={handleMouseDown}
404-
>
405-
<div className="h-16 w-1 bg-sky-300 dark:bg-sky-600 rounded"></div>
406-
</div>
407-
408-
{/* Tree Visualization Container - Absolute positioned with percentage width */}
409-
<div
410-
className="absolute top-0 bottom-0 right-0 overflow-hidden bg-white dark:bg-slate-800 rounded-r-lg"
411-
style={{ width: `${100 - splitPosition}%` }}
412-
>
358+
{/* Tree Visualization Container */}
359+
<div className="w-[30%] bg-white dark:bg-slate-800 rounded-r-lg overflow-hidden">
413360
<div className="p-3 border-b border-slate-200 dark:border-slate-700 bg-gradient-to-r from-sky-50 to-white dark:from-slate-900 dark:to-slate-800">
414361
<h2 className="text-lg font-semibold text-sky-950 dark:text-sky-100 flex items-center">
415362
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 mr-2 text-cyan-500" viewBox="0 0 20 20" fill="currentColor">

0 commit comments

Comments
 (0)