import ReactDOM from 'react-dom' import { NOTE_ICONS } from './DayPlanSidebar.constants' interface NoteModalUi { mode: 'add' | 'edit' icon: string text: string time: string } interface DayPlanSidebarNoteModalProps { noteUi: Record setNoteUi: (updater: (prev: any) => any) => void noteInputRef: React.RefObject cancelNote: (dayId: number) => void saveNote: (dayId: number) => void t: (key: string, params?: Record) => string } export function DayPlanSidebarNoteModal({ noteUi, setNoteUi, noteInputRef, cancelNote, saveNote, t }: DayPlanSidebarNoteModalProps) { return ( <> {Object.entries(noteUi).map(([dayId, ui]) => ui && ReactDOM.createPortal(
cancelNote(Number(dayId))}>
e.stopPropagation()}>
{ui.mode === 'add' ? t('dayplan.noteAdd') : t('dayplan.noteEdit')}
{/* Icon-Auswahl */}
{NOTE_ICONS.map(({ id, Icon }) => ( ))}
setNoteUi(prev => ({ ...prev, [dayId]: { ...prev[dayId], text: e.target.value } }))} onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); saveNote(Number(dayId)) } if (e.key === 'Escape') cancelNote(Number(dayId)) }} placeholder={t('dayplan.noteTitle') + ' *'} required className="text-content" style={{ fontSize: 13, fontWeight: 500, border: `1px solid ${!ui.text?.trim() ? 'var(--border-primary)' : 'var(--border-primary)'}`, borderRadius: 8, padding: '8px 10px', fontFamily: 'inherit', outline: 'none', width: '100%', boxSizing: 'border-box' }} />