mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-09-21 02:30:15 +00:00
feat: custom domain management, status monitor, and theme/styling integration
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createContext, type ReactNode, useEffect, useState } from "react";
|
||||
import { DateTime } from "luxon";
|
||||
import { createContext, type ReactNode, useEffect, useState } from "react";
|
||||
|
||||
export type Theme = "dark" | "light" | "system" | "scheduled";
|
||||
|
||||
@@ -41,7 +41,8 @@ export function ThemeProvider({
|
||||
}, 60000);
|
||||
|
||||
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
const handler = (e: MediaQueryListEvent) => setIsSystemDark(e.matches);
|
||||
const handler = (e?: MediaQueryListEvent) =>
|
||||
setIsSystemDark(e?.matches ?? mediaQuery.matches);
|
||||
mediaQuery.addEventListener("change", handler);
|
||||
|
||||
return () => {
|
||||
@@ -54,7 +55,6 @@ export function ThemeProvider({
|
||||
const root = window.document.documentElement;
|
||||
|
||||
const updateThemeColor = (nextTheme: "light" | "dark") => {
|
||||
|
||||
const themeColor =
|
||||
nextTheme === "dark" ? "hsl(30 15% 8%)" : "hsl(0 0% 98%)";
|
||||
document
|
||||
@@ -94,7 +94,6 @@ export function ThemeProvider({
|
||||
};
|
||||
}, [theme, hour, isSystemDark]);
|
||||
|
||||
|
||||
const value = {
|
||||
theme,
|
||||
setTheme: (theme: Theme) => {
|
||||
|
||||
Reference in New Issue
Block a user