import React, { useState, useEffect } from 'react' /** * Modal for choosing a category in bulk. * * Props: * - open: boolean * - categories: array of content types with nested categories * - onClose: () => void * - onConfirm: (categoryId: number) => void */ export default function BulkCategoryModal({ open, categories = [], onClose, onConfirm }) { const [selectedId, setSelectedId] = useState('') useEffect(() => { if (open) setSelectedId('') }, [open]) const handleConfirm = () => { if (!selectedId) return onConfirm(Number(selectedId)) } const handleKeyDown = (e) => { if (e.key === 'Escape') onClose() if (e.key === 'Enter' && selectedId) handleConfirm() } if (!open) return null return (
Choose a category to assign to the selected artworks.