Components: - FarmCard: Farm summary display with status and metrics - ZoneGrid: Multi-level zone layout visualization - ZoneDetailCard: Individual zone details with environment readings - EnvironmentGauge: Real-time environmental parameter display - BatchProgress: Crop batch progress tracking with health scores - RecipeSelector: Growing recipe browser and selector - AlertPanel: Environment alerts display and management - GrowthStageIndicator: Visual growth stage progress tracker - ResourceUsageChart: Energy/water usage analytics visualization Pages: - /vertical-farm: Dashboard with farm listing and stats - /vertical-farm/register: Multi-step farm registration form - /vertical-farm/[farmId]: Farm detail view with zones and alerts - /vertical-farm/[farmId]/zones: Zone management with batch starting - /vertical-farm/[farmId]/batches: Batch management and harvesting - /vertical-farm/[farmId]/analytics: Farm analytics and performance metrics
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { GrowingZone } from '../../lib/vertical-farming/types';
|
|
import ZoneDetailCard from './ZoneDetailCard';
|
|
|
|
interface ZoneGridProps {
|
|
zones: GrowingZone[];
|
|
onZoneSelect?: (zone: GrowingZone) => void;
|
|
selectedZoneId?: string;
|
|
}
|
|
|
|
export default function ZoneGrid({ zones, onZoneSelect, selectedZoneId }: ZoneGridProps) {
|
|
const zonesByLevel = zones.reduce((acc, zone) => {
|
|
if (!acc[zone.level]) {
|
|
acc[zone.level] = [];
|
|
}
|
|
acc[zone.level].push(zone);
|
|
return acc;
|
|
}, {} as Record<number, GrowingZone[]>);
|
|
|
|
const levels = Object.keys(zonesByLevel)
|
|
.map(Number)
|
|
.sort((a, b) => b - a);
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
{levels.map(level => (
|
|
<div key={level}>
|
|
<h3 className="text-lg font-semibold text-gray-900 mb-3">
|
|
Level {level}
|
|
</h3>
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
{zonesByLevel[level].map(zone => (
|
|
<ZoneDetailCard
|
|
key={zone.id}
|
|
zone={zone}
|
|
onClick={() => onZoneSelect?.(zone)}
|
|
isSelected={selectedZoneId === zone.id}
|
|
/>
|
|
))}
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|