import { useState } from 'react'; import { X, Plus, Building2, Layers, ChevronRight, Check, MapPin } from 'lucide-react'; import { useLayoutStore } from '../../../stores/layoutStore'; interface FloorSelectorProps { isOpen: boolean; onClose: () => void; onSelectFloor: (floorId: string, buildingId: string) => void; onAddProperty?: () => void; onAddBuilding?: () => void; onAddFloor?: (buildingId: string) => void; } export function FloorSelector({ isOpen, onClose, onSelectFloor, onAddProperty, onAddBuilding, onAddFloor }: FloorSelectorProps) { const { property, buildingId, floorId } = useLayoutStore(); const [expandedBuildings, setExpandedBuildings] = useState>(new Set()); if (!isOpen) return null; const toggleBuilding = (id: string) => { setExpandedBuildings(prev => { const next = new Set(prev); if (next.has(id)) { next.delete(id); } else { next.add(id); } return next; }); }; return (
{/* Header */}

Select Floor

Choose a floor to edit

{/* Property Info */}

{property?.name || 'No Property'}

{property?.address && (

{property.address}

)}
{onAddProperty && ( )}
{/* Buildings & Floors List */}
{onAddBuilding && property && ( )} {property?.buildings.map(building => (
{/* Building Header */} {/* Floors */} {expandedBuildings.has(building.id) && (
{building.floors.map(floor => { const isSelected = floorId === floor.id && buildingId === building.id; return ( ); })} {/* Add Floor Button */} {onAddFloor && ( )}
)}
))} {/* Empty State */} {(!property || property.buildings.length === 0) && (

No buildings found

)}
{/* Footer */}
); }