Initial React project
This commit is contained in:
30
src/App.tsx
30
src/App.tsx
@@ -10,6 +10,11 @@ import { HomePage } from './presentation/home/pages/HomePage';
|
||||
import { JobDetailPage } from './presentation/jobs/pages/JobDetailPage';
|
||||
import { JobsPage } from './presentation/jobs/pages/JobsPage';
|
||||
import { MessagesPage } from './presentation/messages/pages/MessagesPage';
|
||||
import { PricingPage } from './presentation/pricing/pages/PricingPage';
|
||||
import { JobordbogenPage } from './presentation/jobordbogen/pages/JobordbogenPage';
|
||||
import { JobordbogenEntryPage } from './presentation/jobordbogen/pages/JobordbogenEntryPage';
|
||||
import { StoriesPage } from './presentation/stories/pages/StoriesPage';
|
||||
import { NewsletterPage } from './presentation/newsletter/pages/NewsletterPage';
|
||||
import {
|
||||
SimulatorPage,
|
||||
type SimulatorEvaluationSelection,
|
||||
@@ -27,6 +32,11 @@ interface JobDetailSelection {
|
||||
|
||||
function App() {
|
||||
const isHomeRoute = useMemo(() => window.location.pathname === '/home', []);
|
||||
const isPricingRoute = useMemo(() => window.location.pathname === '/pricing' || window.location.pathname === '/priser', []);
|
||||
const isStoriesRoute = useMemo(() => window.location.pathname === '/stories', []);
|
||||
const isNewsletterRoute = useMemo(() => window.location.pathname === '/newsletter', []);
|
||||
const isJobordbogenEntryRoute = useMemo(() => window.location.pathname.startsWith('/jobordbogen/') && window.location.pathname !== '/jobordbogen/', []);
|
||||
const isJobordbogenRoute = useMemo(() => window.location.pathname === '/jobordbogen' || window.location.pathname === '/academy', []);
|
||||
const initialAuthenticated = useMemo(() => Boolean(window.localStorage.getItem('token')), []);
|
||||
const initialTheme = useMemo<'light' | 'dark'>(() => {
|
||||
const stored = window.localStorage.getItem('theme');
|
||||
@@ -91,6 +101,26 @@ function App() {
|
||||
return <HomePage />;
|
||||
}
|
||||
|
||||
if (isPricingRoute) {
|
||||
return <PricingPage />;
|
||||
}
|
||||
|
||||
if (isStoriesRoute) {
|
||||
return <StoriesPage />;
|
||||
}
|
||||
|
||||
if (isNewsletterRoute) {
|
||||
return <NewsletterPage />;
|
||||
}
|
||||
|
||||
if (isJobordbogenEntryRoute) {
|
||||
return <JobordbogenEntryPage />;
|
||||
}
|
||||
|
||||
if (isJobordbogenRoute) {
|
||||
return <JobordbogenPage />;
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return <AuthPage onAuthenticated={() => setIsAuthenticated(true)} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user