'use client' import { useEffect, useRef } from 'react' import { motion } from 'framer-motion' import { X, Maximize2 } from 'lucide-react' import type { Note } from '@/lib/types' import { useLanguage } from '@/lib/i18n' import { NoteEditorProvider, useNoteEditorContext } from './note-editor-context' import { NoteTitleBlock } from './note-title-block' import { NoteContentArea } from './note-content-area' import { formatAbsoluteDateLocalized } from '@/lib/utils/format-localized-date' import { fr } from 'date-fns/locale/fr' import { enUS } from 'date-fns/locale/en-US' interface NoteEditorSplitPeekProps { note: Note blockId?: string onClose: () => void onOpenFully: () => void } function PeekEditorBody({ blockId }: { blockId?: string }) { const { note } = useNoteEditorContext() const { t, language } = useLanguage() const dateLocale = language === 'fr' ? fr : enUS const scrollRootRef = useRef(null) useEffect(() => { if (!blockId) return const timer = window.setTimeout(() => { const escaped = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(blockId) : blockId const el = scrollRootRef.current?.querySelector(`[data-id="${escaped}"]`) el?.scrollIntoView({ behavior: 'smooth', block: 'center' }) }, 450) return () => window.clearTimeout(timer) }, [blockId, note.id]) return (

{formatAbsoluteDateLocalized(new Date(note.contentUpdatedAt), language, 'MMM d, yyyy', dateLocale)}

{t('notePeek.readOnlyHint')}

) } export function NoteEditorSplitPeek({ note, blockId, onClose, onOpenFully }: NoteEditorSplitPeekProps) { const { t, language } = useLanguage() const isRtl = language === 'fa' || language === 'ar' return (
{t('notePeek.label')}
) }