Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rearrange

Manav Rathi076d62a22bfc
diff --git a/web/apps/accounts/src/pages/passkeys/index.tsx b/web/apps/accounts/src/pages/passkeys/index.tsx
index aae41dd8bf..946946e208 100644
--- a/web/apps/accounts/src/pages/passkeys/index.tsx
+++ b/web/apps/accounts/src/pages/passkeys/index.tsx
@@ -295,6 +295,53 @@ const ManagePasskeyDrawer: React.FC<ManagePasskeyDrawerProps> = ({
);
};
+interface RenamePasskeyDialogProps {
+ /** If `true`, then the dialog is shown. */
+ open: boolean;
+ /** Callback to invoke when the dialog wants to be closed. */
+ onClose: () => void;
+ /** The {@link Passkey} to rename. */
+ passkey: Passkey;
+ /** Callback to invoke when the passkey is renamed. */
+ onRenamePasskey: () => void;
+}
+
+const RenamePasskeyDialog: React.FC<RenamePasskeyDialogProps> = ({
+ open,
+ onClose,
+ passkey,
+ onRenamePasskey,
+}) => {
+ const fullScreen = useMediaQuery("(max-width: 428px)");
+
+ const handleSubmit = async (inputValue: string) => {
+ try {
+ await renamePasskey(passkey.id, inputValue);
+ onRenamePasskey();
+ } catch (e) {
+ log.error("Failed to rename passkey", e);
+ }
+ };
+
+ return (
+ <DialogBoxV2
+ fullWidth
+ {...{ open, onClose, fullScreen }}
+ attributes={{ title: t("RENAME_PASSKEY") }}
+ >
+ <SingleInputForm
+ initialValue={passkey.friendlyName}
+ callback={handleSubmit}
+ placeholder={t("ENTER_PASSKEY_NAME")}
+ buttonText={t("RENAME")}
+ fieldType="text"
+ secondaryButtonAction={onClose}
+ submitButtonProps={{ sx: { mt: 1, mb: 2 } }}
+ />
+ </DialogBoxV2>
+ );
+};
+
interface DeletePasskeyDialogProps {
/** If `true`, then the dialog is shown. */
open: boolean;
@@ -351,50 +398,3 @@ const DeletePasskeyDialog: React.FC<DeletePasskeyDialogProps> = ({
</DialogBoxV2>
);
};
-
-interface RenamePasskeyDialogProps {
- /** If `true`, then the dialog is shown. */
- open: boolean;
- /** Callback to invoke when the dialog wants to be closed. */
- onClose: () => void;
- /** The {@link Passkey} to rename. */
- passkey: Passkey;
- /** Callback to invoke when the passkey is renamed. */
- onRenamePasskey: () => void;
-}
-
-const RenamePasskeyDialog: React.FC<RenamePasskeyDialogProps> = ({
- open,
- onClose,
- passkey,
- onRenamePasskey,
-}) => {
- const fullScreen = useMediaQuery("(max-width: 428px)");
-
- const handleSubmit = async (inputValue: string) => {
- try {
- await renamePasskey(passkey.id, inputValue);
- onRenamePasskey();
- } catch (e) {
- log.error("Failed to rename passkey", e);
- }
- };
-
- return (
- <DialogBoxV2
- fullWidth
- {...{ open, onClose, fullScreen }}
- attributes={{ title: t("RENAME_PASSKEY") }}
- >
- <SingleInputForm
- initialValue={passkey.friendlyName}
- callback={handleSubmit}
- placeholder={t("ENTER_PASSKEY_NAME")}
- buttonText={t("RENAME")}
- fieldType="text"
- secondaryButtonAction={onClose}
- submitButtonProps={{ sx: { mt: 1, mb: 2 } }}
- />
- </DialogBoxV2>
- );
-};