// Rôle : rend les contrôles modal et quick-add d'ajout d'outils toolbox. import { useState } from "react"; import { CompactDropdown } from "../../../components/CompactDropdown.jsx"; import { Icon } from "../../../components/Icon.jsx"; import { Modal } from "../../../components/Modal.jsx"; import { Tooltip } from "../../../components/Tooltip.jsx"; import { LIBRARY_CATEGORY_DEFINITIONS, TOOLBOX_MODULES } from "../toolboxModuleRegistry.js"; export function AddToolControls({ categories, descriptions, onAdd }) { const [open, setOpen] = useState(false); const modules = Object.entries(TOOLBOX_MODULES); const moduleCategories = LIBRARY_CATEGORY_DEFINITIONS.map((category) => ({ ...category, title: categories[category.key] })); function addTool(type) { onAdd(type); setOpen(false); } function renderToolCard(type) { const module = TOOLBOX_MODULES[type]; return ( ); } return ( <>
( )} > {({ close }) => ( <> {modules.map(([type, module]) => ( { onAdd(type); close(); }} aria-label={`Ajouter ${module.label}`} > ))} )}
{open && ( setOpen(false)}>

Ajouter un outil

{moduleCategories.map((category) => (

{category.title}

{category.types.map(renderToolCard)}
))}
)} ); }