Skip to content

Commit 68c3e78

Browse files
committed
feat: more commands
1 parent 1b3ded9 commit 68c3e78

File tree

3 files changed

+53
-5
lines changed

3 files changed

+53
-5
lines changed

src/components/CommandPalette.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,22 @@ const CommandPalette = ({ isOpen, setIsOpen, openGenericModal, toggleDigitalRain
150150
case 'herDaim':
151151
openGenericModal('Her Daim', <img src="/images/herdaim.jpg" alt="Her Daim" className="max-w-full h-auto" />);
152152
break;
153+
case 'doBarrelRoll':
154+
document.body.classList.add('do-a-barrel-roll');
155+
addToast({ title: 'Wheeeee!', message: 'Do a Barrel Roll!', duration: 1000 });
156+
setTimeout(() => {
157+
document.body.classList.remove('do-a-barrel-roll');
158+
}, 1000);
159+
break;
160+
case 'toggleInvertColors':
161+
if (document.body.classList.contains('invert-mode')) {
162+
document.body.classList.remove('invert-mode');
163+
addToast({ title: 'Colors Restored', message: 'Back to normal!', duration: 2000 });
164+
} else {
165+
document.body.classList.add('invert-mode');
166+
addToast({ title: 'Colors Inverted', message: 'Welcome to the upside down!', duration: 2000 });
167+
}
168+
break;
153169
case 'showTime': {
154170
openGenericModal('Current Time', <LiveClock />);
155171
break;
@@ -208,11 +224,19 @@ const CommandPalette = ({ isOpen, setIsOpen, openGenericModal, toggleDigitalRain
208224
}
209225
case 'toggleFullScreen':
210226
if (!document.fullscreenElement) {
211-
document.documentElement.requestFullscreen();
212-
addToast({ title: 'Full Screen', message: 'Entered full screen mode.', duration: 2000 });
213-
} else if (document.exitFullscreen) {
214-
document.exitFullscreen();
215-
addToast({ title: 'Full Screen', message: 'Exited full screen mode.', duration: 2000 });
227+
document.documentElement.requestFullscreen().then(() => {
228+
addToast({ title: 'Full Screen', message: 'Entered full screen mode.', duration: 2000 });
229+
}).catch(err => {
230+
addToast({ title: 'Error', message: `Could not enter full screen: ${err.message}`, duration: 3000 });
231+
});
232+
} else {
233+
if (document.exitFullscreen) {
234+
document.exitFullscreen().then(() => {
235+
addToast({ title: 'Full Screen', message: 'Exited full screen mode.', duration: 2000 });
236+
}).catch(err => {
237+
addToast({ title: 'Error', message: `Could not exit full screen: ${err.message}`, duration: 3000 });
238+
});
239+
}
216240
}
217241
break;
218242
case 'openGitHubIssue': {

src/hooks/useSearchableData.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ const useSearchableData = () => {
103103
{ title: 'Toggle Full Screen', type: 'command', commandId: 'toggleFullScreen' },
104104
{ title: 'Create Issue for This Page', type: 'command', commandId: 'openGitHubIssue' },
105105
{ title: 'Her Daim', type: 'command', commandId: 'herDaim' },
106+
{ title: 'Do a Barrel Roll', type: 'command', commandId: 'doBarrelRoll' },
107+
{ title: 'Toggle Invert Colors', type: 'command', commandId: 'toggleInvertColors' },
106108
];
107109

108110
setItems([...staticRoutes, ...customCommands, ...allPosts, ...allProjects, ...allLogs, ...allApps]);

src/index.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ body {
1515
font-style: normal !important;
1616
-webkit-font-smoothing: antialiased;
1717
-moz-osx-font-smoothing: grayscale;
18+
transition: filter 0.5s ease; /* Smooth transition for filters */
1819
}
1920

2021
code {
@@ -216,3 +217,24 @@ input[type='number'] {
216217
-ms-overflow-style: none; /* IE and Edge */
217218
scrollbar-width: none; /* Firefox */
218219
}
220+
221+
@keyframes barrel-roll {
222+
0% { transform: rotate(0deg); }
223+
100% { transform: rotate(360deg); }
224+
}
225+
226+
.do-a-barrel-roll {
227+
animation: barrel-roll 1s linear;
228+
}
229+
230+
body.invert-mode::after {
231+
content: '';
232+
position: fixed;
233+
top: 0;
234+
left: 0;
235+
right: 0;
236+
bottom: 0;
237+
z-index: 9999;
238+
backdrop-filter: invert(1) hue-rotate(180deg);
239+
pointer-events: none;
240+
}

0 commit comments

Comments
 (0)