Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web] Standardize single input dialogs on v2

AswinAsok47d371070a35
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index 924687fc72..ff2e6dec4d 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -1256,7 +1256,6 @@ export const Upload: React.FC<UploadProps> = ({
/>
<SingleInputDialog
{...newAlbumNameInputVisibilityProps}
- variant="v2"
onClose={handleNewAlbumNameInputClose}
title={t("new_album")}
label={t("album_name")}
diff --git a/web/apps/photos/src/components/collections/CreateAlbumDialog.tsx b/web/apps/photos/src/components/collections/CreateAlbumDialog.tsx
index 00c9aedb1b..8aadc273e8 100644
--- a/web/apps/photos/src/components/collections/CreateAlbumDialog.tsx
+++ b/web/apps/photos/src/components/collections/CreateAlbumDialog.tsx
@@ -69,7 +69,6 @@ export const CreateAlbumDialog: React.FC<CreateAlbumDialogProps> = ({
<>
<SingleInputDialog
{...{ open, onClose }}
- variant="v2"
title={t("new_album")}
label={t("album_name")}
submitButtonTitle={t("create")}
diff --git a/web/apps/photos/src/components/gallery/PeopleHeader.tsx b/web/apps/photos/src/components/gallery/PeopleHeader.tsx
index 4f336c0ceb..72302c7333 100644
--- a/web/apps/photos/src/components/gallery/PeopleHeader.tsx
+++ b/web/apps/photos/src/components/gallery/PeopleHeader.tsx
@@ -192,7 +192,6 @@ const CGroupPersonHeader: React.FC<CGroupPersonHeaderProps> = ({ person }) => {
placeholder={t("enter_name")}
autoComplete="name"
initialValue={name}
- submitButtonColor="primary"
submitButtonTitle={t("rename")}
onSubmit={handleRename}
/>
@@ -415,7 +414,6 @@ const AddPersonDialog: React.FC<AddPersonDialogProps> = ({
label={t("add_name")}
placeholder={t("enter_name")}
autoComplete="name"
- submitButtonColor="primary"
submitButtonTitle={t("add")}
onSubmit={handleAddPersonWithName}
/>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 4358b10687..aa1267e829 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -2544,22 +2544,21 @@ const Page: React.FC = () => {
onClose={handleCloseAuthenticateUser}
onAuthenticate={handleAuthenticate}
/>
- <SingleInputDialog
- {...albumNameInputVisibilityProps}
- variant="v2"
- title={t("new_album")}
- label={t("album_name")}
- submitButtonTitle={t("create")}
- onClose={() => {
- // Do not leak a cancelled add into the next album creation.
- pendingSingleFileAdd.current = undefined;
- postCreateAlbumHidden.current = false;
- setPostCreateAlbumOp(undefined);
- albumNameInputVisibilityProps.onClose();
- }}
- onSubmit={handleAlbumNameSubmit}
- />
</FullScreenDropZone>
+ <SingleInputDialog
+ {...albumNameInputVisibilityProps}
+ title={t("new_album")}
+ label={t("album_name")}
+ submitButtonTitle={t("create")}
+ onClose={() => {
+ // Do not leak a cancelled add into the next album creation.
+ pendingSingleFileAdd.current = undefined;
+ postCreateAlbumHidden.current = false;
+ setPostCreateAlbumOp(undefined);
+ albumNameInputVisibilityProps.onClose();
+ }}
+ onSubmit={handleAlbumNameSubmit}
+ />
<QuickLinkCreatedNotification
open={publicLinkToast.open}
onCopy={() => {
diff --git a/web/packages/base/components/SingleInputDialog.tsx b/web/packages/base/components/SingleInputDialog.tsx
index 33d8489a5a..7309f0a3e1 100644
--- a/web/packages/base/components/SingleInputDialog.tsx
+++ b/web/packages/base/components/SingleInputDialog.tsx
@@ -1,8 +1,6 @@
import CloseIcon from "@mui/icons-material/Close";
import {
Dialog,
- DialogContent,
- DialogTitle,
IconButton,
Stack,
Typography,
@@ -21,7 +19,7 @@ import {
import { SingleInputForm, type SingleInputFormProps } from "./SingleInputForm";
type SingleInputDialogProps = ModalVisibilityProps &
- Omit<SingleInputFormProps, "onCancel"> & {
+ Omit<SingleInputFormProps, "onCancel" | "variant" | "submitButtonColor"> & {
title: string;
sx?: SxProps<Theme>;
};
@@ -32,7 +30,6 @@ export const SingleInputDialog: React.FC<SingleInputDialogProps> = ({
onSubmit,
title,
sx,
- variant = "default",
...rest
}) => {
const titleID = useId();
@@ -44,58 +41,36 @@ export const SingleInputDialog: React.FC<SingleInputDialogProps> = ({
[onClose, onSubmit],
);
- if (variant !== "default") {
- return (
- <Dialog
- open={open}
- onClose={onClose}
- maxWidth={false}
- aria-labelledby={titleID}
- sx={sx}
- slotProps={{ paper: { sx: v2PaperSx } }}
- >
- <Stack sx={{ p: "20px", gap: "20px" }}>
- <Stack direction="row" sx={v2HeaderRowSx}>
- <Typography id={titleID} sx={v2TitleSx}>
- {title}
- </Typography>
- <IconButton
- aria-label={t("close")}
- onClick={onClose}
- sx={v2CloseButtonSx}
- >
- <CloseIcon sx={{ fontSize: 18 }} />
- </IconButton>
- </Stack>
- <SingleInputForm
- key={open ? "open" : "closed"}
- variant={variant}
- onCancel={onClose}
- onSubmit={handleSubmit}
- {...rest}
- />
- </Stack>
- </Dialog>
- );
- }
-
return (
<Dialog
open={open}
onClose={onClose}
- maxWidth="xs"
- fullWidth
+ maxWidth={false}
+ aria-labelledby={titleID}
sx={sx}
- slotProps={{ paper: { sx: { p: "8px 4px 4px 4px" } } }}
+ slotProps={{ paper: { sx: v2PaperSx } }}
>
- <DialogTitle>{title}</DialogTitle>
- <DialogContent sx={{ "&&&": { pt: 0 } }}>
+ <Stack sx={{ p: "20px", gap: "20px" }}>
+ <Stack direction="row" sx={v2HeaderRowSx}>
+ <Typography id={titleID} sx={v2TitleSx}>
+ {title}
+ </Typography>
+ <IconButton
+ aria-label={t("close")}
+ onClick={onClose}
+ sx={v2CloseButtonSx}
+ >
+ <CloseIcon sx={{ fontSize: 18 }} />
+ </IconButton>
+ </Stack>
<SingleInputForm
+ key={open ? "open" : "closed"}
+ variant="v2"
onCancel={onClose}
onSubmit={handleSubmit}
{...rest}
/>
- </DialogContent>
+ </Stack>
</Dialog>
);
};
diff --git a/web/packages/gallery/components/RenameFileDialog.tsx b/web/packages/gallery/components/RenameFileDialog.tsx
index 6b6a1d39d6..2a65a7ce6f 100644
--- a/web/packages/gallery/components/RenameFileDialog.tsx
+++ b/web/packages/gallery/components/RenameFileDialog.tsx
@@ -20,7 +20,6 @@ export const RenameFileDialog: React.FC<RenameFileDialogProps> = ({
return (
<SingleInputDialog
{...{ open, onClose }}
- variant="v2"
title={t("rename_file")}
label={t("file_name")}
placeholder={t("file_name")}