Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use

Manav Rathiee96b44b74ea
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 6452c1cc12..f68ad9c08d 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -32,6 +32,10 @@ import {
OverflowMenu,
OverflowMenuOption,
} from "ente-base/components/OverflowMenu";
+import {
+ SingleInputForm,
+ type SingleInputFormProps,
+} from "ente-base/components/SingleInputForm";
import {
useIsSmallWidth,
useIsTouchscreen,
@@ -56,9 +60,6 @@ import {
} from "ente-new/photos/services/collection";
import { sortFiles } from "ente-new/photos/services/files";
import { usePhotosAppContext } from "ente-new/photos/types/context";
-import SingleInputForm, {
- type SingleInputFormProps,
-} from "ente-shared/components/SingleInputForm";
import { CustomError, parseSharingErrorCodes } from "ente-shared/error";
import { t } from "i18next";
import { useRouter } from "next/router";
@@ -376,7 +377,7 @@ export default function PublicCollectionGallery() {
setTimeout(hideLoadingBar, 0);
}, [showLoadingBar, hideLoadingBar]);
- const verifyLinkPassword: SingleInputFormProps["callback"] = async (
+ const handleSubmitPassword: SingleInputFormProps["onSubmit"] = async (
password,
setFieldError,
) => {
@@ -396,10 +397,9 @@ export default function PublicCollectionGallery() {
log.error("Failed to verifyLinkPassword", e);
if (isHTTP401Error(e)) {
setFieldError(t("incorrect_password"));
- } else {
- setFieldError(t("generic_error_retry"));
+ return;
}
- return;
+ throw e;
}
await syncWithRemote();
@@ -456,10 +456,10 @@ export default function PublicCollectionGallery() {
{t("link_password_description")}
</Typography>
<SingleInputForm
- callback={verifyLinkPassword}
- placeholder={t("password")}
- buttonText={t("unlock")}
- fieldType="password"
+ inputType="password"
+ label={t("password")}
+ submitButtonTitle={t("unlock")}
+ onSubmit={handleSubmitPassword}
/>
</Stack>
</AccountsPageContents>
diff --git a/web/packages/base/components/SingleInputForm.tsx b/web/packages/base/components/SingleInputForm.tsx
index f3b4e6f262..c991e3ad6c 100644
--- a/web/packages/base/components/SingleInputForm.tsx
+++ b/web/packages/base/components/SingleInputForm.tsx
@@ -26,7 +26,7 @@ export type SingleInputFormProps = Pick<
* "password", wherein it'll show an adornment at the end of the text field
* allowing the user to show or hide the password.
*/
- type?: TextFieldProps["type"];
+ inputType?: TextFieldProps["type"];
/**
* The initial value, if any, to prefill in the input.
*/
@@ -93,7 +93,7 @@ export type SingleInputFormProps = Pick<
* as the helper text associated with the text field.
*/
export const SingleInputForm: React.FC<SingleInputFormProps> = ({
- type,
+ inputType,
initialValue,
submitButtonTitle,
submitButtonColor,
@@ -151,7 +151,7 @@ export const SingleInputForm: React.FC<SingleInputFormProps> = ({
name="value"
value={formik.values.value}
onChange={formik.handleChange}
- type={type ?? "text"}
+ type={showPassword ? "text" : (inputType ?? "text")}
fullWidth
margin="normal"
disabled={formik.isSubmitting}
@@ -159,7 +159,7 @@ export const SingleInputForm: React.FC<SingleInputFormProps> = ({
helperText={formik.errors.value ?? " "}
slotProps={{
input:
- type == "password"
+ inputType == "password"
? {
endAdornment: (
<ShowHidePasswordInputAdornment