the it goes to the "How many pages/screens do you have in mind?
" step
This commit is contained in:
@@ -72,17 +72,34 @@ export function CostEstimatorForm() {
|
|||||||
|
|
||||||
const handleNextStep = () => {
|
const handleNextStep = () => {
|
||||||
startTransition(() => {
|
startTransition(() => {
|
||||||
if (currentStep === 2 && formData.serviceType === 'development') {
|
// Logic for step 2 (Service Type)
|
||||||
setCurrentStep(5);
|
if (currentStep === 2) {
|
||||||
} else if (currentStep === 2 && formData.serviceType === 'ui-ux-design') {
|
if (formData.serviceType === 'development') setCurrentStep(5);
|
||||||
setCurrentStep(12);
|
else if (formData.serviceType === 'ui-ux-design') setCurrentStep(12);
|
||||||
} else if (currentStep === 5 && formData.serviceType === 'development') {
|
else if (formData.serviceType === 'identity-branding') setCurrentStep(8);
|
||||||
setCurrentStep(9);
|
else setCurrentStep(3);
|
||||||
} else if (currentStep === 12) {
|
return;
|
||||||
setCurrentStep(11);
|
|
||||||
} else {
|
|
||||||
setCurrentStep((prev) => prev + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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(() => {
|
startTransition(() => {
|
||||||
if (currentStep === 5 && formData.serviceType === 'development') {
|
if (currentStep === 5 && formData.serviceType === 'development') {
|
||||||
setCurrentStep(2);
|
setCurrentStep(2);
|
||||||
} else if (currentStep === 9 && formData.serviceType === 'development') {
|
return;
|
||||||
|
}
|
||||||
|
if (currentStep === 9 && formData.serviceType === 'development') {
|
||||||
setCurrentStep(5);
|
setCurrentStep(5);
|
||||||
} else if (currentStep === 12) {
|
return;
|
||||||
|
}
|
||||||
|
if (currentStep === 12) {
|
||||||
setCurrentStep(2);
|
setCurrentStep(2);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
if (currentStep === 5 && formData.serviceType === 'ui-ux-design') {
|
||||||
setCurrentStep((prev) => prev - 1);
|
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) => {
|
export const calculateTotalHours = (formData: FormData) => {
|
||||||
|
let customHours = 0;
|
||||||
|
|
||||||
if (formData.serviceType === 'ui-ux-design') {
|
if (formData.serviceType === 'ui-ux-design') {
|
||||||
const hours = formData.uiUxDesignProcess ? uiUxDesignHoursMap[formData.uiUxDesignProcess] : 0;
|
customHours = 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 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') {
|
if (formData.serviceType !== 'development') {
|
||||||
customHours += designHours + animationHours + illustrationTotalHours + brandingH;
|
customHours += designHours + animationHours + illustrationTotalHours + brandingH;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user