diff --git a/app/src/components/ThemeProvider.tsx b/app/src/components/ThemeProvider.tsx
index 6924cf6..3e13d7e 100644
--- a/app/src/components/ThemeProvider.tsx
+++ b/app/src/components/ThemeProvider.tsx
@@ -106,46 +106,37 @@ export const useTheme = () => {
};
export function ModeToggle() {
- const { theme, toggleTheme } = useTheme();
- const [currentIconIndex, setCurrentIconIndex] = useState(0);
-
- const icons = [
- ,
- ,
- ,
- ];
-
-
+ const { toggleTheme } = useTheme();
+ const [systemMode, setSystemMode] = useState(false);
+
useEffect(() => {
- const savedTheme = getTheme();
- const index = icons.findIndex(icon => icon.key === savedTheme);
- setCurrentIconIndex(index >= 0 ? index : 0);
- }, [theme]);
+ const currentTheme = getTheme();
+ setSystemMode(currentTheme === "system");
+ }, []);
const handleClick = () => {
toggleTheme?.();
- const currentTheme = getTheme();
- let nextTheme: Theme;
- if (currentTheme === "dark") {
- nextTheme = "light";
- } else if (currentTheme === "light") {
- nextTheme = "system";
- } else {
- nextTheme = "dark";
- }
- const nextIndex = icons.findIndex(icon => icon.key === nextTheme);
- setCurrentIconIndex(nextIndex >= 0 ? nextIndex : 0);
-
+ const newTheme = getTheme();
+ setSystemMode(newTheme === "system");
};
+ if (systemMode) {
+ return (
+
+ );
+ }
+
return (
-