From f4d0467d2e680aaeadc95bc6679c68d2f7517319 Mon Sep 17 00:00:00 2001 From: Fernando Gomes Date: Mon, 25 May 2026 06:45:58 -0300 Subject: [PATCH] feat(code): show Draft badge on New task when input is unsubmitted Reads the persisted task-input draft from the message editor draft store and renders a small "Draft" badge in the New task sidebar item whenever the editor content is non-empty. The badge clears as soon as the task is submitted (which already calls clearDraft on the "task-input" session). Generated-By: PostHog Code Task-Id: bb2e391e-884e-4f53-be65-441b51ddda98 --- .../sidebar/components/items/HomeItem.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/code/src/renderer/features/sidebar/components/items/HomeItem.tsx b/apps/code/src/renderer/features/sidebar/components/items/HomeItem.tsx index 7ca165a1c2..648ce78d35 100644 --- a/apps/code/src/renderer/features/sidebar/components/items/HomeItem.tsx +++ b/apps/code/src/renderer/features/sidebar/components/items/HomeItem.tsx @@ -2,6 +2,8 @@ import { Tooltip } from "@components/ui/Tooltip"; import { EnvelopeSimple, Plus } from "@phosphor-icons/react"; import { Badge, type ButtonProps } from "@posthog/quill"; import { SHORTCUTS } from "@renderer/constants/keyboard-shortcuts"; +import { useDraftStore } from "@renderer/features/message-editor/stores/draftStore"; +import { isContentEmpty } from "@renderer/features/message-editor/utils/content"; import { SidebarItem } from "../SidebarItem"; import { SidebarKbdHint } from "./SidebarKbdHint"; @@ -12,6 +14,9 @@ interface NewTaskItemProps { } export function NewTaskItem({ isActive, onClick }: NewTaskItemProps) { + const hasDraft = useDraftStore( + (s) => !isContentEmpty(s.drafts["task-input"]), + ); return ( } + endContent={ + <> + {hasDraft ? ( + + Draft + + ) : null} + + + } /> ); }