From cf4741af10af6d2a77b025cd4aad8ff96dee11fe Mon Sep 17 00:00:00 2001 From: Leon Serfaty G Date: Thu, 17 Jul 2025 10:18:40 +0000 Subject: [PATCH] this is how the next step looks like .. calcylate 7 6 hours per page sho --- .../cost-estimator/cost-estimator-form.tsx | 12 +++ .../cost-estimator/step-2-service-type.tsx | 2 +- .../cost-estimator/step-3-project-stage.tsx | 4 +- .../cost-estimator/step-4-design-process.tsx | 6 +- .../cost-estimator/step-5-page-count.tsx | 102 ++++++++++++++++++ 5 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 src/components/cost-estimator/step-5-page-count.tsx diff --git a/src/components/cost-estimator/cost-estimator-form.tsx b/src/components/cost-estimator/cost-estimator-form.tsx index 9bf4f4e..77bd521 100644 --- a/src/components/cost-estimator/cost-estimator-form.tsx +++ b/src/components/cost-estimator/cost-estimator-form.tsx @@ -5,6 +5,7 @@ import { Step1ProjectType } from './step-1-project-type'; import { Step2ServiceType } from './step-2-service-type'; import { Step3ProjectStage } from './step-3-project-stage'; import { Step4DesignProcess } from './step-4-design-process'; +import { Step5PageCount } from './step-5-page-count'; import { Card, CardContent } from '@/components/ui/card'; import { AnimatePresence, motion } from 'framer-motion'; @@ -13,6 +14,7 @@ export type FormData = { serviceType: 'entire-project' | 'development' | 'ui-ux-design' | 'identity-branding' | null; projectStage: number; designProcess: 'custom' | 'mockups' | 'existing' | null; + pageCount: number; }; export function CostEstimatorForm() { @@ -22,6 +24,7 @@ export function CostEstimatorForm() { serviceType: null, projectStage: 0, designProcess: null, + pageCount: 0, }); const [isPending, startTransition] = useTransition(); @@ -77,6 +80,15 @@ export function CostEstimatorForm() { formData={formData} /> ); + case 5: + return ( + + ); default: return (
-
+
diff --git a/src/components/cost-estimator/step-3-project-stage.tsx b/src/components/cost-estimator/step-3-project-stage.tsx index 1e9d599..53af1cb 100644 --- a/src/components/cost-estimator/step-3-project-stage.tsx +++ b/src/components/cost-estimator/step-3-project-stage.tsx @@ -77,8 +77,8 @@ export function Step3ProjectStage({ onNext, onBack, onUpdateData, formData }: St
-
-
+
+
diff --git a/src/components/cost-estimator/step-4-design-process.tsx b/src/components/cost-estimator/step-4-design-process.tsx index ba98249..e8d0ca3 100644 --- a/src/components/cost-estimator/step-4-design-process.tsx +++ b/src/components/cost-estimator/step-4-design-process.tsx @@ -68,9 +68,9 @@ export function Step4DesignProcess({ onNext, onBack, onUpdateData, formData }: S
-
-
-
+
+
+
diff --git a/src/components/cost-estimator/step-5-page-count.tsx b/src/components/cost-estimator/step-5-page-count.tsx new file mode 100644 index 0000000..2eee077 --- /dev/null +++ b/src/components/cost-estimator/step-5-page-count.tsx @@ -0,0 +1,102 @@ +"use client"; + +import type { FormData } from './cost-estimator-form'; +import { Button } from '@/components/ui/button'; +import { Slider } from '@/components/ui/slider'; +import React, { useState, useMemo } from 'react'; +import { Gauge } from 'lucide-react'; + +type Step5Props = { + onNext: () => void; + onBack: () => void; + onUpdateData: (data: Partial) => void; + formData: FormData; +}; + +const pageLabels = [ + "less than 5", // 0 + "5 - 10 pages", // 1 + "10 - 15 pages", // 2 + "15 - 20 pages", // 3 + "20 - 25 pages", // 4 + "25 - 30 pages", // 5 + "30 - 35 pages", // 6 + "35 - 40 pages", // 7 + "40 - 45 pages", // 8 + "45 - 50 pages", // 9 + "50+", // 10 +]; + +const designHoursMap = { + custom: 60, + mockups: 30, + existing: 0, +}; + +const calculateHours = (pageCount: number, projectStage: number, designProcess: 'custom' | 'mockups' | 'existing' | null): number => { + const pageHours = pageCount * 6; + const stageHours = Math.round((projectStage / 100) * 50); + const designHours = designProcess ? designHoursMap[designProcess] : 0; + return pageHours + stageHours + designHours; +}; + + +export function Step5PageCount({ onNext, onBack, onUpdateData, formData }: Step5Props) { + const [value, setValue] = useState([formData.pageCount]); + + const handleSliderChange = (newValue: number[]) => { + setValue(newValue); + onUpdateData({ pageCount: newValue[0] }); + }; + + const currentLabel = useMemo(() => { + const index = value[0]; + return pageLabels[index]; + }, [value]); + + const estimatedHours = useMemo(() => { + const pages = value[0] === 10 ? 50 : (value[0] + 1) * 5 - 1; // Approx for calculation + return calculateHours(pages, formData.projectStage, formData.designProcess); + }, [value, formData.projectStage, formData.designProcess]); + + return ( +
+

How many pages/screens do you have in mind?

+
+
+

{pageLabels[0]}

+

{pageLabels[10]}

+
+ +
+ {currentLabel} +
+
+
+
+ + {estimatedHours}+ hours +
+
+ +
+
+
+
+
+
+
+ +
+
+
+ ); +}