the it goes to the "How many pages/screens do you have in mind?

" step
This commit is contained in:
Leon Serfaty G
2025-07-17 11:05:18 +00:00
parent c6172fd957
commit 4e70480cd1
2 changed files with 56 additions and 17 deletions
@@ -72,17 +72,34 @@ export function CostEstimatorForm() {
const handleNextStep = () => {
startTransition(() => {
if (currentStep === 2 && formData.serviceType === 'development') {
setCurrentStep(5);
} else if (currentStep === 2 && formData.serviceType === 'ui-ux-design') {
setCurrentStep(12);
} else if (currentStep === 5 && formData.serviceType === 'development') {
setCurrentStep(9);
} else if (currentStep === 12) {
setCurrentStep(11);
} else {
setCurrentStep((prev) => prev + 1);
// Logic for step 2 (Service Type)
if (currentStep === 2) {
if (formData.serviceType === 'development') setCurrentStep(5);
else if (formData.serviceType === 'ui-ux-design') setCurrentStep(12);
else if (formData.serviceType === 'identity-branding') setCurrentStep(8);
else setCurrentStep(3);
return;
}
// After page count, if service is development, skip to features
if (currentStep === 5 && formData.serviceType === 'development') {
setCurrentStep(9);
return;
}
// After branding, if service is identity-branding, skip to results
if (currentStep === 8 && formData.serviceType === 'identity-branding') {
setCurrentStep(11);
return;
}
// After UI/UX design step, go to page count
if (currentStep === 12) {
setCurrentStep(5);
return;
}
setCurrentStep((prev) => prev + 1);
});
};
@@ -90,14 +107,26 @@ export function CostEstimatorForm() {
startTransition(() => {
if (currentStep === 5 && formData.serviceType === 'development') {
setCurrentStep(2);
} else if (currentStep === 9 && formData.serviceType === 'development') {
return;
}
if (currentStep === 9 && formData.serviceType === 'development') {
setCurrentStep(5);
} else if (currentStep === 12) {
return;
}
if (currentStep === 12) {
setCurrentStep(2);
return;
}
else {
if (currentStep === 5 && formData.serviceType === 'ui-ux-design') {
setCurrentStep(12);
return;
}
if(currentStep === 8 && formData.serviceType === 'identity-branding') {
setCurrentStep(2);
return;
}
setCurrentStep((prev) => prev - 1);
}
});
};
@@ -42,9 +42,19 @@ const uiUxDesignHoursMap = {
export const calculateTotalHours = (formData: FormData) => {
let customHours = 0;
if (formData.serviceType === 'ui-ux-design') {
const hours = formData.uiUxDesignProcess ? uiUxDesignHoursMap[formData.uiUxDesignProcess] : 0;
return { customHours: hours, readyMadeHours: Math.round(hours * 0.4) };
customHours = formData.uiUxDesignProcess ? uiUxDesignHoursMap[formData.uiUxDesignProcess] : 0;
const pageVal = formData.pageCount === 10 ? 50 : (formData.pageCount + 1) * 5 - 1;
const pageHours = pageVal * 6;
customHours += pageHours;
return { customHours: customHours, readyMadeHours: Math.round(customHours * 0.4) };
}
if (formData.serviceType === 'identity-branding') {
customHours = formData.branding ? (brandingHoursMap[formData.branding] ?? 0) : 0;
return { customHours: customHours, readyMadeHours: Math.round(customHours * 0.4) };
}
@@ -78,7 +88,7 @@ export const calculateTotalHours = (formData: FormData) => {
}
}
let customHours = pageHours + stageHours + additionalFeaturesHours + cartHours;
customHours = pageHours + stageHours + additionalFeaturesHours + cartHours;
if (formData.serviceType !== 'development') {
customHours += designHours + animationHours + illustrationTotalHours + brandingH;
}