feat: add frontend auth shell
This commit is contained in:
@@ -1,7 +1,37 @@
|
||||
import { AppShell } from './layout/AppShell'
|
||||
import { Router } from './router'
|
||||
import { AuthProvider, useAuth } from '@/features/auth/AuthProvider'
|
||||
import { LoginPage } from '@/features/auth/LoginPage'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<AuthProvider>
|
||||
<AppContent />
|
||||
</AuthProvider>
|
||||
)
|
||||
}
|
||||
|
||||
function AppContent() {
|
||||
const { authenticated, loading } = useAuth()
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<main className="flex min-h-screen items-center justify-center bg-background px-5">
|
||||
<div className="grid w-full max-w-[420px] gap-3">
|
||||
<Skeleton className="h-9 w-44" />
|
||||
<Skeleton className="h-4 w-full" />
|
||||
<Skeleton className="h-4 w-3/4" />
|
||||
<Skeleton className="mt-4 h-48 w-full" />
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
if (!authenticated) {
|
||||
return <LoginPage />
|
||||
}
|
||||
|
||||
return (
|
||||
<AppShell>
|
||||
<Router />
|
||||
|
||||
Reference in New Issue
Block a user