feat(frontend): always-visible gun bays, idle/plugged/charging lamp language, self-service password
- Control renders every gun declared in the chargers registry, even when the charger is offline or has not reported that connector yet (state shows Offline / No status yet in gray) - owner-specified state language: gray = idle, pulsing blue = cable in the socket (Preparing), green = charging; suspended/finishing = steady blue; fault = red - POST /api/me/password (requires current password) + /account page, username in the topbar links to it - smoke test: 58 checks (password change round-trip incl. old-password invalidation)
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
/** The signature element: a physical indicator lamp, like the ones on the
|
||||
* charger cabinet itself. Tone encodes state everywhere in the app. */
|
||||
export type LampTone = "off" | "green" | "amber" | "red" | "pulse";
|
||||
* charger cabinet itself. Owner-specified state language:
|
||||
* gray = idle · pulsing blue = cable plugged · green = charging · red = fault */
|
||||
export type LampTone = "off" | "green" | "blue" | "bluepulse" | "amber" | "red";
|
||||
|
||||
const TONE_CLASS: Record<LampTone, string> = {
|
||||
off: "lamp",
|
||||
green: "lamp lamp--green",
|
||||
blue: "lamp lamp--blue",
|
||||
bluepulse: "lamp lamp--blue lamp--pulse-blue",
|
||||
amber: "lamp lamp--amber",
|
||||
red: "lamp lamp--red",
|
||||
pulse: "lamp lamp--green lamp--pulse",
|
||||
};
|
||||
|
||||
export function Lamp({ tone, title }: { tone: LampTone; title?: string }) {
|
||||
@@ -15,20 +17,20 @@ export function Lamp({ tone, title }: { tone: LampTone; title?: string }) {
|
||||
}
|
||||
|
||||
export function statusTone(ocppStatus: string, charging: boolean): LampTone {
|
||||
if (charging) return "pulse";
|
||||
if (charging || ocppStatus === "Charging") return "green";
|
||||
switch (ocppStatus) {
|
||||
case "Charging":
|
||||
return "pulse";
|
||||
case "Preparing":
|
||||
return "bluepulse"; // cable in the socket, waiting to start
|
||||
case "SuspendedEV":
|
||||
case "SuspendedEVSE":
|
||||
case "Finishing":
|
||||
return "blue"; // still plugged, not delivering
|
||||
case "Reserved":
|
||||
return "amber";
|
||||
case "Available":
|
||||
return "green";
|
||||
case "Faulted":
|
||||
case "Unavailable":
|
||||
return "red";
|
||||
default:
|
||||
return "off";
|
||||
return "off"; // Available (idle), Offline, no status yet
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,9 @@ export default function Layout() {
|
||||
))}
|
||||
</nav>
|
||||
<div className="topbar__user">
|
||||
<span className="topbar__who">{me?.name}</span>
|
||||
<NavLink to="/account" className="topbar__who" title="Account settings">
|
||||
{me?.name}
|
||||
</NavLink>
|
||||
<button className="btn btn--ghost btn--sm" onClick={logout}>
|
||||
Log out
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user