chore: add prettier formatting
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { CloudSun, Droplets, Gauge, Navigation, Thermometer, Umbrella, Wind } from "lucide-react";
|
||||
import { calculateFeelsLike, formatHumidity, formatPressure, formatRainfall, formatTemperature, formatWind, getWindDirection } from "@/lib/weather-utils";
|
||||
import {
|
||||
calculateFeelsLike,
|
||||
formatHumidity,
|
||||
formatPressure,
|
||||
formatRainfall,
|
||||
formatTemperature,
|
||||
formatWind,
|
||||
getWindDirection,
|
||||
} from "@/lib/weather-utils";
|
||||
import type { SynopStation } from "@/types/imgw";
|
||||
import { MetricCard } from "@/components/weather/metric-card";
|
||||
import { useI18n } from "@/lib/i18n";
|
||||
@@ -13,17 +21,57 @@ export function CurrentConditionsCard({ station }: { station: SynopStation }) {
|
||||
const windSpeedUnit = useWeatherStore((state) => state.windSpeedUnit);
|
||||
const feelsLike = calculateFeelsLike(station.temperature, station.humidity, station.windSpeed);
|
||||
const metrics = [
|
||||
{ icon: Thermometer, label: t("weather.feelsLike"), value: formatTemperature(feelsLike, language, temperatureUnit), detail: t("weather.feelsLikeDetail") },
|
||||
{ icon: Droplets, label: t("weather.humidity"), value: formatHumidity(station.humidity, language), detail: t("weather.humidityDetail") },
|
||||
{ icon: Gauge, label: t("weather.pressure"), value: formatPressure(station.pressure, language), detail: t("weather.pressureDetail") },
|
||||
{ icon: Wind, label: t("weather.windSpeed"), value: formatWind(station.windSpeed, null, language, windSpeedUnit), detail: t("weather.windSpeedDetail") },
|
||||
{ icon: Navigation, label: t("weather.windDirection"), value: station.windDirection === null ? t("common.noData") : `${station.windDirection}° ${getWindDirection(station.windDirection)}`, detail: t("weather.windDirectionDetail") },
|
||||
{ icon: Umbrella, label: t("weather.rainfallTotal"), value: formatRainfall(station.rainfall, language), detail: t("weather.rainfallDetail") },
|
||||
{ icon: CloudSun, label: t("weather.airTemperature"), value: formatTemperature(station.temperature, language, temperatureUnit), detail: t("weather.temperatureDetail") },
|
||||
{
|
||||
icon: Thermometer,
|
||||
label: t("weather.feelsLike"),
|
||||
value: formatTemperature(feelsLike, language, temperatureUnit),
|
||||
detail: t("weather.feelsLikeDetail"),
|
||||
},
|
||||
{
|
||||
icon: Droplets,
|
||||
label: t("weather.humidity"),
|
||||
value: formatHumidity(station.humidity, language),
|
||||
detail: t("weather.humidityDetail"),
|
||||
},
|
||||
{
|
||||
icon: Gauge,
|
||||
label: t("weather.pressure"),
|
||||
value: formatPressure(station.pressure, language),
|
||||
detail: t("weather.pressureDetail"),
|
||||
},
|
||||
{
|
||||
icon: Wind,
|
||||
label: t("weather.windSpeed"),
|
||||
value: formatWind(station.windSpeed, null, language, windSpeedUnit),
|
||||
detail: t("weather.windSpeedDetail"),
|
||||
},
|
||||
{
|
||||
icon: Navigation,
|
||||
label: t("weather.windDirection"),
|
||||
value:
|
||||
station.windDirection === null
|
||||
? t("common.noData")
|
||||
: `${station.windDirection}° ${getWindDirection(station.windDirection)}`,
|
||||
detail: t("weather.windDirectionDetail"),
|
||||
},
|
||||
{
|
||||
icon: Umbrella,
|
||||
label: t("weather.rainfallTotal"),
|
||||
value: formatRainfall(station.rainfall, language),
|
||||
detail: t("weather.rainfallDetail"),
|
||||
},
|
||||
{
|
||||
icon: CloudSun,
|
||||
label: t("weather.airTemperature"),
|
||||
value: formatTemperature(station.temperature, language, temperatureUnit),
|
||||
detail: t("weather.temperatureDetail"),
|
||||
},
|
||||
];
|
||||
return (
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
||||
{metrics.map((metric, index) => <MetricCard {...metric} index={index} key={metric.label} />)}
|
||||
{metrics.map((metric, index) => (
|
||||
<MetricCard {...metric} index={index} key={metric.label} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user