Skip to content

Commit b3a99d6

Browse files
committed
Fix GUI rerun confirmation dialog
1 parent 9fe7193 commit b3a99d6

2 files changed

Lines changed: 124 additions & 2 deletions

File tree

frontend/src/App.css

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4067,6 +4067,79 @@ h4 {
40674067
color: var(--text-secondary);
40684068
}
40694069

4070+
/* ═════════════════ In-app Confirmation Dialog ═════════════════ */
4071+
4072+
.confirm-dialog-backdrop {
4073+
position: fixed;
4074+
inset: 0;
4075+
z-index: 3000;
4076+
display: grid;
4077+
place-items: center;
4078+
padding: 1.5rem;
4079+
background: rgba(10, 12, 18, 0.58);
4080+
backdrop-filter: blur(3px);
4081+
}
4082+
4083+
.confirm-dialog {
4084+
width: min(520px, 100%);
4085+
background: var(--surface);
4086+
border: 1px solid var(--border);
4087+
border-radius: var(--radius);
4088+
box-shadow: var(--shadow-elevated);
4089+
color: var(--text-primary);
4090+
padding: 1.25rem;
4091+
}
4092+
4093+
.confirm-dialog h3 {
4094+
margin: 0 0 0.75rem;
4095+
color: var(--text-primary);
4096+
font-size: 1rem;
4097+
font-weight: 800;
4098+
}
4099+
4100+
.confirm-dialog-text {
4101+
margin: 0;
4102+
color: var(--text-secondary);
4103+
font-size: 0.88rem;
4104+
line-height: 1.55;
4105+
white-space: pre-line;
4106+
}
4107+
4108+
.confirm-dialog-actions {
4109+
display: flex;
4110+
justify-content: flex-end;
4111+
gap: 0.75rem;
4112+
margin-top: 1.25rem;
4113+
}
4114+
4115+
.confirm-dialog-btn {
4116+
border: 0;
4117+
border-radius: var(--radius-sm);
4118+
cursor: pointer;
4119+
font-size: 0.86rem;
4120+
font-weight: 800;
4121+
padding: 0.65rem 0.95rem;
4122+
transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
4123+
}
4124+
4125+
.confirm-dialog-btn:hover,
4126+
.confirm-dialog-btn:focus {
4127+
outline: none;
4128+
transform: translateY(-1px);
4129+
box-shadow: var(--shadow-hover);
4130+
}
4131+
4132+
.confirm-dialog-btn--secondary {
4133+
background: var(--bg-elevated);
4134+
color: var(--text-primary);
4135+
border: 1px solid var(--border);
4136+
}
4137+
4138+
.confirm-dialog-btn--primary {
4139+
background: var(--mnv-m);
4140+
color: #ffffff;
4141+
}
4142+
40704143
/* ═════════════════ Responsive ═════════════════ */
40714144

40724145
/* Narrower window: shrink sidebar, single-col params */

frontend/src/App.tsx

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ interface ProgressEvent {
271271
total: number;
272272
}
273273

274+
interface ConfirmationPrompt {
275+
message: string;
276+
resolve: (confirmed: boolean) => void;
277+
}
278+
274279
function App() {
275280
const [tab, setTab] = useState<Tab>("analysis");
276281
const [config, setConfig] = useState<AnalysisConfig>(DEFAULT_CONFIG);
@@ -288,6 +293,7 @@ function App() {
288293
const [appVersion, setAppVersion] = useState("v1.1.3");
289294
const [batchProgress, setBatchProgress] = useState<{ current: number; total: number } | null>(null);
290295
const [runProgress, setRunProgress] = useState<ProgressEvent | null>(null);
296+
const [confirmationPrompt, setConfirmationPrompt] = useState<ConfirmationPrompt | null>(null);
291297

292298
const configRef = useRef(config);
293299
useEffect(() => { configRef.current = config; }, [config]);
@@ -611,6 +617,19 @@ function App() {
611617
}
612618
}, []);
613619

620+
const askForConfirmation = useCallback((message: string) => {
621+
return new Promise<boolean>((resolve) => {
622+
setConfirmationPrompt({ message, resolve });
623+
});
624+
}, []);
625+
626+
const resolveConfirmation = useCallback((confirmed: boolean) => {
627+
setConfirmationPrompt((prompt) => {
628+
prompt?.resolve(confirmed);
629+
return null;
630+
});
631+
}, []);
632+
614633
const confirmOutputWrites = useCallback(async (toRun: SampleEntry[]) => {
615634
if (toRun.length === 0) return true;
616635

@@ -655,11 +674,11 @@ function App() {
655674
);
656675
}
657676

658-
return window.confirm(`${sections.join("\n\n")}\n\nContinue?`);
677+
return askForConfirmation(`${sections.join("\n\n")}\n\nContinue?`);
659678
} catch {
660679
return true;
661680
}
662-
}, []);
681+
}, [askForConfirmation]);
663682

664683
const handleRunAll = useCallback(() => {
665684
const toRun = samples.filter((s) => s.status === "pending" || s.status === "error");
@@ -1181,6 +1200,36 @@ function App() {
11811200
)}
11821201
</main>
11831202

1203+
{confirmationPrompt && (
1204+
<div className="confirm-dialog-backdrop" role="presentation">
1205+
<div
1206+
className="confirm-dialog"
1207+
role="dialog"
1208+
aria-modal="true"
1209+
aria-labelledby="confirm-dialog-title"
1210+
>
1211+
<h3 id="confirm-dialog-title">Confirm output overwrite</h3>
1212+
<p className="confirm-dialog-text">{confirmationPrompt.message}</p>
1213+
<div className="confirm-dialog-actions">
1214+
<button
1215+
type="button"
1216+
className="confirm-dialog-btn confirm-dialog-btn--secondary"
1217+
onClick={() => resolveConfirmation(false)}
1218+
>
1219+
Cancel
1220+
</button>
1221+
<button
1222+
type="button"
1223+
className="confirm-dialog-btn confirm-dialog-btn--primary"
1224+
onClick={() => resolveConfirmation(true)}
1225+
>
1226+
Continue
1227+
</button>
1228+
</div>
1229+
</div>
1230+
</div>
1231+
)}
1232+
11841233
{/* Global drop overlay */}
11851234
{dragActive && (
11861235
<div className="drop-overlay">

0 commit comments

Comments
 (0)