diff --git a/app/page.tsx b/app/page.tsx index 5718544..96ca9bc 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -287,31 +287,82 @@ function LockScreen({ onUnlock }: { onUnlock: () => void }) { // ————— Home Tab ————— // ————— Weather Day Detail Modal ————— -function WeatherDayModal({ day, current, onClose }: { - day: { date: string; maxTemp: string; minTemp: string; desc: string; feelsLikeMax?: string; feelsLikeMin?: string; precipProb?: string; windSpeed?: string; humidity?: string } +type ForecastDay = { date: string; maxTemp: string; minTemp: string; desc: string; feelsLikeMax?: string; feelsLikeMin?: string; precipProb?: string; windSpeed?: string; humidity?: string } + +function WeatherDayModal({ day, days, current, onClose, onChange }: { + day: ForecastDay + days: ForecastDay[] current: WeatherData | null onClose: () => void + onChange: (d: ForecastDay) => void }) { const d = new Date(day.date) const isToday = d.toDateString() === new Date().toDateString() const dayLabel = isToday ? 'Сегодня' : d.toLocaleDateString('ru-RU', { weekday: 'long', day: 'numeric', month: 'long' }) + const idx = days.findIndex(x => x.date === day.date) + const canPrev = idx > 0 + const canNext = idx >= 0 && idx < days.length - 1 + const go = (delta: number) => { + const next = days[idx + delta] + if (next) onChange(next) + } return (