Remove from context
This commit is contained in:
@@ -11,7 +11,7 @@ import { AppNavbar } from "@ente/shared/components/Navbar/app";
|
||||
import { clearData } from "@ente/shared/storage/localStorage";
|
||||
import { getTheme } from "@ente/shared/themes";
|
||||
import { THEME_COLOR } from "@ente/shared/themes/constants";
|
||||
import { CssBaseline, useMediaQuery } from "@mui/material";
|
||||
import { CssBaseline } from "@mui/material";
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import { t } from "i18next";
|
||||
import type { AppProps } from "next/app";
|
||||
@@ -28,8 +28,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
|
||||
>();
|
||||
const [dialogBoxV2View, setDialogBoxV2View] = useState(false);
|
||||
|
||||
const isMobile = useMediaQuery("(max-width: 428px)");
|
||||
|
||||
useEffect(() => {
|
||||
disableDiskLogs();
|
||||
// The accounts app has no local state, but some older builds might've
|
||||
@@ -51,7 +49,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
|
||||
|
||||
const appContext = {
|
||||
showNavBar: setShowNavbar,
|
||||
isMobile,
|
||||
setDialogBoxAttributesV2,
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { createContext, useContext } from "react";
|
||||
interface AppContextT {
|
||||
/** Show or hide the app's navigation bar. */
|
||||
showNavBar: (show: boolean) => void;
|
||||
isMobile: boolean;
|
||||
setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
|
||||
DialogBoxAttributesV2 | undefined
|
||||
>();
|
||||
const [dialogBoxV2View, setDialogBoxV2View] = useState(false);
|
||||
const isMobile = useMediaQuery("(max-width: 428px)");
|
||||
const [themeColor, setThemeColor] = useLocalState(
|
||||
LS_KEYS.THEME,
|
||||
THEME_COLOR.DARK,
|
||||
@@ -143,7 +142,6 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
|
||||
const appContext = {
|
||||
logout,
|
||||
showNavBar,
|
||||
isMobile,
|
||||
setDialogBoxAttributesV2,
|
||||
startLoading,
|
||||
finishLoading,
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import Divider from "@mui/material/Divider";
|
||||
import { Divider, useMediaQuery } from "@mui/material";
|
||||
import {
|
||||
AllCollectionDialog,
|
||||
Transition,
|
||||
} from "components/Collections/AllCollections/dialog";
|
||||
import { COLLECTION_LIST_SORT_BY } from "constants/collection";
|
||||
import { AppContext } from "pages/_app";
|
||||
import { useContext } from "react";
|
||||
import { CollectionSummary } from "types/collection";
|
||||
import AllCollectionContent from "./content";
|
||||
import AllCollectionsHeader from "./header";
|
||||
@@ -32,7 +30,7 @@ export default function AllCollections(props: Iprops) {
|
||||
setCollectionListSortBy,
|
||||
isInHiddenSection,
|
||||
} = props;
|
||||
const { isMobile } = useContext(AppContext);
|
||||
const isMobile = useMediaQuery("(max-width: 428px)");
|
||||
|
||||
const onCollectionClick = (collectionID: number) => {
|
||||
setActiveCollectionID(collectionID);
|
||||
|
||||
@@ -39,7 +39,7 @@ import { getTheme } from "@ente/shared/themes";
|
||||
import { THEME_COLOR } from "@ente/shared/themes/constants";
|
||||
import type { User } from "@ente/shared/user/types";
|
||||
import ArrowForward from "@mui/icons-material/ArrowForward";
|
||||
import { CssBaseline, useMediaQuery } from "@mui/material";
|
||||
import { CssBaseline } from "@mui/material";
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import Notification from "components/Notification";
|
||||
import { REDIRECTS } from "constants/redirects";
|
||||
@@ -121,7 +121,6 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||
const [dialogBoxV2View, setDialogBoxV2View] = useState(false);
|
||||
const [watchFolderView, setWatchFolderView] = useState(false);
|
||||
const [watchFolderFiles, setWatchFolderFiles] = useState<FileList>(null);
|
||||
const isMobile = useMediaQuery("(max-width: 428px)");
|
||||
const [notificationView, setNotificationView] = useState(false);
|
||||
const closeNotification = () => setNotificationView(false);
|
||||
const [notificationAttributes, setNotificationAttributes] =
|
||||
@@ -319,7 +318,6 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||
setWatchFolderView,
|
||||
watchFolderFiles,
|
||||
setWatchFolderFiles,
|
||||
isMobile,
|
||||
setNotificationAttributes,
|
||||
themeColor,
|
||||
setThemeColor,
|
||||
|
||||
@@ -9,6 +9,5 @@ export interface AccountsContextT {
|
||||
logout: () => void;
|
||||
/** Show or hide the app's navigation bar. */
|
||||
showNavBar: (show: boolean) => void;
|
||||
isMobile: boolean;
|
||||
setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user