'use client' import { useTranslations } from 'next-intl' import IconButton from '@mui/material/IconButton' import type { LayerType } from './cropZoningTypes' const LAYER_ICONS: Record = { crops: 'tabler-plant-2', waterNeed: 'tabler-droplet', soilQuality: 'tabler-seedling', cultivationRisk: 'tabler-alert-triangle' } type LayerControlProps = { activeLayer: LayerType onLayerChange: (layer: LayerType) => void } const LAYER_ORDER: LayerType[] = ['crops', 'waterNeed', 'soilQuality', 'cultivationRisk'] export default function LayerControl({ activeLayer, onLayerChange }: LayerControlProps) { const t = useTranslations('cropZoning') return (
{LAYER_ORDER.map(layer => ( onLayerChange(layer)} title={t(`layers.${layer}`)} sx={{ mx: 0.5, bgcolor: activeLayer === layer ? 'action.selected' : 'transparent', '&:hover': { bgcolor: activeLayer === layer ? 'action.selected' : 'action.hover' } }} > ))}
) }