feat: implement tenant OAuth flow and guest achievements
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import React from 'react';
|
||||
import React from 'react';
|
||||
import { createBrowserRouter, Outlet, useParams } from 'react-router-dom';
|
||||
import Header from './components/Header';
|
||||
import BottomNav from './components/BottomNav';
|
||||
import { EventStatsProvider } from './context/EventStatsContext';
|
||||
import { GuestIdentityProvider } from './context/GuestIdentityContext';
|
||||
import LandingPage from './pages/LandingPage';
|
||||
import ProfileSetupPage from './pages/ProfileSetupPage';
|
||||
import HomePage from './pages/HomePage';
|
||||
@@ -19,20 +21,43 @@ import NotFoundPage from './pages/NotFoundPage';
|
||||
|
||||
function HomeLayout() {
|
||||
const { slug } = useParams();
|
||||
return (
|
||||
<div className="pb-16">
|
||||
{slug ? <Header slug={slug} /> : <Header title="Event" />}
|
||||
<div className="px-4 py-3">
|
||||
<Outlet />
|
||||
|
||||
if (!slug) {
|
||||
return (
|
||||
<div className="pb-16">
|
||||
<Header title="Event" />
|
||||
<div className="px-4 py-3">
|
||||
<Outlet />
|
||||
</div>
|
||||
<BottomNav />
|
||||
</div>
|
||||
<BottomNav />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<GuestIdentityProvider slug={slug}>
|
||||
<EventStatsProvider slug={slug}>
|
||||
<div className="pb-16">
|
||||
<Header slug={slug} />
|
||||
<div className="px-4 py-3">
|
||||
<Outlet />
|
||||
</div>
|
||||
<BottomNav />
|
||||
</div>
|
||||
</EventStatsProvider>
|
||||
</GuestIdentityProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export const router = createBrowserRouter([
|
||||
{ path: '/', element: <SimpleLayout title="Fotospiel"><LandingPage /></SimpleLayout> },
|
||||
{ path: '/setup', element: <SimpleLayout title="Profil"><ProfileSetupPage /></SimpleLayout> },
|
||||
{
|
||||
path: '/setup/:slug',
|
||||
element: <SetupLayout />,
|
||||
children: [
|
||||
{ index: true, element: <ProfileSetupPage /> },
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/e/:slug',
|
||||
element: <HomeLayout />,
|
||||
@@ -53,6 +78,21 @@ export const router = createBrowserRouter([
|
||||
{ path: '*', element: <NotFoundPage /> },
|
||||
]);
|
||||
|
||||
function SetupLayout() {
|
||||
const { slug } = useParams<{ slug: string }>();
|
||||
if (!slug) return null;
|
||||
return (
|
||||
<GuestIdentityProvider slug={slug}>
|
||||
<EventStatsProvider slug={slug}>
|
||||
<div className="pb-0">
|
||||
<Header slug={slug} />
|
||||
<Outlet />
|
||||
</div>
|
||||
</EventStatsProvider>
|
||||
</GuestIdentityProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function SimpleLayout({ title, children }: { title: string; children: React.ReactNode }) {
|
||||
return (
|
||||
<div className="pb-16">
|
||||
@@ -64,3 +104,4 @@ function SimpleLayout({ title, children }: { title: string; children: React.Reac
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user