Scaffold @forte/admin package with React, Vite, shadcn/ui, TanStack Router

Sets up the admin frontend with login page, auth guard, API client, Zustand
auth store, and all shadcn/ui components. Vite proxies /v1 to backend in dev.
This commit is contained in:
Ryan Moon
2026-03-28 07:35:12 -05:00
parent 01d6ff3fa3
commit e734ef4606
38 changed files with 3708 additions and 25 deletions

View File

@@ -0,0 +1,30 @@
import { createFileRoute, Outlet, redirect } from '@tanstack/react-router'
import { useAuthStore } from '@/stores/auth.store'
export const Route = createFileRoute('/_authenticated')({
beforeLoad: () => {
const { token } = useAuthStore.getState()
if (!token) {
throw redirect({ to: '/login' })
}
},
component: AuthenticatedLayout,
})
function AuthenticatedLayout() {
return (
<div className="min-h-screen bg-background text-foreground">
<div className="flex">
<nav className="w-56 border-r border-border bg-sidebar min-h-screen p-4 space-y-2">
<h2 className="text-lg font-semibold text-sidebar-foreground mb-4">Forte</h2>
<a href="/accounts" className="block px-3 py-2 rounded-md text-sm text-sidebar-foreground hover:bg-sidebar-accent">
Accounts
</a>
</nav>
<main className="flex-1 p-6">
<Outlet />
</main>
</div>
</div>
)
}