Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[desktop][photos] Keep dialogs and drawers below the desktop title bar (#13782)

Yugendhra2f821ac25ab1
diff --git a/web/apps/photos/src/components/CollectionSelector.tsx b/web/apps/photos/src/components/CollectionSelector.tsx
index ecb2badfdd..cb643f58e8 100644
--- a/web/apps/photos/src/components/CollectionSelector.tsx
+++ b/web/apps/photos/src/components/CollectionSelector.tsx
@@ -222,7 +222,7 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
maxWidth: isFullScreen ? "100%" : 600,
maxHeight: isFullScreen
? "100%"
- : "min(600px, calc(100svh - 64px))",
+ : "min(600px, calc(100% - 64px))",
boxSizing: "border-box",
},
],
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 8fd0c61d64..9aaf1de9cd 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -165,7 +165,7 @@ export const SearchBar: React.FC<SearchBarProps> = (props) => {
width: "621px",
maxWidth: "calc(100% - 24px)",
m: "12px",
- maxHeight: "calc(100dvh - 24px)",
+ maxHeight: "calc(100% - 24px)",
p: "20px",
borderRadius: "20px",
bgcolor: "background.default",
@@ -574,8 +574,10 @@ const createSelectStyles = (
}),
menuList: (style) => ({
...style,
- minHeight: "clamp(120px, calc(100dvh - 280px), 320px)",
- maxHeight: "clamp(120px, calc(100dvh - 280px), 320px)",
+ minHeight:
+ "clamp(120px, calc(100dvh - 280px - env(titlebar-area-height, 0px)), 320px)",
+ maxHeight:
+ "clamp(120px, calc(100dvh - 280px - env(titlebar-area-height, 0px)), 320px)",
display: "flex",
flexDirection: "column",
gap: "8px",
diff --git a/web/apps/photos/src/components/collections/AlbumSlideshowSettings.tsx b/web/apps/photos/src/components/collections/AlbumSlideshowSettings.tsx
index 43f8fcab2a..3afac756ff 100644
--- a/web/apps/photos/src/components/collections/AlbumSlideshowSettings.tsx
+++ b/web/apps/photos/src/components/collections/AlbumSlideshowSettings.tsx
@@ -46,7 +46,7 @@ export function AlbumSlideshowSettings({
pb: "max(20px, env(safe-area-inset-bottom))",
width: { xs: "100%", sm: 440 },
maxWidth: { xs: "100%", sm: "calc(100% - 40px)" },
- maxHeight: "80dvh",
+ maxHeight: "80%",
borderRadius: { xs: "20px 20px 0 0", sm: "24px" },
bgcolor: "#161616",
color: "#fff",
diff --git a/web/apps/photos/src/components/collections/CoverPickerDialog.tsx b/web/apps/photos/src/components/collections/CoverPickerDialog.tsx
index ca5a8b46d4..bf443d6829 100644
--- a/web/apps/photos/src/components/collections/CoverPickerDialog.tsx
+++ b/web/apps/photos/src/components/collections/CoverPickerDialog.tsx
@@ -194,7 +194,7 @@ const paperSx = {
width: "min(688px, calc(100svw - 32px))",
maxWidth: "688px",
height: "560px",
- maxHeight: "calc(100dvh - 32px)",
+ maxHeight: "calc(100% - 32px)",
boxSizing: "border-box",
m: 2,
borderRadius: "20px",
diff --git a/web/apps/photos/src/components/gallery/sections/people/PeopleHeader.tsx b/web/apps/photos/src/components/gallery/sections/people/PeopleHeader.tsx
index bbfae8835a..94cd389354 100644
--- a/web/apps/photos/src/components/gallery/sections/people/PeopleHeader.tsx
+++ b/web/apps/photos/src/components/gallery/sections/people/PeopleHeader.tsx
@@ -439,7 +439,7 @@ const AddPersonDialog: React.FC<AddPersonDialogProps> = ({
maxWidth: isFullScreen ? "100%" : 600,
maxHeight: isFullScreen
? "100%"
- : "min(600px, calc(100svh - 64px))",
+ : "min(600px, calc(100% - 64px))",
boxSizing: "border-box",
},
],
diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsx
index 68dff6ac0b..7de20417d5 100644
--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx
+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx
@@ -499,8 +499,8 @@ function RootSidebarContents({
sx: {
width: "min(1200px, calc(100vw - 48px))",
maxWidth: "calc(100vw - 48px)",
- height: "min(900px, calc(100dvh - 48px))",
- maxHeight: "calc(100dvh - 48px)",
+ height: "min(900px, calc(100% - 48px))",
+ maxHeight: "calc(100% - 48px)",
m: 3,
p: 2,
gap: 2,
@@ -533,8 +533,9 @@ function RootSidebarContents({
root: [
theme.components?.MuiDialog
?.styleOverrides?.root,
- { position: "absolute" },
+ { position: "absolute", top: 0 },
],
+ backdrop: { top: 0 },
},
},
MuiBackdrop: {
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index bd21fba985..ac6ee1cdeb 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -5,11 +5,10 @@ import {
Drawer,
IconButton,
Stack,
- styled,
Typography,
type DrawerProps,
} from "@mui/material";
-import { appName, isDesktop } from "ente-base/app";
+import { appName } from "ente-base/app";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import React, { useContext } from "react";
import {
@@ -17,16 +16,12 @@ import {
SidebarPanelContext,
} from "./SidebarDrawerContext";
-type SidebarDrawerProps = DrawerProps & {
- maxWidth?: string;
- disableAppTitlebarBackdrop?: boolean;
-};
+type SidebarDrawerProps = DrawerProps & { maxWidth?: string };
export const SidebarDrawer: React.FC<SidebarDrawerProps> = ({
slotProps,
children,
maxWidth = "375px",
- disableAppTitlebarBackdrop = false,
...rest
}) => {
const container = useContext(SidebarPanelContext);
@@ -39,7 +34,11 @@ export const SidebarDrawer: React.FC<SidebarDrawerProps> = ({
container,
disableEnforceFocus: true,
disableScrollLock: true,
- sx: { position: "absolute", inset: 0 },
+ sx: {
+ position: "absolute",
+ inset: 0,
+ "& > .MuiBackdrop-root": { top: 0 },
+ },
})}
slotProps={{
...(slotProps ?? {}),
@@ -57,6 +56,8 @@ export const SidebarDrawer: React.FC<SidebarDrawerProps> = ({
width: "100%",
...(inShell && {
position: "absolute",
+ top: 0,
+ height: "100%",
boxSizing: "border-box",
bgcolor: "background.paper2",
boxShadow: "none",
@@ -69,26 +70,11 @@ export const SidebarDrawer: React.FC<SidebarDrawerProps> = ({
},
}}
>
- {isDesktop && !inShell && !disableAppTitlebarBackdrop && (
- <AppTitlebarBackdrop />
- )}
<Box sx={{ p: 1 }}>{children}</Box>
</Drawer>
);
};
-// Keep scrolling content behind the desktop titlebar and traffic lights.
-const AppTitlebarBackdrop = styled("div")(({ theme }) => ({
- position: "sticky",
- top: 0,
- left: 0,
- width: "100%",
- minHeight: "env(titlebar-area-height, 0px)",
- zIndex: 1,
- backgroundColor: theme.vars.palette.backdrop.muted,
- backdropFilter: "blur(12px)",
-}));
-
export type NestedSidebarDrawerVisibilityProps = ModalVisibilityProps & {
// Each nesting level must chain its own onClose into this callback.
onRootClose: () => void;
diff --git a/web/packages/base/components/utils/theme.ts b/web/packages/base/components/utils/theme.ts
index c446e0c14f..45150468e2 100644
--- a/web/packages/base/components/utils/theme.ts
+++ b/web/packages/base/components/utils/theme.ts
@@ -449,6 +449,8 @@ const getTypography = (appName: AppName): TypographyVariantsOptions => {
const typography = baseTypography;
+const titlebarAreaHeight = "env(titlebar-area-height, 0px)";
+
// Theme overrides are bundled into every app; keep heavy customization local.
const components: Components = {
MuiCssBaseline: { styleOverrides: { body: { letterSpacing: "-0.011em" } } },
@@ -465,8 +467,35 @@ const components: Components = {
root: {
".MuiBackdrop-root": {
backgroundColor: "var(--mui-palette-backdrop-muted)",
+ top: titlebarAreaHeight,
},
},
+ paper: {
+ top: titlebarAreaHeight,
+ variants: [
+ {
+ props: { anchor: "left" },
+ style: { height: `calc(100% - ${titlebarAreaHeight})` },
+ },
+ {
+ props: { anchor: "right" },
+ style: { height: `calc(100% - ${titlebarAreaHeight})` },
+ },
+ {
+ props: { anchor: "top" },
+ style: {
+ maxHeight: `calc(100% - ${titlebarAreaHeight})`,
+ },
+ },
+ {
+ props: { anchor: "bottom" },
+ style: {
+ top: "auto",
+ maxHeight: `calc(100% - ${titlebarAreaHeight})`,
+ },
+ },
+ ],
+ },
},
},
@@ -476,7 +505,9 @@ const components: Components = {
closeAfterTransition: false,
},
styleOverrides: {
+ backdrop: { top: titlebarAreaHeight },
root: {
+ top: titlebarAreaHeight,
".MuiBackdrop-root": {
backgroundColor: "var(--mui-palette-backdrop-muted)",
},
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index 5964019127..4dd80d6f68 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -646,7 +646,6 @@ const FileInfoSidebar = styled(
<SidebarDrawer
{...props}
maxWidth="425px"
- disableAppTitlebarBackdrop
anchor="right"
// Avoid MUI's aria-hidden focus warning when this closes.
disableRestoreFocus={true}
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index 5d197aa696..fee8e71267 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -1495,7 +1495,7 @@ const SidebarDrawer = styled(Drawer)(({ theme }) => ({
width: "23vw",
minWidth: "520px",
maxWidth: "calc(100% - 32px)",
- height: "calc(100% - 32px)",
+ height: "calc(100% - 32px - env(titlebar-area-height, 0px))",
margin: "16px",
borderRadius: "36px",
backgroundColor: "#fff",
@@ -1509,7 +1509,7 @@ const SidebarDrawer = styled(Drawer)(({ theme }) => ({
width: "100%",
minWidth: "unset",
maxWidth: "100%",
- height: "100%",
+ height: "calc(100% - env(titlebar-area-height, 0px))",
margin: 0,
borderRadius: 0,
},
diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsx
index ecdbdd157c..51e25b54cd 100644
--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx
+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx
@@ -572,7 +572,7 @@ const SidebarDrawer = styled(Drawer)(({ theme }) => ({
width: "23vw",
minWidth: "520px",
maxWidth: "calc(100% - 32px)",
- height: "calc(100% - 32px)",
+ height: "calc(100% - 32px - env(titlebar-area-height, 0px))",
margin: "16px",
borderRadius: "36px",
backgroundColor: "#fff",
@@ -586,7 +586,7 @@ const SidebarDrawer = styled(Drawer)(({ theme }) => ({
width: "100%",
minWidth: "unset",
maxWidth: "100%",
- height: "100%",
+ height: "calc(100% - env(titlebar-area-height, 0px))",
margin: 0,
borderRadius: 0,
},
diff --git a/web/packages/new/photos/components/AssignPersonDialog.tsx b/web/packages/new/photos/components/AssignPersonDialog.tsx
index 33d97cea1f..0802829778 100644
--- a/web/packages/new/photos/components/AssignPersonDialog.tsx
+++ b/web/packages/new/photos/components/AssignPersonDialog.tsx
@@ -45,7 +45,7 @@ export const AssignPersonDialog: React.FC<AssignPersonDialogProps> = ({
fullWidth
fullScreen={isFullScreen}
slotProps={{
- paper: { sx: { maxWidth: "505px", minHeight: "80svh" } },
+ paper: { sx: { maxWidth: "505px", minHeight: "80%" } },
transition: { onExited: () => setSearchTerm("") },
}}
>