All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m11s
Chat (AIChat floating widget): conversationId was never captured from the API response, so every message created a new conversation with no context. Now creates the conversation upfront before streaming (same pattern as ChatContainer) so the ID persists across messages. Note history: was stored globally in UserAISettings, so enabling history on one note enabled it for ALL notes. Now each Note has its own historyEnabled boolean field. The "Enable history" action only affects the specific note. A migration adds the column with default false. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
'use client'
|
|
|
|
import dynamic from 'next/dynamic'
|
|
import { Note } from '@/lib/types'
|
|
import { NotesTabsView } from '@/components/notes-tabs-view'
|
|
|
|
const MasonryGridLazy = dynamic(
|
|
() => import('@/components/masonry-grid').then((m) => m.MasonryGrid),
|
|
{
|
|
ssr: false,
|
|
loading: () => (
|
|
<div
|
|
className="min-h-[200px] rounded-xl border border-dashed border-muted-foreground/20 bg-muted/30 animate-pulse"
|
|
aria-hidden
|
|
/>
|
|
),
|
|
}
|
|
)
|
|
|
|
export type NotesViewMode = 'masonry' | 'tabs'
|
|
|
|
interface NotesMainSectionProps {
|
|
notes: Note[]
|
|
viewMode: NotesViewMode
|
|
onEdit?: (note: Note, readOnly?: boolean) => void
|
|
onSizeChange?: (noteId: string, size: 'small' | 'medium' | 'large') => void
|
|
currentNotebookId?: string | null
|
|
noteHistoryMode?: 'manual' | 'auto'
|
|
onOpenHistory?: (note: Note) => void
|
|
onEnableHistory?: (noteId: string) => Promise<void>
|
|
}
|
|
|
|
export function NotesMainSection({
|
|
notes,
|
|
viewMode,
|
|
onEdit,
|
|
onSizeChange,
|
|
currentNotebookId,
|
|
noteHistoryMode = 'manual',
|
|
onOpenHistory,
|
|
onEnableHistory,
|
|
}: NotesMainSectionProps) {
|
|
if (viewMode === 'tabs') {
|
|
return (
|
|
<div className="flex min-h-0 flex-1 flex-col" data-testid="notes-grid-tabs-wrap">
|
|
<NotesTabsView
|
|
notes={notes}
|
|
onEdit={onEdit}
|
|
currentNotebookId={currentNotebookId}
|
|
noteHistoryMode={noteHistoryMode}
|
|
onOpenHistory={onOpenHistory}
|
|
onEnableHistory={onEnableHistory}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div data-testid="notes-grid">
|
|
<MasonryGridLazy
|
|
notes={notes}
|
|
onEdit={onEdit}
|
|
onSizeChange={onSizeChange}
|
|
noteHistoryMode={noteHistoryMode}
|
|
onOpenHistory={onOpenHistory}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|