import { CropBatch, GrowingRecipe } from '../../lib/vertical-farming/types'; interface BatchProgressProps { batch: CropBatch; recipe?: GrowingRecipe; showDetails?: boolean; } export default function BatchProgress({ batch, recipe, showDetails = true }: BatchProgressProps) { const progressPercent = recipe ? Math.min(100, (batch.currentDay / recipe.expectedDays) * 100) : 0; const statusColors: Record = { germinating: 'bg-yellow-500', growing: 'bg-green-500', ready: 'bg-blue-500', harvesting: 'bg-purple-500', completed: 'bg-gray-500', failed: 'bg-red-500', }; const healthColor = batch.healthScore >= 80 ? 'text-green-600' : batch.healthScore >= 60 ? 'text-yellow-600' : 'text-red-600'; return (

{batch.cropType} {batch.variety && - {batch.variety}}

Batch: {batch.id.slice(0, 12)}...

{batch.status}

Health: {batch.healthScore}%

Progress Day {batch.currentDay} {recipe && `/ ${recipe.expectedDays}`}
{showDetails && (

Current Stage

{batch.currentStage}

Plants

{batch.plantCount.toLocaleString()}

Expected Yield

{batch.expectedYieldKg.toFixed(1)} kg

Harvest Date

{new Date(batch.expectedHarvestDate).toLocaleDateString()}

)} {batch.issues.length > 0 && (

{batch.issues.filter(i => !i.resolvedAt).length} Active Issue(s)

{batch.issues .filter(i => !i.resolvedAt) .slice(0, 2) .map(issue => (

- {issue.type}: {issue.description}

))}
)}
); }