supermemory/apps/web/components/add-document/note.tsx
Ishaan Gupta 7f6b28ab83
Improve quick note editor interactions & fix filter chips responsiveness (#964)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Vedant Mahajan <vedant.04.mahajan@gmail.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
2026-05-21 21:29:33 +05:30

44 lines
1.1 KiB
TypeScript

"use client"
import { useState } from "react"
import { TextEditor } from "../text-editor"
interface NoteContentProps {
onSubmit?: (content: string) => void
onContentChange?: (content: string) => void
isSubmitting?: boolean
isOpen?: boolean
initialContent?: string
}
export function NoteContent({
onSubmit,
onContentChange,
isSubmitting,
initialContent,
}: NoteContentProps) {
const [content, setContent] = useState(initialContent ?? "")
const [seededContent] = useState(initialContent || undefined)
const handleSubmit = (submittedContent = content) => {
if (submittedContent.trim() && !isSubmitting && onSubmit) {
onSubmit(submittedContent)
}
}
const handleContentChange = (newContent: string) => {
setContent(newContent)
onContentChange?.(newContent)
}
return (
<div className="flex h-full min-h-[45dvh] w-full flex-1 overflow-y-auto rounded-[14px] bg-[#10151C] p-3 shadow-inside-out ring-1 ring-[#202A36] md:mb-4! md:bg-[#14161A] md:p-4 md:ring-0">
<TextEditor
content={seededContent}
onContentChange={handleContentChange}
onSubmit={handleSubmit}
debounceMs={0}
/>
</div>
)
}