Improved code structure for board view

This commit is contained in:
2025-11-10 21:13:12 +01:00
parent 6bf91af1f8
commit f0c9c89298
2 changed files with 55 additions and 42 deletions
+39 -1
View File
@@ -1,7 +1,45 @@
"use client";
import BoardView from "@/components/view/board/BoardView";
import { Task } from "@/lib/types";
import { useEffect, useState } from "react";
const id = (prefix = "t") =>
`${prefix}_${Math.random().toString(36).slice(2, 9)}`;
export default function Workspace() {
return <BoardView />;
const [tasks, setTasks] = useState<Task[]>([]);
useEffect(() => {
setTasks([
{ id: id(), title: "Buy groceries", status: "todo" },
{ id: id(), title: "Plan sprint", status: "todo" },
{
id: id(),
title: "Build header",
description: "A simple description",
tags: [
{ name: "Website", color: "pink" },
{ name: "Development", color: "blue" },
{ name: "API", color: "green" },
{ name: "App", color: "purple" },
{ name: "Rust", color: "orange" },
],
status: "inprogress",
},
]);
}, []);
const createTask = (status: string) => {
const task: Task = {
id: id(),
title: "New task",
status: status,
};
setTasks((c) => [...c, task]);
};
return (
<BoardView tasks={tasks} setTasks={setTasks} createTask={createTask} />
);
}