fix(anotacoes): preservar formatação e corrigir layout do card

- Preservar quebras de linha e espaços na descrição das notas
- Corrigir altura fixa do card para manter footer sempre visível
- Texto excedente é cortado em vez de empurrar os botões

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Felipe Coutinho
2026-02-01 22:07:53 +00:00
parent 577246f471
commit 76702d770f
2 changed files with 9 additions and 9 deletions

View File

@@ -82,9 +82,9 @@ export function NoteCard({
].filter((action) => typeof action.onClick === "function");
return (
<Card className="h-[300px] w-[440px] gap-0">
<CardContent className="flex flex-1 flex-col gap-4">
<div className="flex items-start justify-between gap-3">
<Card className="flex h-[300px] w-[440px] flex-col gap-0">
<CardContent className="flex min-h-0 flex-1 flex-col gap-4">
<div className="flex shrink-0 items-start justify-between gap-3">
<div className="flex flex-col gap-2">
<h3 className="text-lg font-semibold leading-tight text-foreground wrap-break-word">
{displayTitle}
@@ -98,7 +98,7 @@ export function NoteCard({
</div>
{isTask ? (
<div className="flex-1 overflow-auto space-y-2 mt-2">
<div className="min-h-0 flex-1 space-y-2 overflow-hidden">
{tasks.slice(0, 5).map((task) => (
<div key={task.id} className="flex items-start gap-2 text-sm">
<div
@@ -129,14 +129,14 @@ export function NoteCard({
)}
</div>
) : (
<p className="flex-1 overflow-auto whitespace-pre-line text-sm text-muted-foreground wrap-break-word leading-relaxed mt-2">
<p className="min-h-0 flex-1 overflow-hidden whitespace-pre-line text-sm text-muted-foreground wrap-break-word leading-relaxed">
{note.description}
</p>
)}
</CardContent>
{actions.length > 0 ? (
<CardFooter className="flex flex-wrap gap-3 px-6 pt-3 text-sm">
<CardFooter className="flex shrink-0 flex-wrap gap-3 px-6 pt-3 text-sm">
{actions.map(({ label, icon, onClick, variant }) => (
<button
key={label}

View File

@@ -108,7 +108,7 @@ export function NoteDialog({
const onlySpaces =
normalize(formState.title).length === 0 ||
(isNote && normalize(formState.description).length === 0) ||
(isNote && formState.description.trim().length === 0) ||
(!isNote && (!formState.tasks || formState.tasks.length === 0));
const invalidLen = titleCount > MAX_TITLE || descCount > MAX_DESC;
@@ -116,7 +116,7 @@ export function NoteDialog({
const unchanged =
mode === "update" &&
normalize(formState.title) === normalize(note?.title ?? "") &&
normalize(formState.description) === normalize(note?.description ?? "") &&
formState.description.trim() === (note?.description ?? "").trim() &&
JSON.stringify(formState.tasks) === JSON.stringify(note?.tasks);
const disableSubmit = isPending || onlySpaces || unchanged || invalidLen;
@@ -182,7 +182,7 @@ export function NoteDialog({
const payload = {
title: normalize(formState.title),
description: normalize(formState.description),
description: formState.description.trim(),
type: formState.type,
tasks: formState.tasks,
};