chore: scaffold turbo monorepo with hono api and react admin web

This commit is contained in:
Jose Selesan
2026-10-15 15:24:34 -03:00
commit 2b1d2152c4
89 changed files with 4996 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
import { createFileRoute, Navigate, Outlet } from '@tanstack/react-router'
import { AppHeader } from '@/components/layout/app-header'
import { AppSidebar } from '@/components/layout/app-sidebar'
import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar'
import { Skeleton } from '@/components/ui/skeleton'
import { useSession } from '@/lib/auth-client'
export const Route = createFileRoute('/_authenticated')({
component: AuthenticatedLayout,
})
/**
* Layout for every authenticated page. The session lives in BetterAuth (Hono
* API); while it resolves we render a loader, and without a session we bounce
* the user to `/sign-in`.
*/
function AuthenticatedLayout() {
const { data: session, isPending } = useSession()
if (isPending) {
return <SessionLoading />
}
if (!session) {
return <Navigate to="/sign-in" replace />
}
return (
<SidebarProvider>
<AppSidebar />
<SidebarInset>
<AppHeader />
<div className="flex flex-1 flex-col gap-4 p-4 md:gap-6 md:p-6">
<Outlet />
</div>
</SidebarInset>
</SidebarProvider>
)
}
function SessionLoading() {
return (
<div className="space-y-4 p-6">
<Skeleton className="h-8 w-48" />
<Skeleton className="h-64 w-full" />
</div>
)
}