Files
DeepTutor/web/features/notes/components/NoteSuggestionContent.tsx
Bingxi Zhao (Frank) 857a82e74a feat(notes): add block notebooks with inline reviews and linked favorites
Add rich text and learning blocks, media uploads, page trees, and revisioned notebook storage. Present AI suggestions at their target blocks with durable accept and dismiss actions.

Unify saved outputs as Favorites with typed expandable blocks, stable source links, atomic batch insertion, nesting, dragging, and undo/redo.

Validation: 99 frontend tests and 99 backend tests pass in an isolated snapshot, along with TypeScript, scoped ESLint, dependency architecture, and locale parity checks.
2026-10-17 23:15:23 +08:00

39 lines
1.1 KiB
TypeScript

'use client'
import dynamic from 'next/dynamic'
import type { NoteBlock } from '@/lib/notes-api'
import { blockPreview } from '../model/blocks'
const Learning = dynamic(() => import('./NoteLearningContent'), { ssr: false })
const Markdown = dynamic(() => import('@/components/common/MarkdownRenderer'), { ssr: false })
export default function NoteSuggestionContent({
blocks,
markdown,
}: {
blocks?: NoteBlock[] | null
markdown: string
}) {
if (!blocks?.length) return <Markdown content={markdown} />
return (
<>
{blocks.map(block =>
block.type === 'learning' ? (
<Learning
key={block.id}
id={`review-${block.id}`}
kind={String(block.props.kind || '')}
prompt=""
markdown={String(block.props.markdown || '')}
data={String(block.props.data || '{}')}
sourceUrl={String(block.props.sourceUrl || '')}
readOnly
onChange={() => {}}
/>
) : (
<Markdown key={block.id} content={blockPreview(block)} />
)
)}
</>
)
}