From ee405e3e086b1b1418873da6e812980fea299187 Mon Sep 17 00:00:00 2001 From: Antigravity Date: Sat, 9 May 2026 21:25:28 +0000 Subject: [PATCH] fix: show notebook hierarchy with submenu expand in note move dropdown --- memento-note/components/note-card.tsx | 50 ++++++++++++++++++--------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/memento-note/components/note-card.tsx b/memento-note/components/note-card.tsx index 61d9fb5..f38be31 100644 --- a/memento-note/components/note-card.tsx +++ b/memento-note/components/note-card.tsx @@ -9,6 +9,9 @@ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, + DropdownMenuSub, + DropdownMenuSubContent, + DropdownMenuSubTrigger, } from '@/components/ui/dropdown-menu' import { AlertDialog, @@ -20,7 +23,7 @@ import { AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog' -import { Pin, Bell, GripVertical, X, Link2, FolderOpen, StickyNote, LucideIcon, Folder, Briefcase, FileText, Zap, BarChart3, Globe, Sparkles, Book, Heart, Crown, Music, Building2, LogOut, Trash2, AlignLeft, FileCode2, PenLine, ListChecks } from 'lucide-react' +import { Pin, Bell, GripVertical, X, Link2, FolderOpen, StickyNote, LucideIcon, Folder, Briefcase, FileText, Zap, BarChart3, Globe, Sparkles, Book, Heart, Crown, Music, Building2, LogOut, Trash2, AlignLeft, FileCode2, PenLine, ListChecks, ChevronRight } from 'lucide-react' import { useState, useEffect, useTransition, useOptimistic, memo, useMemo } from 'react' import dynamic from 'next/dynamic' import { useSession } from 'next-auth/react' @@ -507,22 +510,37 @@ export const NoteCard = memo(function NoteCard({ {notebooks.filter(nb => !nb.parentId).map((notebook: any) => { const NotebookIcon = getNotebookIcon(notebook.icon || 'folder') const children = notebooks.filter((c: any) => c.parentId === notebook.id) - return ( -
- handleMoveToNotebook(notebook.id)}> - - {notebook.name} - - {children.map((child: any) => { - const ChildIcon = getNotebookIcon(child.icon || 'folder') - return ( - handleMoveToNotebook(child.id)} className="pl-8"> - - └ {child.name} + if (children.length > 0) { + return ( + + + + {notebook.name} + + + + handleMoveToNotebook(notebook.id)}> + + {notebook.name} - ) - })} -
+ {children.map((child: any) => { + const ChildIcon = getNotebookIcon(child.icon || 'folder') + return ( + handleMoveToNotebook(child.id)}> + + {child.name} + + ) + })} + + + ) + } + return ( + handleMoveToNotebook(notebook.id)}> + + {notebook.name} + ) })}