diff --git a/client/src/app/page.tsx b/client/src/app/page.tsx index 984d2ba..b80c2a7 100644 --- a/client/src/app/page.tsx +++ b/client/src/app/page.tsx @@ -4,6 +4,7 @@ import Board from '@/components/Board'; import Navbar from '@/components/Navbar'; import Toolbar from '@/components/Toolbar'; import TaskDetails from '@/components/TaskDetails'; +import Task from '@/components/Task' export default function Home() { // State to control whether the popup is visible @@ -15,12 +16,10 @@ export default function Home() { }; return ( -
+
- -
-
+
); } diff --git a/client/src/components/Board/index.tsx b/client/src/components/Board/index.tsx index e0f00f3..087c255 100644 --- a/client/src/components/Board/index.tsx +++ b/client/src/components/Board/index.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'; import Task from '@/components/Task'; import './styles.css'; +import Toolbar from '@/components/Toolbar' interface BoardViewState { offsetX: number; @@ -9,75 +10,68 @@ interface BoardViewState { zoom: number; }; -const tasks = [ - { - id: 1, - title: 'Gather wood', - description: 'Example description!', - width: 200, - height: 100, - posX: 200, - posY: 350, - color: "#f7d9c4" - }, - { - id: 2, - title: 'Build door', - width: 200, - height: 100, - posX: 500, - posY: 300, - color: "#faedcb" - }, - { - id: 3, - title: 'Build walls', - width: 200, - height: 100, - posX: 500, - posY: 450, - color: "#faedcb" - }, - { - id: 4, - title: 'Find cool tree', - width: 200, - height: 100, - posX: 300, - posY: 100, - color: "#f7d9c4" - }, - { - id: 5, - title: 'Assemble treehouse', - width: 200, - height: 100, - posX: 800, - posY: 250, - color: "#c9e4de" - }, -]; - export default function Board() { const [board_view_state, setBoardViewState] = useState({ offsetX: 0, offsetY: 0, zoom: 1.0, }); + + const [tasks, setTaskList] = useState([ + { + id: 1, + title: 'Assemble treehouse', + width: 200, + height: 100, + posX: 800, + posY: 250, + color: "#c9e4de" + }, + { + id: 2, + title: 'Find wood', + width: 200, + height: 100, + posX: 400, + posY: 250, + color: "#c9e4de" + + } + ]); + + + const handleAddTask = () => { + var newTasks = tasks.slice(); + newTasks.push({ + id: tasks.length + 1, + title: 'Untitled', + width: 200, + height: 100, + posX: 50, + posY: 150, + color: "#faedcb" + + }); + console.log(newTasks.length); + setTaskList(newTasks); + }; + + return (
+
+ className="board-bg-grid bg-white absolute h-full w-full"> + {tasks.map((task, idx) => ( - - ))} + ))}
+ ); }; diff --git a/client/src/components/Board/styles.css b/client/src/components/Board/styles.css index a1a5b3c..c8fe69e 100644 --- a/client/src/components/Board/styles.css +++ b/client/src/components/Board/styles.css @@ -3,3 +3,15 @@ background-image: radial-gradient(circle, #c8c8c8 2px, rgba(0, 0, 0, 0) 2px); background-position: left 25px top 25px; } + +.rectangle { + position: fixed; + top: 100; + left: 100; + background-color: rgba(239, 224, 255); + border-radius: 12px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + display: flex; + align-items: center; + flex-direction: column; +} diff --git a/client/src/components/Toolbar/index.tsx b/client/src/components/Toolbar/index.tsx index cd502e8..a54dc55 100644 --- a/client/src/components/Toolbar/index.tsx +++ b/client/src/components/Toolbar/index.tsx @@ -1,5 +1,9 @@ "use client"; import React from 'react'; +import Task from '@/components/Task'; +import setTaskList from '../Board/index.tsx'; +import taskList from '../Board/index.tsx' +import Board from '@/components/Board' import { Button, IconButton, ButtonGroup, ButtonToolbar } from 'rsuite'; import { ArrowFlowUpRight24Regular, @@ -10,7 +14,11 @@ import { import styles from './Toolbar.module.css'; -export default function Toolbar() { +interface toolbarProps { + addTask: ()=>void +} + +export default function Toolbar({ addTask = () => {}}: toolbarProps) { const changeCursor = (cursorType: string) => { document.body.style.cursor = cursorType; }; @@ -33,11 +41,13 @@ export default function Toolbar() { appearance='primary' color='blue' size='lg' + onClick={() => addTask()} /> } appearance='primary' color='blue' size='lg' + />