From 34d54c7de3ad65e82c0dbab61deb05941888c76d Mon Sep 17 00:00:00 2001 From: Leo dev Date: Mon, 10 Nov 2025 19:02:21 +0100 Subject: [PATCH] Seperated task component --- src/components/view/board/BoardView.tsx | 43 +++---------------------- src/components/view/board/Task.tsx | 43 +++++++++++++++++++++++++ src/lib/types.ts | 8 +++++ 3 files changed, 55 insertions(+), 39 deletions(-) create mode 100644 src/components/view/board/Task.tsx create mode 100644 src/lib/types.ts diff --git a/src/components/view/board/BoardView.tsx b/src/components/view/board/BoardView.tsx index 5a6cdeb..064a7f2 100644 --- a/src/components/view/board/BoardView.tsx +++ b/src/components/view/board/BoardView.tsx @@ -1,24 +1,12 @@ "use client"; import { useEffect, useState } from "react"; -import { - Card, - CardHeader, - CardTitle, - CardContent, - CardDescription, -} from "@/components/ui/card"; +import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd"; -import { Color, getColor } from "@/lib/ui/color"; import { PlusIcon } from "lucide-react"; - -type Task = { - id: string; - title: string; - description?: string; - tags?: { name: string; color: Color }[]; -}; +import { Task } from "@/lib/types"; +import BoardTask from "./Task"; const columnLabels: Record = { todo: "To do", @@ -125,30 +113,7 @@ export default function BoardView() { index={index} > {(provided) => ( - - - {task.title} - - {task.description} - - - - {task.tags?.map((tag, i) => ( - - {tag.name} - - ))} - - + )} ))} diff --git a/src/components/view/board/Task.tsx b/src/components/view/board/Task.tsx new file mode 100644 index 0000000..71119e5 --- /dev/null +++ b/src/components/view/board/Task.tsx @@ -0,0 +1,43 @@ +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { Task } from "@/lib/types"; +import { getColor } from "@/lib/ui/color"; +import { DraggableProvided } from "@hello-pangea/dnd"; + +export default function BoardTask({ + task, + provided, +}: { + task: Task; + provided: DraggableProvided; +}) { + return ( + + + {task.title} + {task.description} + + + {task.tags?.map((tag, i) => ( + + {tag.name} + + ))} + + + ); +} diff --git a/src/lib/types.ts b/src/lib/types.ts new file mode 100644 index 0000000..41c2880 --- /dev/null +++ b/src/lib/types.ts @@ -0,0 +1,8 @@ +import { Color } from "./ui/color"; + +export type Task = { + id: string; + title: string; + description?: string; + tags?: { name: string; color: Color }[]; +};