feat: The Other Dude v9.0.1 — full-featured email system
ci: add GitHub Pages deployment workflow for docs site Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
43
frontend/src/routes/_authenticated/index.tsx
Normal file
43
frontend/src/routes/_authenticated/index.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import { useEffect } from 'react'
|
||||
import { createFileRoute, useNavigate } from '@tanstack/react-router'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { FleetDashboard } from '@/components/fleet/FleetDashboard'
|
||||
import { CardGridSkeleton } from '@/components/ui/page-skeleton'
|
||||
import { useAuth, isSuperAdmin } from '@/lib/auth'
|
||||
import { tenantsApi } from '@/lib/api'
|
||||
|
||||
export const Route = createFileRoute('/_authenticated/')({
|
||||
component: FleetDashboardPage,
|
||||
})
|
||||
|
||||
function FleetDashboardPage() {
|
||||
const { user } = useAuth()
|
||||
const navigate = useNavigate()
|
||||
|
||||
// Only check for super_admin -- regular users always have a tenant
|
||||
const shouldCheck = isSuperAdmin(user)
|
||||
|
||||
const { data: tenants, isLoading: tenantsLoading } = useQuery({
|
||||
queryKey: ['tenants'],
|
||||
queryFn: tenantsApi.list,
|
||||
enabled: shouldCheck,
|
||||
})
|
||||
|
||||
// Filter out the System (Internal) tenant — only real customer tenants count
|
||||
const realTenants = tenants?.filter(
|
||||
(t) => t.id !== '00000000-0000-0000-0000-000000000000',
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (shouldCheck && !tenantsLoading && tenants && realTenants && realTenants.length === 0) {
|
||||
void navigate({ to: '/setup' })
|
||||
}
|
||||
}, [shouldCheck, tenantsLoading, tenants, realTenants, navigate])
|
||||
|
||||
// Show skeleton while checking (super_admin only)
|
||||
if (shouldCheck && tenantsLoading) {
|
||||
return <CardGridSkeleton />
|
||||
}
|
||||
|
||||
return <FleetDashboard />
|
||||
}
|
||||
Reference in New Issue
Block a user