import { useState } from "react"; import { Icon } from "../../../components/Icon.jsx"; export function ScreenshotsModule({ toolboxId, moduleId, context, editing }) { const data = context.getModuleData(toolboxId, moduleId, { shots: [] }); const textContent = context.moduleText?.screenshots || {}; const [dragOver, setDragOver] = useState(false); const pastePlaceholder = textContent.pastePlaceholder || "Coller une image ici"; async function addFiles(files) { if (await context.addScreenshotFiles(toolboxId, moduleId, files)) { setDragOver(false); } } function updateShot(shotId, patch) { context.setModuleData(toolboxId, moduleId, { shots: data.shots.map((shot) => shot.id === shotId ? { ...shot, ...patch } : shot) }); } return ( <> {editing && (