Add Enter HotKey to aAuth authroize screen (#21512)
as title <img width="1263" height="834" alt="image" src="https://github.com/user-attachments/assets/73dbfca2-8c7f-469d-8273-6adec5472abd" /> <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/21512?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user