mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-08 15:52:48 +03:00
add light/dark mode icon switcher
This commit is contained in:
@@ -5,9 +5,12 @@ import SetupDetector from "@/components/setup/SetupDetector";
|
|||||||
import SetupHwAccel from "@/components/setup/SetupHwAccel";
|
import SetupHwAccel from "@/components/setup/SetupHwAccel";
|
||||||
import SetupRecording from "@/components/setup/SetupRecording";
|
import SetupRecording from "@/components/setup/SetupRecording";
|
||||||
import SetupWelcome from "@/components/setup/SetupWelcome";
|
import SetupWelcome from "@/components/setup/SetupWelcome";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
|
import { useTheme } from "@/context/theme-provider";
|
||||||
import { useCallback, useReducer } from "react";
|
import { useCallback, useReducer } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { LuMoon, LuSun } from "react-icons/lu";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
@@ -108,8 +111,11 @@ function wizardReducer(state: WizardState, action: WizardAction): WizardState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function SetupWizard() {
|
export default function SetupWizard() {
|
||||||
const { t } = useTranslation(["views/setup"]);
|
const { t } = useTranslation(["views/setup", "common"]);
|
||||||
const [state, dispatch] = useReducer(wizardReducer, initialState);
|
const [state, dispatch] = useReducer(wizardReducer, initialState);
|
||||||
|
const { theme, systemTheme, setTheme } = useTheme();
|
||||||
|
|
||||||
|
const isDark = (theme === "system" ? systemTheme : theme) === "dark";
|
||||||
|
|
||||||
const handleSkipSetup = useCallback(async () => {
|
const handleSkipSetup = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
@@ -219,6 +225,19 @@ export default function SetupWizard() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-dvh items-center justify-center bg-background p-4">
|
<div className="flex min-h-dvh items-center justify-center bg-background p-4">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
className="fixed right-4 top-4 text-muted-foreground hover:text-primary"
|
||||||
|
aria-label={t(isDark ? "menu.darkMode.light" : "menu.darkMode.dark", {
|
||||||
|
ns: "common",
|
||||||
|
})}
|
||||||
|
onClick={() => setTheme(isDark ? "light" : "dark")}
|
||||||
|
>
|
||||||
|
{isDark ? <LuSun className="size-4" /> : <LuMoon className="size-4" />}
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Card className="w-full max-w-lg">
|
<Card className="w-full max-w-lg">
|
||||||
<CardContent className="p-6">
|
<CardContent className="p-6">
|
||||||
<StepIndicator
|
<StepIndicator
|
||||||
|
|||||||
Reference in New Issue
Block a user