feat: add clear button for bookmark data

- Right-aligned clear button in the same row as load/decrypt
- Clears events, stats, and timing data
- Disabled when no data to clear
This commit is contained in:
Gigi
2025-10-17 20:35:17 +02:00
parent a37735fc1c
commit 68ee1b3122

View File

@@ -257,6 +257,14 @@ const Debug: React.FC<DebugProps> = ({ relayPool }) => {
}
}
const handleClearBookmarks = () => {
setBookmarkEvents([])
setBookmarkStats(null)
setTLoadBookmarks(null)
setTDecryptBookmarks(null)
DebugBus.info('debug', 'Cleared bookmark data')
}
const handleBunkerLogin = async () => {
if (!bunkerUri.trim()) {
setBunkerError('Please enter a bunker URI')
@@ -499,7 +507,7 @@ const Debug: React.FC<DebugProps> = ({ relayPool }) => {
<h3 className="section-title">Bookmark Loading</h3>
<div className="text-sm opacity-70 mb-3">Test bookmark loading and decryption (kinds: 10003, 30003, 30001, 39701)</div>
<div className="flex gap-2 mb-3">
<div className="flex gap-2 mb-3 items-center">
<button
className="btn btn-primary"
onClick={handleLoadBookmarks}
@@ -528,6 +536,13 @@ const Debug: React.FC<DebugProps> = ({ relayPool }) => {
'Decrypt'
)}
</button>
<button
className="btn btn-secondary ml-auto"
onClick={handleClearBookmarks}
disabled={bookmarkEvents.length === 0 && !bookmarkStats}
>
Clear
</button>
</div>
<div className="mb-3 flex gap-2 flex-wrap">