feat: add native Symcon archive trends and explicit room naming
This commit is contained in:
1 parent
bb153490b0
commit
cfc77787a0
28 files changed
+2449
-1250
No files matched your search
@@ -7,7 +7,7 @@ import { PACKAGES, type PackageId } from "../../../packages.ts";
|
||||
import { entityOptions } from "../entities.ts";
|
||||
import { checkField, colorField, entityField, hint, numberField, selectField, textField } from "../fields.ts";
|
||||
import type { EditorHost } from "../host.ts";
|
||||
import type { RectField } from "../ops/rooms.ts";
|
||||
import { areaLeafName, type RectField } from "../ops/rooms.ts";
|
||||
import { SPOT_TYPES, spotCount, spotItems } from "../ops/spots.ts";
|
||||
import type { SideState } from "../side-state.ts";
|
||||
import { formatArea, formatLength } from "../../../units.ts";
|
||||
@@ -161,6 +161,7 @@ export function renderRoomForm(host: EditorHost, state: SideState, room: Room, a
|
||||
<div class="nf-form">
|
||||
${textField(host, t("room_name"), room.name, (v) => actions.patch({ name: v }), { wide: true })}
|
||||
${selectField(host, t("area"), room.area_id ?? "", areaChoices, (id) => actions.setArea(id), { wide: true })}
|
||||
${isSymcon(host.hass) && room.area_id ? html`<button type="button" class="nf-btn nf-wide nf-take-area-name" ?disabled=${!host.admin || !areaLeafName(host.hass, room.area_id)} @click=${() => actions.patch({ name: areaLeafName(host.hass, room.area_id!) })}>Bereichsnamen übernehmen</button>` : nothing}
|
||||
${(room.sub_areas ?? []).map((a) => html`<span class="nf-chip nf-wide">${host.hass?.areas?.[a]?.name ?? a} <button class="nf-btn nf-field-btn" ?disabled=${!host.admin} title=${t("delete")} @click=${() => actions.patch({ sub_areas: (room.sub_areas ?? []).filter((x) => x !== a).length ? (room.sub_areas ?? []).filter((x) => x !== a) : null })}>✕</button></span>`)}
|
||||
${room.area_id
|
||||
? selectField(host, t("sub_area_add"), "", areaChoices.filter(([id]) => id !== room.area_id && !(room.sub_areas ?? []).includes(id)), (id) => id && actions.patch({ sub_areas: [...(room.sub_areas ?? []), id] }), { wide: true, title: t("sub_area_hint") })
|
||||
|
||||
Reference in new issue
Block a user