| 122 | } |
| 123 | |
| 124 | function getAqiLabel(aqi: number): { label: string; color: string } { |
| 125 | if (aqi <= 20) return { label: "Good", color: "#7BC75B" }; |
| 126 | if (aqi <= 40) return { label: "Fair", color: "#CDDC39" }; |
| 127 | if (aqi <= 60) return { label: "Moderate", color: "#C6B77E" }; |
| 128 | if (aqi <= 80) return { label: "Poor", color: "#FF9800" }; |
| 129 | if (aqi <= 100) return { label: "Very Poor", color: "#d73027" }; |
| 130 | return { label: "Hazardous", color: "#7B1FA2" }; |
| 131 | } |
| 132 | |
| 133 | function waterStressLabel(soilMoisture: number | null, rainfall: number | null): { label: string; color: string; detail: string } { |
| 134 | if (soilMoisture == null) return { label: "Checking…", color: "hsl(150, 10%, 55%)", detail: "Waiting for soil moisture data" }; |