diff --git a/keep-notes/components/masonry-grid.css b/keep-notes/components/masonry-grid.css index 20d5f72..2c9f00f 100644 --- a/keep-notes/components/masonry-grid.css +++ b/keep-notes/components/masonry-grid.css @@ -48,19 +48,16 @@ .masonry-item[data-size="small"], .note-card[data-size="small"] { min-height: 150px; - height: auto !important; } .masonry-item[data-size="medium"], .note-card[data-size="medium"] { min-height: 200px; - height: auto !important; } .masonry-item[data-size="large"], .note-card[data-size="large"] { min-height: 300px; - height: auto !important; } /* Drag State Styles - Clean and flat behavior requested by user */ @@ -133,19 +130,16 @@ .masonry-item[data-size="small"], .masonry-item-content .note-card[data-size="small"] { min-height: 120px; - height: auto !important; } .masonry-item[data-size="medium"], .masonry-item-content .note-card[data-size="medium"] { min-height: 160px; - height: auto !important; } .masonry-item[data-size="large"], .masonry-item-content .note-card[data-size="large"] { min-height: 240px; - height: auto !important; } /* Reduced drag effect on mobile */ diff --git a/keep-notes/components/masonry-grid.tsx b/keep-notes/components/masonry-grid.tsx index 7713e37..f7a28ad 100644 --- a/keep-notes/components/masonry-grid.tsx +++ b/keep-notes/components/masonry-grid.tsx @@ -26,18 +26,23 @@ interface MasonryItemProps { isDragging?: boolean; } -const MasonryItem = memo(function MasonryItem({ note, onEdit, onResize, onNoteSizeChange, onDragStart, onDragEnd, isDragging }: MasonryItemProps) { +const MasonryItem = function MasonryItem({ note, onEdit, onResize, onNoteSizeChange, onDragStart, onDragEnd, isDragging }: MasonryItemProps) { const resizeRef = useResizeObserver(onResize); + useEffect(() => { + onResize(); + const timer = setTimeout(onResize, 300); + return () => clearTimeout(timer); + }, [note.size, onResize]); + return (
-
+
); -}); +}; export function MasonryGrid({ notes, onEdit }: MasonryGridProps) { const { t } = useLanguage(); @@ -354,7 +359,7 @@ export function MasonryGrid({ notes, onEdit }: MasonryGridProps) {
{pinnedNotes.map(note => ( {othersNotes.map(note => ( ( { + onSelect={(e) => { onSizeChange?.(size); }} className={cn( diff --git a/keep-notes/components/note-card.tsx b/keep-notes/components/note-card.tsx index 219e464..c759d09 100644 --- a/keep-notes/components/note-card.tsx +++ b/keep-notes/components/note-card.tsx @@ -237,15 +237,21 @@ export function NoteCard({ } const handleSizeChange = async (size: 'small' | 'medium' | 'large') => { - // Notify parent of size change so it can update its state - onSizeChange?.(size) + startTransition(async () => { + // Instant visual feedback for the card itself + addOptimisticNote({ size }) - // Trigger layout refresh - onResize?.() - setTimeout(() => onResize?.(), 300) + // Notify parent so it can update its local state + onSizeChange?.(size) - // Update server in background - updateSize(note.id, size) + // Trigger layout refresh + onResize?.() + setTimeout(() => onResize?.(), 300) + + // Update server in background + await updateSize(note.id, size) + router.refresh() + }) } const handleCheckItem = async (checkItemId: string) => { diff --git a/keep-notes/playwright-report/index.html b/keep-notes/playwright-report/index.html index 7713416..02b45af 100644 --- a/keep-notes/playwright-report/index.html +++ b/keep-notes/playwright-report/index.html @@ -82,4 +82,4 @@ Error generating stack: `+n.message+`
- \ No newline at end of file + \ No newline at end of file diff --git a/keep-notes/prisma/dev.db b/keep-notes/prisma/dev.db index fd1f8e9..708e288 100644 Binary files a/keep-notes/prisma/dev.db and b/keep-notes/prisma/dev.db differ