if the user selects UI/UX design if should take them to this step
opti
This commit is contained in:
@@ -13,6 +13,7 @@ import { Step8Branding } from './step-8-branding';
|
|||||||
import { Step9AdditionalFeatures } from './step-9-additional-features';
|
import { Step9AdditionalFeatures } from './step-9-additional-features';
|
||||||
import { Step10ShoppingCart } from './step-10-shopping-cart';
|
import { Step10ShoppingCart } from './step-10-shopping-cart';
|
||||||
import { Step11Results, calculateTotalHours } from './step-11-results';
|
import { Step11Results, calculateTotalHours } from './step-11-results';
|
||||||
|
import { Step12UiUxDesign } from './step-12-uiux-design';
|
||||||
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';
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ export type FormData = {
|
|||||||
branding: BrandingSelection;
|
branding: BrandingSelection;
|
||||||
additionalFeatures: string[];
|
additionalFeatures: string[];
|
||||||
shoppingCart: ShoppingCartSelection;
|
shoppingCart: ShoppingCartSelection;
|
||||||
|
uiUxDesignProcess: 'custom' | 'concepts' | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function CostEstimatorForm() {
|
export function CostEstimatorForm() {
|
||||||
@@ -64,6 +66,7 @@ export function CostEstimatorForm() {
|
|||||||
hasCart: null,
|
hasCart: null,
|
||||||
multiplePurchases: null,
|
multiplePurchases: null,
|
||||||
},
|
},
|
||||||
|
uiUxDesignProcess: null,
|
||||||
});
|
});
|
||||||
const [isPending, startTransition] = useTransition();
|
const [isPending, startTransition] = useTransition();
|
||||||
|
|
||||||
@@ -71,8 +74,12 @@ export function CostEstimatorForm() {
|
|||||||
startTransition(() => {
|
startTransition(() => {
|
||||||
if (currentStep === 2 && formData.serviceType === 'development') {
|
if (currentStep === 2 && formData.serviceType === 'development') {
|
||||||
setCurrentStep(5);
|
setCurrentStep(5);
|
||||||
|
} else if (currentStep === 2 && formData.serviceType === 'ui-ux-design') {
|
||||||
|
setCurrentStep(12);
|
||||||
} else if (currentStep === 5 && formData.serviceType === 'development') {
|
} else if (currentStep === 5 && formData.serviceType === 'development') {
|
||||||
setCurrentStep(9);
|
setCurrentStep(9);
|
||||||
|
} else if (currentStep === 12) {
|
||||||
|
setCurrentStep(11);
|
||||||
} else {
|
} else {
|
||||||
setCurrentStep((prev) => prev + 1);
|
setCurrentStep((prev) => prev + 1);
|
||||||
}
|
}
|
||||||
@@ -85,7 +92,10 @@ export function CostEstimatorForm() {
|
|||||||
setCurrentStep(2);
|
setCurrentStep(2);
|
||||||
} else if (currentStep === 9 && formData.serviceType === 'development') {
|
} else if (currentStep === 9 && formData.serviceType === 'development') {
|
||||||
setCurrentStep(5);
|
setCurrentStep(5);
|
||||||
} else {
|
} else if (currentStep === 12) {
|
||||||
|
setCurrentStep(2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
setCurrentStep((prev) => prev - 1);
|
setCurrentStep((prev) => prev - 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -115,6 +125,7 @@ export function CostEstimatorForm() {
|
|||||||
hasCart: null,
|
hasCart: null,
|
||||||
multiplePurchases: null
|
multiplePurchases: null
|
||||||
},
|
},
|
||||||
|
uiUxDesignProcess: null,
|
||||||
});
|
});
|
||||||
setCurrentStep(1);
|
setCurrentStep(1);
|
||||||
}
|
}
|
||||||
@@ -219,6 +230,15 @@ export function CostEstimatorForm() {
|
|||||||
readyMadeHours={readyMadeHours}
|
readyMadeHours={readyMadeHours}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
case 12:
|
||||||
|
return (
|
||||||
|
<Step12UiUxDesign
|
||||||
|
onNext={handleNextStep}
|
||||||
|
onBack={handlePrevStep}
|
||||||
|
onUpdateData={handleUpdateFormData}
|
||||||
|
formData={formData}
|
||||||
|
/>
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<Step1ProjectType
|
<Step1ProjectType
|
||||||
|
|||||||
@@ -35,9 +35,19 @@ const shoppingCartHoursMap = {
|
|||||||
simple: 60,
|
simple: 60,
|
||||||
multiple: 15
|
multiple: 15
|
||||||
};
|
};
|
||||||
|
const uiUxDesignHoursMap = {
|
||||||
|
custom: 80,
|
||||||
|
concepts: 40,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export const calculateTotalHours = (formData: FormData) => {
|
export const calculateTotalHours = (formData: FormData) => {
|
||||||
|
if (formData.serviceType === 'ui-ux-design') {
|
||||||
|
const hours = formData.uiUxDesignProcess ? uiUxDesignHoursMap[formData.uiUxDesignProcess] : 0;
|
||||||
|
return { customHours: hours, readyMadeHours: Math.round(hours * 0.4) };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const pageVal = formData.pageCount === 10 ? 50 : (formData.pageCount + 1) * 5 - 1;
|
const pageVal = formData.pageCount === 10 ? 50 : (formData.pageCount + 1) * 5 - 1;
|
||||||
const pageHours = pageVal * 6;
|
const pageHours = pageVal * 6;
|
||||||
const stageHours = Math.round((formData.projectStage / 100) * 50);
|
const stageHours = Math.round((formData.projectStage / 100) * 50);
|
||||||
@@ -68,7 +78,11 @@ export const calculateTotalHours = (formData: FormData) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const customHours = pageHours + stageHours + designHours + animationHours + illustrationTotalHours + brandingH + additionalFeaturesHours + cartHours;
|
let customHours = pageHours + stageHours + additionalFeaturesHours + cartHours;
|
||||||
|
if (formData.serviceType !== 'development') {
|
||||||
|
customHours += designHours + animationHours + illustrationTotalHours + brandingH;
|
||||||
|
}
|
||||||
|
|
||||||
const readyMadeHours = Math.round(customHours * 0.4);
|
const readyMadeHours = Math.round(customHours * 0.4);
|
||||||
|
|
||||||
return { customHours, readyMadeHours };
|
return { customHours, readyMadeHours };
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
|
||||||
|
"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 Step12Props = {
|
||||||
|
onNext: () => void;
|
||||||
|
onBack: () => void;
|
||||||
|
onUpdateData: (data: Partial<FormData>) => void;
|
||||||
|
formData: FormData;
|
||||||
|
};
|
||||||
|
|
||||||
|
const designOptions = [
|
||||||
|
{
|
||||||
|
id: 'custom',
|
||||||
|
title: 'Custom interface with Consultative Support',
|
||||||
|
hours: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'concepts',
|
||||||
|
title: 'I have concepts',
|
||||||
|
hours: 40,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export function Step12UiUxDesign({ onNext, onBack, onUpdateData, formData }: Step12Props) {
|
||||||
|
const [selectedOption, setSelectedOption] = useState<'custom' | 'concepts' | null>(formData.uiUxDesignProcess);
|
||||||
|
|
||||||
|
const handleSelect = (optionId: 'custom' | 'concepts') => {
|
||||||
|
setSelectedOption(optionId);
|
||||||
|
onUpdateData({ uiUxDesignProcess: optionId });
|
||||||
|
};
|
||||||
|
|
||||||
|
const estimatedHours = useMemo(() => {
|
||||||
|
return designOptions.find(opt => opt.id === selectedOption)?.hours ?? 0;
|
||||||
|
}, [selectedOption]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-start">
|
||||||
|
<h2 className="font-headline text-3xl font-bold tracking-tight text-center w-full">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}>Back</Button>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="w-10 h-2 bg-primary rounded-full" />
|
||||||
|
<div className="w-10 h-2 bg-primary rounded-full" />
|
||||||
|
<div className="w-10 h-2 bg-muted rounded-full" />
|
||||||
|
<div className="w-10 h-2 bg-muted rounded-full" />
|
||||||
|
<div className="w-10 h-2 bg-muted rounded-full" />
|
||||||
|
<div className="w-10 h-2 bg-muted rounded-full" />
|
||||||
|
<div className="w-10 h-2 bg-muted rounded-full" />
|
||||||
|
<div className="w-10 h-2 bg-muted rounded-full" />
|
||||||
|
<div className="w-10 h-2 bg-muted rounded-full" />
|
||||||
|
</div>
|
||||||
|
<Button onClick={onNext} disabled={!selectedOption}>
|
||||||
|
Next
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user