diff --git a/web/apps/photos/src/components/Collections/CollectionListBar/index.tsx b/web/apps/photos/src/components/Collections/CollectionListBar/index.tsx index 42e8796471..6cab1cfa66 100644 --- a/web/apps/photos/src/components/Collections/CollectionListBar/index.tsx +++ b/web/apps/photos/src/components/Collections/CollectionListBar/index.tsx @@ -7,7 +7,7 @@ import useComponentScroll, { } from "@ente/shared/hooks/useComponentScroll"; import useWindowSize from "@ente/shared/hooks/useWindowSize"; import ExpandMore from "@mui/icons-material/ExpandMore"; -import { Box, IconButton, Typography } from "@mui/material"; +import { Box, IconButton, Typography, useMediaQuery } from "@mui/material"; import CollectionListBarCard from "components/Collections/CollectionListBar/CollectionCard"; import { CollectionListBarWrapper, @@ -16,8 +16,7 @@ import { import { ALL_SECTION, COLLECTION_LIST_SORT_BY } from "constants/collection"; import { t } from "i18next"; import memoize from "memoize-one"; -import { AppContext } from "pages/_app"; -import React, { useContext, useEffect } from "react"; +import React, { useEffect } from "react"; import AutoSizer from "react-virtualized-auto-sizer"; import { FixedSizeList as List, @@ -94,9 +93,8 @@ const CollectionListBar = (props: IProps) => { isInHiddenSection, } = props; - const appContext = useContext(AppContext); - const windowSize = useWindowSize(); + const isMobile = useMediaQuery("(max-width: 428px)"); const { componentRef: collectionListWrapperRef, @@ -136,7 +134,7 @@ const CollectionListBar = (props: IProps) => { {isInHiddenSection ? t("HIDDEN_ALBUMS") : t("ALBUMS")} - {appContext.isMobile && ( + {isMobile && ( { /> )} - {!appContext.isMobile && ( + {!isMobile && (