Multitenantperorg enabling
All checks were successful
Build and Push / build (push) Successful in 1m21s

This commit is contained in:
2026-04-26 22:09:26 +02:00
parent 7b22bc4087
commit 2c85bf8597
13 changed files with 584 additions and 225 deletions

View File

@@ -1,31 +1,36 @@
"use client";
import { useState, useEffect } from "react";
import { useRouter } from "next/navigation";
import { OnboardingWizard } from "./wizard";
import { ProvisioningStatus } from "./provisioning-status";
interface OnboardingFlowProps {
orgName: string;
initialState: "no_request" | "pending" | "approved" | "provisioning" | "rejected";
}
/**
* Orchestrates the onboarding experience:
* - no_request → show wizard
* - pending/approved/provisioning/rejected → show status
* - After wizard submission → switch to status polling
* Wraps the onboarding wizard. On successful submission, refreshes the
* router so the parent server component re-renders with the new pending
* request visible in the dashboard list.
*
* Slice 3: this component used to manage the no_request → pending →
* provisioning → active state machine, with conditional rendering of
* `<ProvisioningStatus>`. That state is now reflected at the dashboard
* level (which renders one `<ProvisioningStatus>` per pending request),
* so this wrapper does just one thing: show the wizard, then navigate.
*/
export function OnboardingFlow({ orgName, initialState }: OnboardingFlowProps) {
const [showWizard, setShowWizard] = useState(initialState === "no_request");
export function OnboardingFlow({ orgName }: OnboardingFlowProps) {
const router = useRouter();
if (showWizard) {
return (
<OnboardingWizard
orgName={orgName}
onComplete={() => setShowWizard(false)}
/>
);
}
return <ProvisioningStatus />;
return (
<OnboardingWizard
orgName={orgName}
onComplete={() => {
// Navigate back to /dashboard and re-fetch on the server. The
// parent server component will see the new `pending` row and
// render its `<ProvisioningStatus>` card automatically.
router.push("/dashboard");
router.refresh();
}}
/>
);
}