feat: Introduce uwu mode
Some checks failed
Check Types / tests (push) Failing after 41s
CodeQL / Analyze (javascript) (push) Failing after 52s
Lint & Format / tests (push) Successful in 27s
Mirror to Codeberg / Mirror (push) Failing after 0s

This commit is contained in:
Jesse Wierzbinski 2025-04-05 03:10:36 +02:00
parent 5026e59d17
commit be79c569a1
No known key found for this signature in database
4 changed files with 62 additions and 0 deletions

View file

@ -1,5 +1,6 @@
"use client";
import { uwuifyDocument } from "@/lib/uwuify";
import { ThemeProvider, useTheme } from "next-themes";
import { type ReactNode, useEffect } from "react";
@ -27,10 +28,31 @@ function ThemeWatcher() {
return null;
}
function UwuWatcher() {
// Uwuify the whole page when ctrl + u is pressed
useEffect(() => {
function onKeyDown(event: KeyboardEvent) {
if (event.key === "u" && (event.metaKey || event.ctrlKey)) {
event.preventDefault();
uwuifyDocument();
}
}
window.addEventListener("keydown", onKeyDown);
return () => {
window.removeEventListener("keydown", onKeyDown);
};
}, []);
return null;
}
export function Providers({ children }: { children: ReactNode }) {
return (
<ThemeProvider attribute="class" disableTransitionOnChange={true}>
<ThemeWatcher />
<UwuWatcher />
{children}
</ThemeProvider>
);