From a97dd11f259a57b4444001f06f9d9e751aad5905 Mon Sep 17 00:00:00 2001 From: Cosmo Date: Thu, 23 Apr 2026 19:35:01 +0000 Subject: [PATCH] revert(home): restore weather hero with anim + details, drop Countdown from home MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Focus/Countdown не лежат по high-density. На Home вернул старый weather-hero: WeatherAnimation (фон + иконка), feelsLike/humidity/wind, 76px display-цифра (чуть крупнее прежних 64). FocusCard и CountdownCard файлы оставляем для будущего, но на главной не подключаем. Убрал сопутствующие state/fetch (tramNext, countdowns, nextEvent). Co-Authored-By: Claude Opus 4.7 (1M context) --- app/page.tsx | 148 +++++++++++++++++++++++++-------------------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 8b3fb24..9ebc7ca 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -14,8 +14,6 @@ import WeatherAnimation from '@/components/WeatherAnimation' import VoiceOverlay from '@/components/VoiceOverlay' import TimerWidget from '@/components/TimerWidget' import TimerHomeWidget from '@/components/TimerHomeWidget' -import FocusCard from '@/components/FocusCard' -import CountdownCard from '@/components/CountdownCard' type Tab = 'home' | 'devices' | 'calendar' | 'notes' | 'settings' @@ -448,8 +446,6 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S const [calLoading, setCalLoading] = useState(true) const [pinnedNotes, setPinnedNotes] = useState([]) const [selectedDay, setSelectedDay] = useState(null) - const [countdowns, setCountdowns] = useState<{ label: string; date: string }[]>([]) - const [tramNext, setTramNext] = useState<{ route: string; minutes: number; direction: string } | null>(null) useEffect(() => { fetch('/api/calendar?range=today') @@ -489,57 +485,8 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S }) .catch(() => {}) - // Countdowns - fetch('/api/countdowns') - .then(r => r.json()) - .then(d => setCountdowns((d.countdowns || []).map((c: any) => ({ label: c.label, date: c.date })))) - .catch(() => {}) }, []) - // Nearest upcoming tram — refresh every 30s so FocusCard stays current - useEffect(() => { - let cancelled = false - const STOP_IDS = [ - { id: '16226', direction: 'в центр' }, - { id: '16354', direction: 'от центра' }, - ] - const load = async () => { - try { - const results = await Promise.all( - STOP_IDS.map(s => - fetch(`/api/transport?stopId=${s.id}`) - .then(r => r.json()) - .then(j => (j.arrivals || []).map((a: any) => ({ ...a, direction: s.direction }))) - .catch(() => []) - ) - ) - const all = results.flat().filter(a => typeof a.minutes === 'number' && a.minutes >= 0) - all.sort((a: any, b: any) => a.minutes - b.minutes) - if (!cancelled) { - setTramNext(all[0] ? { - route: all[0].route, - minutes: all[0].minutes, - direction: all[0].direction, - } : null) - } - } catch {} - } - load() - const t = setInterval(load, 30_000) - return () => { cancelled = true; clearInterval(t) } - }, []) - - // Next event (today or tomorrow) — сейчас or nearest upcoming within next 24h - const nextEvent = (() => { - const now = Date.now() - const pool = [...todayEvents, ...tomorrowEvents] - .filter(e => !e.allDay) - .map(e => ({ e, t: new Date(e.start).getTime() })) - .filter(({ t }) => t >= now - 5 * 60_000) - .sort((a, b) => a.t - b.t) - return pool[0]?.e || null - })() - return ( @@ -548,19 +495,82 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S padding: '18px 22px 24px', display: 'flex', flexDirection: 'column', gap: 14, }}> - {/* ───── Bento row: Focus hero + Tram ───── */} + {/* ───── Bento row: Hero weather + Tram ───── */}
- {/* Focus — контекст-hero */} - + {/* Hero weather card */} + {weather ? ( +
weather?.forecast?.[0] && setSelectedDay(weather.forecast[0])} + style={{ + padding: '24px 26px', + display: 'flex', flexDirection: 'column', + position: 'relative', overflow: 'hidden', + cursor: 'pointer', + }} + > + {/* Decorative animation, large, behind */} +
+ +
+ +
+ Сейчас +
+ +
+
+ {weather.temp}° +
+ +
+ +
+ {weather.desc} +
+ +
+ {weather.feelsLike && ( +
+
Ощущается
+
{weather.feelsLike}°
+
+ )} + {weather.humidity && ( +
+
Влажность
+
{weather.humidity}
+
+ )} + {weather.windSpeed && ( +
+
Ветер
+
{weather.windSpeed}
+
+ )} +
+
+ ) : ( +
+ Загрузка погоды... +
+ )} {/* Tram */} @@ -701,16 +711,6 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S
- {/* ───── Row 4: Countdown ───── */} -
- -
{/* место под будущий виджет */} -
- {/* Weather day detail modal */} {selectedDay && (