From 78471543c32d98b37a4b5a80f92dda5179b37f27 Mon Sep 17 00:00:00 2001 From: le king fu Date: Wed, 8 Apr 2026 21:15:59 -0400 Subject: [PATCH] fix: separate subtask expand chevron from detail view icon (#63) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split TaskItem into two independent states: - `expanded` (chevron): toggles subtask visibility, only shown when subtasks exist - `detailOpen` (search icon + title click): opens detail panel with notes, priority, edit/delete actions The two actions are fully independent — expanding subtasks does not open the detail view and vice versa. Co-Authored-By: Claude Opus 4.6 (1M context) --- web/src/components/TaskItem.tsx | 52 +++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/web/src/components/TaskItem.tsx b/web/src/components/TaskItem.tsx index 1d0d7a8..faa1b8f 100644 --- a/web/src/components/TaskItem.tsx +++ b/web/src/components/TaskItem.tsx @@ -9,6 +9,7 @@ import { Calendar, Repeat, Check, + Search, } from "lucide-react"; import { useTranslation } from "react-i18next"; import type { Task } from "@/lib/types"; @@ -40,6 +41,7 @@ export function TaskItem({ task, subtasks = [], depth = 0 }: TaskItemProps) { const { t } = useTranslation(); const router = useRouter(); const [expanded, setExpanded] = useState(false); + const [detailOpen, setDetailOpen] = useState(false); const [editing, setEditing] = useState(false); const [title, setTitle] = useState(task.title); const [notes, setNotes] = useState(task.notes || ""); @@ -123,17 +125,21 @@ export function TaskItem({ task, subtasks = [], depth = 0 }: TaskItemProps) { > {/* Main row */}
- {/* Expand toggle */} - + {/* Expand subtasks toggle — only shown when subtasks exist */} + {subtasks.length > 0 ? ( + + ) : ( + + )} {/* Checkbox */} - {/* Title */} + {/* Title — click opens detail */} setExpanded(!expanded)} + onClick={() => setDetailOpen(!detailOpen)} > {task.title} @@ -174,10 +180,20 @@ export function TaskItem({ task, subtasks = [], depth = 0 }: TaskItemProps) { {subtasks.filter((s) => s.completed).length}/{subtasks.length} )} + + {/* Detail view toggle */} +
- {/* Expanded view */} - {expanded && ( + {/* Detail view */} + {detailOpen && (
{editing ? (
@@ -284,7 +300,7 @@ export function TaskItem({ task, subtasks = [], depth = 0 }: TaskItemProps) {
{/* Subtask form */} - {showSubtaskForm && expanded && ( + {showSubtaskForm && detailOpen && (
)} - {/* Subtasks */} - {subtasks.map((sub) => ( + {/* Subtasks — toggled by chevron */} + {expanded && subtasks.map((sub) => ( ))}