Initial commit
This commit is contained in:
5
apps/frontend/src/routes/$complexSlug/booking.tsx
Normal file
5
apps/frontend/src/routes/$complexSlug/booking.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Outlet, createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
export const Route = createFileRoute('/$complexSlug/booking')({
|
||||
component: Outlet,
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { PublicBookingConfirmationPage } from '@/features/public-booking/public-booking-confirmation-page'
|
||||
|
||||
export const Route = createFileRoute('/$complexSlug/booking/confirmed/$bookingCode')({
|
||||
component: PublicBookingConfirmationRouteComponent,
|
||||
})
|
||||
|
||||
function PublicBookingConfirmationRouteComponent() {
|
||||
const { complexSlug, bookingCode } = Route.useParams()
|
||||
|
||||
return (
|
||||
<PublicBookingConfirmationPage
|
||||
complexSlug={complexSlug}
|
||||
bookingCode={bookingCode}
|
||||
/>
|
||||
)
|
||||
}
|
||||
12
apps/frontend/src/routes/$complexSlug/booking/index.tsx
Normal file
12
apps/frontend/src/routes/$complexSlug/booking/index.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { PublicBookingPage } from '@/features/public-booking/public-booking-page'
|
||||
|
||||
export const Route = createFileRoute('/$complexSlug/booking/')({
|
||||
component: PublicBookingIndexRouteComponent,
|
||||
})
|
||||
|
||||
function PublicBookingIndexRouteComponent() {
|
||||
const { complexSlug } = Route.useParams()
|
||||
|
||||
return <PublicBookingPage complexSlug={complexSlug} />
|
||||
}
|
||||
16
apps/frontend/src/routes/__root.tsx
Normal file
16
apps/frontend/src/routes/__root.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Outlet, createRootRouteWithContext } from '@tanstack/react-router'
|
||||
import type { AuthContextValue } from '@/lib/auth'
|
||||
import type { ApiClient } from '@/lib/api-client'
|
||||
import { NotFoundPage } from '@/features/not-found/not-found-page'
|
||||
import { ServerErrorPage } from '@/features/server-error/server-error-page'
|
||||
|
||||
type RouterContext = {
|
||||
auth: AuthContextValue
|
||||
api: ApiClient
|
||||
}
|
||||
|
||||
export const Route = createRootRouteWithContext<RouterContext>()({
|
||||
component: Outlet,
|
||||
errorComponent: ServerErrorPage,
|
||||
notFoundComponent: NotFoundPage,
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { ComplexCourtsPage } from '@/features/complex/complex-courts-page'
|
||||
|
||||
export const Route = createFileRoute('/_app/_authenticated/complex/$slug/edit')({
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
function RouteComponent() {
|
||||
const { slug } = Route.useParams()
|
||||
return <ComplexCourtsPage complexSlug={slug} />
|
||||
}
|
||||
6
apps/frontend/src/routes/_app/_authenticated/index.tsx
Normal file
6
apps/frontend/src/routes/_app/_authenticated/index.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { HomePage } from '@/features/home/home-page'
|
||||
|
||||
export const Route = createFileRoute('/_app/_authenticated/')({
|
||||
component: HomePage,
|
||||
})
|
||||
12
apps/frontend/src/routes/_app/_authenticated/route.tsx
Normal file
12
apps/frontend/src/routes/_app/_authenticated/route.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { createFileRoute, redirect } from '@tanstack/react-router'
|
||||
|
||||
export const Route = createFileRoute('/_app/_authenticated')({
|
||||
beforeLoad: ({ context, location }) => {
|
||||
if (!context.auth.isAuthenticated) {
|
||||
throw redirect({
|
||||
to: '/login',
|
||||
search: { redirect: location.href },
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
6
apps/frontend/src/routes/_app/about.tsx
Normal file
6
apps/frontend/src/routes/_app/about.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { AboutPage } from '@/features/about/about-page'
|
||||
|
||||
export const Route = createFileRoute('/_app/about')({
|
||||
component: AboutPage,
|
||||
})
|
||||
6
apps/frontend/src/routes/_app/profile.tsx
Normal file
6
apps/frontend/src/routes/_app/profile.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { ProfilePage } from '@/features/profile/profile-page'
|
||||
|
||||
export const Route = createFileRoute('/_app/profile')({
|
||||
component: ProfilePage,
|
||||
})
|
||||
6
apps/frontend/src/routes/_app/route.tsx
Normal file
6
apps/frontend/src/routes/_app/route.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { RootLayout } from '@/features/layout/root-layout'
|
||||
|
||||
export const Route = createFileRoute('/_app')({
|
||||
component: RootLayout,
|
||||
})
|
||||
22
apps/frontend/src/routes/login.tsx
Normal file
22
apps/frontend/src/routes/login.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { createFileRoute, redirect } from '@tanstack/react-router'
|
||||
import { z } from 'zod'
|
||||
import { LoginPage } from '@/features/login/login-page'
|
||||
|
||||
const loginSearchSchema = z.object({
|
||||
redirect: z.string().optional(),
|
||||
})
|
||||
|
||||
export const Route = createFileRoute('/login')({
|
||||
validateSearch: loginSearchSchema,
|
||||
beforeLoad: ({ context }) => {
|
||||
if (context.auth.isAuthenticated) {
|
||||
throw redirect({ to: '/' })
|
||||
}
|
||||
},
|
||||
component: LoginRouteComponent,
|
||||
})
|
||||
|
||||
function LoginRouteComponent() {
|
||||
const search = Route.useSearch()
|
||||
return <LoginPage redirectTo={search.redirect} />
|
||||
}
|
||||
6
apps/frontend/src/routes/onboard.tsx
Normal file
6
apps/frontend/src/routes/onboard.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { OnboardPage } from '@/features/onboard/onboard-page'
|
||||
|
||||
export const Route = createFileRoute('/onboard')({
|
||||
component: OnboardPage,
|
||||
})
|
||||
Reference in New Issue
Block a user