All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 5s
- Fix useBrainstormSocket: stable guestId via useRef, remove setState in cleanup - Fix GhostCursor: direct DOM manipulation via refs, no useState re-renders - Fix all SQL embedding queries: add ::vector cast on text columns - Fix embedding truncation to 15000 chars (under 8192 token limit) - Fix NoteEmbedding INSERT: remove non-existent updatedAt column - Fix billing page: show all quota stats in grid instead of single metric - Fix usage meter: accordion expand/collapse, per-feature detail - Fix semantic search: rebuild 103 note embeddings, ::vector cast on vectorSearch - Fix brainstorm expand/manual-idea/create: ::vector cast on embedding SQL
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import { useState, useCallback } from 'react'
|
|
|
|
import dynamic from 'next/dynamic'
|
|
import type { Note } from '@/lib/types'
|
|
import { NotesEditorialView } from '@/components/notes-editorial-view'
|
|
import { getNoteById } from '@/app/actions/notes'
|
|
|
|
const NoteEditor = dynamic(
|
|
() => import('@/components/note-editor').then(m => ({ default: m.NoteEditor })),
|
|
{ ssr: false }
|
|
)
|
|
|
|
interface ArchiveClientProps {
|
|
notes: Note[]
|
|
}
|
|
|
|
export function ArchiveClient({ notes }: ArchiveClientProps) {
|
|
const [editingNote, setEditingNote] = useState<{ note: Note; readOnly: boolean } | null>(null)
|
|
|
|
const handleOpen = useCallback(async (note: Note, readOnly = false) => {
|
|
const fresh = await getNoteById(note.id)
|
|
if (fresh) setEditingNote({ note: fresh, readOnly })
|
|
}, [])
|
|
|
|
const handleClose = useCallback(() => {
|
|
setEditingNote(null)
|
|
}, [])
|
|
|
|
if (editingNote) {
|
|
return (
|
|
<NoteEditor
|
|
note={editingNote.note}
|
|
readOnly={editingNote.readOnly}
|
|
onClose={handleClose}
|
|
onNoteSaved={() => {}}
|
|
fullPage
|
|
/>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<NotesEditorialView
|
|
notes={notes}
|
|
onOpen={handleOpen}
|
|
/>
|
|
)
|
|
}
|