@7365admin1/layer-common 4.73.1-staging.456 → 4.73.1-staging.457
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -806,6 +806,7 @@
|
|
|
806
806
|
.hero-strip { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
|
|
807
807
|
.hero-strip .hero-fact { padding: 8px 12px; }
|
|
808
808
|
.hero-strip .hero-fact__value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
809
|
+
.hero-cleaning-warnings { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
|
|
809
810
|
.hero-detail__main { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); gap: 20px; align-items: start; }
|
|
810
811
|
.hero-detail__main--single { grid-template-columns: minmax(0, 1fr); }
|
|
811
812
|
.hero-detail__cam, .hero-detail__map { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
|
|
@@ -56,6 +56,17 @@
|
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
58
58
|
|
|
59
|
+
<!-- A scrubber's water, tanks and current job (brands that report them); warnings as tags. -->
|
|
60
|
+
<div v-if="cleaning.warnings.length" class="hero-cleaning-warnings" role="status" aria-label="Needs attention">
|
|
61
|
+
<span v-for="w in cleaning.warnings" :key="w" class="hero-tag hero-tag--outline">{{ w }}</span>
|
|
62
|
+
</div>
|
|
63
|
+
<div v-if="cleaning.facts.length" class="hero-facts hero-strip" role="list" aria-label="Water and tanks">
|
|
64
|
+
<div v-for="f in cleaning.facts" :key="f.label" class="hero-fact" role="listitem">
|
|
65
|
+
<div class="hero-fact__label">{{ f.label }}</div>
|
|
66
|
+
<div class="hero-fact__value" :title="f.value">{{ f.value }}</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
59
70
|
<!-- Above the fold: camera | map, with the commands under the map they act on. -->
|
|
60
71
|
<div v-if="!noInterface" class="hero-detail__main" :class="{ 'hero-detail__main--single': !hasCamera }">
|
|
61
72
|
<section v-if="hasCamera" class="hero-detail__cam" aria-label="Camera">
|
|
@@ -305,6 +316,7 @@ import {
|
|
|
305
316
|
robotAbilities,
|
|
306
317
|
robotErrorMessage,
|
|
307
318
|
robotFacts,
|
|
319
|
+
cleaningReadings,
|
|
308
320
|
robotStatus,
|
|
309
321
|
showSpotClean,
|
|
310
322
|
sinceText,
|
|
@@ -420,6 +432,7 @@ const stripFacts = computed(() =>
|
|
|
420
432
|
.filter((f): f is NonNullable<typeof f> => !!f)
|
|
421
433
|
.map((f) => (f.label === "Robot reports" ? { ...f, label: "Doing now" } : f)),
|
|
422
434
|
);
|
|
435
|
+
const cleaning = computed(() => cleaningReadings(live.value as any));
|
|
423
436
|
const identity = computed(() => {
|
|
424
437
|
const model = facts.value.find((f) => f.label === "Model")?.value;
|
|
425
438
|
const serial = facts.value.find((f) => f.label === "Serial")?.value;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.73.1-staging.
|
|
5
|
+
"version": "4.73.1-staging.457",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
package/utils/robot-display.ts
CHANGED
|
@@ -626,6 +626,8 @@ export type TLiveRobotState = {
|
|
|
626
626
|
capabilities?: Record<string, unknown>;
|
|
627
627
|
/** Plain-words facts for this brand + model (core `robotManifest`). */
|
|
628
628
|
profile?: TRobotProfile;
|
|
629
|
+
/** A scrubber's water, tank and job readings (core `TRobotCleaning`, brands with `waterTanks`). */
|
|
630
|
+
cleaning?: TRobotCleaning | null;
|
|
629
631
|
lastSeenAt?: string | null;
|
|
630
632
|
/** Epoch ms of the last answer that was read (set by `mergeLiveStates`). */
|
|
631
633
|
readAt?: number;
|
|
@@ -1358,6 +1360,71 @@ export function lastKnownLabel(at: unknown, now: number = Date.now()): string {
|
|
|
1358
1360
|
|
|
1359
1361
|
export type TRobotFact = { label: string; value: string; dim: boolean };
|
|
1360
1362
|
|
|
1363
|
+
/** Core's `TRobotCleaning`: levels are "low" | "medium" | "high"; parts ok=false = open / not fitted. */
|
|
1364
|
+
export type TRobotCleaning = {
|
|
1365
|
+
cleanWater?: { level?: string; percent?: number | null } | null;
|
|
1366
|
+
dirtyWater?: { level?: string; percent?: number | null } | null;
|
|
1367
|
+
parts?: Array<{ part?: string; ok?: boolean }> | null;
|
|
1368
|
+
job?: { percent?: number | null; areaDone?: number | null; areaPlanned?: number | null } | null;
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
export type TCleaningReadings = {
|
|
1372
|
+
/** Clean water · Dirty water · Tanks and covers · Job - only the ones the robot reported. */
|
|
1373
|
+
facts: TRobotFact[];
|
|
1374
|
+
/** Warning chips: "Clean water low", "Dirty water full", "Top cover open". */
|
|
1375
|
+
warnings: string[];
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1378
|
+
const LEVEL_TEXT: Readonly<Record<string, string>> = { low: "Low", medium: "Medium", high: "High" };
|
|
1379
|
+
const PART_PROBLEM: Readonly<Record<string, string>> = {
|
|
1380
|
+
"top cover": "Top cover open",
|
|
1381
|
+
"clean-water tank": "Clean-water tank not fitted",
|
|
1382
|
+
"dirty-water tank": "Dirty-water tank not fitted",
|
|
1383
|
+
"dust box": "Dust box not fitted",
|
|
1384
|
+
};
|
|
1385
|
+
const m2 = (n: number) => `${Number.isInteger(n) ? n : n.toFixed(1)} m²`;
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* A cleaning robot's water, tanks and current job in plain words, for the
|
|
1389
|
+
* detail screen (web and phones). Capability-driven: nothing unless the brand +
|
|
1390
|
+
* model reports `waterTanks` and the robot answered online; a reading the robot
|
|
1391
|
+
* did not send is left out (hide, never grey).
|
|
1392
|
+
*
|
|
1393
|
+
* Clean water low and dirty water full (high) are warnings, as is any open
|
|
1394
|
+
* cover or missing tank. The job line shows only while it cleans.
|
|
1395
|
+
*/
|
|
1396
|
+
export function cleaningReadings(live: TLiveRobotState | null | undefined): TCleaningReadings {
|
|
1397
|
+
const none: TCleaningReadings = { facts: [], warnings: [] };
|
|
1398
|
+
if (!live?.ok || live.online === false || live.capabilities?.waterTanks !== true) return none;
|
|
1399
|
+
const c = live.cleaning;
|
|
1400
|
+
if (!c || typeof c !== "object") return none;
|
|
1401
|
+
const facts: TRobotFact[] = [];
|
|
1402
|
+
const warnings: string[] = [];
|
|
1403
|
+
const water = (label: string, w: TRobotCleaning["cleanWater"]) => {
|
|
1404
|
+
const text = LEVEL_TEXT[String(w?.level ?? "")];
|
|
1405
|
+
if (!text) return "";
|
|
1406
|
+
const pct = finite(w?.percent) ? ` · ${Math.round(w!.percent as number)}%` : "";
|
|
1407
|
+
facts.push({ label, value: `${text}${pct}`, dim: false });
|
|
1408
|
+
return String(w!.level);
|
|
1409
|
+
};
|
|
1410
|
+
if (water("Clean water", c.cleanWater) === "low") warnings.push("Clean water low");
|
|
1411
|
+
if (water("Dirty water", c.dirtyWater) === "high") warnings.push("Dirty water full");
|
|
1412
|
+
const parts = (Array.isArray(c.parts) ? c.parts : []).filter((p) => p && typeof p.part === "string" && typeof p.ok === "boolean");
|
|
1413
|
+
if (parts.length) {
|
|
1414
|
+
const problems = parts.filter((p) => !p.ok).map((p) => PART_PROBLEM[p.part as string] ?? `${firstUp(String(p.part))} not fitted`);
|
|
1415
|
+
facts.push({ label: "Tanks and covers", value: problems.length ? problems.join(" · ") : "Tanks and covers OK", dim: false });
|
|
1416
|
+
warnings.push(...problems);
|
|
1417
|
+
}
|
|
1418
|
+
const j = c.job;
|
|
1419
|
+
if (j && typeof j === "object") {
|
|
1420
|
+
const bits: string[] = [];
|
|
1421
|
+
if (finite(j.percent)) bits.push(`${Math.round(j.percent as number)}% done`);
|
|
1422
|
+
if (finite(j.areaDone)) bits.push(finite(j.areaPlanned) ? `${m2(j.areaDone as number)} of ${m2(j.areaPlanned as number)}` : `${m2(j.areaDone as number)} cleaned`);
|
|
1423
|
+
if (bits.length) facts.push({ label: "This job", value: bits.join(" · "), dim: false });
|
|
1424
|
+
}
|
|
1425
|
+
return { facts, warnings };
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1361
1428
|
/**
|
|
1362
1429
|
* The detail screen's facts grid (README §3): Connection · Battery · Floor ·
|
|
1363
1430
|
* Live position · Robot reports · Model · Serial · Last seen. A fact the brand
|
|
@@ -1625,6 +1692,7 @@ export function robotAbilities(input: {
|
|
|
1625
1692
|
on("floorReporting") && "floor",
|
|
1626
1693
|
on("readLocation") && "live position",
|
|
1627
1694
|
on("thermalCamera") && "heat readings",
|
|
1695
|
+
on("waterTanks") && "water levels and tanks",
|
|
1628
1696
|
on("patrolHistory") && (on("thermalCamera") ? "past patrols with photos and temperatures" : "past patrols with photos"),
|
|
1629
1697
|
].filter(Boolean) as string[];
|
|
1630
1698
|
const p = input?.profile ?? {};
|