forked from git.gladyson/openmonetis
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:
@@ -82,9 +82,9 @@ export function NoteCard({
|
|||||||
].filter((action) => typeof action.onClick === "function");
|
].filter((action) => typeof action.onClick === "function");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="h-[300px] w-[440px] gap-0">
|
<Card className="flex h-[300px] w-[440px] flex-col gap-0">
|
||||||
<CardContent className="flex flex-1 flex-col gap-4">
|
<CardContent className="flex min-h-0 flex-1 flex-col gap-4">
|
||||||
<div className="flex items-start justify-between gap-3">
|
<div className="flex shrink-0 items-start justify-between gap-3">
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<h3 className="text-lg font-semibold leading-tight text-foreground wrap-break-word">
|
<h3 className="text-lg font-semibold leading-tight text-foreground wrap-break-word">
|
||||||
{displayTitle}
|
{displayTitle}
|
||||||
@@ -98,7 +98,7 @@ export function NoteCard({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isTask ? (
|
{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) => (
|
{tasks.slice(0, 5).map((task) => (
|
||||||
<div key={task.id} className="flex items-start gap-2 text-sm">
|
<div key={task.id} className="flex items-start gap-2 text-sm">
|
||||||
<div
|
<div
|
||||||
@@ -129,14 +129,14 @@ export function NoteCard({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</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}
|
{note.description}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
||||||
{actions.length > 0 ? (
|
{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 }) => (
|
{actions.map(({ label, icon, onClick, variant }) => (
|
||||||
<button
|
<button
|
||||||
key={label}
|
key={label}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export function NoteDialog({
|
|||||||
|
|
||||||
const onlySpaces =
|
const onlySpaces =
|
||||||
normalize(formState.title).length === 0 ||
|
normalize(formState.title).length === 0 ||
|
||||||
(isNote && normalize(formState.description).length === 0) ||
|
(isNote && formState.description.trim().length === 0) ||
|
||||||
(!isNote && (!formState.tasks || formState.tasks.length === 0));
|
(!isNote && (!formState.tasks || formState.tasks.length === 0));
|
||||||
|
|
||||||
const invalidLen = titleCount > MAX_TITLE || descCount > MAX_DESC;
|
const invalidLen = titleCount > MAX_TITLE || descCount > MAX_DESC;
|
||||||
@@ -116,7 +116,7 @@ export function NoteDialog({
|
|||||||
const unchanged =
|
const unchanged =
|
||||||
mode === "update" &&
|
mode === "update" &&
|
||||||
normalize(formState.title) === normalize(note?.title ?? "") &&
|
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);
|
JSON.stringify(formState.tasks) === JSON.stringify(note?.tasks);
|
||||||
|
|
||||||
const disableSubmit = isPending || onlySpaces || unchanged || invalidLen;
|
const disableSubmit = isPending || onlySpaces || unchanged || invalidLen;
|
||||||
@@ -182,7 +182,7 @@ export function NoteDialog({
|
|||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
title: normalize(formState.title),
|
title: normalize(formState.title),
|
||||||
description: normalize(formState.description),
|
description: formState.description.trim(),
|
||||||
type: formState.type,
|
type: formState.type,
|
||||||
tasks: formState.tasks,
|
tasks: formState.tasks,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user