+
- ) : (
-
-
-
-
-
-
+ ) : (
+
+
+
+ 暂无天气数据
+
+
+ 请搜索城市查看实时天气信息
+
-
暂无天气数据
-
请搜索城市查看实时天气信息
-
-
)}
);
diff --git a/1114/app/components/weather/WeatherDetailsGrid.tsx b/1114/app/components/weather/WeatherDetailsGrid.tsx
index d3cbb85..82c9f11 100644
--- a/1114/app/components/weather/WeatherDetailsGrid.tsx
+++ b/1114/app/components/weather/WeatherDetailsGrid.tsx
@@ -1,6 +1,6 @@
import { Droplets,Wind,Gauge,Cloud,Eye,ThermometerSun} from "lucide-react";
import React from "react";
-import { getWindDirection } from "@/components/lib/utils";
+import { getWindDirection } from "@/lib/utils";
import {useWeatherStore} from "@/store/weatherStore";
interface WeatherInfoItemProps {
diff --git a/1114/app/components/weather/WeatherDisplay.tsx b/1114/app/components/weather/WeatherDisplay.tsx
index e69de29..8d22140 100644
--- a/1114/app/components/weather/WeatherDisplay.tsx
+++ b/1114/app/components/weather/WeatherDisplay.tsx
@@ -0,0 +1,72 @@
+import { useWeatherStore } from "@/store/weatherStore";
+import { Cloud, CloudDrizzle, CloudFog, CloudLightning, CloudMoon, CloudRain, CloudSnow, CloudSun, MapPin, Moon, Sun, ThermometerSun } from "lucide-react";
+import { formatTemperature } from "../../lib/utils";
+
+interface WeatherIconProps {
+ description: string;
+ isDay: string;
+ className?: string;
+}
+
+function WeatherIcon({ description, isDay, className='w-16 h-16 md:w-20 md:h-20' }: WeatherIconProps) {
+ const desc = description.toLowerCase();
+ const isDaytime = isDay === 'yes';
+
+ if(desc.includes('雨') || desc.includes('rain')) return
+ if(desc.includes('雪') || desc.includes('snow')) return
+ if(desc.includes('雷') || desc.includes('thunderstorm')) return
+ if(desc.includes('fog') || desc.includes('雾')) return
+ if(desc.includes('cloudy') || desc.includes('阴') || desc.includes('overcast')) return
+ if(desc.includes('heavy') || desc.includes('暴')) return
+ if(desc.includes('晴') || desc.includes('clear') || desc.includes('sunny')) return (
+ isDaytime ? :
+ )
+ if(desc.includes('scattered') || desc.includes('多云') || desc.includes('partial')) return (
+ isDaytime ? :
+ )
+ return isDaytime ? :
+}
+
+export function WeatherDisplay(){
+ const {currentWeather} = useWeatherStore();
+ if (!currentWeather) return null;
+
+ return (
+
+
+
+
+
+
+
+
{currentWeather.location.name}
+
+
+ {currentWeather.location.country}
+
+
+
+
+
+
+
+
+
+ {formatTemperature(currentWeather.current.temperature)}
+
+ °C
+
+
+ {currentWeather.current.weather_descriptions[0]}
+
+
+
+ 体感 {formatTemperature(currentWeather.current.feelslike)}°C
+
+
+
+ )
+}
diff --git a/1114/app/components/weather/WeatherSearchForm.tsx b/1114/app/components/weather/WeatherSearchForm.tsx
index ad3f0e7..b9db5c1 100644
--- a/1114/app/components/weather/WeatherSearchForm.tsx
+++ b/1114/app/components/weather/WeatherSearchForm.tsx
@@ -1,5 +1,5 @@
//天气搜索表单组件
-import { cn } from "@/components/lib/utils";
+import { cn } from "@/lib/utils";
import React ,{useState,type FormEvent,type ChangeEvent, use} from "react";
import { Button } from "@/components/ui/button";
import { Input} from "../ui/input";
diff --git a/1114/app/components/lib/utils.ts b/1114/app/lib/utils.ts
similarity index 100%
rename from 1114/app/components/lib/utils.ts
rename to 1114/app/lib/utils.ts
diff --git a/1114/app/routes/weather.tsx b/1114/app/routes/weather.tsx
index 1c2c8c6..22b5a52 100644
--- a/1114/app/routes/weather.tsx
+++ b/1114/app/routes/weather.tsx
@@ -15,7 +15,7 @@ export function meta() {
}
export default function Weather() {
- const { currentWeather, isLoading, error, setError } = useWeatherStore()
+
const { currentWeather, isLoading, error, setError } = useWeatherStore()
useEffect(() => {
if (error) {
@@ -24,7 +24,7 @@ export default function Weather() {
setError("")
}
}, [error, setError])
- }, [error, setError])
+
return (
diff --git a/1114/pnpm-lock.yaml b/1114/pnpm-lock.yaml
index 05d5522..c3ab268 100644
--- a/1114/pnpm-lock.yaml
+++ b/1114/pnpm-lock.yaml
@@ -79,7 +79,7 @@ importers:
specifier: ^22.19.0
version: 22.19.1
'@types/react':
- specifier: ^19.1.13
+ specifier: ^19.2.4
version: 19.2.4
'@types/react-dom':
specifier: ^19.1.9