fix(storm-intel): show CloudHail icon for ice-pellet/hail forecast codes
Tomorrow.io 7xxx codes are ice pellets, not snow — remapped from Snowflake to CloudHail. Added hailRisk override so any day flagged as hail risk by the API always renders the hail icon regardless of weatherCode. Also added missing 6xxx (freezing rain) codes to the icon table. Mock Sunday entry corrected to weatherCode 8000 (thunderstorm) — 7102 at 76°F made no meteorological sense.
This commit is contained in:
@@ -63,8 +63,12 @@ const FORECAST_ICONS = {
|
||||
4000: CloudDrizzle, 4200: CloudDrizzle,
|
||||
4001: CloudRain, 4201: CloudRain,
|
||||
8000: CloudLightning,
|
||||
7000: Snowflake, 7101: Snowflake, 7102: Snowflake,
|
||||
5000: Snowflake, 5100: Snowflake, 5101: Snowflake,
|
||||
// 5xxx = actual snow
|
||||
5000: Snowflake, 5001: Snowflake, 5100: Snowflake, 5101: Snowflake,
|
||||
// 6xxx = freezing rain
|
||||
6000: CloudDrizzle, 6001: CloudRain, 6200: CloudDrizzle, 6201: CloudRain,
|
||||
// 7xxx = ice pellets / hail — NOT snow
|
||||
7000: CloudHail, 7101: CloudHail, 7102: CloudHail,
|
||||
};
|
||||
|
||||
function scoreColor(score) {
|
||||
@@ -528,7 +532,7 @@ const ForecastStrip = ({ forecast, loading, alertDay, hasStormAlert }) => {
|
||||
<div className="flex items-stretch gap-1.5 px-4 sm:px-6 py-2.5 overflow-x-auto scrollbar-none">
|
||||
<span className="text-[10px] font-black uppercase tracking-widest text-zinc-400 self-center mr-1 shrink-0 hidden sm:block">7-Day</span>
|
||||
{forecast.map((day, i) => {
|
||||
const FIcon = FORECAST_ICONS[day.weatherCode] ?? Cloud;
|
||||
const FIcon = day.hailRisk ? CloudHail : (FORECAST_ICONS[day.weatherCode] ?? Cloud);
|
||||
const isAlert = day.stormScore >= 65;
|
||||
const isWarn = day.stormScore >= 40 && !isAlert;
|
||||
const dayLabel = i === 0
|
||||
|
||||
Reference in New Issue
Block a user