11import './App.css' ;
2- import { useContext , useEffect , useMemo , useState } from 'react' ;
3- import DropZone from './components/DropZone' ;
2+ import { useContext , useMemo , useState } from 'react' ;
43import { Button } from './components/ui/button' ;
54import Upload from "@/components/Upload.tsx" ;
65import GraphvizParent from "@/components/GraphvizParent.tsx" ;
76import FilterComponent from './components/FilterComponent.tsx' ;
87import SelfLoopSwitch from './components/selfLoopSwitch.tsx' ;
9- import Slider from '. /components/slider.tsx' ;
8+ import Slider from '@ /components/slider.tsx' ;
109import SequenceSelector from "@/components/SequenceSelector.tsx" ;
1110import { Context , SequenceCount } from "@/Context.tsx" ;
12- import { Separator } from "@/components/ui/separator"
11+ import {
12+ Popover ,
13+ PopoverContent ,
14+ PopoverTrigger ,
15+ } from "@/components/ui/popover"
16+
1317import Loading from './components/Loading.tsx' ;
1418
1519function App ( ) {
@@ -21,8 +25,7 @@ function App() {
2125 const [ selfLoops , setSelfLoops ] = useState < boolean > ( true ) ;
2226 // State to manage the minimum number of visits for displaying edges in the graph
2327 const [ minVisits , setMinVisits ] = useState < number > ( 0 ) ;
24- const [ menuVisible , setMenuVisible ] = useState ( false ) ;
25- const { resetData, setGraphData, data, setData, loading, error, setError, top5Sequences, setSelectedSequence, setLoading, selectedSequence, csvData, setCSVData } = useContext ( Context ) ;
28+ const { resetData, loading, error, setError, top5Sequences, setSelectedSequence, selectedSequence, csvData, setCSVData } = useContext ( Context ) ;
2629 const showControls = useMemo ( ( ) => {
2730 if ( loading == false && csvData . length > 0 ) {
2831 return true ;
@@ -46,7 +49,6 @@ function App() {
4649 setError ( errorMessage ) ;
4750 }
4851
49- const toggleMenu = ( ) => setMenuVisible ( ! menuVisible ) ;
5052 /**
5153 * Toggles the self-loops inclusion in the graph by switching the state.
5254 */
@@ -71,7 +73,7 @@ function App() {
7173 *
7274 * @param {boolean } loading - Whether the data is currently loading/processing.
7375 */
74-
76+
7577 // Rendering the components that allow user interaction and display the graph
7678 return (
7779 < div className = 'p-3' >
@@ -88,8 +90,8 @@ function App() {
8890 </ div >
8991 </ div >
9092 </ header >
91- { ! showControls && < Upload onDataProcessed = { handleDataProcessed } /> }
92-
93+ { ! showControls && < Upload onDataProcessed = { handleDataProcessed } /> }
94+
9395 { loading && < Loading /> }
9496 { /* Display Error Message */ }
9597 { error && (
@@ -103,8 +105,8 @@ function App() {
103105
104106 {
105107 showControls && (
106- < div className = "p-5 m-2" >
107-
108+ < div className = "p-5 m-2 flex flex-col gap-3 " >
109+
108110 < div className = "selected-sequence-bar flex justify-between bg-gray-200 p-4 mb-4" >
109111 < h2 className = "text-lg font-semibold" > Selected Sequence:</ h2 >
110112 { selectedSequence && (
@@ -114,37 +116,47 @@ function App() {
114116 ) }
115117 </ div >
116118 { /* Properties Button */ }
117- < button
118- className = "flex-auto top-10 left-10 bg-blue-500 text-white z-30 rounded-md p-4 mb-4"
119- onClick = { toggleMenu }
120- >
121- { menuVisible ? "Hide Properties" : "Show Properties" }
122- </ button >
123-
124- { /* Properties Menu */ }
125-
126- { menuVisible && (
127- < div className = "absolute top-50 left-4 p-4 bg-gray-200 z-30 shadow-lg w-85 rounded-lg" >
128- < h3 className = "text-md font-semibold mb-4" > Properties Menu</ h3 >
129- < FilterComponent onFilterChange = { setFilter } />
130- { /*{selectedSequence && (*/ }
131- { /* <h2>{selectedSequence.toString().split('->').join(' -> ')}</h2>*/ }
132- { /*)}*/ }
133- < SequenceSelector
134- onSequenceSelect = { handleSelectSequence }
135- sequences = { top5Sequences ! }
136- selectedSequence = { selectedSequence }
137- />
138- < SelfLoopSwitch isOn = { selfLoops } handleToggle = { handleToggle } />
139- < Slider
140- step = { 5 }
141- min = { 0 }
142- max = { 5000 }
143- value = { minVisits }
144- onChange = { handleSlider }
145- />
146- </ div >
147- ) }
119+ < Popover >
120+ < PopoverTrigger className = "w-fit bg-slate-500 p-3 rounded-lg text-white" > Properties</ PopoverTrigger >
121+ < PopoverContent className = "w-96 bg-white rounded-lg shadow-lg p-6 border border-gray-200 mx-10" >
122+ < div className = "flex flex-col space-y-6" >
123+ { /* Filter Section */ }
124+ < div className = "space-y-2" >
125+ < h3 className = "text-lg font-semibold text-gray-900" > Filters</ h3 >
126+ < FilterComponent onFilterChange = { setFilter } />
127+ </ div >
128+
129+ { /* Sequence Section */ }
130+ < div className = "space-y-2" >
131+ < h3 className = "text-lg font-semibold text-gray-900" > Sequences</ h3 >
132+ < SequenceSelector
133+ onSequenceSelect = { handleSelectSequence }
134+ sequences = { top5Sequences || [ ] }
135+ selectedSequence = { selectedSequence }
136+ />
137+ </ div >
138+
139+ { /* Controls Section */ }
140+ < div className = "space-y-4" >
141+ < div className = "pb-2 border-b border-gray-200" >
142+ < SelfLoopSwitch isOn = { selfLoops } handleToggle = { handleToggle } />
143+ </ div >
144+
145+ < div className = "space-y-2" >
146+ < label className = "text-sm font-medium text-gray-700" > Edge Visits</ label >
147+ < Slider
148+ step = { 5 }
149+ min = { 0 }
150+ max = { 5000 }
151+ value = { minVisits }
152+ onChange = { handleSlider }
153+ />
154+ </ div >
155+ </ div >
156+ </ div >
157+ </ PopoverContent >
158+ </ Popover >
159+
148160
149161 { /* Graph and Data Display */ }
150162 { ! loading && csvData && (
0 commit comments