// Tag manager modal: view, rename, recolor, delete tags. const TMIcons = window.Icons; const { TAG_COLORS: TM_TAG_COLORS } = window.PMStore; const TAG_COLOR_MAP = { emerald: '#10b981', blue: '#3b82f6', purple: '#a855f7', pink: '#ec4899', amber: '#f59e0b', red: '#ef4444', gray: '#6b7280', teal: '#14b8a6', }; function TagManager({ state, onClose, onUpdateTag, onDeleteTag }) { const [editingId, setEditingId] = React.useState(null); const [editName, setEditName] = React.useState(''); React.useEffect(() => { const onEsc = (e) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', onEsc); return () => window.removeEventListener('keydown', onEsc); }, [onClose]); const startEdit = (tag) => { setEditingId(tag.id); setEditName(tag.name); }; const saveEdit = (tag) => { const name = editName.trim(); if (name && name !== tag.name) onUpdateTag(tag.id, { name }); setEditingId(null); }; return (
e.stopPropagation()}>
Etiket Yönetimi
{state.tags.length === 0 ? (
Henüz etiket yok.
Görev düzenleyicisinden ekleyebilirsiniz.
) : state.tags.map(tag => (
{tag.name}
{editingId === tag.id ? ( setEditName(e.target.value)} onKeyDown={e => { if (e.key === 'Enter') saveEdit(tag); if (e.key === 'Escape') setEditingId(null); }} onBlur={() => saveEdit(tag)} /> ) : ( )}
{TM_TAG_COLORS.map(color => (
))}
); } window.TagManager = TagManager;