import { Button, Spinner } from "@digdir/designsystemet-react"; import { CheckmarkIcon, EraserIcon, XMarkIcon } from "@navikt/aksel-icons"; import { getLocalizedString } from "@olenbetong/appframe-core"; import { useState } from "react"; import { useRedactContext } from "./RedactContext.js"; /** Toolbar shown while the redact tool is active. Reads state from RedactContext. */ export function RedactToolbar() { let { rects, clearAll, applyRedact, onApply, onCancel } = useRedactContext(); let [applying, setApplying] = useState(false); async function handleApply() { if (rects.length === 0) { onCancel(); return; } setApplying(true); try { let result = await applyRedact(); if (result) onApply(result.blob, result.actions); } finally { setApplying(false); } } return ( <>