feat: dark mode support, markdown descriptions, inline editing on TaskPage

- Full dark mode across TaskPage (header, cards, sidebar, forms)
- Task descriptions rendered as markdown (ReactMarkdown + remark-gfm)
- Inline description editing with markdown preview
- Inline title editing (click to edit)
- Theme system (useTheme hook with light/dark/system toggle)
- Dark mode classes across remaining components
This commit is contained in:
2026-01-29 10:33:38 +00:00
parent ef35e508c4
commit f4c60bf6aa
13 changed files with 599 additions and 398 deletions

View File

@@ -1,5 +1,7 @@
import { useState, useEffect, useCallback } from "react";
import { useParams, Link, useNavigate } from "react-router-dom";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import type { Task, TaskStatus, Project } from "../lib/types";
import { updateTask, fetchProjects, addProgressNote, addSubtask, toggleSubtask, deleteSubtask, deleteTask } from "../lib/api";
import { useToast } from "../components/Toast";
@@ -12,11 +14,11 @@ const priorityColors: Record<string, string> = {
};
const statusColors: Record<string, string> = {
active: "bg-amber-100 text-amber-800 border-amber-300",
queued: "bg-blue-100 text-blue-800 border-blue-300",
blocked: "bg-red-100 text-red-800 border-red-300",
completed: "bg-green-100 text-green-800 border-green-300",
cancelled: "bg-gray-100 text-gray-600 border-gray-300",
active: "bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-300 border-amber-300 dark:border-amber-700",
queued: "bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 border-blue-300 dark:border-blue-700",
blocked: "bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300 border-red-300 dark:border-red-700",
completed: "bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300 border-green-300 dark:border-green-700",
cancelled: "bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-300 dark:border-gray-600",
};
const statusIcons: Record<string, string> = {
@@ -29,20 +31,20 @@ const statusIcons: Record<string, string> = {
const statusActions: Record<string, { label: string; next: TaskStatus; color: string }[]> = {
active: [
{ label: "⏸ Pause", next: "queued", color: "bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100" },
{ label: "🚫 Block", next: "blocked", color: "bg-red-50 text-red-700 border-red-200 hover:bg-red-100" },
{ label: "✅ Complete", next: "completed", color: "bg-green-50 text-green-700 border-green-200 hover:bg-green-100" },
{ label: "⏸ Pause", next: "queued", color: "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-700 hover:bg-blue-100 dark:hover:bg-blue-900/40" },
{ label: "🚫 Block", next: "blocked", color: "bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 border-red-200 dark:border-red-700 hover:bg-red-100 dark:hover:bg-red-900/40" },
{ label: "✅ Complete", next: "completed", color: "bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-200 dark:border-green-700 hover:bg-green-100 dark:hover:bg-green-900/40" },
],
queued: [
{ label: "▶ Activate", next: "active", color: "bg-amber-50 text-amber-700 border-amber-200 hover:bg-amber-100" },
{ label: "🚫 Block", next: "blocked", color: "bg-red-50 text-red-700 border-red-200 hover:bg-red-100" },
{ label: "▶ Activate", next: "active", color: "bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-700 hover:bg-amber-100 dark:hover:bg-amber-900/40" },
{ label: "🚫 Block", next: "blocked", color: "bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 border-red-200 dark:border-red-700 hover:bg-red-100 dark:hover:bg-red-900/40" },
],
blocked: [
{ label: "▶ Activate", next: "active", color: "bg-amber-50 text-amber-700 border-amber-200 hover:bg-amber-100" },
{ label: "📋 Queue", next: "queued", color: "bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100" },
{ label: "▶ Activate", next: "active", color: "bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-700 hover:bg-amber-100 dark:hover:bg-amber-900/40" },
{ label: "📋 Queue", next: "queued", color: "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-700 hover:bg-blue-100 dark:hover:bg-blue-900/40" },
],
completed: [{ label: "🔄 Requeue", next: "queued", color: "bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100" }],
cancelled: [{ label: "🔄 Requeue", next: "queued", color: "bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100" }],
completed: [{ label: "🔄 Requeue", next: "queued", color: "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-700 hover:bg-blue-100 dark:hover:bg-blue-900/40" }],
cancelled: [{ label: "🔄 Requeue", next: "queued", color: "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-700 hover:bg-blue-100 dark:hover:bg-blue-900/40" }],
};
function formatDate(dateStr: string): string {
@@ -63,6 +65,9 @@ function timeAgo(dateStr: string): string {
return `${days}d ago`;
}
// Markdown prose classes for descriptions and notes
const proseClasses = "prose prose-sm prose-gray dark:prose-invert max-w-none [&_pre]:bg-gray-800 dark:[&_pre]:bg-gray-900 [&_pre]:text-gray-100 [&_pre]:rounded-lg [&_pre]:p-3 [&_pre]:overflow-x-auto [&_pre]:text-xs [&_code]:bg-gray-200 dark:[&_code]:bg-gray-700 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_p]:mb-2 [&_p:last-child]:mb-0 [&_ul]:mb-2 [&_ol]:mb-2 [&_li]:mb-0.5 [&_h1]:text-base [&_h2]:text-sm [&_h3]:text-sm [&_a]:text-amber-600 dark:[&_a]:text-amber-400 [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:border-gray-300 dark:[&_blockquote]:border-gray-600 [&_blockquote]:pl-3 [&_blockquote]:text-gray-500 dark:[&_blockquote]:text-gray-400";
export function TaskPage() {
const { taskRef } = useParams<{ taskRef: string }>();
const [task, setTask] = useState<Task | null>(null);
@@ -76,6 +81,14 @@ export function TaskPage() {
const [saving, setSaving] = useState(false);
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
const [deleting, setDeleting] = useState(false);
// Description editing
const [editingDescription, setEditingDescription] = useState(false);
const [descriptionDraft, setDescriptionDraft] = useState("");
const [savingDescription, setSavingDescription] = useState(false);
// Title editing
const [editingTitle, setEditingTitle] = useState(false);
const [titleDraft, setTitleDraft] = useState("");
const [savingTitle, setSavingTitle] = useState(false);
const { toast } = useToast();
const navigate = useNavigate();
@@ -120,6 +133,38 @@ export function TaskPage() {
}
};
const handleSaveDescription = async () => {
if (!task) return;
setSavingDescription(true);
try {
await updateTask(task.id, { description: descriptionDraft });
fetchTask();
setEditingDescription(false);
toast("Description updated", "success");
} catch (e) {
console.error("Failed to save description:", e);
toast("Failed to save description", "error");
} finally {
setSavingDescription(false);
}
};
const handleSaveTitle = async () => {
if (!task || !titleDraft.trim()) return;
setSavingTitle(true);
try {
await updateTask(task.id, { title: titleDraft.trim() });
fetchTask();
setEditingTitle(false);
toast("Title updated", "success");
} catch (e) {
console.error("Failed to save title:", e);
toast("Failed to save title", "error");
} finally {
setSavingTitle(false);
}
};
const handleDelete = async () => {
if (!task) return;
setDeleting(true);
@@ -138,7 +183,7 @@ export function TaskPage() {
if (loading) {
return (
<div className="min-h-screen flex items-center justify-center text-gray-400">
<div className="min-h-screen flex items-center justify-center text-gray-400 dark:text-gray-500">
Loading task...
</div>
);
@@ -149,8 +194,8 @@ export function TaskPage() {
<div className="min-h-screen flex items-center justify-center">
<div className="text-center">
<span className="text-4xl block mb-3">😕</span>
<p className="text-gray-500 mb-4">{error || "Task not found"}</p>
<Link to="/queue" className="text-amber-600 hover:text-amber-700 font-medium text-sm">
<p className="text-gray-500 dark:text-gray-400 mb-4">{error || "Task not found"}</p>
<Link to="/queue" className="text-amber-600 dark:text-amber-400 hover:text-amber-700 dark:hover:text-amber-300 font-medium text-sm">
Back to Queue
</Link>
</div>
@@ -168,14 +213,18 @@ export function TaskPage() {
return (
<div className="min-h-screen">
{/* Header */}
<header className={`sticky top-14 md:top-0 z-30 border-b ${isActive ? "bg-gradient-to-r from-amber-50 to-orange-50 border-amber-200" : "bg-white border-gray-200"}`}>
<header className={`sticky top-14 md:top-0 z-30 border-b ${
isActive
? "bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-900/20 dark:to-orange-900/20 border-amber-200 dark:border-amber-800"
: "bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-800"
}`}>
<div className="max-w-4xl mx-auto px-4 sm:px-6 py-4">
<div className="flex items-center gap-2 mb-2">
<Link to="/queue" className="text-sm text-gray-400 hover:text-gray-600 transition">
<Link to="/queue" className="text-sm text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition">
Queue
</Link>
<span className="text-gray-300">/</span>
<span className="text-xs font-bold text-amber-700 bg-amber-100 px-2 py-0.5 rounded font-mono">
<span className="text-gray-300 dark:text-gray-600">/</span>
<span className="text-xs font-bold text-amber-700 dark:text-amber-400 bg-amber-100 dark:bg-amber-900/30 px-2 py-0.5 rounded font-mono">
HQ-{task.taskNumber}
</span>
</div>
@@ -195,15 +244,51 @@ export function TaskPage() {
{task.priority}
</span>
{project && (
<span className="text-xs text-gray-500 bg-gray-100 px-2 py-0.5 rounded">
<span className="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 px-2 py-0.5 rounded">
📁 {project.name}
</span>
)}
</div>
<h1 className="text-xl font-bold text-gray-900">{task.title}</h1>
{editingTitle ? (
<div className="flex items-center gap-2">
<input
autoFocus
value={titleDraft}
onChange={(e) => setTitleDraft(e.target.value)}
className="text-xl font-bold text-gray-900 dark:text-gray-100 bg-transparent border-b-2 border-amber-400 dark:border-amber-500 outline-none flex-1 py-0.5"
onKeyDown={(e) => {
if (e.key === "Enter") handleSaveTitle();
if (e.key === "Escape") setEditingTitle(false);
}}
disabled={savingTitle}
/>
<button
onClick={handleSaveTitle}
disabled={savingTitle || !titleDraft.trim()}
className="text-xs px-2.5 py-1 bg-amber-500 text-white rounded-lg font-medium hover:bg-amber-600 transition disabled:opacity-50"
>
{savingTitle ? "..." : "Save"}
</button>
<button
onClick={() => setEditingTitle(false)}
className="text-xs px-2.5 py-1 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 rounded-lg font-medium hover:bg-gray-200 dark:hover:bg-gray-700 transition"
>
Cancel
</button>
</div>
) : (
<h1
className="text-xl font-bold text-gray-900 dark:text-gray-100 cursor-pointer hover:text-amber-700 dark:hover:text-amber-400 transition group"
onClick={() => { setTitleDraft(task.title); setEditingTitle(true); }}
title="Click to edit title"
>
{task.title}
<span className="opacity-0 group-hover:opacity-100 text-gray-400 dark:text-gray-500 text-sm ml-2 transition"></span>
</h1>
)}
</div>
{/* Status Actions */}
<div className="flex gap-2 shrink-0">
<div className="flex gap-2 shrink-0 flex-wrap justify-end">
{actions.map((action) => (
<button
key={action.next}
@@ -226,9 +311,13 @@ export function TaskPage() {
const isDueSoon = diffDays <= 2 && !isOverdue;
return (
<div className="mt-2 flex items-center gap-2">
<span className="text-xs text-gray-500">📅 Due:</span>
<span className="text-xs text-gray-500 dark:text-gray-400">📅 Due:</span>
<span className={`text-xs font-medium px-2 py-0.5 rounded-full ${
isOverdue ? "bg-red-100 text-red-700" : isDueSoon ? "bg-amber-100 text-amber-700" : "bg-gray-100 text-gray-600"
isOverdue
? "bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400"
: isDueSoon
? "bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400"
: "bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400"
}`}>
{formatDate(task.dueDate)} ({isOverdue ? `${Math.abs(diffDays)}d overdue` : diffDays === 0 ? "today" : diffDays === 1 ? "tomorrow" : `${diffDays}d left`})
</span>
@@ -243,30 +332,80 @@ export function TaskPage() {
{/* Main content */}
<div className="lg:col-span-2 space-y-6">
{/* Description */}
<div className="bg-white rounded-xl border border-gray-200 shadow-sm p-5">
<h2 className="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-3">Description</h2>
<p className="text-sm text-gray-700 leading-relaxed whitespace-pre-wrap">
{task.description || <span className="text-gray-400 italic">No description</span>}
</p>
<div className="bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 shadow-sm p-5">
<div className="flex items-center justify-between mb-3">
<h2 className="text-sm font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wider">Description</h2>
{!editingDescription && (
<button
onClick={() => { setDescriptionDraft(task.description || ""); setEditingDescription(true); }}
className="text-xs text-gray-400 dark:text-gray-500 hover:text-amber-600 dark:hover:text-amber-400 transition font-medium"
>
Edit
</button>
)}
</div>
{editingDescription ? (
<div className="space-y-3">
<textarea
autoFocus
value={descriptionDraft}
onChange={(e) => setDescriptionDraft(e.target.value)}
rows={8}
className="w-full text-sm border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-amber-200 dark:focus:ring-amber-800 focus:border-amber-300 dark:focus:border-amber-700 resize-y min-h-[120px] font-mono placeholder:text-gray-400 dark:placeholder:text-gray-500"
placeholder="Describe the task... (Markdown supported)"
/>
<div className="flex items-center justify-between">
<span className="text-[10px] text-gray-400 dark:text-gray-500">Markdown supported</span>
<div className="flex gap-2">
<button
onClick={() => setEditingDescription(false)}
className="text-xs px-3 py-1.5 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 rounded-lg font-medium hover:bg-gray-200 dark:hover:bg-gray-700 transition"
>
Cancel
</button>
<button
onClick={handleSaveDescription}
disabled={savingDescription}
className="text-xs px-3 py-1.5 bg-amber-500 text-white rounded-lg font-medium hover:bg-amber-600 transition disabled:opacity-50"
>
{savingDescription ? "Saving..." : "Save"}
</button>
</div>
</div>
</div>
) : task.description ? (
<div className={`text-sm leading-relaxed ${proseClasses}`}>
<ReactMarkdown remarkPlugins={[remarkGfm]}>
{task.description}
</ReactMarkdown>
</div>
) : (
<p
className="text-sm text-gray-400 dark:text-gray-500 italic cursor-pointer hover:text-amber-500 dark:hover:text-amber-400 transition py-4 text-center border-2 border-dashed border-gray-200 dark:border-gray-700 rounded-lg"
onClick={() => { setDescriptionDraft(""); setEditingDescription(true); }}
>
No description click to add one
</p>
)}
</div>
{/* Subtasks */}
<div className="bg-white rounded-xl border border-gray-200 shadow-sm p-5">
<div className="bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 shadow-sm p-5">
<div className="flex items-center justify-between mb-3">
<h2 className="text-sm font-semibold text-gray-400 uppercase tracking-wider">
<h2 className="text-sm font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wider">
Subtasks {task.subtasks?.length > 0 && (
<span className="text-gray-300 ml-1">({task.subtasks.filter(s => s.completed).length}/{task.subtasks.length})</span>
<span className="text-gray-300 dark:text-gray-600 ml-1">({task.subtasks.filter(s => s.completed).length}/{task.subtasks.length})</span>
)}
</h2>
{task.subtasks?.length > 0 && (
<span className="text-xs text-gray-400">{subtaskProgress}%</span>
<span className="text-xs text-gray-400 dark:text-gray-500">{subtaskProgress}%</span>
)}
</div>
{/* Progress bar */}
{task.subtasks?.length > 0 && (
<div className="mb-4">
<div className="w-full bg-gray-200 rounded-full h-2">
<div className="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2">
<div
className="bg-green-500 h-2 rounded-full transition-all duration-300"
style={{ width: `${subtaskProgress}%` }}
@@ -279,7 +418,7 @@ export function TaskPage() {
{task.subtasks?.length > 0 && (
<div className="space-y-1 mb-4">
{task.subtasks.map((subtask) => (
<div key={subtask.id} className="flex items-center gap-3 group py-1.5 px-2 rounded-lg hover:bg-gray-50 transition">
<div key={subtask.id} className="flex items-center gap-3 group py-1.5 px-2 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition">
<button
onClick={async () => {
try {
@@ -292,7 +431,7 @@ export function TaskPage() {
className={`w-5 h-5 rounded border-2 flex items-center justify-center shrink-0 transition ${
subtask.completed
? "bg-green-500 border-green-500 text-white"
: "border-gray-300 hover:border-amber-400"
: "border-gray-300 dark:border-gray-600 hover:border-amber-400 dark:hover:border-amber-500"
}`}
>
{subtask.completed && (
@@ -301,7 +440,7 @@ export function TaskPage() {
</svg>
)}
</button>
<span className={`text-sm flex-1 ${subtask.completed ? "line-through text-gray-400" : "text-gray-700"}`}>
<span className={`text-sm flex-1 ${subtask.completed ? "line-through text-gray-400 dark:text-gray-500" : "text-gray-700 dark:text-gray-300"}`}>
{subtask.title}
</span>
<button
@@ -313,7 +452,7 @@ export function TaskPage() {
console.error("Failed to delete subtask:", e);
}
}}
className="opacity-0 group-hover:opacity-100 text-gray-300 hover:text-red-400 transition p-0.5"
className="opacity-0 group-hover:opacity-100 text-gray-300 dark:text-gray-600 hover:text-red-400 dark:hover:text-red-400 transition p-0.5"
>
<svg className="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
@@ -331,7 +470,7 @@ export function TaskPage() {
value={newSubtaskTitle}
onChange={(e) => setNewSubtaskTitle(e.target.value)}
placeholder="Add a subtask..."
className="flex-1 text-sm border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-amber-200 focus:border-amber-300"
className="flex-1 text-sm border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-amber-200 dark:focus:ring-amber-800 focus:border-amber-300 dark:focus:border-amber-700 placeholder:text-gray-400 dark:placeholder:text-gray-500"
onKeyDown={async (e) => {
if (e.key === "Enter" && newSubtaskTitle.trim()) {
setAddingSubtask(true);
@@ -371,10 +510,10 @@ export function TaskPage() {
</div>
{/* Progress Notes */}
<div className="bg-white rounded-xl border border-gray-200 shadow-sm p-5">
<h2 className="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-3">
<div className="bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 shadow-sm p-5">
<h2 className="text-sm font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-3">
Progress Notes {task.progressNotes?.length > 0 && (
<span className="text-gray-300 ml-1">({task.progressNotes.length})</span>
<span className="text-gray-300 dark:text-gray-600 ml-1">({task.progressNotes.length})</span>
)}
</h2>
@@ -386,7 +525,7 @@ export function TaskPage() {
onChange={(e) => setNoteText(e.target.value)}
placeholder="Add a progress note..."
rows={2}
className="flex-1 text-sm border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-amber-200 focus:border-amber-300 resize-y min-h-[40px] max-h-32"
className="flex-1 text-sm border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-amber-200 dark:focus:ring-amber-800 focus:border-amber-300 dark:focus:border-amber-700 resize-y min-h-[40px] max-h-32 placeholder:text-gray-400 dark:placeholder:text-gray-500"
onKeyDown={(e) => {
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
e.preventDefault();
@@ -415,12 +554,12 @@ export function TaskPage() {
{addingNote ? "..." : "Add"}
</button>
</div>
<p className="text-[10px] text-gray-400 mt-1">+Enter to submit</p>
<p className="text-[10px] text-gray-400 dark:text-gray-500 mt-1">+Enter to submit</p>
</div>
{/* Notes list */}
{!task.progressNotes || task.progressNotes.length === 0 ? (
<div className="text-sm text-gray-400 italic py-6 text-center border-2 border-dashed border-gray-100 rounded-lg">
<div className="text-sm text-gray-400 dark:text-gray-500 italic py-6 text-center border-2 border-dashed border-gray-100 dark:border-gray-800 rounded-lg">
No progress notes yet
</div>
) : (
@@ -431,16 +570,18 @@ export function TaskPage() {
.map((note, i) => (
<div key={i} className="relative pl-6 pb-4 last:pb-0 group">
{i < task.progressNotes.length - 1 && (
<div className="absolute left-[9px] top-3 bottom-0 w-0.5 bg-gray-200 group-last:hidden" />
<div className="absolute left-[9px] top-3 bottom-0 w-0.5 bg-gray-200 dark:bg-gray-700 group-last:hidden" />
)}
<div className={`absolute left-0 top-1 w-[18px] h-[18px] rounded-full border-2 flex items-center justify-center ${
i === 0 && isActive ? "border-amber-400 bg-amber-50" : "border-gray-300 bg-white"
i === 0 && isActive
? "border-amber-400 dark:border-amber-500 bg-amber-50 dark:bg-amber-900/30"
: "border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900"
}`}>
<div className={`w-2 h-2 rounded-full ${i === 0 && isActive ? "bg-amber-500" : "bg-gray-300"}`} />
<div className={`w-2 h-2 rounded-full ${i === 0 && isActive ? "bg-amber-500" : "bg-gray-300 dark:bg-gray-600"}`} />
</div>
<div>
<p className="text-sm text-gray-700 leading-relaxed">{note.note}</p>
<p className="text-xs text-gray-400 mt-0.5">{formatDate(note.timestamp)} · {timeAgo(note.timestamp)}</p>
<p className="text-sm text-gray-700 dark:text-gray-300 leading-relaxed">{note.note}</p>
<p className="text-xs text-gray-400 dark:text-gray-500 mt-0.5">{formatDate(note.timestamp)} · {timeAgo(note.timestamp)}</p>
</div>
</div>
))}
@@ -452,49 +593,49 @@ export function TaskPage() {
{/* Sidebar */}
<div className="space-y-4">
{/* Meta */}
<div className="bg-white rounded-xl border border-gray-200 shadow-sm p-4">
<h3 className="text-xs font-semibold text-gray-400 uppercase tracking-wider mb-3">Details</h3>
<div className="bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 shadow-sm p-4">
<h3 className="text-xs font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-3">Details</h3>
<div className="space-y-3 text-sm">
<div className="flex justify-between">
<span className="text-gray-500">Source</span>
<span className="text-gray-700 font-medium capitalize">{task.source}</span>
<span className="text-gray-500 dark:text-gray-400">Source</span>
<span className="text-gray-700 dark:text-gray-300 font-medium capitalize">{task.source}</span>
</div>
{task.assigneeName && (
<div className="flex justify-between">
<span className="text-gray-500">Assignee</span>
<span className="text-gray-700 font-medium">{task.assigneeName}</span>
<span className="text-gray-500 dark:text-gray-400">Assignee</span>
<span className="text-gray-700 dark:text-gray-300 font-medium">{task.assigneeName}</span>
</div>
)}
{project && (
<div className="flex justify-between">
<span className="text-gray-500">Project</span>
<span className="text-gray-700 font-medium">{project.name}</span>
<span className="text-gray-500 dark:text-gray-400">Project</span>
<span className="text-gray-700 dark:text-gray-300 font-medium">{project.name}</span>
</div>
)}
<div className="flex justify-between">
<span className="text-gray-500">Created</span>
<span className="text-gray-700 text-xs">{timeAgo(task.createdAt)}</span>
<span className="text-gray-500 dark:text-gray-400">Created</span>
<span className="text-gray-700 dark:text-gray-300 text-xs">{timeAgo(task.createdAt)}</span>
</div>
{task.updatedAt !== task.createdAt && (
<div className="flex justify-between">
<span className="text-gray-500">Updated</span>
<span className="text-gray-700 text-xs">{timeAgo(task.updatedAt)}</span>
<span className="text-gray-500 dark:text-gray-400">Updated</span>
<span className="text-gray-700 dark:text-gray-300 text-xs">{timeAgo(task.updatedAt)}</span>
</div>
)}
{task.completedAt && (
<div className="flex justify-between">
<span className="text-gray-500">Completed</span>
<span className="text-gray-700 text-xs">{timeAgo(task.completedAt)}</span>
<span className="text-gray-500 dark:text-gray-400">Completed</span>
<span className="text-gray-700 dark:text-gray-300 text-xs">{timeAgo(task.completedAt)}</span>
</div>
)}
</div>
</div>
{/* Quick link */}
<div className="bg-white rounded-xl border border-gray-200 shadow-sm p-4">
<h3 className="text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2">Share</h3>
<div className="bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 shadow-sm p-4">
<h3 className="text-xs font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2">Share</h3>
<div className="flex items-center gap-2">
<code className="text-xs text-gray-500 font-mono bg-gray-50 px-2 py-1 rounded flex-1 truncate">
<code className="text-xs text-gray-500 dark:text-gray-400 font-mono bg-gray-50 dark:bg-gray-800 px-2 py-1 rounded flex-1 truncate">
/task/HQ-{task.taskNumber}
</code>
<button
@@ -503,7 +644,7 @@ export function TaskPage() {
navigator.clipboard.writeText(url);
toast("Link copied", "info");
}}
className="text-xs px-2 py-1 bg-gray-100 rounded hover:bg-gray-200 transition"
className="text-xs px-2 py-1 bg-gray-100 dark:bg-gray-800 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition"
>
📋
</button>
@@ -511,18 +652,18 @@ export function TaskPage() {
</div>
{/* Danger zone */}
<div className="bg-white rounded-xl border border-gray-200 shadow-sm p-4">
<h3 className="text-xs font-semibold text-gray-400 uppercase tracking-wider mb-3">Danger Zone</h3>
<div className="bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 shadow-sm p-4">
<h3 className="text-xs font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-3">Danger Zone</h3>
{!showDeleteConfirm ? (
<button
onClick={() => setShowDeleteConfirm(true)}
className="w-full text-sm text-red-600 hover:text-red-700 border border-red-200 rounded-lg px-3 py-2 hover:bg-red-50 transition font-medium"
className="w-full text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 border border-red-200 dark:border-red-800 rounded-lg px-3 py-2 hover:bg-red-50 dark:hover:bg-red-900/20 transition font-medium"
>
🗑 Delete Task
</button>
) : (
<div className="space-y-2 animate-slide-up">
<p className="text-xs text-red-700">This cannot be undone. Are you sure?</p>
<p className="text-xs text-red-700 dark:text-red-400">This cannot be undone. Are you sure?</p>
<div className="flex gap-2">
<button
onClick={handleDelete}
@@ -533,7 +674,7 @@ export function TaskPage() {
</button>
<button
onClick={() => setShowDeleteConfirm(false)}
className="flex-1 text-sm px-3 py-2 border border-gray-200 rounded-lg text-gray-600 hover:bg-gray-50 transition"
className="flex-1 text-sm px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition"
>
Cancel
</button>