Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move

Manav Rathi6b64e20a7ea5
diff --git a/web/apps/accounts/src/pages/passkeys/index.tsx b/web/apps/accounts/src/pages/passkeys/index.tsx
index 3b6f6af2d2..fb9f591ad5 100644
--- a/web/apps/accounts/src/pages/passkeys/index.tsx
+++ b/web/apps/accounts/src/pages/passkeys/index.tsx
@@ -1,7 +1,7 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemDivider, MenuItemGroup } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
-import { mdErrorAttributes } from "@/base/components/utils/mini-dialog";
+import { errorDialogAttributes } from "@/base/components/utils/mini-dialog";
import log from "@/base/log";
import { ensure } from "@/utils/ensure";
import { CenteredFlex } from "@ente/shared/components/Container";
@@ -45,7 +45,7 @@ const Page: React.FC = () => {
>();
const showPasskeyFetchFailedErrorDialog = useCallback(() => {
- showMiniDialog(mdErrorAttributes(t("passkey_fetch_failed")));
+ showMiniDialog(errorDialogAttributes(t("passkey_fetch_failed")));
}, [showMiniDialog]);
useEffect(() => {
diff --git a/web/packages/accounts/components/LoginComponents.tsx b/web/packages/accounts/components/LoginComponents.tsx
index a1b5158bda..b7bdb675c3 100644
--- a/web/packages/accounts/components/LoginComponents.tsx
+++ b/web/packages/accounts/components/LoginComponents.tsx
@@ -5,6 +5,7 @@ import {
} from "@/accounts/services/passkey";
import type { MiniDialogAttributes } from "@/base/components/MiniDialog";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
+import { genericErrorDialogAttributes } from "@/base/components/utils/mini-dialog";
import log from "@/base/log";
import { customAPIHost } from "@/base/origins";
import { VerticallyCentered } from "@ente/shared/components/Container";
@@ -108,7 +109,7 @@ export const VerifyingPasskey: React.FC<VerifyingPasskeyProps> = ({
e instanceof Error &&
e.message == passkeySessionExpiredErrorMessage
? sessionExpiredDialogAttributes(logout)
- : genericErrorAttributes(),
+ : genericErrorDialogAttributes(),
);
setVerificationStatus("waiting");
}
@@ -194,11 +195,10 @@ const ButtonStack = styled("div")`
`;
/**
- * {@link DialogBoxAttributesV2} for showing the error when the user's session
- * has expired.
+ * {@link MiniDialogAttributes} for showing asking the user to login again when
+ * their session has expired.
*
- * It asks them to login again. There is one button, which allows them to
- * logout.
+ * There is one button, which allows them to logout.
*
* @param onLogin Called when the user presses the "Login" button on the error
* dialog.
@@ -215,12 +215,3 @@ export const sessionExpiredDialogAttributes = (
},
cancel: false,
});
-
-/**
- * {@link DialogBoxAttributesV2} for showing a generic error.
- */
-const genericErrorAttributes = (): MiniDialogAttributes => ({
- title: t("error"),
- close: { variant: "critical" },
- message: t("generic_error_retry"),
-});
diff --git a/web/packages/base/components/utils/mini-dialog.tsx b/web/packages/base/components/utils/mini-dialog.tsx
index 0b81aea53b..088e8511f2 100644
--- a/web/packages/base/components/utils/mini-dialog.tsx
+++ b/web/packages/base/components/utils/mini-dialog.tsx
@@ -43,7 +43,7 @@ export const useAttributedMiniDialog = () => {
*
* - Otherwise it sets a default title and use the only argument as the message.
*/
-export const mdErrorAttributes = (
+export const errorDialogAttributes = (
messageOrTitle: string,
optionalMessage?: string,
): MiniDialogAttributes => {
@@ -57,3 +57,6 @@ export const mdErrorAttributes = (
continue: { color: "critical" },
};
};
+
+export const genericErrorDialogAttributes = () =>
+ errorDialogAttributes(t("generic_error"));