Phase 1: NoteEditor Split (64KB → 9 focused components) - components/note-editor/: types.ts, context, toolbar, title-block, content-area, metadata-section, full-page, dialog compositions - Maintains backwards compatibility via re-export from note-editor.tsx Phase 2: Context Consolidation (5 → 3 contexts) - NotebooksContext absorbs LabelContext (labels CRUD) - EditorUIContext merges HomeViewContext + NotebookDragContext - Removed: LabelContext, home-view-context, notebook-drag-context Phase 3: React Query Infrastructure - Added QueryProvider with @tanstack/react-query - lib/query-keys.ts: centralized query key definitions - lib/query-hooks.ts: useNotes, useNotebooksQuery, useLabelsQuery - lib/use-refresh.ts: hybrid invalidateQueries + triggerRefresh helper - NotebooksContext: invalidateQueries on mutations (with triggerRefresh fallback) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import { NoteEditorProvider, useNoteEditorContext } from './note-editor-context'
|
|
import { NoteEditorFullPage } from './note-editor-full-page'
|
|
import { NoteEditorDialog } from './note-editor-dialog'
|
|
import { Note } from '@/lib/types'
|
|
|
|
interface NoteEditorProps {
|
|
note: Note
|
|
readOnly?: boolean
|
|
onClose: () => void
|
|
fullPage?: boolean
|
|
}
|
|
|
|
export function NoteEditor({ note, readOnly, onClose, fullPage = false }: NoteEditorProps) {
|
|
return (
|
|
<NoteEditorProvider note={note} readOnly={readOnly} fullPage={fullPage}>
|
|
{fullPage ? (
|
|
<NoteEditorFullPage onClose={onClose} />
|
|
) : (
|
|
<NoteEditorDialog onClose={onClose} />
|
|
)}
|
|
</NoteEditorProvider>
|
|
)
|
|
}
|
|
|
|
// Re-export context hook for backwards compatibility
|
|
export { useNoteEditorContext } from './note-editor-context'
|
|
|
|
// Re-export sub-components for advanced usage
|
|
export { NoteEditorFullPage } from './note-editor-full-page'
|
|
export { NoteEditorDialog } from './note-editor-dialog'
|
|
export { NoteEditorProvider } from './note-editor-context'
|
|
export { NoteTitleBlock } from './note-title-block'
|
|
export { NoteContentArea } from './note-content-area'
|
|
export { NoteMetadataSection } from './note-metadata-section'
|
|
export { NoteEditorToolbar } from './note-editor-toolbar' |