This commit is contained in:
Manav Rathi 2024-05-25 17:00:03 +05:30
parent b42759d473
commit 4a0c93373d
No known key found for this signature in database
5 changed files with 6 additions and 9 deletions

View file

@ -25,7 +25,6 @@ import HTTPService from "@ente/shared/network/HTTPService";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import { getTheme } from "@ente/shared/themes";
import { THEME_COLOR } from "@ente/shared/themes/constants";
import type { SetTheme } from "@ente/shared/themes/types";
import type { User } from "@ente/shared/user/types";
import { CssBaseline, useMediaQuery } from "@mui/material";
import { ThemeProvider } from "@mui/material/styles";
@ -42,7 +41,7 @@ type AppContextType = {
finishLoading: () => void;
isMobile: boolean;
themeColor: THEME_COLOR;
setThemeColor: SetTheme;
setThemeColor: (themeColor: THEME_COLOR) => void;
somethingWentWrong: () => void;
setDialogBoxAttributesV2: SetDialogBoxAttributesV2;
logout: () => void;

View file

@ -529,7 +529,7 @@ const UtilitySection: React.FC<UtilitySectionProps> = ({ closeSidebar }) => {
});
const toggleTheme = () => {
setThemeColor((themeColor) =>
setThemeColor(
themeColor === THEME_COLOR.DARK
? THEME_COLOR.LIGHT
: THEME_COLOR.DARK,

View file

@ -36,7 +36,6 @@ import {
} from "@ente/shared/storage/localStorage/helpers";
import { getTheme } from "@ente/shared/themes";
import { THEME_COLOR } from "@ente/shared/themes/constants";
import type { SetTheme } from "@ente/shared/themes/types";
import type { User } from "@ente/shared/user/types";
import ArrowForward from "@mui/icons-material/ArrowForward";
import { CssBaseline, useMediaQuery } from "@mui/material";
@ -95,7 +94,7 @@ type AppContextType = {
setWatchFolderFiles: (files: FileList) => void;
isMobile: boolean;
themeColor: THEME_COLOR;
setThemeColor: SetTheme;
setThemeColor: (themeColor: THEME_COLOR) => void;
somethingWentWrong: () => void;
setDialogBoxAttributesV2: SetDialogBoxAttributesV2;
isCFProxyDisabled: boolean;

View file

@ -2,10 +2,12 @@ import { THEME_COLOR } from "@ente/shared/themes/constants";
import DarkModeIcon from "@mui/icons-material/DarkMode";
import LightModeIcon from "@mui/icons-material/LightMode";
import { ToggleButton, ToggleButtonGroup } from "@mui/material";
interface Iprops {
themeColor: THEME_COLOR;
setThemeColor: (theme: THEME_COLOR) => void;
setThemeColor: (themeColor: THEME_COLOR) => void;
}
export default function ThemeSwitcher({ themeColor, setThemeColor }: Iprops) {
const handleChange = (event, themeColor: THEME_COLOR) => {
if (themeColor !== null) {

View file

@ -1,3 +0,0 @@
import { THEME_COLOR } from "./constants";
export type SetTheme = React.Dispatch<React.SetStateAction<THEME_COLOR>>;