@@ -703,6 +703,7 @@ export function ContextualAIChat({
onSelect={(id) => setChatScope(id)}
placeholder="Inclure un carnet..."
className="w-full"
+ size="sm"
dropUp
/>
diff --git a/memento-note/components/hierarchical-notebook-selector.tsx b/memento-note/components/hierarchical-notebook-selector.tsx
index 3c3ef59..c373dcc 100644
--- a/memento-note/components/hierarchical-notebook-selector.tsx
+++ b/memento-note/components/hierarchical-notebook-selector.tsx
@@ -1,6 +1,6 @@
'use client'
-import React, { useState, useMemo, useRef, useCallback, useLayoutEffect } from 'react'
+import React, { useState, useMemo, useRef, useCallback } from 'react'
import {
ChevronRight,
ChevronDown,
@@ -11,16 +11,16 @@ import {
} from 'lucide-react'
import { Notebook } from '@/lib/types'
import { motion, AnimatePresence } from 'motion/react'
-import { cn } from '@/lib/utils'
import { createPortal } from 'react-dom'
interface HierarchicalNotebookSelectorProps {
- notebooks: Notebook[]
+ notebooks: { id: string; name: string; icon?: string | null; parentId?: string | null; trashedAt?: Date | string | null }[]
selectedId: string | null
onSelect: (id: string) => void
className?: string
placeholder?: string
dropUp?: boolean
+ size?: 'default' | 'sm'
}
export function HierarchicalNotebookSelector({
@@ -30,19 +30,19 @@ export function HierarchicalNotebookSelector({
className = '',
placeholder = 'Select a notebook...',
dropUp = false,
+ size = 'default',
}: HierarchicalNotebookSelectorProps) {
const [isOpen, setIsOpen] = useState(false)
const [searchQuery, setSearchQuery] = useState('')
const [expandedIds, setExpandedIds] = useState
>(new Set())
const triggerRef = useRef(null)
- const [dropdownStyle, setDropdownStyle] = useState(null)
- const computeStyle = useCallback(() => {
- if (!triggerRef.current) return null
+ const getDropdownStyle = useCallback((): React.CSSProperties => {
+ if (!triggerRef.current) return { position: 'fixed', top: 0, left: 0, width: 280, zIndex: 9999 }
const rect = triggerRef.current.getBoundingClientRect()
if (dropUp) {
return {
- position: 'fixed' as const,
+ position: 'fixed',
bottom: window.innerHeight - rect.top + 8,
left: rect.left,
width: Math.max(rect.width, 280),
@@ -50,7 +50,7 @@ export function HierarchicalNotebookSelector({
}
}
return {
- position: 'fixed' as const,
+ position: 'fixed',
top: rect.bottom + 8,
left: rect.left,
width: Math.max(rect.width, 280),
@@ -58,23 +58,12 @@ export function HierarchicalNotebookSelector({
}
}, [dropUp])
- useLayoutEffect(() => {
- if (isOpen) {
- setDropdownStyle(computeStyle())
- const handleResize = () => setDropdownStyle(computeStyle())
- window.addEventListener('resize', handleResize)
- return () => window.removeEventListener('resize', handleResize)
- } else {
- setDropdownStyle(null)
- }
- }, [isOpen, computeStyle])
-
const selectedNotebook = notebooks.find(nb => nb.id === selectedId)
const path = useMemo(() => {
if (!selectedNotebook) return []
- const trail: Notebook[] = []
- let current: Notebook | undefined = selectedNotebook
+ const trail: typeof notebooks = []
+ let current: typeof notebooks[0] | undefined = selectedNotebook
while (current) {
trail.unshift(current)
if (!current.parentId) break
@@ -93,7 +82,7 @@ export function HierarchicalNotebookSelector({
setExpandedIds(next)
}
- const renderTree = (parentId: string | null | undefined, level = 0) => {
+ const renderTree = (parentId: string | null | undefined, level = 0): React.ReactNode => {
const children = notebooks.filter(
nb => (nb.parentId ?? null) === (parentId ?? null)
)
@@ -167,10 +156,10 @@ export function HierarchicalNotebookSelector({
setIsOpen(!isOpen)}
- className="w-full bg-slate-50 dark:bg-white/5 border border-border/80 rounded-xl px-4 py-4 text-sm outline-none focus:ring-4 ring-blueprint/5 focus:border-blueprint/40 transition-all cursor-pointer text-ink flex items-center gap-3"
+ onClick={() => setIsOpen(prev => !prev)}
+ className={`w-full bg-slate-50 dark:bg-white/5 border border-border/80 rounded-xl outline-none focus:ring-4 ring-blueprint/5 focus:border-blueprint/40 transition-all cursor-pointer text-ink flex items-center gap-3 ${size === 'sm' ? 'px-3 py-2 text-xs' : 'px-4 py-3 text-sm'}`}
>
-
+
{path.length > 0 ? (
@@ -190,15 +179,17 @@ export function HierarchicalNotebookSelector({
-
- {isOpen && dropdownStyle && typeof window !== 'undefined' && createPortal(
- <>
- setIsOpen(false)} />
+ {isOpen && typeof window !== 'undefined' && createPortal(
+ <>
+
setIsOpen(false)} />
+
@@ -231,10 +222,10 @@ export function HierarchicalNotebookSelector({
- >,
- document.body
- )}
-
+
+ >,
+ document.body
+ )}
)
}
diff --git a/memento-note/components/home-client.tsx b/memento-note/components/home-client.tsx
index 74d87f7..9cf8469 100644
--- a/memento-note/components/home-client.tsx
+++ b/memento-note/components/home-client.tsx
@@ -420,11 +420,14 @@ export function HomeClient({ initialNotes, initialSettings }: HomeClientProps) {
{currentNotebook && notebookPath.length > 0 && (
-
+
{notebookPath.map((nb: any, i: number) => (
- {i > 0 && }
-
+ {i > 0 && }
+
{nb.name}
diff --git a/memento-note/components/note-editor/note-editor-full-page.tsx b/memento-note/components/note-editor/note-editor-full-page.tsx
index 56c9f87..5ef3bb5 100644
--- a/memento-note/components/note-editor/note-editor-full-page.tsx
+++ b/memento-note/components/note-editor/note-editor-full-page.tsx
@@ -11,6 +11,7 @@ import { ReminderDialog } from '@/components/reminder-dialog'
import { ContextualAIChat } from '@/components/contextual-ai-chat'
import { NoteDocumentInfoPanel } from '@/components/note-document-info-panel'
import { format } from 'date-fns'
+import { ChevronRight } from 'lucide-react'
import { toast } from 'sonner'
import { Note } from '@/lib/types'
@@ -40,10 +41,10 @@ export function NoteEditorFullPage({ onClose }: NoteEditorFullPageProps) {
{/* Breadcrumb + Title block */}
{/* Breadcrumb: Notebook › Date */}
-
- {notebookName &&
{notebookName}}
- {notebookName &&
›}
-
+
+ {notebookName && {notebookName}}
+ {notebookName && }
+
{format(new Date(note.contentUpdatedAt), 'MMM d, yyyy')}