style: run prettier on entire codebase

This commit is contained in:
BOHA
2026-03-24 19:59:14 +01:00
parent 872be42107
commit 3c167cf5c4
148 changed files with 26740 additions and 13990 deletions

View File

@@ -1,40 +1,48 @@
import { createContext, useContext, useState, useEffect, type ReactNode } from 'react'
import {
createContext,
useContext,
useState,
useEffect,
type ReactNode,
} from "react";
interface ThemeContextValue {
theme: string
toggleTheme: () => void
theme: string;
toggleTheme: () => void;
}
const ThemeContext = createContext<ThemeContextValue | null>(null)
const ThemeContext = createContext<ThemeContextValue | null>(null);
export function ThemeProvider({ children }: { children: ReactNode }) {
const [theme, setTheme] = useState(() => {
if (typeof window !== 'undefined') {
return localStorage.getItem('boha-theme') || 'dark'
if (typeof window !== "undefined") {
return localStorage.getItem("boha-theme") || "dark";
}
return 'dark'
})
return "dark";
});
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme)
localStorage.setItem('boha-theme', theme)
const themeColor = theme === 'dark' ? '#12121a' : '#ffffff'
document.querySelector('meta[name="theme-color"]')?.setAttribute('content', themeColor)
}, [theme])
document.documentElement.setAttribute("data-theme", theme);
localStorage.setItem("boha-theme", theme);
const themeColor = theme === "dark" ? "#12121a" : "#ffffff";
document
.querySelector('meta[name="theme-color"]')
?.setAttribute("content", themeColor);
}, [theme]);
const toggleTheme = () => {
setTheme(prev => (prev === 'dark' ? 'light' : 'dark'))
}
setTheme((prev) => (prev === "dark" ? "light" : "dark"));
};
return (
<ThemeContext.Provider value={{ theme, toggleTheme }}>
{children}
</ThemeContext.Provider>
)
);
}
export function useTheme(): ThemeContextValue {
const context = useContext(ThemeContext)
if (!context) throw new Error('useTheme must be used within a ThemeProvider')
return context
const context = useContext(ThemeContext);
if (!context) throw new Error("useTheme must be used within a ThemeProvider");
return context;
}