Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(photos):align-sidebar-dialogs-with-settings-ui

Aswin Asok861becdafc7c
diff --git a/web/apps/photos/src/components/AuthenticateUser.tsx b/web/apps/photos/src/components/AuthenticateUser.tsx
index 6077ab87c1..a0a09afcbb 100644
--- a/web/apps/photos/src/components/AuthenticateUser.tsx
+++ b/web/apps/photos/src/components/AuthenticateUser.tsx
@@ -59,7 +59,14 @@ export const AuthenticateUser: React.FC<AuthenticateUserProps> = ({
>
<Stack sx={{ p: "20px", gap: "20px" }}>
<Stack direction="row" sx={v2HeaderRowSx}>
- <DialogTitle sx={{ ...v2TitleSx, "&&": { p: 0 } }}>
+ <DialogTitle
+ sx={{
+ ...v2TitleSx,
+ fontSize: "20px",
+ lineHeight: "28px",
+ "&&": { p: 0 },
+ }}
+ >
{t("password")}
</DialogTitle>
<IconButton
diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsx
index ef9505c739..08a89065bd 100644
--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx
+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx
@@ -24,6 +24,7 @@ import {
import Typography from "@mui/material/Typography";
import { isDesktop } from "ente-base/app";
import { LinkButton } from "ente-base/components/LinkButton";
+import { AttributedMiniDialog } from "ente-base/components/MiniDialog";
import {
RowButton,
RowButtonEndActivityIndicator,
@@ -31,6 +32,7 @@ import {
import { SpacedRow } from "ente-base/components/containers";
import { SidebarDrawer } from "ente-base/components/mui/SidebarDrawer";
import { SidebarPanelContext } from "ente-base/components/mui/SidebarDrawerContext";
+import { useAttributedMiniDialog } from "ente-base/components/utils/dialog";
import {
useModalVisibility,
type ModalVisibilityProps,
@@ -126,13 +128,28 @@ export const Sidebar: React.FC<SidebarProps> = ({
const { show: showExport, props: exportVisibilityProps } =
useModalVisibility();
const { onClose: closeExport } = exportVisibilityProps;
-
- useEffect(() => {
- if (!open) closeExport();
- }, [open, closeExport]);
+ const {
+ show: showManageMemberSubscription,
+ props: manageMemberSubscriptionVisibilityProps,
+ } = useModalVisibility();
+ const { onClose: closeMemberSubscription } =
+ manageMemberSubscriptionVisibilityProps;
const { watchFolderView, setWatchFolderView } = usePhotosAppContext();
const { showMiniDialog, logout } = useBaseContext();
+ const {
+ showMiniDialog: showDownloadAppDialog,
+ miniDialogProps: downloadAppDialogProps,
+ } = useAttributedMiniDialog();
+ const { onClose: closeDownloadAppDialog } = downloadAppDialogProps;
+
+ useEffect(() => {
+ if (!open) {
+ closeExport();
+ closeMemberSubscription();
+ closeDownloadAppDialog();
+ }
+ }, [open, closeExport, closeMemberSubscription, closeDownloadAppDialog]);
const [pendingAccountAction, setPendingAccountAction] =
useState<AccountAction>();
@@ -149,6 +166,8 @@ export const Sidebar: React.FC<SidebarProps> = ({
helpVisibilityProps.onClose();
freeUpSpaceVisibilityProps.onClose();
closeExport();
+ closeMemberSubscription();
+ closeDownloadAppDialog();
setWatchFolderView(false);
onCloseOverlays();
}, [
@@ -158,6 +177,8 @@ export const Sidebar: React.FC<SidebarProps> = ({
helpVisibilityProps,
freeUpSpaceVisibilityProps,
closeExport,
+ closeMemberSubscription,
+ closeDownloadAppDialog,
setWatchFolderView,
onCloseOverlays,
]);
@@ -198,7 +219,8 @@ export const Sidebar: React.FC<SidebarProps> = ({
const handleShowExport = useCallback(() => {
if (!isDesktop) {
- showMiniDialog(downloadAppDialogAttributes());
+ closeMemberSubscription();
+ showDownloadAppDialog(downloadAppDialogAttributes());
return;
}
@@ -211,7 +233,13 @@ export const Sidebar: React.FC<SidebarProps> = ({
log.error("Failed to authenticate before export", error);
}
})();
- }, [closeSections, onAuthenticateUser, showExport, showMiniDialog]);
+ }, [
+ closeSections,
+ closeMemberSubscription,
+ onAuthenticateUser,
+ showExport,
+ showDownloadAppDialog,
+ ]);
const performSidebarAction = useCallback(
async (actionID: SidebarActionID) => {
@@ -299,7 +327,11 @@ export const Sidebar: React.FC<SidebarProps> = ({
<>
<UserDetailsSection
sidebarOpen={open}
- {...{ onShowPlanSelector }}
+ {...{
+ onShowPlanSelector,
+ showManageMemberSubscription,
+ manageMemberSubscriptionVisibilityProps,
+ }}
/>
<Stack
sx={{
@@ -342,6 +374,21 @@ export const Sidebar: React.FC<SidebarProps> = ({
</>
}
>
+ <AttributedMiniDialog
+ {...downloadAppDialogProps}
+ sx={(theme) => ({
+ "& .MuiDialog-paper": { borderRadius: "20px" },
+ "& .MuiDialog-paper > .MuiStack-root": {
+ p: "24px 24px 8px",
+ },
+ "& .MuiDialogContent-root": { p: "16px 24px 24px" },
+ "& .MuiDialogTitle-root": theme.typography.h2,
+ "& .MuiButton-root": {
+ borderRadius: "12px",
+ minHeight: 48,
+ },
+ })}
+ />
{open && exportVisibilityProps.open && (
<Export
{...exportVisibilityProps}
@@ -595,17 +642,17 @@ const HeaderSection: React.FC<SectionProps> = ({ onCloseSidebar }) => (
type UserDetailsSectionProps = Pick<SidebarProps, "onShowPlanSelector"> & {
sidebarOpen: boolean;
+ showManageMemberSubscription: () => void;
+ manageMemberSubscriptionVisibilityProps: ModalVisibilityProps;
};
const UserDetailsSection: React.FC<UserDetailsSectionProps> = ({
sidebarOpen,
onShowPlanSelector,
+ showManageMemberSubscription,
+ manageMemberSubscriptionVisibilityProps,
}) => {
const userDetails = useUserDetailsSnapshot();
- const {
- show: showManageMemberSubscription,
- props: manageMemberSubscriptionVisibilityProps,
- } = useModalVisibility();
useEffect(() => {
if (sidebarOpen) void pullUserDetails();
diff --git a/web/apps/photos/src/components/sidebar/accounts/ManageMemberSubscription.tsx b/web/apps/photos/src/components/sidebar/accounts/ManageMemberSubscription.tsx
index b810833257..e92a5deb94 100644
--- a/web/apps/photos/src/components/sidebar/accounts/ManageMemberSubscription.tsx
+++ b/web/apps/photos/src/components/sidebar/accounts/ManageMemberSubscription.tsx
@@ -36,36 +36,53 @@ export const ManageMemberSubscription: React.FC<
});
return (
- <Dialog {...{ open, onClose, fullScreen }} maxWidth="xs" fullWidth>
- <SpacedRow sx={{ p: "20px 8px 12px 16px" }}>
- <Stack>
- <Typography variant="h3">{t("subscription")}</Typography>
- <Typography sx={{ color: "text.muted" }}>
+ <Dialog
+ {...{ open, onClose, fullScreen }}
+ maxWidth="xs"
+ fullWidth
+ aria-labelledby="member-subscription-title"
+ slotProps={{
+ paper: { sx: { borderRadius: fullScreen ? 0 : "20px" } },
+ }}
+ >
+ <SpacedRow
+ sx={{
+ p: "24px 16px 16px 24px",
+ "& .MuiIconButton-root": { color: "text.muted" },
+ }}
+ >
+ <Stack sx={{ gap: 0.5 }}>
+ <Typography variant="h2" id="member-subscription-title">
+ {t("subscription")}
+ </Typography>
+ <Typography variant="small" sx={{ color: "text.muted" }}>
{t("family_plan")}
</Typography>
</Stack>
<DialogCloseIconButton {...{ onClose }} />
</SpacedRow>
- <DialogContent>
- <Stack sx={{ alignItems: "center", mx: 2 }}>
- <Box sx={{ mb: 4 }}>
+ <DialogContent sx={{ "&&": { p: "8px 24px 24px" } }}>
+ <Stack sx={{ gap: 3 }}>
+ <Box
+ sx={{
+ p: 2,
+ borderRadius: "16px",
+ bgcolor: "fill.faint",
+ }}
+ >
<Typography sx={{ color: "text.muted" }}>
{t("subscription_info_family")}
</Typography>
- <Typography>
+ <Typography sx={{ mt: 0.5, overflowWrap: "anywhere" }}>
{familyAdminEmail(userDetails) ?? ""}
</Typography>
</Box>
- <img
- height={256}
- src="/images/family-plan/1x.png"
- srcSet="/images/family-plan/2x.png 2x, /images/family-plan/3x.png 3x"
- />
<FocusVisibleButton
fullWidth
- variant="outlined"
+ variant="contained"
color="critical"
onClick={confirmLeaveFamily}
+ sx={{ borderRadius: "20px", minHeight: 48 }}
>
{t("leave_family_plan")}
</FocusVisibleButton>
diff --git a/web/packages/base/components/MiniDialog.tsx b/web/packages/base/components/MiniDialog.tsx
index e862d5c266..2506167e9e 100644
--- a/web/packages/base/components/MiniDialog.tsx
+++ b/web/packages/base/components/MiniDialog.tsx
@@ -36,14 +36,14 @@ export interface MiniDialogAttributes {
buttonDirection?: "row" | "column";
}
-type MiniDialogProps = Pick<DialogProps, "open"> & {
+type MiniDialogProps = Pick<DialogProps, "open" | "sx"> & {
onClose: () => void;
attributes?: MiniDialogAttributes;
};
export const AttributedMiniDialog: React.FC<
React.PropsWithChildren<MiniDialogProps>
-> = ({ open, onClose, attributes, children }) => {
+> = ({ open, onClose, attributes, children, sx }) => {
const [phase, setPhase] = useState<
"loading" | "secondary-loading" | "failed" | undefined
>();
@@ -137,7 +137,7 @@ export const AttributedMiniDialog: React.FC<
return (
<Dialog
- {...{ open }}
+ {...{ open, sx }}
onClose={handleClose}
fullWidth
slotProps={{ paper: { sx: { maxWidth: "360px" } } }}