Separated task in table view

This commit is contained in:
2025-11-11 13:52:43 +01:00
parent 0aaa6f8396
commit 849dd0050a
3 changed files with 62 additions and 34 deletions
+6 -5
View File
@@ -1,3 +1,4 @@
import { Badge } from "@/components/ui/badge";
import {
Card,
CardContent,
@@ -44,15 +45,15 @@ export default function BoardTask({
<CardTitle>{task.title}</CardTitle>
<CardDescription>{task.description}</CardDescription>
</CardHeader>
<CardContent className="flex flex-wrap gap-2 overflow-hidden">
<CardContent className="flex flex-wrap gap-1.5 overflow-hidden">
{task.tags?.map((tag, i) => (
<span
<Badge
key={tag}
variant="outline"
style={getColor(tags[tag].color)}
className="inline-flex items-center py-0.5 px-1.5 rounded-sm max-w-full truncate"
>
{tags[tag].name}
</span>
{tag}
</Badge>
))}
</CardContent>
</Card>
+12 -28
View File
@@ -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 (
<Table>
<TableHeader>
<TableRow>
<TableHead className="min-w-[200px]">Title</TableHead>
<TableHead>Status</TableHead>
<TableHead>Title</TableHead>
<TableHead>Description</TableHead>
<TableHead>Status</TableHead>
<TableHead>Tags</TableHead>
</TableRow>
</TableHeader>
@@ -35,32 +37,14 @@ export function TableView({ tasks, setTasks }: TaskViewProps) {
</TableRow>
) : (
tasks.map((task) => (
<TableRow key={task.id}>
<TableCell className="font-medium">{task.title}</TableCell>
<TableCell>
<Badge
variant={
task.status === "done"
? "default"
: task.status === "in-progress"
? "secondary"
: "outline"
<TableTask
key={task.id}
task={task}
setTask={(t) =>
setTasks((tasks) => tasks.map((c) => (c.id === t.id ? t : c)))
}
>
{task.status}
</Badge>
</TableCell>
<TableCell className="max-w-[250px] truncate">
{task.description || "-"}
</TableCell>
<TableCell>
{task.tags?.map((tag) => (
<Badge key={tag} variant="outline">
{tag}
</Badge>
))}
</TableCell>
</TableRow>
tags={tags}
/>
))
)}
</TableBody>
+43
View File
@@ -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<string, { color: Color; name: string }>;
}) {
return (
<TableRow>
<TableCell className="font-medium">{task.title}</TableCell>
<TableCell className="max-w-[250px] truncate">
{task.description || "-"}
</TableCell>
<TableCell>
<Badge
variant={
task.status === "done"
? "default"
: task.status === "in-progress"
? "secondary"
: "outline"
}
>
{task.status}
</Badge>
</TableCell>
<TableCell className="flex gap-1 items-center">
{task.tags?.map((tag, i) => (
<Badge key={tag} variant="outline" style={getColor(tags[tag].color)}>
{tag}
</Badge>
))}
</TableCell>
</TableRow>
);
}