2023-06-30 09:26:06 +03:00
|
|
|
import { Navigate, Route, Routes, useLocation } from 'react-router-dom';
|
|
|
|
import { AnimatePresence, LayoutGroup } from 'framer-motion';
|
2023-06-04 12:23:09 +03:00
|
|
|
|
2023-07-07 03:05:15 +03:00
|
|
|
import { RequireOnboarded } from '@/auth/components/RequireOnboarded';
|
|
|
|
import { RequireOnboarding } from '@/auth/components/RequireOnboarding';
|
2023-06-30 09:26:06 +03:00
|
|
|
import { AuthModal } from '@/auth/components/ui/Modal';
|
|
|
|
import { AuthLayout } from '@/ui/layout/AuthLayout';
|
2023-06-17 22:24:15 +03:00
|
|
|
import { DefaultLayout } from '@/ui/layout/DefaultLayout';
|
2023-06-30 09:26:06 +03:00
|
|
|
import { CreateProfile } from '~/pages/auth/CreateProfile';
|
|
|
|
import { CreateWorkspace } from '~/pages/auth/CreateWorkspace';
|
2023-06-21 05:17:31 +03:00
|
|
|
import { Index } from '~/pages/auth/Index';
|
|
|
|
import { PasswordLogin } from '~/pages/auth/PasswordLogin';
|
|
|
|
import { Verify } from '~/pages/auth/Verify';
|
|
|
|
import { Companies } from '~/pages/companies/Companies';
|
|
|
|
import { Opportunities } from '~/pages/opportunities/Opportunities';
|
|
|
|
import { People } from '~/pages/people/People';
|
|
|
|
import { SettingsProfile } from '~/pages/settings/SettingsProfile';
|
2023-07-08 04:56:22 +03:00
|
|
|
import { SettingsWorkspaceMembers } from '~/pages/settings/SettingsWorkspaceMembers';
|
2022-12-01 17:58:08 +03:00
|
|
|
|
2023-07-08 04:53:05 +03:00
|
|
|
import { AppInternalHooks } from './AppInternalHooks';
|
|
|
|
|
2023-06-30 09:26:06 +03:00
|
|
|
/**
|
|
|
|
* AuthRoutes is used to allow transitions between auth pages with framer-motion.
|
|
|
|
*/
|
|
|
|
function AuthRoutes() {
|
|
|
|
const location = useLocation();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<LayoutGroup>
|
|
|
|
<AuthModal>
|
|
|
|
<AnimatePresence mode="wait">
|
|
|
|
<Routes location={location} key={location.pathname}>
|
|
|
|
<Route path="" element={<Index />} />
|
|
|
|
<Route path="callback" element={<Verify />} />
|
|
|
|
<Route path="password-login" element={<PasswordLogin />} />
|
|
|
|
<Route path="create/workspace" element={<CreateWorkspace />} />
|
|
|
|
<Route path="create/profile" element={<CreateProfile />} />
|
|
|
|
</Routes>
|
|
|
|
</AnimatePresence>
|
|
|
|
</AuthModal>
|
|
|
|
</LayoutGroup>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-06-08 11:36:37 +03:00
|
|
|
export function App() {
|
|
|
|
return (
|
2023-07-08 04:53:05 +03:00
|
|
|
<>
|
|
|
|
<AppInternalHooks />
|
|
|
|
<DefaultLayout>
|
|
|
|
<Routes>
|
|
|
|
<Route
|
|
|
|
path="auth/*"
|
|
|
|
element={
|
|
|
|
<RequireOnboarding>
|
|
|
|
<AuthLayout>
|
|
|
|
<AuthRoutes />
|
|
|
|
</AuthLayout>
|
|
|
|
</RequireOnboarding>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path="*"
|
|
|
|
element={
|
|
|
|
<RequireOnboarded>
|
|
|
|
<Routes>
|
|
|
|
<Route path="" element={<Navigate to="/people" replace />} />
|
|
|
|
<Route path="people" element={<People />} />
|
|
|
|
<Route path="companies" element={<Companies />} />
|
|
|
|
<Route path="opportunities" element={<Opportunities />} />
|
|
|
|
<Route
|
|
|
|
path="settings/*"
|
|
|
|
element={
|
|
|
|
<Routes>
|
|
|
|
<Route path="profile" element={<SettingsProfile />} />
|
2023-07-08 04:56:22 +03:00
|
|
|
<Route
|
|
|
|
path="workspace-members"
|
|
|
|
element={<SettingsWorkspaceMembers />}
|
|
|
|
/>
|
2023-07-08 04:53:05 +03:00
|
|
|
</Routes>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Routes>
|
|
|
|
</RequireOnboarded>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Routes>
|
|
|
|
</DefaultLayout>
|
|
|
|
</>
|
2022-12-01 17:58:08 +03:00
|
|
|
);
|
|
|
|
}
|