MCPcopy Create free account
hub / github.com/ScrapeGraphAI/scrapecraft / SplitView

Function SplitView

frontend/src/components/Layout/SplitView.tsx:6–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import WorkflowSidebar from '../Workflow/WorkflowSidebar';
5
6const SplitView: React.FC = () => {
7 const [splitPosition, setSplitPosition] = useState(40); // 40% for chat
8 const [isDragging, setIsDragging] = useState(false);
9
10 const handleMouseDown = () => {
11 setIsDragging(true);
12 };
13
14 const handleMouseMove = (e: React.MouseEvent) => {
15 if (!isDragging) return;
16
17 const container = e.currentTarget;
18 const rect = container.getBoundingClientRect();
19 const x = e.clientX - rect.left;
20 const percentage = (x / rect.width) * 100;
21
22 setSplitPosition(Math.min(Math.max(percentage, 20), 80));
23 };
24
25 const handleMouseUp = () => {
26 setIsDragging(false);
27 };
28
29 return (
30 <div className="flex h-full">
31 {/* Workflow Sidebar */}
32 <WorkflowSidebar />
33
34 {/* Main Content Area */}
35 <div
36 className="flex-1 flex h-full relative"
37 onMouseMove={handleMouseMove}
38 onMouseUp={handleMouseUp}
39 onMouseLeave={handleMouseUp}
40 >
41 {/* Chat Panel */}
42 <div
43 className="h-full border-r border-border"
44 style={{ width: `${splitPosition}%` }}
45 >
46 <ChatContainer />
47 </div>
48
49 {/* Resizer */}
50 <div
51 className="absolute top-0 h-full w-1 cursor-col-resize hover:bg-primary/50 transition-colors"
52 style={{ left: `${splitPosition}%`, marginLeft: '-2px' }}
53 onMouseDown={handleMouseDown}
54 />
55
56 {/* Pipeline Panel */}
57 <div
58 className="h-full"
59 style={{ width: `${100 - splitPosition}%` }}
60 >
61 <PipelinePanel />
62 </div>
63 </div>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected