@@ -48,6 +48,7 @@ const DnDFlow = () => {
4848 const [ nodes , setNodes , onNodesChange ] = useNodesState ( initialNodes ) ;
4949 const [ edges , setEdges , onEdgesChange ] = useEdgesState ( initialEdges ) ;
5050 const [ selectedNode , setSelectedNode ] = useState ( null ) ;
51+ const [ sidebarVisible , setSidebarVisible ] = useState ( true ) ;
5152 const [ activeTab , setActiveTab ] = useState ( 'graph' ) ;
5253 const [ simulationResults , setSimulationResults ] = useState ( null ) ;
5354 const [ selectedEdge , setSelectedEdge ] = useState ( null ) ;
@@ -957,9 +958,74 @@ const DnDFlow = () => {
957958 { /* Graph Editor Tab */ }
958959 { activeTab === 'graph' && (
959960 < div style = { { display : 'flex' , flex : 1 , height : 'calc(100vh - 50px)' , overflow : 'hidden' } } >
960- < div style = { { width : 250 , height : '100%' , borderRight : '1px solid #ccc' } } >
961- < Sidebar />
962- </ div >
961+ { /* Sidebar Toggle Button */ }
962+ < button
963+ onClick = { ( ) => setSidebarVisible ( ! sidebarVisible ) }
964+ style = { {
965+ position : 'absolute' ,
966+ top : '60px' ,
967+ left : sidebarVisible ? '240px' : '10px' ,
968+ zIndex : 1000 ,
969+ backgroundColor : '#2c2c54' ,
970+ color : '#ffffff' ,
971+ border : '1px solid #555' ,
972+ borderRadius : '4px' ,
973+ width : '32px' ,
974+ height : '32px' ,
975+ cursor : 'pointer' ,
976+ display : 'flex' ,
977+ alignItems : 'center' ,
978+ justifyContent : 'center' ,
979+ transition : 'left 0.3s ease' ,
980+ boxShadow : '0 2px 4px rgba(0,0,0,0.3)' ,
981+ padding : '4px'
982+ } }
983+ onMouseEnter = { ( e ) => {
984+ e . target . style . backgroundColor = '#3c3c64' ;
985+ e . target . style . borderColor = '#78A083' ;
986+ } }
987+ onMouseLeave = { ( e ) => {
988+ e . target . style . backgroundColor = '#2c2c54' ;
989+ e . target . style . borderColor = '#555' ;
990+ } }
991+ title = { sidebarVisible ? 'Hide Sidebar' : 'Show Sidebar' }
992+ >
993+ < svg
994+ width = "20"
995+ height = "20"
996+ viewBox = "0 0 24 24"
997+ fill = "none"
998+ xmlns = "http://www.w3.org/2000/svg"
999+ >
1000+ { sidebarVisible ? (
1001+ // Hide sidebar icon (sidebar with left arrow)
1002+ < >
1003+ < rect x = "2" y = "3" width = "6" height = "18" rx = "1" fill = "currentColor" opacity = "0.3" />
1004+ < rect x = "10" y = "3" width = "12" height = "18" rx = "1" stroke = "currentColor" strokeWidth = "1.5" fill = "none" />
1005+ < path d = "M6 12L4 10M6 12L4 14M6 12H1" stroke = "currentColor" strokeWidth = "1.5" strokeLinecap = "round" strokeLinejoin = "round" />
1006+ </ >
1007+ ) : (
1008+ // Show sidebar icon (sidebar with right arrow)
1009+ < >
1010+ < rect x = "2" y = "3" width = "6" height = "18" rx = "1" stroke = "currentColor" strokeWidth = "1.5" fill = "none" />
1011+ < rect x = "10" y = "3" width = "12" height = "18" rx = "1" stroke = "currentColor" strokeWidth = "1.5" fill = "none" />
1012+ < path d = "M5 12L7 10M5 12L7 14M5 12H10" stroke = "currentColor" strokeWidth = "1.5" strokeLinecap = "round" strokeLinejoin = "round" />
1013+ </ >
1014+ ) }
1015+ </ svg >
1016+ </ button >
1017+
1018+ { /* Sidebar */ }
1019+ { sidebarVisible && (
1020+ < div style = { {
1021+ width : 250 ,
1022+ height : '100%' ,
1023+ borderRight : '1px solid #ccc' ,
1024+ transition : 'width 0.3s ease'
1025+ } } >
1026+ < Sidebar />
1027+ </ div >
1028+ ) }
9631029
9641030 < GraphView
9651031 refEl = { ref }
0 commit comments