From 1f25b9c104fbf7023cc04a9911e809f61b97499a Mon Sep 17 00:00:00 2001 From: Mikhail Kilin Date: Thu, 19 Mar 2026 15:44:38 +0300 Subject: [PATCH] Add confirmation modal for project deletion Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/App.css | 54 ++++++++++++++++++++++++++++++++++++++++++++ frontend/src/App.tsx | 49 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 99 insertions(+), 4 deletions(-) diff --git a/frontend/src/App.css b/frontend/src/App.css index 48a5859..06f6b5d 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -176,6 +176,60 @@ h2 { background: #e74c3c; } +.modal-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 100; +} + +.modal { + background: white; + border-radius: 8px; + padding: 1.5rem 2rem; + min-width: 300px; + text-align: center; +} + +.modal p { + font-size: 1.1rem; + margin-bottom: 1.5rem; +} + +.modal-actions { + display: flex; + gap: 0.75rem; + justify-content: center; +} + +.modal-actions button { + padding: 0.5rem 1.25rem; + font-size: 1rem; + cursor: pointer; + border: 1px solid #ccc; + border-radius: 4px; + background: #333; + color: white; +} + +.modal-actions button:hover { + background: #555; +} + +.modal-actions button.danger { + background: #c0392b; +} + +.modal-actions button.danger:hover { + background: #e74c3c; +} + .vpn-block { display: flex; justify-content: center; diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 8fcdda2..d74d639 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -11,6 +11,28 @@ import { } from "./api"; import "./App.css"; +function ConfirmModal({ + message, + onConfirm, + onCancel, +}: { + message: string; + onConfirm: () => void; + onCancel: () => void; +}) { + return ( +
+
e.stopPropagation()}> +

{message}

+
+ + +
+
+
+ ); +} + function ProjectList({ onSelect, }: { @@ -18,6 +40,7 @@ function ProjectList({ }) { const [projects, setProjects] = useState([]); const [name, setName] = useState(""); + const [deleteId, setDeleteId] = useState(null); const load = async () => { setProjects(await fetchProjects()); @@ -56,10 +79,9 @@ function ProjectList({ )} - + + {showDeleteModal && ( + setShowDeleteModal(false)} + onConfirm={handleDelete} + /> + )} ); }