this is how the next step should look like.

option 1: Custom interface
This commit is contained in:
Leon Serfaty G
2025-07-17 10:15:39 +00:00
parent 6631391a6f
commit 9b0a02d663
4 changed files with 112 additions and 8 deletions
@@ -4,6 +4,7 @@ import React, { useState, useTransition } from 'react';
import { Step1ProjectType } from './step-1-project-type'; import { Step1ProjectType } from './step-1-project-type';
import { Step2ServiceType } from './step-2-service-type'; import { Step2ServiceType } from './step-2-service-type';
import { Step3ProjectStage } from './step-3-project-stage'; import { Step3ProjectStage } from './step-3-project-stage';
import { Step4DesignProcess } from './step-4-design-process';
import { Card, CardContent } from '@/components/ui/card'; import { Card, CardContent } from '@/components/ui/card';
import { AnimatePresence, motion } from 'framer-motion'; import { AnimatePresence, motion } from 'framer-motion';
@@ -11,6 +12,7 @@ export type FormData = {
projectType: 'website' | 'mobile-app' | 'platform' | null; projectType: 'website' | 'mobile-app' | 'platform' | null;
serviceType: 'entire-project' | 'development' | 'ui-ux-design' | 'identity-branding' | null; serviceType: 'entire-project' | 'development' | 'ui-ux-design' | 'identity-branding' | null;
projectStage: number; projectStage: number;
designProcess: 'custom' | 'mockups' | 'existing' | null;
}; };
export function CostEstimatorForm() { export function CostEstimatorForm() {
@@ -19,6 +21,7 @@ export function CostEstimatorForm() {
projectType: null, projectType: null,
serviceType: null, serviceType: null,
projectStage: 0, projectStage: 0,
designProcess: null,
}); });
const [isPending, startTransition] = useTransition(); const [isPending, startTransition] = useTransition();
@@ -65,6 +68,15 @@ export function CostEstimatorForm() {
formData={formData} formData={formData}
/> />
); );
case 4:
return (
<Step4DesignProcess
onNext={handleNextStep}
onBack={handlePrevStep}
onUpdateData={handleUpdateFormData}
formData={formData}
/>
);
default: default:
return ( return (
<Step1ProjectType <Step1ProjectType
@@ -56,10 +56,11 @@ export function Step2ServiceType({ onNext, onBack, onUpdateData, formData }: Ste
<div className="mt-8 flex w-full items-center justify-between"> <div className="mt-8 flex w-full items-center justify-between">
<Button variant="ghost" onClick={onBack}>Back</Button> <Button variant="ghost" onClick={onBack}>Back</Button>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<div className="w-16 h-2 bg-muted rounded-full" /> <div className="w-12 h-2 bg-muted rounded-full" />
<div className="w-16 h-2 bg-primary rounded-full" /> <div className="w-12 h-2 bg-primary rounded-full" />
<div className="w-16 h-2 bg-muted rounded-full" /> <div className="w-12 h-2 bg-muted rounded-full" />
<div className="w-16 h-2 bg-muted rounded-full" /> <div className="w-12 h-2 bg-muted rounded-full" />
<div className="w-12 h-2 bg-muted rounded-full" />
</div> </div>
<Button onClick={onNext} disabled={!selectedService}> <Button onClick={onNext} disabled={!selectedService}>
Next Next
@@ -75,10 +75,17 @@ export function Step3ProjectStage({ onNext, onBack, onUpdateData, formData }: St
<span className="font-headline text-lg font-bold">{estimatedHours} hours</span> <span className="font-headline text-lg font-bold">{estimatedHours} hours</span>
</div> </div>
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<Button variant="ghost" onClick={onBack}>Go Back</Button> <Button variant="ghost" onClick={onBack}>Back</Button>
<Button onClick={onNext}> <div className="flex items-center gap-2">
Next <div className="w-12 h-2 bg-muted rounded-full" />
</Button> <div className="w-12 h-2 bg-muted rounded-full" />
<div className="w-12 h-2 bg-primary rounded-full" />
<div className="w-12 h-2 bg-muted rounded-full" />
<div className="w-12 h-2 bg-muted rounded-full" />
</div>
<Button onClick={onNext}>
Next
</Button>
</div> </div>
</div> </div>
</div> </div>
@@ -0,0 +1,84 @@
"use client";
import type { FormData } from './cost-estimator-form';
import { Button } from '@/components/ui/button';
import { Gauge } from 'lucide-react';
import React, { useState, useMemo } from 'react';
type Step4Props = {
onNext: () => void;
onBack: () => void;
onUpdateData: (data: Partial<FormData>) => void;
formData: FormData;
};
const designOptions = [
{
id: 'custom',
title: 'Custom interface with Consultative Support',
hours: 60,
},
{
id: 'mockups',
title: 'I have mockups',
hours: 30,
},
{
id: 'existing',
title: 'My existing design will do',
hours: 0,
},
];
export function Step4DesignProcess({ onNext, onBack, onUpdateData, formData }: Step4Props) {
const [selectedOption, setSelectedOption] = useState<string | null>(formData.designProcess);
const handleSelect = (optionId: 'custom' | 'mockups' | 'existing') => {
setSelectedOption(optionId);
onUpdateData({ designProcess: optionId });
};
const estimatedHours = useMemo(() => {
const designHours = designOptions.find(opt => opt.id === selectedOption)?.hours ?? 0;
const stageHours = Math.round((formData.projectStage / 100) * 50);
return stageHours + designHours;
}, [selectedOption, formData.projectStage]);
return (
<div className="flex flex-col items-start">
<h2 className="font-headline text-3xl font-bold tracking-tight">In need of design? What type of design process would you like?</h2>
<div className="mt-8 grid w-full grid-cols-1 gap-4">
{designOptions.map((option) => (
<Button
key={option.id}
variant={selectedOption === option.id ? 'default' : 'outline'}
className="w-full justify-start p-6 text-lg"
onClick={() => handleSelect(option.id as any)}
>
{option.title}
</Button>
))}
</div>
<div className="mt-16 flex w-full items-center justify-between">
<div className="flex items-center gap-2">
<Gauge className="h-6 w-6 text-primary" />
<span className="font-headline text-lg font-bold">{estimatedHours} hours</span>
</div>
<div className="flex items-center gap-4">
<Button variant="ghost" onClick={onBack}>Go Back</Button>
<div className="flex items-center gap-2">
<div className="w-12 h-2 bg-muted rounded-full" />
<div className="w-12 h-2 bg-muted rounded-full" />
<div className="w-12 h-2 bg-muted rounded-full" />
<div className="w-12 h-2 bg-primary rounded-full" />
<div className="w-12 h-2 bg-muted rounded-full" />
</div>
<Button onClick={onNext} disabled={!selectedOption}>
Next
</Button>
</div>
</div>
</div>
);
}