From 849dd0050a0f6f7e30d25085f265a30d1685a734 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Tue, 11 Nov 2025 13:52:43 +0100 Subject: [PATCH] Separated task in table view --- src/components/view/board/Task.tsx | 11 ++++--- src/components/view/table/TableView.tsx | 42 ++++++++---------------- src/components/view/table/Task.tsx | 43 +++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 34 deletions(-) create mode 100644 src/components/view/table/Task.tsx diff --git a/src/components/view/board/Task.tsx b/src/components/view/board/Task.tsx index 69618fc..e62f078 100644 --- a/src/components/view/board/Task.tsx +++ b/src/components/view/board/Task.tsx @@ -1,3 +1,4 @@ +import { Badge } from "@/components/ui/badge"; import { Card, CardContent, @@ -44,15 +45,15 @@ export default function BoardTask({ {task.title} {task.description} - + {task.tags?.map((tag, i) => ( - - {tags[tag].name} - + {tag} + ))} diff --git a/src/components/view/table/TableView.tsx b/src/components/view/table/TableView.tsx index 2c950c2..282e88a 100644 --- a/src/components/view/table/TableView.tsx +++ b/src/components/view/table/TableView.tsx @@ -11,15 +11,17 @@ import { } from "@/components/ui/table"; import { Badge } from "@/components/ui/badge"; import { TaskViewProps } from "../TaskView"; +import { getColor } from "@/lib/ui/color"; +import TableTask from "./Task"; -export function TableView({ tasks, setTasks }: TaskViewProps) { +export function TableView({ tasks, setTasks, tags }: TaskViewProps) { return ( - Title - Status + Title Description + Status Tags @@ -35,32 +37,14 @@ export function TableView({ tasks, setTasks }: TaskViewProps) { ) : ( tasks.map((task) => ( - - {task.title} - - - {task.status} - - - - {task.description || "-"} - - - {task.tags?.map((tag) => ( - - {tag} - - ))} - - + + setTasks((tasks) => tasks.map((c) => (c.id === t.id ? t : c))) + } + tags={tags} + /> )) )} diff --git a/src/components/view/table/Task.tsx b/src/components/view/table/Task.tsx new file mode 100644 index 0000000..ee2d9d4 --- /dev/null +++ b/src/components/view/table/Task.tsx @@ -0,0 +1,43 @@ +import { Badge } from "@/components/ui/badge"; +import { TableCell, TableRow } from "@/components/ui/table"; +import { Task } from "@/lib/types"; +import { Color, getColor } from "@/lib/ui/color"; + +export default function TableTask({ + task, + setTask, + tags, +}: { + task: Task; + setTask: (t: Task) => void; + tags: Record; +}) { + return ( + + {task.title} + + {task.description || "-"} + + + + {task.status} + + + + {task.tags?.map((tag, i) => ( + + {tag} + + ))} + + + ); +}