diff --git a/app/page.tsx b/app/page.tsx index 7b1a90a..0fd6435 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -368,7 +368,6 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S const [todayEvents, setTodayEvents] = useState([]) const [tomorrowEvents, setTomorrowEvents] = useState([]) const [calLoading, setCalLoading] = useState(true) - const [greeting, setGreeting] = useState(getGreeting()) const [pinnedNotes, setPinnedNotes] = useState([]) const [selectedDay, setSelectedDay] = useState(null) @@ -411,11 +410,6 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S .catch(() => {}) }, []) - useEffect(() => { - const t = setInterval(() => setGreeting(getGreeting()), 60000) - return () => clearInterval(t) - }, []) - return ( @@ -424,14 +418,6 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S padding: '18px 22px 24px', display: 'flex', flexDirection: 'column', gap: 14, }}> - {/* ───── Greeting ───── */} -

- {greeting} 👋 -

- {/* ───── Bento row: Hero weather + Tram ───── */}
diff --git a/components/TopBar.tsx b/components/TopBar.tsx index a3464a9..3b9b0e8 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -26,6 +26,13 @@ function formatDate(date: Date): string { return `${weekday}, ${day} ${month}` } +function getGreeting(h: number): string { + if (h >= 5 && h < 12) return 'Доброе утро' + if (h >= 12 && h < 17) return 'Добрый день' + if (h >= 17 && h < 22) return 'Добрый вечер' + return 'Доброй ночи' +} + export default function TopBar({ sensors, haConnected }: TopBarProps) { const [time, setTime] = useState(() => new Date()) @@ -40,15 +47,16 @@ export default function TopBar({ sensors, haConnected }: TopBarProps) {
{/* Left: time + date */} @@ -67,8 +75,18 @@ export default function TopBar({ sensors, haConnected }: TopBarProps) {
+ {/* Center: greeting */} +
+ {getGreeting(time.getHours())} 👋 +
+ {/* Right: sensors + weather */} -
+
{/* HA status */}