"use client" import { useMemo, useState } from "react" import { LinkIcon } from "lucide-react" import { cn } from "@lib/utils" import { Button } from "@ui/components/button" import { dmSansClassName } from "@/lib/fonts" import { TextEditor } from "../text-editor" import { extractUrls } from "@/lib/url-helpers" interface NoteContentProps { onSubmit?: (content: string) => void onContentChange?: (content: string) => void onImportLinks?: (urls: string[]) => void isSubmitting?: boolean isOpen?: boolean initialContent?: string } export function NoteContent({ onSubmit, onContentChange, onImportLinks, isSubmitting, initialContent, }: NoteContentProps) { const [content, setContent] = useState(initialContent ?? "") const [seededContent] = useState(initialContent || undefined) const [dismissed, setDismissed] = useState(false) const { urls: detectedUrls } = useMemo(() => extractUrls(content), [content]) const showBulkOffer = detectedUrls.length >= 2 && !dismissed const canSubmit = content.trim().length > 0 && !isSubmitting const handleSubmit = () => { if (canSubmit && onSubmit) { onSubmit(content) } } const handleContentChange = (newContent: string) => { setContent(newContent) onContentChange?.(newContent) } return (
{detectedUrls.length} links {" "} detected — save each as its own memory?