Add "Mein Zimmer" room-control page (Home Assistant, proxied through the backend)
Implements the room-control page from the design mockup: a scenes row above cards for shutters, color lamps, and brightness-only lamps, all driven by a new `general.ha` config section (server URL, token, ordered device/scene lists). The backend proxies every Home Assistant call server-side (GET/POST /api/ha/...) rather than the browser calling Home Assistant directly, so the long-lived token never leaves the LAN device and Home Assistant's own CORS settings don't need to know about musicmouse at all. Card kind (shutter/color/brightness-only) is inferred at runtime from what Home Assistant reports about each entity, not configured explicitly. Also stops tracking python-backend/config.yml, which had drifted into the repo despite its own header saying it shouldn't be - it now carries real credentials locally and needs to stay untracked. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
interface Props {
|
||||
title?: string;
|
||||
mascot?: string;
|
||||
/** Shown next to the title when the mouse is reachable but the firmware is not. */
|
||||
status?: ReactNode;
|
||||
/** A pill linking to the other page - there's no router, so it's a click handler
|
||||
* rather than an `href`. */
|
||||
link?: { label: string; onClick: () => void };
|
||||
}
|
||||
|
||||
export function AppHeader({ status }: Props) {
|
||||
export function AppHeader({
|
||||
title = "Musik Delphin",
|
||||
mascot = "/dolphin-mascot.png",
|
||||
status,
|
||||
link,
|
||||
}: Props) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
@@ -16,13 +26,30 @@ export function AppHeader({ status }: Props) {
|
||||
// The status bar is translucent in standalone mode, so make room for it.
|
||||
padding: "calc(18px + env(safe-area-inset-top)) 32px 6px",
|
||||
flex: "none",
|
||||
position: "relative",
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src="/dolphin-mascot.png"
|
||||
alt=""
|
||||
style={{ width: 64, height: 64, objectFit: "contain" }}
|
||||
/>
|
||||
{link && (
|
||||
<button
|
||||
onClick={link.onClick}
|
||||
style={{
|
||||
position: "absolute",
|
||||
left: 24,
|
||||
border: "none",
|
||||
cursor: "pointer",
|
||||
background: "oklch(97% 0.01 230 / .95)",
|
||||
color: "oklch(30% 0.03 230)",
|
||||
fontWeight: 800,
|
||||
fontSize: 14,
|
||||
padding: "9px 16px",
|
||||
borderRadius: 999,
|
||||
boxShadow: "0 6px 18px oklch(15% 0.04 230 / .4)",
|
||||
}}
|
||||
>
|
||||
{link.label}
|
||||
</button>
|
||||
)}
|
||||
<img src={mascot} alt="" style={{ width: 64, height: 64, objectFit: "contain" }} />
|
||||
<div
|
||||
style={{
|
||||
fontSize: 34,
|
||||
@@ -31,7 +58,7 @@ export function AppHeader({ status }: Props) {
|
||||
textShadow: "0 3px 14px oklch(15% 0.05 210 / .5)",
|
||||
}}
|
||||
>
|
||||
Musik Delphin
|
||||
{title}
|
||||
</div>
|
||||
{status}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user