epic-ux-design #1

Open
sepehr wants to merge 31 commits from epic-ux-design into main
3 changed files with 22 additions and 13 deletions
Showing only changes of commit f822a6eb18 - Show all commits

View File

@@ -132,6 +132,9 @@ export function AutoLabelSuggestionDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle className="sr-only">{t('ai.autoLabels.analyzing')}</DialogTitle>
</DialogHeader>
<div className="flex flex-col items-center justify-center py-12">
<Loader2 className="h-8 w-8 animate-spin text-primary" />
<p className="mt-4 text-sm text-muted-foreground">

View File

@@ -184,6 +184,11 @@ export function MasonryGrid({ notes, onEdit }: MasonryGridProps) {
})
);
const localNotesRef = useRef<Note[]>(localNotes)
useEffect(() => {
localNotesRef.current = localNotes
}, [localNotes])
const handleDragStart = useCallback((event: DragStartEvent) => {
setActiveId(event.active.id as string);
startDrag(event.active.id as string);
@@ -196,25 +201,25 @@ export function MasonryGrid({ notes, onEdit }: MasonryGridProps) {
if (!over || active.id === over.id) return;
setLocalNotes(prev => {
const oldIndex = prev.findIndex(n => n.id === active.id);
const newIndex = prev.findIndex(n => n.id === over.id);
if (oldIndex === -1 || newIndex === -1) return prev;
return arrayMove(prev, oldIndex, newIndex);
});
const reordered = arrayMove(
localNotesRef.current,
localNotesRef.current.findIndex(n => n.id === active.id),
localNotesRef.current.findIndex(n => n.id === over.id),
);
// Persist new order to DB (sans revalidation pour éviter le flash)
setLocalNotes(current => {
const ids = current.map(n => n.id);
if (reordered.length === 0) return;
setLocalNotes(reordered);
// Persist order outside of setState to avoid "setState in render" warning
const ids = reordered.map(n => n.id);
updateFullOrderWithoutRevalidation(ids).catch(err => {
console.error('Failed to persist order:', err);
});
return current;
});
}, [endDrag]);
return (
<DndContext
id="masonry-dnd"
sensors={sensors}
collisionDetection={closestCenter}
onDragStart={handleDragStart}

View File

@@ -370,6 +370,7 @@ export function NotesTabsView({ notes, onEdit, currentNotebookId }: NotesTabsVie
aria-label={t('notes.viewTabs')}
>
<DndContext
id="notes-tabs-dnd"
sensors={sensors}
collisionDetection={closestCenter}
onDragEnd={handleDragEnd}