From 3a254d5290ce54d8c2eab26dd251ebd72f8f92a1 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 27 Jan 2026 04:01:09 +0000 Subject: [PATCH] feat: Add Clear button to reset mind map This commit introduces a "Clear" button to the main toolbar. - Adds a "Clear" button to the UI. - Implements a `handleClear` function that resets the nodes and edges of the mind map. - Includes a confirmation dialog to prevent accidental clearing of the mind map. - Refactors inline styles to a CSS class for better maintainability. Co-authored-by: coderdevang <85845460+coderdevang@users.noreply.github.com> --- .gitignore | 8 ++++++++ src/App.css | 15 +++++++++++++++ src/App.jsx | 14 ++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/.gitignore b/.gitignore index a547bf3..df6c709 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,11 @@ dist-ssr *.njsproj *.sln *.sw? + +# Test runner directories +/coverage +/.nyc_output + +# Test artifacts +/tests/__pycache__ +__pycache__/ diff --git a/src/App.css b/src/App.css index b9d355d..9fd2ae4 100644 --- a/src/App.css +++ b/src/App.css @@ -5,6 +5,21 @@ text-align: center; } +.clear-button { + padding: 10px 20px; + background-color: #f44336; + color: white; + border: none; + border-radius: 8px; + font-weight: bold; + cursor: pointer; +} + +.clear-button:disabled { + cursor: not-allowed; + opacity: 0.7; +} + .logo { height: 6em; padding: 1.5em; diff --git a/src/App.jsx b/src/App.jsx index 5f3df15..ff7a6a0 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -161,6 +161,13 @@ export default function App() { setLoading(false); }; + const handleClear = () => { + if (window.confirm('Are you sure you want to clear the mind map?')) { + setNodes(initialNodes); + setEdges(initialEdges); + } + }; + const onNodeClick = async (_event, node) => { stopGenerationRef.current = false; setLoading(true); @@ -246,6 +253,13 @@ export default function App() { > Export as PNG +