fix: show notebook hierarchy with submenu expand in note move dropdown
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m33s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m33s
This commit is contained in:
@@ -9,6 +9,9 @@ import {
|
|||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
|
DropdownMenuSub,
|
||||||
|
DropdownMenuSubContent,
|
||||||
|
DropdownMenuSubTrigger,
|
||||||
} from '@/components/ui/dropdown-menu'
|
} from '@/components/ui/dropdown-menu'
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
@@ -20,7 +23,7 @@ import {
|
|||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
} from '@/components/ui/alert-dialog'
|
} 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 { useState, useEffect, useTransition, useOptimistic, memo, useMemo } from 'react'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import { useSession } from 'next-auth/react'
|
import { useSession } from 'next-auth/react'
|
||||||
@@ -507,22 +510,37 @@ export const NoteCard = memo(function NoteCard({
|
|||||||
{notebooks.filter(nb => !nb.parentId).map((notebook: any) => {
|
{notebooks.filter(nb => !nb.parentId).map((notebook: any) => {
|
||||||
const NotebookIcon = getNotebookIcon(notebook.icon || 'folder')
|
const NotebookIcon = getNotebookIcon(notebook.icon || 'folder')
|
||||||
const children = notebooks.filter((c: any) => c.parentId === notebook.id)
|
const children = notebooks.filter((c: any) => c.parentId === notebook.id)
|
||||||
return (
|
if (children.length > 0) {
|
||||||
<div key={notebook.id}>
|
return (
|
||||||
<DropdownMenuItem onClick={() => handleMoveToNotebook(notebook.id)}>
|
<DropdownMenuSub key={notebook.id}>
|
||||||
<NotebookIcon className="h-4 w-4 mr-2" />
|
<DropdownMenuSubTrigger className="gap-2">
|
||||||
{notebook.name}
|
<NotebookIcon className="h-4 w-4" />
|
||||||
</DropdownMenuItem>
|
{notebook.name}
|
||||||
{children.map((child: any) => {
|
<ChevronRight className="h-3 w-3 ml-auto opacity-50" />
|
||||||
const ChildIcon = getNotebookIcon(child.icon || 'folder')
|
</DropdownMenuSubTrigger>
|
||||||
return (
|
<DropdownMenuSubContent>
|
||||||
<DropdownMenuItem key={child.id} onClick={() => handleMoveToNotebook(child.id)} className="pl-8">
|
<DropdownMenuItem onClick={() => handleMoveToNotebook(notebook.id)}>
|
||||||
<ChildIcon className="h-4 w-4 mr-2" />
|
<NotebookIcon className="h-4 w-4 mr-2" />
|
||||||
└ {child.name}
|
{notebook.name}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)
|
{children.map((child: any) => {
|
||||||
})}
|
const ChildIcon = getNotebookIcon(child.icon || 'folder')
|
||||||
</div>
|
return (
|
||||||
|
<DropdownMenuItem key={child.id} onClick={() => handleMoveToNotebook(child.id)}>
|
||||||
|
<ChildIcon className="h-4 w-4 mr-2" />
|
||||||
|
{child.name}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</DropdownMenuSubContent>
|
||||||
|
</DropdownMenuSub>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<DropdownMenuItem key={notebook.id} onClick={() => handleMoveToNotebook(notebook.id)}>
|
||||||
|
<NotebookIcon className="h-4 w-4 mr-2" />
|
||||||
|
{notebook.name}
|
||||||
|
</DropdownMenuItem>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user