i cant move from step 1

This commit is contained in:
Leon Serfaty G
2025-07-17 10:33:28 +00:00
parent db77e86302
commit 4d5469fd8e
3 changed files with 106 additions and 2 deletions
@@ -1,6 +1,6 @@
"use client";
import React, { useState, useTransition } from 'react';
import React, { useState, useTransition, useMemo } from 'react';
import { Step1ProjectType } from './step-1-project-type';
import { Step2ServiceType } from './step-2-service-type';
import { Step3ProjectStage } from './step-3-project-stage';
@@ -9,6 +9,7 @@ import { Step5PageCount } from './step-5-page-count';
import { Step6Animations } from './step-6-animations';
import { Step7Illustrations } from './step-7-illustrations';
import { Step8Branding } from './step-8-branding';
import { Step9Results, calculateTotalHours } from './step-9-results';
import { Card, CardContent } from '@/components/ui/card';
import { AnimatePresence, motion } from 'framer-motion';
@@ -67,6 +68,28 @@ export function CostEstimatorForm() {
setFormData((prev) => ({ ...prev, ...newData }));
};
const handleReset = () => {
setFormData({
projectType: null,
serviceType: null,
projectStage: 0,
designProcess: null,
pageCount: 0,
animatedElements: null,
illustrations: {
has2d: false,
is2dAnimated: null,
has3d: false,
is3dAnimated: null,
},
branding: null,
});
setCurrentStep(1);
}
const estimatedHours = useMemo(() => calculateTotalHours(formData), [formData]);
const renderStep = () => {
switch (currentStep) {
case 1:
@@ -139,6 +162,14 @@ export function CostEstimatorForm() {
formData={formData}
/>
);
case 9:
return (
<Step9Results
formData={formData}
onReset={handleReset}
estimatedHours={estimatedHours}
/>
)
default:
return (
<Step1ProjectType