Uniformize folder structure (#693)
* Uniformize folder structure * Fix icons * Fix icons * Fix tests * Fix tests
This commit is contained in:
15
front/src/sync-hooks/AppInternalHooks.tsx
Normal file
15
front/src/sync-hooks/AppInternalHooks.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import { AnalyticsHook } from './AnalyticsHook';
|
||||
import { GotoHotkeysHooks } from './GotoHotkeysHooks';
|
||||
import { HotkeyScopeAutoSyncHook } from './HotkeyScopeAutoSyncHook';
|
||||
import { HotkeyScopeBrowserRouterSync } from './HotkeyScopeBrowserRouterSync';
|
||||
|
||||
export function AppInternalHooks() {
|
||||
return (
|
||||
<>
|
||||
<AnalyticsHook />
|
||||
<GotoHotkeysHooks />
|
||||
<HotkeyScopeAutoSyncHook />
|
||||
<HotkeyScopeBrowserRouterSync />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import { useGoToHotkeys } from '@/lib/hotkeys/hooks/useGoToHotkeys';
|
||||
import { useGoToHotkeys } from '@/ui/hotkey/hooks/useGoToHotkeys';
|
||||
|
||||
export function GotoHotkeysHooks() {
|
||||
useGoToHotkeys('p', '/people');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useHotkeyScopeAutoSync } from '@/lib/hotkeys/hooks/internal/useHotkeyScopeAutoSync';
|
||||
import { useHotkeyScopeAutoSync } from '@/ui/hotkey/hooks/internal/useHotkeyScopeAutoSync';
|
||||
|
||||
export function HotkeyScopeAutoSyncHook() {
|
||||
useHotkeyScopeAutoSync();
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
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';
|
||||
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';
|
||||
import { useSetHotkeyScope } from '@/ui/hotkey/hooks/useSetHotkeyScope';
|
||||
import { TableHotkeyScope } from '@/ui/table/types/TableHotkeyScope';
|
||||
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
||||
|
||||
export function HotkeyScopeBrowserRouterSync() {
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
import { matchPath, useLocation } from 'react-router-dom';
|
||||
import { parse } from 'url';
|
||||
|
||||
import { AppBasePath } from '../types/AppBasePath';
|
||||
|
||||
export function useIsMatchingLocation() {
|
||||
const location = useLocation();
|
||||
|
||||
return function isMatchingLocation(basePath: AppBasePath, path: string) {
|
||||
const constructedPath = basePath
|
||||
? parse(`${basePath}/${path}`).pathname ?? ''
|
||||
: path;
|
||||
|
||||
return !!matchPath(constructedPath, location.pathname);
|
||||
};
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
export enum AppBasePath {
|
||||
Auth = '/auth',
|
||||
Settings = '/settings',
|
||||
Root = '/',
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
export enum AppPath {
|
||||
AuthCatchAll = `/auth/*`,
|
||||
PeoplePage = '/people',
|
||||
CompaniesPage = '/companies',
|
||||
CompanyShowPage = '/companies/:companyId',
|
||||
PersonShowPage = '/person/:personId',
|
||||
OpportunitiesPage = '/opportunities',
|
||||
SettingsCatchAll = `/settings/*`,
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
export enum AuthPath {
|
||||
Index = '',
|
||||
Callback = 'callback',
|
||||
PasswordLogin = 'password-login',
|
||||
CreateWorkspace = 'create/workspace',
|
||||
CreateProfile = 'create/profile',
|
||||
InviteLink = 'invite/:workspaceInviteHash',
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
export enum PageHotkeyScope {
|
||||
Settings = 'settings',
|
||||
CreateWokspace = 'create-workspace',
|
||||
PasswordLogin = 'password-login',
|
||||
AuthIndex = 'auth-index',
|
||||
CreateProfile = 'create-profile',
|
||||
ShowPage = 'show-page',
|
||||
PersonShowPage = 'person-show-page',
|
||||
CompanyShowPage = 'company-show-page',
|
||||
CompaniesPage = 'companies-page',
|
||||
PeoplePage = 'people-page',
|
||||
OpportunitiesPage = 'opportunities-page',
|
||||
ProfilePage = 'profile-page',
|
||||
WorkspaceMemberPage = 'workspace-member-page',
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
export enum SettingsPath {
|
||||
ProfilePage = 'profile',
|
||||
WorkspaceMembersPage = 'workspace-members',
|
||||
Workspace = 'workspace',
|
||||
}
|
||||
Reference in New Issue
Block a user