From ac4b0c956981265de53ab6f2bbb878966d3ae8c2 Mon Sep 17 00:00:00 2001 From: Tasnim Zulfiqar Date: Thu, 14 Aug 2025 19:44:15 -0400 Subject: [PATCH 1/3] Refactored return statement in App.jsx --- src/App.jsx | 954 ++------------------------------ src/components/EdgeDetails.jsx | 73 +++ src/components/GraphView.jsx | 249 +++++++++ src/components/ResultsPanel.jsx | 67 +++ src/components/SolverPanel.jsx | 369 ++++++++++++ src/components/TopBar.jsx | 124 +++++ src/styles/UI.js | 10 + 7 files changed, 948 insertions(+), 898 deletions(-) create mode 100644 src/components/EdgeDetails.jsx create mode 100644 src/components/GraphView.jsx create mode 100644 src/components/ResultsPanel.jsx create mode 100644 src/components/SolverPanel.jsx create mode 100644 src/components/TopBar.jsx create mode 100644 src/styles/UI.js diff --git a/src/App.jsx b/src/App.jsx index 1ae99eea..c6f660d0 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -26,6 +26,14 @@ import LogDock from './components/LogDock.jsx'; import { createFunctionNode } from './components/nodes/FunctionNode.jsx'; +//return refactor (WIP) +import { styles } from './styles/UI.js'; +import TopBar from './components/TopBar.jsx'; +import GraphView from './components/GraphView.jsx'; +import EdgeDetails from './components/EdgeDetails.jsx'; +import SolverPanel from './components/SolverPanel.jsx'; +import ResultsPanel from './components/ResultsPanel.jsx'; + // * Declaring variables * // Default solver parameters @@ -952,420 +960,44 @@ const DnDFlow = () => { return (
- {/* Tab Navigation */} -
-
-

- PathView -

- - - - - -
- -
- {/* GitHub Link */} - { - e.target.style.backgroundColor = '#1b1f23'; - e.target.style.transform = 'translateY(-1px)'; - e.target.style.boxShadow = '0 4px 12px rgba(36, 41, 46, 0.4)'; - }} - onMouseLeave={(e) => { - e.target.style.backgroundColor = '#000000ff'; - e.target.style.transform = 'translateY(0)'; - e.target.style.boxShadow = '0 2px 6px rgba(36, 41, 46, 0.3)'; - }} - title="View on GitHub" - > - - - - - - {/* Help Button */} - -
-
+ {/* Tab Navigation */} + {/* Graph Editor Tab */} {activeTab === 'graph' && ( -
- {/* Sidebar */} -
+
+
- {/* Main Graph Area */} -
-
- - - - - - {menu && } - {copyFeedback && ( -
- {copyFeedback} -
- )} - - - - - - - - - - {showKeyboardShortcuts && ( -
-
- Keyboard Shortcuts: - -
- Ctrl+C: Copy selected node
- Ctrl+V: Paste copied node
- Ctrl+D: Duplicate selected node
- Del/Backspace: Delete selection
- Right-click: Context menu -
- )} -
-
-
+ + {/* Node Sidebar */} { isDocumentationExpanded={isDocumentationExpanded} setIsDocumentationExpanded={setIsDocumentationExpanded} /> - {selectedEdge && ( -
-
-

Selected Edge

-
- ID: {selectedEdge.id} -
-
- Source: {selectedEdge.source} -
-
- Target: {selectedEdge.target} -
-
- Type: {selectedEdge.type} -
- -
- - -
-
- )} + {/* Edge Details */} + setSelectedEdge(null)} + onDelete={deleteSelectedEdge} + />
)} @@ -1453,369 +1025,11 @@ const DnDFlow = () => { {/* Solver Parameters Tab */} {activeTab === 'solver' && ( -
-
-

- Solver Parameters -

-
-
-
- - setSolverParams({ ...solverParams, dt: e.target.value })} - style={{ - width: '95%', - padding: '10px', - borderRadius: '5px', - border: '1px solid #555', - backgroundColor: '#1e1e2f', - color: '#ffffff', - fontSize: '14px' - }} - /> -
- -
- - setSolverParams({ ...solverParams, dt_min: e.target.value })} - style={{ - width: '95%', - padding: '10px', - borderRadius: '5px', - border: '1px solid #555', - backgroundColor: '#1e1e2f', - color: '#ffffff', - fontSize: '14px' - }} - /> -
- -
- - setSolverParams({ ...solverParams, dt_max: e.target.value })} - style={{ - width: '95%', - padding: '10px', - borderRadius: '5px', - border: '1px solid #555', - backgroundColor: '#1e1e2f', - color: '#ffffff', - fontSize: '14px' - }} - /> -
- -
- - -
- -
- - setSolverParams({ ...solverParams, tolerance_fpi: e.target.value })} - style={{ - width: '95%', - padding: '10px', - borderRadius: '5px', - border: '1px solid #555', - backgroundColor: '#1e1e2f', - color: '#ffffff', - fontSize: '14px' - }} - /> -
- -
- - setSolverParams({ ...solverParams, iterations_max: e.target.value })} - style={{ - width: '95%', - padding: '10px', - borderRadius: '5px', - border: '1px solid #555', - backgroundColor: '#1e1e2f', - color: '#ffffff', - fontSize: '14px' - }} - /> -
- -
- - setSolverParams({ ...solverParams, simulation_duration: e.target.value })} - style={{ - width: '95%', - padding: '10px', - borderRadius: '5px', - border: '1px solid #555', - backgroundColor: '#1e1e2f', - color: '#ffffff', - fontSize: '14px' - }} - /> -
- -
- -
- -
- -