fix: hidden settings menu affects settings layout (#7769)
This PR fixes #6746 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { fireEvent, renderHook } from '@testing-library/react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { MemoryRouter, useLocation } from 'react-router-dom';
|
||||
import { fireEvent, renderHook } from '@testing-library/react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
|
||||
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
||||
@ -23,7 +23,7 @@ const renderHookConfig = {
|
||||
describe('useGoToHotkeys', () => {
|
||||
it('should navigate on hotkey trigger', () => {
|
||||
const { result } = renderHook(() => {
|
||||
useGoToHotkeys('a', '/three');
|
||||
useGoToHotkeys({ key: 'a', location: '/three' });
|
||||
|
||||
const setHotkeyScope = useSetHotkeyScope();
|
||||
|
||||
|
||||
@ -5,13 +5,24 @@ import { AppHotkeyScope } from '../types/AppHotkeyScope';
|
||||
|
||||
import { useSequenceHotkeys } from './useSequenceScopedHotkeys';
|
||||
|
||||
export const useGoToHotkeys = (key: Keys, location: string) => {
|
||||
type GoToHotkeysProps = {
|
||||
key: Keys;
|
||||
location: string;
|
||||
preNavigateFunction?: () => void;
|
||||
};
|
||||
|
||||
export const useGoToHotkeys = ({
|
||||
key,
|
||||
location,
|
||||
preNavigateFunction,
|
||||
}: GoToHotkeysProps) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
useSequenceHotkeys(
|
||||
'g',
|
||||
key,
|
||||
() => {
|
||||
preNavigateFunction?.();
|
||||
navigate(location);
|
||||
},
|
||||
AppHotkeyScope.Goto,
|
||||
|
||||
Reference in New Issue
Block a user