From f0b8758cc2c64bc1cbdb588d5da628e72acd3f52 Mon Sep 17 00:00:00 2001 From: Felipe Coutinho Date: Thu, 26 Feb 2026 18:04:41 +0000 Subject: [PATCH] =?UTF-8?q?style:=20padronizar=20note-dialog=20com=20Label?= =?UTF-8?q?s=20e=20scroll=20apenas=20no=20conte=C3=BAdo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adiciona Labels (Título, Conteúdo, Tipo de anotação, Adicionar tarefa) seguindo o padrão dos demais dialogs do projeto (space-y-1 + Label). DialogDescription visível novamente com texto contextual. Scroll apenas no form (-mx-6 max-h-[80vh] overflow-y-auto px-6), header e footer fixos — mesmo padrão do lancamento-dialog. Footer movido para fora do form; submit via requestSubmit(). Corrige useMemo antes do early return no note-details-dialog. Co-Authored-By: Claude Opus 4.6 --- components/anotacoes/note-details-dialog.tsx | 5 +- components/anotacoes/note-dialog.tsx | 219 +++++++++++-------- 2 files changed, 125 insertions(+), 99 deletions(-) diff --git a/components/anotacoes/note-details-dialog.tsx b/components/anotacoes/note-details-dialog.tsx index b4e2910..54de84f 100644 --- a/components/anotacoes/note-details-dialog.tsx +++ b/components/anotacoes/note-details-dialog.tsx @@ -45,13 +45,14 @@ export function NoteDetailsDialog({ }; }, [note]); + const tasks = note?.tasks || []; + const sortedTasks = useMemo(() => sortTasksByStatus(tasks), [tasks]); + if (!note) { return null; } const isTask = note.type === "tarefa"; - const tasks = note.tasks || []; - const sortedTasks = useMemo(() => sortTasksByStatus(tasks), [tasks]); const completedCount = tasks.filter((t) => t.completed).length; const totalCount = tasks.length; diff --git a/components/anotacoes/note-dialog.tsx b/components/anotacoes/note-dialog.tsx index 5c5f8df..edd44ef 100644 --- a/components/anotacoes/note-dialog.tsx +++ b/components/anotacoes/note-dialog.tsx @@ -26,6 +26,7 @@ import { DialogTrigger, } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { Textarea } from "@/components/ui/textarea"; import { useControlledState } from "@/hooks/use-controlled-state"; @@ -76,7 +77,6 @@ export function NoteDialog({ const descRef = useRef(null); const newTaskRef = useRef(null); - // Use controlled state hook for dialog open state const [dialogOpen, setDialogOpen] = useControlledState( open, false, @@ -85,7 +85,6 @@ export function NoteDialog({ const initialState = buildInitialValues(note); - // Use form state hook for form management const { formState, updateField, setFormState } = useFormState(initialState); @@ -98,7 +97,11 @@ export function NoteDialog({ } }, [dialogOpen, note, setFormState]); - const title = mode === "create" ? "Nova anotação" : "Editar anotação"; + const dialogTitle = mode === "create" ? "Nova anotação" : "Editar anotação"; + const description = + mode === "create" + ? "Crie uma nota simples ou uma lista de tarefas." + : "Altere o conteúdo desta anotação."; const submitLabel = mode === "create" ? "Salvar" : "Atualizar"; const titleCount = formState.title.length; @@ -224,104 +227,114 @@ export function NoteDialog({ return ( {trigger ? {trigger} : null} - + - {title} - - {mode === "create" - ? "Criar nova anotação" - : "Editar anotação existente"} - + {dialogTitle} + {description}
{mode === "create" && ( - - updateField("type", value as "nota" | "tarefa") - } - disabled={isPending} - className="flex gap-4" - > -
- - -
-
- - -
-
+
+ + + updateField("type", value as "nota" | "tarefa") + } + disabled={isPending} + className="flex gap-4" + > +
+ + +
+
+ + +
+
+
)} - updateField("title", e.target.value)} - placeholder="Título" - maxLength={MAX_TITLE} - disabled={isPending} - required - /> - - {isNote && ( -