fix: onEnter creating new function page in settings (#7236)
## Description - This PR solves the issue #7235 - On pressing enter, it automatically redirected to New function page in settings
This commit is contained in:
@ -8,10 +8,7 @@ import { Table } from '@/ui/layout/table/components/Table';
|
|||||||
import { TableBody } from '@/ui/layout/table/components/TableBody';
|
import { TableBody } from '@/ui/layout/table/components/TableBody';
|
||||||
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
|
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
|
||||||
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
||||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
import { Key } from 'ts-key-enum';
|
|
||||||
import { ServerlessFunction } from '~/generated-metadata/graphql';
|
import { ServerlessFunction } from '~/generated-metadata/graphql';
|
||||||
import { useHotkeyScopeOnMount } from '~/hooks/useHotkeyScopeOnMount';
|
import { useHotkeyScopeOnMount } from '~/hooks/useHotkeyScopeOnMount';
|
||||||
|
|
||||||
@ -25,19 +22,11 @@ const StyledTableBody = styled(TableBody)`
|
|||||||
|
|
||||||
export const SettingsServerlessFunctionsTable = () => {
|
export const SettingsServerlessFunctionsTable = () => {
|
||||||
const { serverlessFunctions } = useGetManyServerlessFunctions();
|
const { serverlessFunctions } = useGetManyServerlessFunctions();
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
useHotkeyScopeOnMount(
|
useHotkeyScopeOnMount(
|
||||||
SettingsServerlessFunctionHotkeyScope.ServerlessFunction,
|
SettingsServerlessFunctionHotkeyScope.ServerlessFunction,
|
||||||
);
|
);
|
||||||
|
|
||||||
useScopedHotkeys(
|
|
||||||
[Key.Enter],
|
|
||||||
() => {
|
|
||||||
navigate(getSettingsPagePath(SettingsPath.NewServerlessFunction));
|
|
||||||
},
|
|
||||||
SettingsServerlessFunctionHotkeyScope.ServerlessFunction,
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{serverlessFunctions.length ? (
|
{serverlessFunctions.length ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user