From ec27b01531543de2ba17c5cdc306827f5c65bc41 Mon Sep 17 00:00:00 2001 From: Abhinav Sinha Date: Thu, 18 Jun 2026 01:49:10 +0530 Subject: [PATCH] refactor: replace window alerts with modals Signed-off-by: Abhinav Sinha --- frontend/src/components/BundleNav.jsx | 11 ++- frontend/src/components/ConfirmModal.jsx | 60 +++++++++++++ .../src/components/ConfirmModal.module.css | 87 +++++++++++++++++++ frontend/src/components/ExamTimer.jsx | 31 +++++-- frontend/src/components/ScenarioPanel.jsx | 11 ++- frontend/src/components/Sidebar.jsx | 29 +++++-- frontend/src/components/useConfirm.jsx | 57 ++++++++++++ 7 files changed, 270 insertions(+), 16 deletions(-) create mode 100644 frontend/src/components/ConfirmModal.jsx create mode 100644 frontend/src/components/ConfirmModal.module.css create mode 100644 frontend/src/components/useConfirm.jsx diff --git a/frontend/src/components/BundleNav.jsx b/frontend/src/components/BundleNav.jsx index 73f09b7..a6a1342 100644 --- a/frontend/src/components/BundleNav.jsx +++ b/frontend/src/components/BundleNav.jsx @@ -1,5 +1,6 @@ import { useState, useRef } from 'react' import styles from './BundleNav.module.css' +import { useConfirm } from './useConfirm' async function resetProgress(scope, opts) { await fetch('/api/progress/reset', { @@ -17,6 +18,7 @@ export default function BundleNav({ const [startX, setStartX] = useState(0) const [scrollLeft, setScrollLeft] = useState(0) const [dragDist, setDragDist] = useState(0) + const { confirm, ConfirmUI } = useConfirm() const handleMouseDown = (e) => { if (!trackRef.current) return @@ -41,6 +43,7 @@ export default function BundleNav({ return ( <> + {ConfirmUI}