fix: remove duplicate weather condition badge
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
|||||||
getWeatherDescription,
|
getWeatherDescription,
|
||||||
getWeatherMoodFromData,
|
getWeatherMoodFromData,
|
||||||
} from "@/lib/weather-utils";
|
} from "@/lib/weather-utils";
|
||||||
import type { SynopStation, WeatherMood } from "@/types/imgw";
|
import type { SynopStation } from "@/types/imgw";
|
||||||
import type { ImgwCurrentWeather } from "@/types/imgw-current";
|
import type { ImgwCurrentWeather } from "@/types/imgw-current";
|
||||||
import { WeatherIcon } from "@/components/weather/weather-icon";
|
import { WeatherIcon } from "@/components/weather/weather-icon";
|
||||||
import { WeatherEffects } from "@/components/weather/weather-effects";
|
import { WeatherEffects } from "@/components/weather/weather-effects";
|
||||||
@@ -23,17 +23,6 @@ import { useWeatherStore } from "@/lib/store";
|
|||||||
|
|
||||||
type DevWeatherEffectOverride = "rain" | "thunderstorm" | "none";
|
type DevWeatherEffectOverride = "rain" | "thunderstorm" | "none";
|
||||||
|
|
||||||
function moodAccentClass(mood: WeatherMood) {
|
|
||||||
return {
|
|
||||||
warm: "border-accent/25 bg-accent/10 text-accent",
|
|
||||||
cloudy: "border-border/70 bg-surface-muted text-muted",
|
|
||||||
wind: "border-border/70 bg-surface-muted text-muted",
|
|
||||||
cold: "border-border/70 bg-surface-muted text-muted",
|
|
||||||
night: "border-border/70 bg-surface-muted text-muted",
|
|
||||||
mild: "border-accent/25 bg-accent/10 text-accent",
|
|
||||||
}[mood];
|
|
||||||
}
|
|
||||||
|
|
||||||
function readDevWeatherEffectOverride(): DevWeatherEffectOverride | null {
|
function readDevWeatherEffectOverride(): DevWeatherEffectOverride | null {
|
||||||
if (process.env.NODE_ENV !== "development" || typeof window === "undefined") return null;
|
if (process.env.NODE_ENV !== "development" || typeof window === "undefined") return null;
|
||||||
const effect = new URLSearchParams(window.location.search).get("effect");
|
const effect = new URLSearchParams(window.location.search).get("effect");
|
||||||
@@ -63,7 +52,6 @@ export function WeatherHero({ station, currentWeather, currentWeatherLoading = f
|
|||||||
rainfall: currentWeather.precipitation10m ?? station.rainfall,
|
rainfall: currentWeather.precipitation10m ?? station.rainfall,
|
||||||
} : station;
|
} : station;
|
||||||
const mood = getWeatherMoodFromData(displayedStation);
|
const mood = getWeatherMoodFromData(displayedStation);
|
||||||
const moodAccent = moodAccentClass(mood);
|
|
||||||
const feelsLike = currentWeather?.feelsLike ?? calculateFeelsLike(displayedStation.temperature, displayedStation.humidity, displayedStation.windSpeed);
|
const feelsLike = currentWeather?.feelsLike ?? calculateFeelsLike(displayedStation.temperature, displayedStation.humidity, displayedStation.windSpeed);
|
||||||
const metrics = [
|
const metrics = [
|
||||||
{ icon: Droplets, label: t("weather.humidity"), value: formatHumidity(displayedStation.humidity, language) },
|
{ icon: Droplets, label: t("weather.humidity"), value: formatHumidity(displayedStation.humidity, language) },
|
||||||
@@ -110,9 +98,6 @@ export function WeatherHero({ station, currentWeather, currentWeatherLoading = f
|
|||||||
<div>
|
<div>
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
<span className="flex items-center gap-1.5 text-sm font-medium text-muted"><MapPin className="size-4" />{displayedLocationName}</span>
|
<span className="flex items-center gap-1.5 text-sm font-medium text-muted"><MapPin className="size-4" />{displayedLocationName}</span>
|
||||||
<span className={`rounded-control border px-2.5 py-1 text-[0.68rem] font-semibold uppercase tracking-[0.14em] ${moodAccent}`}>
|
|
||||||
{weatherDescription}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-2 space-y-1 text-xs text-muted">
|
<div className="mt-2 space-y-1 text-xs text-muted">
|
||||||
<p>{currentWeatherLoading
|
<p>{currentWeatherLoading
|
||||||
|
|||||||
Reference in New Issue
Block a user