Skip to content

The open alternative to Salesforce, designed for AI.

Add Enter HotKey to aAuth authroize screen (#21512)

martmull84a8504473b7
diff --git a/packages/twenty-front/src/pages/auth/Authorize.tsx b/packages/twenty-front/src/pages/auth/Authorize.tsx
index 195781c30ba..752f863a76d 100644
--- a/packages/twenty-front/src/pages/auth/Authorize.tsx
+++ b/packages/twenty-front/src/pages/auth/Authorize.tsx
@@ -1,11 +1,13 @@
import { styled } from '@linaria/react';
import { useContext, useEffect, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
+import { Key } from 'ts-key-enum';
import { AppPath } from 'twenty-shared/types';
import { AppConnectionHeader } from '@/applications/components/AppConnectionHeader';
import { AuthorizeActionButtons } from '@/applications/components/AuthorizeActionButtons';
import { useRedirect } from '@/domain-manager/hooks/useRedirect';
+import { useGlobalHotkeys } from '@/ui/utilities/hotkey/hooks/useGlobalHotkeys';
import { Trans, useLingui } from '@lingui/react/macro';
import { useMutation, useQuery } from '@apollo/client/react';
import { isDefined } from 'twenty-shared/utils';
@@ -215,6 +217,33 @@ export const Authorize = () => {
}
};
+ useGlobalHotkeys({
+ keys: [Key.Enter],
+ callback: (keyboardEvent) => {
+ if (
+ keyboardEvent.target instanceof HTMLButtonElement ||
+ loading ||
+ isAuthorizing ||
+ !isDefined(applicationRegistration)
+ ) {
+ return;
+ }
+
+ handleAuthorize();
+ },
+ containsModifier: false,
+ dependencies: [
+ loading,
+ isAuthorizing,
+ applicationRegistration,
+ clientId,
+ redirectUrl,
+ ],
+ options: {
+ preventDefault: false,
+ },
+ });
+
if (isDefined(queryError)) {
return (
<ModalContent isVerticallyCentered isHorizontallyCentered>