Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update

Manav Rathid660f71f56f3
diff --git a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
index 9feab319b5..09f3733c4e 100644
--- a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
+++ b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx
@@ -7,6 +7,7 @@ import {
type SingleInputFormProps,
} from "ente-base/components/SingleInputForm";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
+import { ut } from "ente-base/i18n";
import log from "ente-base/log";
import type { Collection } from "ente-media/collection";
import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
@@ -194,7 +195,7 @@ export const AlbumCastDialog: React.FC<AlbumCastDialogProps> = ({
</Stack>
<SingleInputForm
label={t("code")}
- placeholder={"123456"}
+ placeholder={ut("123456")}
submitButtonTitle={t("pair_device_to_tv")}
submitButtonColor="accent"
onSubmit={onSubmit}
@@ -203,6 +204,7 @@ export const AlbumCastDialog: React.FC<AlbumCastDialogProps> = ({
variant="text"
fullWidth
onClick={() => setView("choose")}
+ sx={{ mt: 1 }}
>
{t("go_back")}
</FocusVisibleButton>
diff --git a/web/packages/base/components/SingleInputDialog.tsx b/web/packages/base/components/SingleInputDialog.tsx
index 7282b14a81..2f997b680f 100644
--- a/web/packages/base/components/SingleInputDialog.tsx
+++ b/web/packages/base/components/SingleInputDialog.tsx
@@ -1,11 +1,7 @@
import { Dialog, DialogContent, DialogTitle } from "@mui/material";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
-import React from "react";
-import {
- SingleInputForm,
- type SingleInputFormProps,
- type SingleInputFormShowError,
-} from "./SingleInputForm";
+import React, { useCallback } from "react";
+import { SingleInputForm, type SingleInputFormProps } from "./SingleInputForm";
type SingleInputDialogProps = ModalVisibilityProps &
Omit<SingleInputFormProps, "onCancel"> & {
@@ -29,13 +25,13 @@ export const SingleInputDialog: React.FC<SingleInputDialogProps> = ({
title,
...rest
}) => {
- const handleSubmit = async (
- value: string,
- showError: SingleInputFormShowError,
- ) => {
- await onSubmit(value, showError);
- onClose();
- };
+ const handleSubmit: SingleInputFormProps["onSubmit"] = useCallback(
+ async (value, showError) => {
+ await onSubmit(value, showError);
+ onClose();
+ },
+ [onClose, onSubmit],
+ );
return (
<Dialog
diff --git a/web/packages/base/components/SingleInputForm.tsx b/web/packages/base/components/SingleInputForm.tsx
index 3592156d27..d310d22f97 100644
--- a/web/packages/base/components/SingleInputForm.tsx
+++ b/web/packages/base/components/SingleInputForm.tsx
@@ -11,8 +11,6 @@ import { useFormik } from "formik";
import { t } from "i18next";
import React from "react";
-export type SingleInputFormShowError = (message: string) => void;
-
export type SingleInputFormProps = Pick<
TextFieldProps,
"label" | "placeholder" | "autoComplete" | "autoFocus" | "slotProps"
@@ -64,10 +62,10 @@ export type SingleInputFormProps = Pick<
* {@link showError} will get overwritten by the generic error message.
*/
onSubmit:
- | ((name: string, showError: SingleInputFormShowError) => void)
+ | ((name: string, showError: (message: string) => void) => void)
| ((
name: string,
- showError: SingleInputFormShowError,
+ showError: (message: string) => void,
) => Promise<void>);
};