feat(dashboard): add onboarding gate forcing company setup before app use

After login/activation, show a full-screen loader while company settings
resolve, then force the user onto /settings/company and block navigation to
any other route until the company info is filled in. The gate releases once the
company record has a name; fails open on API error so a transient failure can
never lock the user out.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-04 14:58:37 +04:00
co-authored by Claude Opus 4.8
parent fdce301495
commit 97ad275588
3 changed files with 79 additions and 2 deletions
@@ -6,6 +6,7 @@ import { DashboardLayout } from "@/base/components/layout/dashboard"
import { useAuth } from "@/shared/hooks/use-auth"
import { navGroups } from "@/config/navGroups"
import { getAuthCookies } from "@/modules/auth/auth.actions"
import { OnboardingGate } from "@/shared/components/onboarding-gate"
import { redirect } from "next/navigation"
@@ -38,7 +39,7 @@ export default async function AuthenticatedLayout({
return (
<DashboardLayout navGroups={navGroups} logo={<Logo />} user={userInfo}>
{children}
<OnboardingGate>{children}</OnboardingGate>
</DashboardLayout>
)
}