Uniformize folder structure (#693)

* Uniformize folder structure

* Fix icons

* Fix icons

* Fix tests

* Fix tests
This commit is contained in:
Charles Bochet
2023-07-16 14:29:28 -07:00
committed by GitHub
parent 900ec5572f
commit 6ced8434bd
462 changed files with 931 additions and 960 deletions

View 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 />
</>
);
}

View File

@ -1,4 +1,4 @@
import { useGoToHotkeys } from '@/lib/hotkeys/hooks/useGoToHotkeys';
import { useGoToHotkeys } from '@/ui/hotkey/hooks/useGoToHotkeys';
export function GotoHotkeysHooks() {
useGoToHotkeys('p', '/people');

View File

@ -1,4 +1,4 @@
import { useHotkeyScopeAutoSync } from '@/lib/hotkeys/hooks/internal/useHotkeyScopeAutoSync';
import { useHotkeyScopeAutoSync } from '@/ui/hotkey/hooks/internal/useHotkeyScopeAutoSync';
export function HotkeyScopeAutoSyncHook() {
useHotkeyScopeAutoSync();

View File

@ -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();

View File

@ -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);
};
}

View File

@ -1,5 +0,0 @@
export enum AppBasePath {
Auth = '/auth',
Settings = '/settings',
Root = '/',
}

View File

@ -1,9 +0,0 @@
export enum AppPath {
AuthCatchAll = `/auth/*`,
PeoplePage = '/people',
CompaniesPage = '/companies',
CompanyShowPage = '/companies/:companyId',
PersonShowPage = '/person/:personId',
OpportunitiesPage = '/opportunities',
SettingsCatchAll = `/settings/*`,
}

View File

@ -1,8 +0,0 @@
export enum AuthPath {
Index = '',
Callback = 'callback',
PasswordLogin = 'password-login',
CreateWorkspace = 'create/workspace',
CreateProfile = 'create/profile',
InviteLink = 'invite/:workspaceInviteHash',
}

View File

@ -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',
}

View File

@ -1,5 +0,0 @@
export enum SettingsPath {
ProfilePage = 'profile',
WorkspaceMembersPage = 'workspace-members',
Workspace = 'workspace',
}