Feat/better hotkeys scope (#526)
* Working version * fix * Fixed console log * Fix lint * wip * Fix * Fix * consolelog --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -2,9 +2,6 @@ import { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { keyframes } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilState } from 'recoil';
|
||||
|
||||
import { captureHotkeyTypeInFocusState } from '@/hotkeys/states/captureHotkeyTypeInFocusState';
|
||||
|
||||
import { useOnboardingStatus } from '../hooks/useOnboardingStatus';
|
||||
import { OnboardingStatus } from '../utils/getOnboardingStatus';
|
||||
@ -38,9 +35,6 @@ export function RequireOnboarded({
|
||||
}): JSX.Element {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [, setCaptureHotkeyTypeInFocus] = useRecoilState(
|
||||
captureHotkeyTypeInFocusState,
|
||||
);
|
||||
const onboardingStatus = useOnboardingStatus();
|
||||
|
||||
useEffect(() => {
|
||||
@ -53,12 +47,6 @@ export function RequireOnboarded({
|
||||
}
|
||||
}, [onboardingStatus, navigate]);
|
||||
|
||||
useEffect(() => {
|
||||
if (onboardingStatus === OnboardingStatus.Completed) {
|
||||
setCaptureHotkeyTypeInFocus(false);
|
||||
}
|
||||
}, [setCaptureHotkeyTypeInFocus, onboardingStatus]);
|
||||
|
||||
if (onboardingStatus !== OnboardingStatus.Completed) {
|
||||
return (
|
||||
<EmptyContainer>
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { useHotkeysScopeOnMountOnly } from '@/hotkeys/hooks/useHotkeysScopeOnMountOnly';
|
||||
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||
import { Modal as UIModal } from '@/ui/components/modal/Modal';
|
||||
|
||||
type Props = React.ComponentProps<'div'>;
|
||||
@ -17,6 +19,11 @@ const StyledContainer = styled.div`
|
||||
`;
|
||||
|
||||
export function AuthModal({ children, ...restProps }: Props) {
|
||||
useHotkeysScopeOnMountOnly({
|
||||
scope: InternalHotkeysScope.Modal,
|
||||
customScopes: { 'command-menu': false, goto: false },
|
||||
});
|
||||
|
||||
return (
|
||||
<UIModal isOpen={true}>
|
||||
<StyledContainer {...restProps}>{children}</StyledContainer>
|
||||
|
||||
Reference in New Issue
Block a user