File size: 2,192 Bytes
ecb2a3f | 1 2 3 4 5 6 7 8 9 10 | import React,{useEffect,useRef} from 'react';
import {Archive,X} from 'lucide-react';
export default function ArchiveDialog({open,onClose,onConfirm,busy,scope='local'}){
const dialog=useRef(null);
useEffect(()=>{if(open)dialog.current?.showModal();else dialog.current?.close()},[open]);
const description=scope==='guest'?'Demo inspections matching these filters will be moved out of the active history and review list.':scope==='local'?'All inspections on this computer matching these filters will move to the archive. This includes matches beyond the 500 shown here. They will leave the active history and review list.':`Up to 500 active inspections matching the current filters will be archived in ${scope==='personal'?'Personal':'Team'} Workspace. They will leave that workspace’s active history and review queue.`;
const boundary=scope==='guest'?'Only this demo session is affected. Account and Team records stay unchanged. Demo archives may be lost when the online app restarts.':scope==='personal'?'Only this account’s Personal inspections move. Shared Team copies stay active. This account can restore its own Personal work.':scope==='team'?'Only Team inspections this account is allowed to archive will move. Personal originals stay active. Ask a Developer to restore Team work.':'This action does not change cloud records.';
return <dialog aria-label="Archive matching inspections" ref={dialog} className="confirmation-dialog" onCancel={onClose} onClose={onClose}><div className="section-title"><div className="setup-icon"><Archive size={25}/></div><button className="icon-button" aria-label="Cancel clear history" disabled={busy} onClick={onClose}><X size={18}/></button></div><h2>Move these inspections to the archive?</h2><p>{description}</p><div className="note">Photos, results and conversations are kept. Open History recovery to restore them, while their saved storage is still available. {boundary}</div><div className="button-row"><button className="secondary" onClick={onClose} disabled={busy}>Keep history</button><button className="primary" onClick={onConfirm} disabled={busy}>{busy?'Archiving…':'Archive matching history'}</button></div></dialog>;
}
|