From 93b467ba13b543dbce009f146b413ea492863a23 Mon Sep 17 00:00:00 2001 From: qiuchenfan <2035024011@qq.com> Date: Mon, 17 Nov 2025 19:26:09 +0800 Subject: [PATCH 1/3] 1114 --- app/components/WeatherDetailsGird.tsx | 1 + app/components/WeatherDispaly2.tsx | 45 -------------------------- app/components/WeatherDisplay.tsx | 46 +++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 45 deletions(-) delete mode 100644 app/components/WeatherDispaly2.tsx diff --git a/app/components/WeatherDetailsGird.tsx b/app/components/WeatherDetailsGird.tsx index 30bf498..d4fe5ff 100644 --- a/app/components/WeatherDetailsGird.tsx +++ b/app/components/WeatherDetailsGird.tsx @@ -1,5 +1,6 @@ import { Cloud, Droplets, Gauge, ThermometerSun, Wind } from "lucide-react"; import { useWeatherStore } from "@/store/weatherStore"; +import { MapPin, Thermometer } from "lucide-react"; interface WeatherDetailsGridProps { icon: React.ReactNode; diff --git a/app/components/WeatherDispaly2.tsx b/app/components/WeatherDispaly2.tsx deleted file mode 100644 index b519075..0000000 --- a/app/components/WeatherDispaly2.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { MapPin, Thermometer } from "lucide-react"; - -export function WeatherDisplay2(){ - 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 -
-
-
-
- ) -} \ No newline at end of file diff --git a/app/components/WeatherDisplay.tsx b/app/components/WeatherDisplay.tsx index 6efd581..c6e3415 100644 --- a/app/components/WeatherDisplay.tsx +++ b/app/components/WeatherDisplay.tsx @@ -9,6 +9,7 @@ import { CloudSnow, CloudSun, MapPin, Moon, Sun, + Thermometer, ThermometerSun } from 'lucide-react'; @@ -44,3 +45,48 @@ function WeatherIcon({ description, isDay, className = "w-16 h-16 md:w-20 md:h-2 } return isDaytime ? : ; } + + +export function WeatherDisplay2(){ + 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 +
+
+
+
+ ) +} \ No newline at end of file From 56c08f7c8f54498d09badeebc287b3df99f9e664 Mon Sep 17 00:00:00 2001 From: qiuchenfan <2035024011@qq.com> Date: Mon, 17 Nov 2025 19:29:17 +0800 Subject: [PATCH 2/3] 1115 --- app/components/WeatherDisplay.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/WeatherDisplay.tsx b/app/components/WeatherDisplay.tsx index c6e3415..33e8b7a 100644 --- a/app/components/WeatherDisplay.tsx +++ b/app/components/WeatherDisplay.tsx @@ -47,7 +47,7 @@ function WeatherIcon({ description, isDay, className = "w-16 h-16 md:w-20 md:h-2 } -export function WeatherDisplay2(){ +export function WeatherDisplay(){ const {currentWeather} = useWeatherStore(); if(!currentWeather) return null; @@ -82,7 +82,7 @@ export function WeatherDisplay2(){ {currentWeather.current.weather_descriptions[0]}

- + 体感{formatTemperature(currentWeather.current.feelslike)}°C
From 465a52d36fbc1e8ddcfd645e05c1f504101e4d1a Mon Sep 17 00:00:00 2001 From: jinsir <874871581@qq.com> Date: Mon, 17 Nov 2025 19:29:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?form=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/WeatherSearchForm.tsx | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/app/components/WeatherSearchForm.tsx b/app/components/WeatherSearchForm.tsx index 04dff4f..ab0ac03 100644 --- a/app/components/WeatherSearchForm.tsx +++ b/app/components/WeatherSearchForm.tsx @@ -7,7 +7,7 @@ import { useWeatherStore } from '@/store/weatherStore'; export function WeatherSearchForm() { - const [isLoading, currentWeather, searchWeather, refreshWeather] = useWeatherStore(); + const {isLoading, currentWeather, searchWeather, refreshWeather} = useWeatherStore(); const [city, setCity] = useState(''); const [inputError, setInputError] = useState(''); @@ -25,11 +25,7 @@ export function WeatherSearchForm() { setInputError('请输入城市名称'); return; } - if (!trimmedCity) { - setInputError('请输入有效的城市名称'); - return; - } - + if (trimmedCity.length < 2) { setInputError('请输入至少2个字符'); return; @@ -40,10 +36,9 @@ export function WeatherSearchForm() { return; } await searchWeather(trimmedCity); - } - + return ( -
+
@@ -52,16 +47,16 @@ export function WeatherSearchForm() { setCity(e.target.value)} + onChange={handleInputChange} placeholder="请输入城市名称" disabled={isLoading} - className={cn('pl-10 pr-4 py-2 w-full', inputError && 'border-red-500')} + className={cn('pl-10 pr-4 py-2 w-full text-base rounded-xl bg-slate-50/50 focus:bg-white transition-all', inputError && 'border-red-500') } />
{inputError && ( -
- -

{inputError}

+
+ +

{inputError}

@@ -99,4 +94,5 @@ export function WeatherSearchForm() { ) } +} } \ No newline at end of file