diff --git a/server/src/index.ts b/server/src/index.ts index 7e9bca2a..2eef0c31 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -210,28 +210,6 @@ async function ensureLocalTrustedBoardPrincipal(db: any): Promise { } } -async function ensureInitialCompanySeed(db: any): Promise<{ id: string; name: string; issuePrefix: string } | null> { - const existingCompany = await db - .select({ id: companies.id }) - .from(companies) - .limit(1) - .then((rows: Array<{ id: string }>) => rows[0] ?? null); - if (existingCompany) return null; - - return db - .insert(companies) - .values({ - name: "Paperclip", - description: "Default company created on first startup", - }) - .returning({ - id: companies.id, - name: companies.name, - issuePrefix: companies.issuePrefix, - }) - .then((rows: Array<{ id: string; name: string; issuePrefix: string }>) => rows[0] ?? null); -} - let db; let embeddedPostgres: EmbeddedPostgresInstance | null = null; let embeddedPostgresStartedByThisProcess = false; @@ -383,11 +361,6 @@ if (config.databaseUrl) { startupDbInfo = { mode: "embedded-postgres", dataDir, port }; } -const seededCompany = await ensureInitialCompanySeed(db as any); -if (seededCompany) { - logger.info(`Seeded initial company: ${seededCompany.name} (${seededCompany.issuePrefix})`); -} - if (config.deploymentMode === "local_trusted" && !isLoopbackHost(config.host)) { throw new Error( `local_trusted mode requires loopback host binding (received: ${config.host}). ` + diff --git a/ui/src/App.tsx b/ui/src/App.tsx index a9967433..340ebdc0 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,6 +1,9 @@ +import { useEffect, useRef } from "react"; import { Navigate, Outlet, Route, Routes, useLocation } from "@/lib/router"; import { useQuery } from "@tanstack/react-query"; +import { Button } from "@/components/ui/button"; import { Layout } from "./components/Layout"; +import { OnboardingWizard } from "./components/OnboardingWizard"; import { authApi } from "./api/auth"; import { healthApi } from "./api/health"; import { Dashboard } from "./pages/Dashboard"; @@ -26,6 +29,7 @@ import { BoardClaimPage } from "./pages/BoardClaim"; import { InviteLandingPage } from "./pages/InviteLanding"; import { queryKeys } from "./lib/queryKeys"; import { useCompany } from "./context/CompanyContext"; +import { useDialog } from "./context/DialogContext"; function BootstrapPendingPage() { return ( @@ -137,11 +141,7 @@ function CompanyRootRedirect() { const targetCompany = selectedCompany ?? companies[0] ?? null; if (!targetCompany) { - return ( -
- No accessible companies found. -
- ); + return ; } return ; @@ -157,11 +157,7 @@ function UnprefixedBoardRedirect() { const targetCompany = selectedCompany ?? companies[0] ?? null; if (!targetCompany) { - return ( -
- No accessible companies found. -
- ); + return ; } return ( @@ -172,6 +168,32 @@ function UnprefixedBoardRedirect() { ); } +function NoCompaniesStartPage() { + const { openOnboarding } = useDialog(); + const opened = useRef(false); + + useEffect(() => { + if (opened.current) return; + opened.current = true; + openOnboarding(); + }, [openOnboarding]); + + return ( +
+
+

Create your first company

+

+ Get started by creating a company. +

+
+ +
+
+ +
+ ); +} + export function App() { return ( @@ -181,6 +203,7 @@ export function App() { }> } /> + } /> } /> } /> } />