feat: new layout, rooms row, fix weather+HA, fix BottomNav overflow
All checks were successful
Deploy to Coolify / deploy (push) Successful in 5s

- Remove TasksCard and SavingsCard from home tab
- New grid layout: lights+thermostat row 1, purifier+weather row 2
- Add RoomsRow component with room navigation
- Fix HA entity mapping: fan.zhimi_rmb1_9528_air_purifier → fan.air_purifier
- Add real entity aliases for HA route
- Fix weather route: add timeout, better error handling
- Fix BottomNav: use 100dvh + flex-shrink-0
- TopBar: accept isDemo prop, show Demo badge in header
- WeatherCard: compact prop, better loading/error states
- globals.css: add no-scrollbar utility
This commit is contained in:
Cosmo
2026-04-22 10:33:20 +00:00
parent ecf69400f6
commit 088cd35ea6
7 changed files with 375 additions and 152 deletions

View File

@@ -18,22 +18,28 @@ function getWeatherEmoji(code: string): string {
}
function formatDate(dateStr: string): string {
const d = new Date(dateStr);
const d = new Date(dateStr + "T12:00:00");
return d.toLocaleDateString("ru-RU", { weekday: "short", day: "numeric" });
}
interface Props {
weather: any;
compact?: boolean;
}
export default function WeatherCard({ weather }: Props) {
export default function WeatherCard({ weather, compact }: Props) {
if (!weather) {
return (
<motion.div
className="glass-card p-6 h-full flex items-center justify-center"
className="glass-card p-6 h-full flex flex-col items-center justify-center gap-3"
style={{
background: "rgba(59,130,246,0.03)",
border: "1px solid rgba(59,130,246,0.1)",
}}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
>
<div className="text-3xl animate-pulse">🌤</div>
<div className="text-sm" style={{ color: "var(--text-secondary)" }}>
Загрузка погоды...
</div>
@@ -41,9 +47,30 @@ export default function WeatherCard({ weather }: Props) {
);
}
const hasData = weather.temp && weather.temp !== "—";
if (!hasData) {
return (
<motion.div
className="glass-card p-6 h-full flex flex-col items-center justify-center gap-2"
style={{
background: "rgba(59,130,246,0.03)",
border: "1px solid rgba(59,130,246,0.1)",
}}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
>
<div className="text-3xl">🌧</div>
<div className="text-sm text-center" style={{ color: "var(--text-secondary)" }}>
Нет данных о погоде
</div>
</motion.div>
);
}
return (
<motion.div
className="glass-card p-6 h-full flex flex-col"
className="glass-card p-5 h-full flex flex-col"
style={{
background: "rgba(59,130,246,0.05)",
border: "1px solid rgba(59,130,246,0.15)",
@@ -55,26 +82,29 @@ export default function WeatherCard({ weather }: Props) {
>
{/* Location */}
<div
className="text-sm font-medium mb-3"
className="text-xs font-medium mb-2"
style={{ color: "var(--text-secondary)" }}
>
📍 Санкт-Петербург
</div>
{/* Current weather */}
<div className="flex items-center gap-4 mb-4">
<div className="text-5xl leading-none">
<div className="flex items-center gap-3 mb-3">
<div className={compact ? "text-3xl leading-none" : "text-4xl leading-none"}>
{getWeatherEmoji(weather.weatherCode)}
</div>
<div>
<div
className="font-black leading-none"
style={{ fontSize: "44px", color: "var(--text-primary)" }}
style={{
fontSize: compact ? "36px" : "42px",
color: "var(--text-primary)",
}}
>
{weather.temp}°
</div>
<div
className="text-sm mt-1"
className="text-xs mt-0.5"
style={{ color: "var(--text-secondary)" }}
>
{weather.desc}
@@ -83,24 +113,21 @@ export default function WeatherCard({ weather }: Props) {
</div>
{/* Stats */}
<div className="flex gap-4 mb-4">
<div className="flex items-center gap-1.5">
<Droplets size={14} color="#3b82f6" />
<div className="flex gap-3 mb-3 flex-wrap">
<div className="flex items-center gap-1">
<Droplets size={12} color="#3b82f6" />
<span className="text-xs" style={{ color: "var(--text-secondary)" }}>
{weather.humidity}%
</span>
</div>
<div className="flex items-center gap-1.5">
<Wind size={14} color="#8b5cf6" />
<div className="flex items-center gap-1">
<Wind size={12} color="#8b5cf6" />
<span className="text-xs" style={{ color: "var(--text-secondary)" }}>
{weather.windSpeed} км/ч
</span>
</div>
<div
className="text-xs"
style={{ color: "var(--text-secondary)" }}
>
Ощущается {weather.feelsLike}°
<div className="text-xs" style={{ color: "var(--text-secondary)" }}>
Ощущ. {weather.feelsLike}°
</div>
</div>
@@ -109,22 +136,30 @@ export default function WeatherCard({ weather }: Props) {
{(weather.forecast || []).slice(0, 3).map((day: any, i: number) => (
<motion.div
key={day.date}
className="flex-1 rounded-2xl p-2.5 text-center"
className="flex-1 rounded-xl p-2 text-center"
style={{
background: i === 0 ? "rgba(59,130,246,0.14)" : "rgba(255,255,255,0.04)",
border: i === 0 ? "1px solid rgba(59,130,246,0.28)" : "1px solid rgba(255,255,255,0.06)",
background:
i === 0
? "rgba(59,130,246,0.14)"
: "rgba(255,255,255,0.04)",
border:
i === 0
? "1px solid rgba(59,130,246,0.28)"
: "1px solid rgba(255,255,255,0.06)",
}}
initial={{ opacity: 0, y: 8 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 + i * 0.08 }}
>
<div
className="text-xs mb-1 font-medium"
className="text-xs mb-0.5 font-medium"
style={{ color: "var(--text-secondary)" }}
>
{i === 0 ? "Сег." : formatDate(day.date)}
</div>
<div className="text-lg mb-1">{getWeatherEmoji(day.weatherCode)}</div>
<div className="text-base mb-0.5">
{getWeatherEmoji(day.weatherCode)}
</div>
<div
className="text-xs font-bold"
style={{ color: "var(--text-primary)" }}