Chungus 2.0

This commit is contained in:
Owen
2025-10-10 11:27:15 -07:00
parent f64a477c3d
commit d92b87b7c8
224 changed files with 1507 additions and 1586 deletions

View File

@@ -0,0 +1,46 @@
"use client";
import setGlobalColorTheme from "@app/lib/themeColors";
import { useTheme } from "next-themes";
import { useEffect, useState } from "react";
type ThemeColorStateProps = {
children: React.ReactNode;
colors: any;
};
export default function ThemeDataProvider({
children,
colors
}: ThemeColorStateProps) {
const [isMounted, setIsMounted] = useState(false);
const { theme } = useTheme();
useEffect(() => {
if (!colors) {
setIsMounted(true);
return;
}
let lightOrDark = theme;
if (theme === "system" || !theme) {
lightOrDark = window.matchMedia("(prefers-color-scheme: dark)")
.matches
? "dark"
: "light";
}
setGlobalColorTheme(lightOrDark as "light" | "dark", colors);
if (!isMounted) {
setIsMounted(true);
}
}, [theme]);
if (!isMounted) {
return null;
}
return <>{children}</>;
}