|
|
|
@@ -1,71 +1,71 @@
|
|
|
|
|
import { useEffect } from 'react';
|
|
|
|
|
|
|
|
|
|
import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
|
|
|
|
|
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
|
|
|
|
import { PageHotkeysScope } from '@/hotkeys/types/internal/PageHotkeysScope';
|
|
|
|
|
import { useSetHotkeyScope } from '@/lib/hotkeys/hooks/useSetHotkeyScope';
|
|
|
|
|
import { TableHotkeyScope } from '@/ui/tables/types/TableHotkeyScope';
|
|
|
|
|
|
|
|
|
|
import { useIsMatchingLocation } from './hooks/useIsMatchingLocation';
|
|
|
|
|
import { AppBasePath } from './types/AppBasePath';
|
|
|
|
|
import { AppPath } from './types/AppPath';
|
|
|
|
|
import { AuthPath } from './types/AuthPath';
|
|
|
|
|
import { PageHotkeyScope } from './types/PageHotkeyScope';
|
|
|
|
|
import { SettingsPath } from './types/SettingsPath';
|
|
|
|
|
|
|
|
|
|
export function HotkeysScopeBrowserRouterSync() {
|
|
|
|
|
export function HotkeyScopeBrowserRouterSync() {
|
|
|
|
|
const isMatchingLocation = useIsMatchingLocation();
|
|
|
|
|
|
|
|
|
|
const setHotkeysScope = useSetHotkeysScope();
|
|
|
|
|
const setHotkeyScope = useSetHotkeyScope();
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
switch (true) {
|
|
|
|
|
case isMatchingLocation(AppBasePath.Root, AppPath.CompaniesPage): {
|
|
|
|
|
setHotkeysScope(InternalHotkeysScope.Table, { goto: true });
|
|
|
|
|
setHotkeyScope(TableHotkeyScope.Table, { goto: true });
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Root, AppPath.PeoplePage): {
|
|
|
|
|
setHotkeysScope(InternalHotkeysScope.Table, { goto: true });
|
|
|
|
|
setHotkeyScope(TableHotkeyScope.Table, { goto: true });
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Root, AppPath.CompanyShowPage): {
|
|
|
|
|
setHotkeysScope(PageHotkeysScope.CompanyShowPage, { goto: true });
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.CompanyShowPage, { goto: true });
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Root, AppPath.PersonShowPage): {
|
|
|
|
|
setHotkeysScope(PageHotkeysScope.PersonShowPage, { goto: true });
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.PersonShowPage, { goto: true });
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Root, AppPath.OpportunitiesPage): {
|
|
|
|
|
setHotkeysScope(PageHotkeysScope.OpportunitiesPage, { goto: true });
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.OpportunitiesPage, { goto: true });
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Auth, AuthPath.Index): {
|
|
|
|
|
setHotkeysScope(InternalHotkeysScope.AuthIndex);
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.AuthIndex);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Auth, AuthPath.CreateProfile): {
|
|
|
|
|
setHotkeysScope(InternalHotkeysScope.CreateProfile);
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.CreateProfile);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Auth, AuthPath.CreateWorkspace): {
|
|
|
|
|
setHotkeysScope(InternalHotkeysScope.CreateWokspace);
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.CreateWokspace);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Auth, AuthPath.PasswordLogin): {
|
|
|
|
|
setHotkeysScope(InternalHotkeysScope.PasswordLogin);
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.PasswordLogin);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(AppBasePath.Settings, SettingsPath.ProfilePage): {
|
|
|
|
|
setHotkeysScope(PageHotkeysScope.ProfilePage, { goto: true });
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.ProfilePage, { goto: true });
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case isMatchingLocation(
|
|
|
|
|
AppBasePath.Settings,
|
|
|
|
|
SettingsPath.WorkspaceMembersPage,
|
|
|
|
|
): {
|
|
|
|
|
setHotkeysScope(PageHotkeysScope.WorkspaceMemberPage, { goto: true });
|
|
|
|
|
setHotkeyScope(PageHotkeyScope.WorkspaceMemberPage, { goto: true });
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, [isMatchingLocation, setHotkeysScope]);
|
|
|
|
|
}, [isMatchingLocation, setHotkeyScope]);
|
|
|
|
|
|
|
|
|
|
return <></>;
|
|
|
|
|
}
|