diff --git a/client/src/App.jsx b/client/src/App.jsx index 33e47ac..a2cbd81 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -1,15 +1,34 @@ import { useState } from 'react' import Header from './components/layout/Header/Header.jsx'; import Sidebar from './components/layout/Sidebar/Sidebar.jsx'; -import Widget from './components/layout/Canvas/Widget.jsx' -import { Grid, GridItem, useRecipe } from "@chakra-ui/react" -import CanvasHeader from './components/layout/Canvas/CanvasHeader.jsx' +import Canvas from './components/layout/Canvas/Canvas.jsx'; +import { Grid, GridItem, useRecipe, Box } from '@chakra-ui/react'; + +// REMOVE AFTER TESTING +import CanvasHeader from './components/layout/Canvas/CanvasHeader.jsx'; +import { GridLayout } from 'react-grid-layout'; function App() { const recipe = useRecipe({ key: "canvas" }); const styles = recipe(); + // TEST TEST TEST +// return ( +// +// {/* ← This should render something visible */} +// {/* +// {layout.map((item) => ( +// +// +// +// ))} +// */} +// +// ); +// } + + return ( - - - - - - - - + {/* */} + + + + {/* + + */} + {/* */} ); diff --git a/client/src/components/layout/Canvas/Canvas.jsx b/client/src/components/layout/Canvas/Canvas.jsx new file mode 100644 index 0000000..06075a6 --- /dev/null +++ b/client/src/components/layout/Canvas/Canvas.jsx @@ -0,0 +1,45 @@ +// This component defines a generic Widget that can be dynamically resized and +// dragged inside the canvas +// Content not included, must be populated using custom charts plots and notifications +import { useState } from 'react'; +import CanvasHeader from './CanvasHeader'; +import GridLayout from 'react-grid-layout'; +import Widget from './Widget.jsx'; +import { Box } from '@chakra-ui/react'; + +export default function Canvas() { + // Define widgets initial position and size + // TODO Add dynamic adding/deleting of widgets via options button + const [layout, setLayout] = useState([ + { i: 'myWidget1', x: 0, y: 0, w: 3, h: 3, minH: 3, static: false }, + { i: 'myWidget2', x: 3, y: 0, w: 3, h: 3, minH: 3, static: false }, + { i: 'myWidget3', x: 6, y: 0, w: 3, h: 3, minH: 3, static: false } + ]); + + const onLayoutChange = (newLayout) => { + setLayout(newLayout); + console.log('Updated layout:', newLayout) + }; + + return ( + + + + {layout.map((item) => ( + + + + ))} + + + ); +} diff --git a/client/src/components/layout/Canvas/Widget.jsx b/client/src/components/layout/Canvas/Widget.jsx index b3413ad..b012bba 100644 --- a/client/src/components/layout/Canvas/Widget.jsx +++ b/client/src/components/layout/Canvas/Widget.jsx @@ -1,57 +1,76 @@ -// This component defines a generic Widget that can be dynamically resized and -// dragged inside the canvas -// Content not included, must be populated using custom charts plots and notifications - -import { useState } from 'react'; -import GridLayout from 'react-grid-layout'; - -export default function Widget() { - // Define widgets initial position and size - // TODO Add dynamic adding/deleting of widgets via options button - const [layout, setLayout] = useState([ - { i: 'myWidget1', x: 0, y: 0, w: 3, h: 3, minH: 3, static: false }, - { i: 'myWidget2', x: 3, y: 0, w: 3, h: 3, minH: 3, static: false }, - { i: 'myWidget3', x: 6, y: 0, w: 3, h: 3, minH: 3, static: false } - ]); - - const onLayoutChange = (newLayout) => { - setLayout(newLayout); - console.log('Updated layout:', newLayout) - }; - +// Widget.jsx +export default function Widget({ title }) { return ( - + - - - VDAP Widget - - - This is the widget content - drag or resize me! - - - - VDAP Widget - - - This is the widget content - drag or resize me! - - - - VDAP Widget - - - This is the widget content - drag or resize me! - - - + {title} + + + This is the widget content - drag or resize me! + + > ); -} + } + +// The below code has been moved to Canvas.jsx + +// // This component defines a generic Widget that can be dynamically resized and +// // dragged inside the canvas +// // Content not included, must be populated using custom charts plots and notifications + +// import { useState } from 'react'; +// import GridLayout from 'react-grid-layout'; + +// export default function Widget() { +// // Define widgets initial position and size +// // TODO Add dynamic adding/deleting of widgets via options button +// const [layout, setLayout] = useState([ +// { i: 'myWidget1', x: 0, y: 0, w: 3, h: 3, minH: 3, static: false }, +// { i: 'myWidget2', x: 3, y: 0, w: 3, h: 3, minH: 3, static: false }, +// { i: 'myWidget3', x: 6, y: 0, w: 3, h: 3, minH: 3, static: false } +// ]); + +// const onLayoutChange = (newLayout) => { +// setLayout(newLayout); +// console.log('Updated layout:', newLayout) +// }; + +// return ( +// +// +// +// VDAP Widget +// +// +// This is the widget content - drag or resize me! +// +// +// +// VDAP Widget +// +// +// This is the widget content - drag or resize me! +// +// +// +// VDAP Widget +// +// +// This is the widget content - drag or resize me! +// +// +// +// ); +// }