import { useRef } from 'react' import { answerDrawing } from '@/editor/annotations/drawingGuard' import { useAnnotationWork } from '@/editor/annotations/workStore' import { useT } from '@/i18n/useT' import ConfirmDialog from '../ConfirmDialog' /** * The drawing guard's question (R-12), mounted with the workspace so it shows whatever * tab is in view: « Continuer » keeps the work, « Abandonner » drops it and makes the move * that was held. The creation dialog, when shown, asks it in its own footer instead. */ export default function DrawingGuardDialog() { const t = useT() // Over a shown creation dialog the question is that dialog's own (R-12, board 31 D). const question = useAnnotationWork((s) => s.question?.work === 'creation' && s.creation?.dialog ? null : s.question, ) // The title stays while the dialog closes. const title = useRef('') if (question) title.current = t(`editor.annotations.guard.${question.work}`) return ( answerDrawing(true)} onCancel={() => answerDrawing(false)} /> ) }