Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Test runner directories
/coverage
/.nyc_output

# Test artifacts
/tests/__pycache__
__pycache__/
15 changes: 15 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -246,6 +253,13 @@ export default function App() {
>
Export as PNG
</button>
<button
onClick={handleClear}
disabled={loading || nodes.length === 0}
className="clear-button"
>
Clear
</button>
</div>
</div>

Expand Down