Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,26 @@ export const updateWizard = async ({
where: { organizationId: orgId },
});

if (!onboarding) {
await db.onboarding.create({
data: {
organizationId: orgId,
[dbColumn]: {
version: parsed.version || companyDetailsLatestVersion,
isCompleted: parsed.isCompleted,
data: parsed.data,
},
await db.onboarding.upsert({
where: {
organizationId: orgId,
},
create: {
organizationId: orgId,
[dbColumn]: {
version: parsed.version || companyDetailsLatestVersion,
isCompleted: parsed.isCompleted,
data: parsed.data,
},
});
} else {
await db.onboarding.update({
where: {
organizationId: orgId,
},
update: {
[dbColumn]: {
version: parsed.version || companyDetailsLatestVersion,
isCompleted: parsed.isCompleted,
data: parsed.data,
},
data: {
[dbColumn]: {
version: parsed.version || companyDetailsLatestVersion,
isCompleted: parsed.isCompleted,
data: parsed.data,
},
},
});
}
},
});

revalidatePath(`/${orgId}/implementation/wizard/${wizardId}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,7 @@ import {
SelectValue,
} from "@comp/ui/select";
import { useParams, useRouter } from "next/navigation";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@comp/ui/breadcrumb";
import PageWithBreadcrumb from "@/components/pages/PageWithBreadcrumb";
import { Card, CardContent, CardHeader, CardTitle } from "@comp/ui/card";

const steps = [
"Company identity",
Expand Down Expand Up @@ -220,14 +213,14 @@ export const CompanyDetailsWizardForm = ({
return (
<div className="flex flex-col gap-2">
<Label htmlFor="companyWebsite">
Public website URL
Website
</Label>
<Input
id="companyWebsite"
type="url"
value={displayValue}
onChange={handleChange}
placeholder="acme.com"
prefix="https://"
/>
{errors.companyWebsite && (
<span className="text-destructive text-sm">
Expand Down Expand Up @@ -274,9 +267,9 @@ export const CompanyDetailsWizardForm = ({
);
return found
? {
value: found.value,
label: found.label,
}
value: found.value,
label: found.label,
}
: { value: v, label: v };
})}
placeholder="Select or add one..."
Expand Down Expand Up @@ -592,16 +585,24 @@ export const CompanyDetailsWizardForm = ({
}
}}
>
<WizardStepper steps={steps} currentStep={step} />
<WizardQuestion
step={step}
totalSteps={steps.length}
question={questionNodes[step]}
onNext={handleNext}
onBack={handleBack}
nextDisabled={false}
showBack={step > 0}
/>
<Card>
<CardHeader>
<CardTitle>
<WizardStepper steps={steps} currentStep={step} />
</CardTitle>
</CardHeader>
<CardContent>
<WizardQuestion
step={step}
totalSteps={steps.length}
question={questionNodes[step]}
onNext={handleNext}
onBack={handleBack}
nextDisabled={false}
showBack={step > 0}
/>
</CardContent>
</Card>
</form>
</FormProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export function WizardQuestion({
</Button>
)}
</div>
<div className="flex-1 flex justify-center">
<span className="text-muted-foreground text-sm select-none">
<div className="flex items-center justify-center">
<span className="text-muted-foreground text-xs select-none">
Step {step + 1} / {totalSteps}
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ interface WizardStepperProps {

export function WizardStepper({ steps, currentStep }: WizardStepperProps) {
return (
<div className="mb-8">
<div className="text-3xl font-semibold">{steps[currentStep]}</div>
</div>
<div>
<div>{steps[currentStep]}</div>
</div >
);
}
Loading