Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rename 1

Manav Rathi145c7356a8a9
diff --git a/web/apps/photos/src/components/AuthenticateUserModal.tsx b/web/apps/photos/src/components/AuthenticateUserModal.tsx
index 0002760a82..9c230cc220 100644
--- a/web/apps/photos/src/components/AuthenticateUserModal.tsx
+++ b/web/apps/photos/src/components/AuthenticateUserModal.tsx
@@ -1,6 +1,6 @@
import { checkSessionValidity } from "@/accounts/services/session";
import {
- DialogBoxV2,
+ TitledMiniDialog,
type MiniDialogAttributes,
} from "@/base/components/MiniDialog";
import log from "@/base/log";
@@ -98,7 +98,7 @@ export default function AuthenticateUserModal({
};
return (
- <DialogBoxV2
+ <TitledMiniDialog
open={open}
onClose={onClose}
sx={{ position: "absolute" }}
@@ -111,7 +111,7 @@ export default function AuthenticateUserModal({
keyAttributes={keyAttributes}
submitButtonProps={{ sx: { mb: 0 } }}
/>
- </DialogBoxV2>
+ </TitledMiniDialog>
);
}
diff --git a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
index a3f56c6ca6..67b4b2d678 100644
--- a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
+++ b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
@@ -1,4 +1,4 @@
-import { DialogBoxV2 } from "@/base/components/MiniDialog";
+import { TitledMiniDialog } from "@/base/components/MiniDialog";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { boxSeal } from "@/base/crypto/libsodium";
import log from "@/base/log";
@@ -135,7 +135,7 @@ export const AlbumCastDialog: React.FC<AlbumCastDialogProps> = ({
}, [open]);
return (
- <DialogBoxV2
+ <TitledMiniDialog
open={open}
onClose={onClose}
title={t("cast_album_to_tv")}
@@ -213,6 +213,6 @@ export const AlbumCastDialog: React.FC<AlbumCastDialogProps> = ({
</Button>
</>
)}
- </DialogBoxV2>
+ </TitledMiniDialog>
);
};
diff --git a/web/apps/photos/src/components/Collections/CollectionNamer.tsx b/web/apps/photos/src/components/Collections/CollectionNamer.tsx
index 0374b8dc14..bf64267499 100644
--- a/web/apps/photos/src/components/Collections/CollectionNamer.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionNamer.tsx
@@ -1,4 +1,4 @@
-import { DialogBoxV2 } from "@/base/components/MiniDialog";
+import { TitledMiniDialog } from "@/base/components/MiniDialog";
import SingleInputForm, {
type SingleInputFormProps,
} from "@ente/shared/components/SingleInputForm";
@@ -39,7 +39,7 @@ export default function CollectionNamer({ attributes, ...props }: Props) {
};
return (
- <DialogBoxV2
+ <TitledMiniDialog
open={props.show}
onClose={props.onHide}
title={attributes.title}
@@ -53,6 +53,6 @@ export default function CollectionNamer({ attributes, ...props }: Props) {
submitButtonProps={{ sx: { mt: 1, mb: 2 } }}
secondaryButtonAction={props.onHide}
/>
- </DialogBoxV2>
+ </TitledMiniDialog>
);
}
diff --git a/web/apps/photos/src/components/DeleteAccountModal.tsx b/web/apps/photos/src/components/DeleteAccountModal.tsx
index ba2d6488f1..72494f9455 100644
--- a/web/apps/photos/src/components/DeleteAccountModal.tsx
+++ b/web/apps/photos/src/components/DeleteAccountModal.tsx
@@ -1,4 +1,4 @@
-import { DialogBoxV2 } from "@/base/components/MiniDialog";
+import { TitledMiniDialog } from "@/base/components/MiniDialog";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { LoadingButton } from "@/base/components/mui/LoadingButton";
import log from "@/base/log";
@@ -138,7 +138,7 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => {
return (
<>
- <DialogBoxV2
+ <TitledMiniDialog
fullWidth
open={open}
onClose={onClose}
@@ -216,7 +216,7 @@ const DeleteAccountModal = ({ open, onClose }: Iprops) => {
</form>
)}
</Formik>
- </DialogBoxV2>
+ </TitledMiniDialog>
</>
);
};
diff --git a/web/apps/photos/src/components/ExportPendingList.tsx b/web/apps/photos/src/components/ExportPendingList.tsx
index 667926afdd..087f31d3d0 100644
--- a/web/apps/photos/src/components/ExportPendingList.tsx
+++ b/web/apps/photos/src/components/ExportPendingList.tsx
@@ -1,4 +1,4 @@
-import { DialogBoxV2 } from "@/base/components/MiniDialog";
+import { TitledMiniDialog } from "@/base/components/MiniDialog";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { ItemCard, PreviewItemTile } from "@/new/photos/components/Tiles";
import { EnteFile } from "@/new/photos/types/file";
@@ -55,10 +55,9 @@ const ExportPendingList = (props: Iprops) => {
};
return (
- <DialogBoxV2
+ <TitledMiniDialog
open={props.isOpen}
onClose={props.onClose}
- fullWidth
PaperProps={{
sx: { maxWidth: "444px" },
}}
@@ -79,7 +78,7 @@ const ExportPendingList = (props: Iprops) => {
>
{t("close")}
</FocusVisibleButton>
- </DialogBoxV2>
+ </TitledMiniDialog>
);
};
diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo/FileNameEditDialog.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo/FileNameEditDialog.tsx
index b21a3ac58d..886328ddbf 100644
--- a/web/apps/photos/src/components/PhotoViewer/FileInfo/FileNameEditDialog.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/FileInfo/FileNameEditDialog.tsx
@@ -1,4 +1,4 @@
-import { DialogBoxV2 } from "@/base/components/MiniDialog";
+import { TitledMiniDialog } from "@/base/components/MiniDialog";
import SingleInputForm, {
type SingleInputFormProps,
} from "@ente/shared/components/SingleInputForm";
@@ -23,7 +23,7 @@ export const FileNameEditDialog = ({
}
};
return (
- <DialogBoxV2
+ <TitledMiniDialog
sx={{ zIndex: 1600 }}
open={isInEditMode}
onClose={closeEditMode}
@@ -39,6 +39,6 @@ export const FileNameEditDialog = ({
secondaryButtonAction={closeEditMode}
submitButtonProps={{ sx: { mt: 1, mb: 2 } }}
/>
- </DialogBoxV2>
+ </TitledMiniDialog>
);
};
diff --git a/web/packages/base/components/MiniDialog.tsx b/web/packages/base/components/MiniDialog.tsx
index cc628bacdb..8ddabc611b 100644
--- a/web/packages/base/components/MiniDialog.tsx
+++ b/web/packages/base/components/MiniDialog.tsx
@@ -223,55 +223,50 @@ export function MiniDialog({
// }
// }
-type DialogBoxV2Props = React.PropsWithChildren<
- Omit<DialogProps, "onClose"> & {
- onClose: () => void;
- /**
- * The dialog's title.
- *
- * Usually this will be a string, but it can be any {@link ReactNode}. Note
- * that it always gets wrapped in a Typography element to set the font
- * style, so if your ReactNode wants to do its own thing, it'll need to
- * reset or override these customizations.
- */
- title?: React.ReactNode;
- }
->;
+type TitledMiniDialogProps = Omit<DialogProps, "onClose"> & {
+ onClose: () => void;
+ /**
+ * The dialog's title.
+ */
+ title?: React.ReactNode;
+};
/**
- * TODO This is a duplicate of MiniDialog. This is for use by call sites that
- * were using the MiniDialog not as a dialog but as a base container. Such use
- * cases are better served by directly using the MUI {@link Dialog}, so these
- * are considered deprecated. Splitting these here so that we can streamline the
- * API for the notify/confirm case separately.
+ * MiniDialog in a "shell" form.
+ *
+ * This is a {@link Dialog} for use at places which need more customization than
+ * what {@link MiniDialog} provides, but wish to retain the same size and
+ * general look without duplicating the MiniDialog code.
+ *
+ * It does three things:
+ *
+ * - Sets a fixed size same as {@link MiniDialog}, and sets up similar padding.
+ * - Takes the title as a prop, and wraps it in a {@link DialogTitle}.
+ * - Wraps children in a scrollable {@link DialogContent}.
*/
-export function DialogBoxV2({
- title,
- children,
- open,
- onClose,
- ...props
-}: DialogBoxV2Props) {
+export const TitledMiniDialog: React.FC<
+ React.PropsWithChildren<TitledMiniDialogProps>
+> = ({ title, children, open, onClose, ...props }) => {
const { PaperProps, ...rest } = props;
return (
<Dialog
open={open}
onClose={onClose}
+ fullWidth
PaperProps={{
...PaperProps,
sx: {
- // padding: "8px 12px",
maxWidth: "360px",
...PaperProps?.sx,
},
}}
{...rest}
>
- <DialogTitle sx={{ "&&&": { paddingBlock: "18px 0" } }}>
+ <DialogTitle sx={{ "&&&": { paddingBlock: "24px 16px" } }}>
{title}
</DialogTitle>
<DialogContent>{children}</DialogContent>
</Dialog>
);
-}
+};