diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx index 3dd98e7efe..4b9572cdd2 100644 --- a/web/apps/accounts/src/pages/_app.tsx +++ b/web/apps/accounts/src/pages/_app.tsx @@ -1,5 +1,6 @@ import { staticAppTitle } from "@/base/app"; import { CustomHead } from "@/base/components/Head"; +import { AppNavbar } from "@/base/components/Navbar"; import { setupI18n } from "@/base/i18n"; import { disableDiskLogs } from "@/base/log"; import { logUnhandledErrorsAndRejections } from "@/base/log-web"; @@ -7,7 +8,6 @@ import { Overlay } from "@ente/shared/components/Container"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; -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"; diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx index 88d8ed2efd..cab009dd17 100644 --- a/web/apps/auth/src/pages/_app.tsx +++ b/web/apps/auth/src/pages/_app.tsx @@ -2,6 +2,7 @@ import { accountLogout } from "@/accounts/services/logout"; import type { AccountsContextT } from "@/accounts/types/context"; import { clientPackageName, staticAppTitle } from "@/base/app"; import { CustomHead } from "@/base/components/Head"; +import { AppNavbar } from "@/base/components/Navbar"; import { setupI18n } from "@/base/i18n"; import { logStartupBanner, @@ -13,7 +14,6 @@ import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; import { MessageContainer } from "@ente/shared/components/MessageContainer"; -import { AppNavbar } from "@ente/shared/components/Navbar/app"; import { useLocalState } from "@ente/shared/hooks/useLocalState"; import HTTPService from "@ente/shared/network/HTTPService"; import { @@ -24,7 +24,7 @@ import { import { getTheme } from "@ente/shared/themes"; import { THEME_COLOR } from "@ente/shared/themes/constants"; import type { User } from "@ente/shared/user/types"; -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"; diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx index d5a3934337..a3f94c2f43 100644 --- a/web/apps/auth/src/pages/auth.tsx +++ b/web/apps/auth/src/pages/auth.tsx @@ -1,3 +1,4 @@ +import { NavbarBase } from "@/base/components/Navbar"; import { ensure } from "@/utils/ensure"; import { HorizontalFlex, @@ -6,7 +7,6 @@ import { import { EnteLogo } from "@ente/shared/components/EnteLogo"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; import { sessionExpiredDialogAttributes } from "@ente/shared/components/LoginComponents"; -import NavbarBase from "@ente/shared/components/Navbar/base"; import OverflowMenu from "@ente/shared/components/OverflowMenu/menu"; import { OverflowMenuOption } from "@ente/shared/components/OverflowMenu/option"; import { AUTH_PAGES as PAGES } from "@ente/shared/constants/pages"; diff --git a/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx index 451ea2c481..12e49a7ae5 100644 --- a/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx +++ b/web/apps/photos/src/components/pages/dedupe/SelectedFileOptions.tsx @@ -1,5 +1,5 @@ +import { SelectionBar } from "@/base/components/Navbar"; import { FluidContainer } from "@ente/shared/components/Container"; -import { SelectionBar } from "@ente/shared/components/Navbar/SelectionBar"; import BackButton from "@mui/icons-material/ArrowBackOutlined"; import CloseIcon from "@mui/icons-material/Close"; import DeleteIcon from "@mui/icons-material/Delete"; diff --git a/web/apps/photos/src/components/pages/gallery/Navbar.tsx b/web/apps/photos/src/components/pages/gallery/Navbar.tsx index f932995aea..45ae67d80c 100644 --- a/web/apps/photos/src/components/pages/gallery/Navbar.tsx +++ b/web/apps/photos/src/components/pages/gallery/Navbar.tsx @@ -1,6 +1,6 @@ +import { NavbarBase } from "@/base/components/Navbar"; import { EnteFile } from "@/new/photos/types/file"; import { FlexWrapper, HorizontalFlex } from "@ente/shared/components/Container"; -import NavbarBase from "@ente/shared/components/Navbar/base"; import ArrowBack from "@mui/icons-material/ArrowBack"; import MenuIcon from "@mui/icons-material/Menu"; import { IconButton, Typography } from "@mui/material"; diff --git a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx index 1d7d916aa9..d860c1839e 100644 --- a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx +++ b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx @@ -1,5 +1,5 @@ +import { SelectionBar } from "@/base/components/Navbar"; import { FluidContainer } from "@ente/shared/components/Container"; -import { SelectionBar } from "@ente/shared/components/Navbar/SelectionBar"; import ClockIcon from "@mui/icons-material/AccessTime"; import AddIcon from "@mui/icons-material/Add"; import ArchiveIcon from "@mui/icons-material/ArchiveOutlined"; diff --git a/web/apps/photos/src/components/pages/sharedAlbum/Navbar.tsx b/web/apps/photos/src/components/pages/sharedAlbum/Navbar.tsx index 38d68569ae..18abdc436e 100644 --- a/web/apps/photos/src/components/pages/sharedAlbum/Navbar.tsx +++ b/web/apps/photos/src/components/pages/sharedAlbum/Navbar.tsx @@ -1,5 +1,5 @@ +import { NavbarBase } from "@/base/components/Navbar"; import { FluidContainer } from "@ente/shared/components/Container"; -import NavbarBase from "@ente/shared/components/Navbar/base"; import AddPhotoAlternateOutlined from "@mui/icons-material/AddPhotoAlternateOutlined"; import { Box } from "@mui/material"; import UploadButton from "components/Upload/UploadButton"; diff --git a/web/apps/photos/src/components/pages/sharedAlbum/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/sharedAlbum/SelectedFileOptions.tsx index 54b1dc72fb..c8a369ba16 100644 --- a/web/apps/photos/src/components/pages/sharedAlbum/SelectedFileOptions.tsx +++ b/web/apps/photos/src/components/pages/sharedAlbum/SelectedFileOptions.tsx @@ -1,5 +1,5 @@ +import { SelectionBar } from "@/base/components/Navbar"; import { FluidContainer } from "@ente/shared/components/Container"; -import { SelectionBar } from "@ente/shared/components/Navbar/SelectionBar"; import CloseIcon from "@mui/icons-material/Close"; import DownloadIcon from "@mui/icons-material/Download"; import { Box, IconButton, Stack, Tooltip } from "@mui/material"; diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx index 423808a1f2..195ab2f8ff 100644 --- a/web/apps/photos/src/pages/_app.tsx +++ b/web/apps/photos/src/pages/_app.tsx @@ -1,6 +1,7 @@ import type { AccountsContextT } from "@/accounts/types/context"; import { clientPackageName, staticAppTitle } from "@/base/app"; import { CustomHead } from "@/base/components/Head"; +import { AppNavbar } from "@/base/components/Navbar"; import { setupI18n } from "@/base/i18n"; import log from "@/base/log"; import { @@ -21,7 +22,6 @@ import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types"; import EnteSpinner from "@ente/shared/components/EnteSpinner"; import { MessageContainer } from "@ente/shared/components/MessageContainer"; -import { AppNavbar } from "@ente/shared/components/Navbar/app"; import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages"; import { useLocalState } from "@ente/shared/hooks/useLocalState"; import HTTPService from "@ente/shared/network/HTTPService"; diff --git a/web/packages/base/components/Navbar.tsx b/web/packages/base/components/Navbar.tsx new file mode 100644 index 0000000000..b4d4bdf346 --- /dev/null +++ b/web/packages/base/components/Navbar.tsx @@ -0,0 +1,40 @@ +import { CenteredFlex, FlexWrapper } from "@ente/shared/components/Container"; +import { EnteLogo } from "@ente/shared/components/EnteLogo"; +import { styled } from "@mui/material"; +import React from "react"; + +/** + * The "bar" at the top of the screen. + * + * Usually this area contains the App's main navigation bar ({@link AppNavbar}), + * but depending on the context it can also show the {@link SelectionBar}. + * */ +export const NavbarBase = styled(FlexWrapper)` + min-height: 64px; + position: sticky; + top: 0; + left: 0; + z-index: 10; + border-bottom: 1px solid ${({ theme }) => theme.palette.divider}; + background-color: ${({ theme }) => theme.colors.background.base}; + margin-bottom: 16px; + padding: 0 24px; + @media (max-width: 720px) { + padding: 0 4px; + } +`; + +export const AppNavbar: React.FC = () => { + return ( + + + + + + ); +}; + +export const SelectionBar = styled(NavbarBase)` + position: fixed; + z-index: 12; +`; diff --git a/web/packages/shared/components/Navbar/SelectionBar.tsx b/web/packages/shared/components/Navbar/SelectionBar.tsx deleted file mode 100644 index 6473e1f601..0000000000 --- a/web/packages/shared/components/Navbar/SelectionBar.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { styled } from "@mui/material"; -import NavbarBase from "./base"; -export const SelectionBar = styled(NavbarBase)` - position: fixed; - z-index: 12; -`; diff --git a/web/packages/shared/components/Navbar/app.tsx b/web/packages/shared/components/Navbar/app.tsx deleted file mode 100644 index b843295b32..0000000000 --- a/web/packages/shared/components/Navbar/app.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from "react"; -import { CenteredFlex } from "../../components/Container"; -import { EnteLogo } from "../EnteLogo"; -import NavbarBase from "./base"; - -export const AppNavbar: React.FC = () => { - return ( - - - - - - ); -}; diff --git a/web/packages/shared/components/Navbar/base.tsx b/web/packages/shared/components/Navbar/base.tsx deleted file mode 100644 index 67cb67c3a3..0000000000 --- a/web/packages/shared/components/Navbar/base.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { styled } from "@mui/material"; -import { FlexWrapper } from "../../components/Container"; - -const NavbarBase = styled(FlexWrapper)` - min-height: 64px; - position: sticky; - top: 0; - left: 0; - z-index: 10; - border-bottom: 1px solid ${({ theme }) => theme.palette.divider}; - background-color: ${({ theme }) => theme.colors.background.base}; - margin-bottom: 16px; - padding: 0 24px; - @media (max-width: 720px) { - padding: 0 4px; - } -`; - -export default NavbarBase;