diff --git a/src/components/MobileOffsetOrder.tsx b/src/components/MobileOffsetOrder.tsx index 1b69a02..5f053d6 100644 --- a/src/components/MobileOffsetOrder.tsx +++ b/src/components/MobileOffsetOrder.tsx @@ -11,8 +11,19 @@ interface Props { onBack: () => void; } +interface Project { + id: string; + name: string; + type: string; + description: string; + location: string; + pricePerTon: number; + imageUrl: string; + percentage: number; +} + export function MobileOffsetOrder({ tons, monetaryAmount, currency, onBack }: Props) { - const [currentStep, setCurrentStep] = useState<'summary' | 'payment' | 'confirmation'>('summary'); + const [currentStep, setCurrentStep] = useState<'summary' | 'projects' | 'payment' | 'confirmation'>('summary'); const [loading, setLoading] = useState(false); const [orderData, setOrderData] = useState({ name: '', @@ -20,6 +31,40 @@ export function MobileOffsetOrder({ tons, monetaryAmount, currency, onBack }: Pr phone: '' }); + // Dummy projects data + const projects: Project[] = [ + { + id: '1', + name: 'Coastal Blue Carbon', + type: 'Blue Carbon', + description: 'Protecting and restoring coastal wetlands that capture carbon 10x faster than forests.', + location: 'Indonesia', + pricePerTon: 25, + imageUrl: 'https://images.unsplash.com/photo-1559827260-dc66d52bef19?auto=format&fit=crop&q=80&w=800', + percentage: 0.35 + }, + { + id: '2', + name: 'Wind Power Initiative', + type: 'Renewable Energy', + description: 'Supporting offshore wind farms to replace fossil fuel energy generation.', + location: 'North Sea', + pricePerTon: 15, + imageUrl: 'https://images.unsplash.com/photo-1548337138-e87d889cc369?auto=format&fit=crop&q=80&w=800', + percentage: 0.30 + }, + { + id: '3', + name: 'Rainforest Conservation', + type: 'Forestry', + description: 'Protecting critical rainforest habitats from deforestation.', + location: 'Amazon Basin', + pricePerTon: 12, + imageUrl: 'https://images.unsplash.com/photo-1511884642898-4c92249e20b6?auto=format&fit=crop&q=80&w=800', + percentage: 0.35 + } + ]; + // Calculate cost (using dummy pricing) const pricePerTon = 18; // $18 per ton const totalCost = monetaryAmount || (tons * pricePerTon); @@ -30,6 +75,10 @@ export function MobileOffsetOrder({ tons, monetaryAmount, currency, onBack }: Pr }; const handleProceedToPayment = () => { + setCurrentStep('projects'); + }; + + const handleProceedFromProjects = () => { setCurrentStep('payment'); }; @@ -149,6 +198,87 @@ export function MobileOffsetOrder({ tons, monetaryAmount, currency, onBack }: Pr ); + const renderProjectsStep = () => ( + + + Project Portfolio + + Your offset will be distributed across these verified carbon reduction projects + + + + {projects.map((project, index) => ( + + + + + + {project.name} + {project.location} + + + + + + + {project.type} + + + {(project.percentage * 100).toFixed(0)}% + + + + + {project.description} + + + + Price per ton + ${project.pricePerTon} + + + + ))} + + + + + + Total CO₂ Offset + {tons.toFixed(2)} tons + + + Portfolio Price + + {formatCurrency(totalCost, targetCurrency)} + + + + + + Continue to Payment + + + ); + const renderPaymentStep = () => ( {currentStep === 'summary' ? 'Order Summary' : + currentStep === 'projects' ? 'Project Portfolio' : currentStep === 'payment' ? 'Payment' : 'Order Confirmed'} @@ -353,7 +484,10 @@ export function MobileOffsetOrder({ tons, monetaryAmount, currency, onBack }: Pr + {currentStep === 'summary' && renderSummaryStep()} + {currentStep === 'projects' && renderProjectsStep()} {currentStep === 'payment' && renderPaymentStep()} {currentStep === 'confirmation' && renderConfirmationStep()}
+ Your offset will be distributed across these verified carbon reduction projects +
{project.location}
+ {project.description} +