Skip to content

Commit 9b23a38

Browse files
committed
feat: Clear all local storage data.
1 parent 4dba4d2 commit 9b23a38

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/components/CommandPalette.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ const CommandPalette = ({ isOpen, setIsOpen, openGenericModal, toggleDigitalRain
162162
navigator.clipboard.writeText(window.location.href);
163163
addToast({ title: 'Copied', message: 'Current URL copied to clipboard!', duration: 3000 });
164164
break;
165+
case 'clearLocalStorage':
166+
localStorage.clear();
167+
addToast({ title: 'Success', message: 'Local storage cleared!', duration: 3000 });
168+
break;
165169
default:
166170
break;
167171
}

src/hooks/useSearchableData.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const useSearchableData = () => {
8282
{ title: 'Show Quick Stopwatch', type: 'command', commandId: 'stopwatch' },
8383
{ title: 'Show User/Browser Information', type: 'command', commandId: 'showOSInfo' },
8484
{ title: 'Copy Current URL', type: 'command', commandId: 'copyCurrentURL' },
85+
{ title: 'Clear Local Storage', type: 'command', commandId: 'clearLocalStorage' },
8586
{ title: 'Her Daim', type: 'command', commandId: 'herDaim' },
8687
];
8788

src/pages/SettingsPage.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,33 @@ const SettingsPage = () => {
165165
Reset Sidebar State
166166
</button>
167167
</div>
168+
169+
<h1 className="text-3xl font-arvo font-normal mb-4 text-app">
170+
Local Storage Management
171+
</h1>
172+
<hr className="border-gray-700 mb-4" />
173+
<div className="mb-6 ml-4 mr-4">
174+
<p className="text-gray-300 mb-4">
175+
Clear all local storage data for this site. This will reset
176+
all your preferences and cached data.
177+
</p>
178+
<button
179+
onClick={() => {
180+
localStorage.clear();
181+
addToast({
182+
title: 'Success',
183+
message: 'All local storage data has been cleared. The page will now reload.',
184+
duration: 3000,
185+
});
186+
setTimeout(() => {
187+
window.location.reload();
188+
}, 3000);
189+
}}
190+
className="px-6 py-2 rounded-md font-arvo font-normal transition-colors duration-300 ease-in-out border bg-red-800/50 text-white hover:bg-red-700/50 border-red-700"
191+
>
192+
Clear All Local Storage
193+
</button>
194+
</div>
168195
</div>
169196
</div>
170197
</div>

0 commit comments

Comments
 (0)