diff --git a/src/pages/Tasks.tsx b/src/pages/Tasks.tsx new file mode 100644 index 0000000..4a6df16 --- /dev/null +++ b/src/pages/Tasks.tsx @@ -0,0 +1,194 @@ +import { useState } from "react"; +import { Card, CardContent } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Avatar, AvatarFallback } from "@/components/ui/avatar"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import { + Plus, Calendar, Filter, GripVertical, MoreHorizontal +} from "lucide-react"; +import { toast } from "sonner"; +import Sidebar from "@/components/Sidebar"; +import Header from "@/components/Header"; + +interface Task { + id: number; + title: string; + priority: string; + priorityColor: string; + assignee: string; + assigneeColor: string; + due: string; + tags: { label: string; color: string }[]; +} + +interface Column { + id: string; + title: string; + color: string; + dotColor: string; + tasks: Task[]; +} + +const initialColumns: Column[] = [ + { + id: "todo", + title: "To Do", + color: "bg-slate-100 text-slate-700", + dotColor: "bg-slate-400", + tasks: [ + { id: 1, title: "Create user onboarding wizard", priority: "High", priorityColor: "bg-red-100 text-red-700", assignee: "AK", assigneeColor: "bg-violet-500", due: "Apr 14", tags: [{ label: "Frontend", color: "bg-violet-100 text-violet-700" }] }, + { id: 2, title: "Write API documentation", priority: "Medium", priorityColor: "bg-amber-100 text-amber-700", assignee: "MR", assigneeColor: "bg-indigo-500", due: "Apr 16", tags: [{ label: "Docs", color: "bg-sky-100 text-sky-700" }] }, + { id: 3, title: "Set up error monitoring", priority: "Low", priorityColor: "bg-slate-100 text-slate-600", assignee: "JL", assigneeColor: "bg-emerald-500", due: "Apr 18", tags: [{ label: "DevOps", color: "bg-orange-100 text-orange-700" }] }, + { id: 4, title: "Design email templates", priority: "Medium", priorityColor: "bg-amber-100 text-amber-700", assignee: "SC", assigneeColor: "bg-amber-500", due: "Apr 20", tags: [{ label: "Design", color: "bg-pink-100 text-pink-700" }] }, + ], + }, + { + id: "in-progress", + title: "In Progress", + color: "bg-violet-100 text-violet-700", + dotColor: "bg-violet-500", + tasks: [ + { id: 5, title: "Implement auth flow with OAuth", priority: "High", priorityColor: "bg-red-100 text-red-700", assignee: "MR", assigneeColor: "bg-indigo-500", due: "Apr 13", tags: [{ label: "Backend", color: "bg-emerald-100 text-emerald-700" }] }, + { id: 6, title: "Build notification system", priority: "High", priorityColor: "bg-red-100 text-red-700", assignee: "AK", assigneeColor: "bg-violet-500", due: "Apr 15", tags: [{ label: "Frontend", color: "bg-violet-100 text-violet-700" }, { label: "Backend", color: "bg-emerald-100 text-emerald-700" }] }, + { id: 7, title: "Optimize database queries", priority: "Medium", priorityColor: "bg-amber-100 text-amber-700", assignee: "TP", assigneeColor: "bg-sky-500", due: "Apr 17", tags: [{ label: "Backend", color: "bg-emerald-100 text-emerald-700" }] }, + ], + }, + { + id: "done", + title: "Done", + color: "bg-emerald-100 text-emerald-700", + dotColor: "bg-emerald-500", + tasks: [ + { id: 8, title: "Set up CI/CD pipeline", priority: "High", priorityColor: "bg-red-100 text-red-700", assignee: "JL", assigneeColor: "bg-emerald-500", due: "Apr 10", tags: [{ label: "DevOps", color: "bg-orange-100 text-orange-700" }] }, + { id: 9, title: "Design landing page mockups", priority: "Medium", priorityColor: "bg-amber-100 text-amber-700", assignee: "SC", assigneeColor: "bg-amber-500", due: "Apr 9", tags: [{ label: "Design", color: "bg-pink-100 text-pink-700" }] }, + { id: 10, title: "Configure analytics tracking", priority: "Low", priorityColor: "bg-slate-100 text-slate-600", assignee: "TP", assigneeColor: "bg-sky-500", due: "Apr 8", tags: [{ label: "Frontend", color: "bg-violet-100 text-violet-700" }] }, + ], + }, +]; + +export default function TasksPage() { + const [columns, setColumns] = useState(initialColumns); + const [priorityFilter, setPriorityFilter] = useState("all"); + const [assigneeFilter, setAssigneeFilter] = useState("all"); + + const handleAddTask = (columnId: string) => { + toast("Task creation dialog would open here"); + }; + + const filteredColumns = columns.map(col => ({ + ...col, + tasks: col.tasks.filter(t => { + if (priorityFilter !== "all" && t.priority !== priorityFilter) return false; + if (assigneeFilter !== "all" && t.assignee !== assigneeFilter) return false; + return true; + }), + })); + + return ( +
+ +
+
+
+ {/* ── Header ── */} +
+
+

Tasks

+

Kanban board for your current sprint

+
+ +
+ + {/* ── Filters ── */} +
+
+ + Filter by: +
+ + +
+ + {/* ── Kanban Board ── */} +
+ {filteredColumns.map((column) => ( +
+ {/* Column Header */} +
+
+
+

{column.title}

+ {column.tasks.length} +
+ +
+ + {/* Task Cards */} +
+ {column.tasks.map((task) => ( + + +
+

{task.title}

+ +
+
+ {task.tags.map((tag, i) => ( + {tag.label} + ))} +
+
+
+ {task.priority} + + {task.due} + +
+ + {task.assignee} + +
+
+
+ ))} + +
+
+ ))} +
+
+
+
+ ); +}