@7365admin1/layer-common 4.97.1-staging.640 → 4.97.1-staging.642

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.
@@ -57,7 +57,8 @@
57
57
  <v-card variant="outlined" :class="{ 'cctv-dd__picked': picked.has(p.file) }">
58
58
  <div class="cctv-dd__thumb" @click="togglePick(p.file)">
59
59
  <img v-if="thumbs[key(p.file)]" :src="thumbs[key(p.file)]" :alt="`Waiting photo from ${when(p.at)}`" />
60
- <v-icon v-else icon="mdi-image-outline" size="28" />
60
+ <v-icon v-else-if="thumbFailed.has(key(p.file))" icon="mdi-image-broken-variant" size="28" />
61
+ <v-progress-circular v-else indeterminate size="24" width="2" aria-label="Loading photo" />
61
62
  <v-checkbox-btn :model-value="picked.has(p.file)" class="cctv-dd__check" density="compact" aria-label="Select photo" @click.stop @update:model-value="togglePick(p.file)" />
62
63
  </div>
63
64
  <div class="pa-2">
@@ -84,7 +85,8 @@
84
85
  <v-col v-for="f in data.sorted[s]" :key="f" cols="4" sm="3" md="2">
85
86
  <div class="cctv-dd__thumb cctv-dd__thumb--sm">
86
87
  <img v-if="thumbs[key(f, s)]" :src="thumbs[key(f, s)]" :alt="`Photo sorted as ${s}`" />
87
- <v-icon v-else icon="mdi-image-outline" size="24" />
88
+ <v-icon v-else-if="thumbFailed.has(key(f, s))" icon="mdi-image-broken-variant" size="24" />
89
+ <v-progress-circular v-else indeterminate size="20" width="2" aria-label="Loading photo" />
88
90
  <v-btn icon="mdi-close" size="x-small" variant="flat" class="cctv-dd__remove" :disabled="busy" :aria-label="`Remove this photo from ${s}`" @click="discard([f], s)" />
89
91
  </div>
90
92
  </v-col>
@@ -122,6 +124,8 @@ const loading = ref(false);
122
124
  const error = ref<unknown>(null);
123
125
  const busy = ref(false);
124
126
  const thumbs = ref<Record<string, string>>({});
127
+ // Photos that could not be fetched (shown as a broken picture instead of a spinner).
128
+ const thumbFailed = ref<Set<string>>(new Set());
125
129
  const picked = ref<Set<string>>(new Set());
126
130
  const alerts = ref<string[]>([]);
127
131
  const confirmDiscard = ref(false);
@@ -158,7 +162,7 @@ async function loadThumbs() {
158
162
  const url = await classifierPhoto(props.engine, props.name, t.file, t.state);
159
163
  thumbs.value = { ...thumbs.value, [t.k]: url };
160
164
  } catch {
161
- /* placeholder stays */
165
+ thumbFailed.value = new Set(thumbFailed.value).add(t.k);
162
166
  }
163
167
  }
164
168
  };
@@ -33,7 +33,8 @@
33
33
  <tr v-if="event.faceName"><th>Face</th><td>{{ event.faceName }}</td></tr>
34
34
  <tr v-if="event.plate"><th>Plate</th><td>{{ event.plate }}</td></tr>
35
35
  <tr v-if="!isClassification"><th>Zones</th><td>{{ (event.zones ?? []).join(", ") || "None" }}<template v-if="(event.enteredZones ?? []).length"> (entered: {{ event.enteredZones.join(" then ") }})</template></td></tr>
36
- <tr><th>Confidence</th><td>{{ scoreText(event.score) }}</td></tr>
36
+ <!-- A smart detection result carries no score from the engine. -->
37
+ <tr v-if="!isClassification"><th>Confidence</th><td>{{ scoreText(event.score) }}</td></tr>
37
38
  <tr v-if="event.incident"><th>Incident</th><td>An incident report was created for this alert.</td></tr>
38
39
  </tbody>
39
40
  </v-table>
@@ -176,7 +176,7 @@
176
176
  type="button"
177
177
  class="hero-bmap__name"
178
178
  :class="{ 'hero-bmap__name--left': nameTagSide(r.left, r.top, r.name, plane.w, plane.h, BUILDING_TAG).flipX }"
179
- :style="{ transform: `translateZ(${look.pinZ}px) ${unskew}` }"
179
+ :style="{ transform: `translateZ(${look.pinZ + (nameTagStack(f.robots)[r.id] ?? 0) * TAG_STEP}px) ${unskew}` }"
180
180
  @click.stop="emit('open', r.id)"
181
181
  @mousedown.stop
182
182
  >
@@ -246,6 +246,7 @@ import { siteFloorKey, siteFloorLabel, type TSiteFloor } from "../../utils/robot
246
246
  import {
247
247
  BUILDING_TAG,
248
248
  nameTagSide,
249
+ nameTagStack,
249
250
  brandName,
250
251
  siteFloorOf,
251
252
  mapFloors,
@@ -287,6 +288,9 @@ import {
287
288
  type TMapCamera,
288
289
  } from "../../utils/robot-building";
289
290
 
291
+ // Height between stacked name tags of robots standing close together (px, along the pin).
292
+ const TAG_STEP = 22;
293
+
290
294
  const props = withDefaults(
291
295
  defineProps<{
292
296
  organization: string;
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.97.1-staging.640",
5
+ "version": "4.97.1-staging.642",
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.",
@@ -2041,3 +2041,22 @@ export function jobOptionsLine(offered: { clean: boolean; rounds: boolean; modes
2041
2041
  }
2042
2042
  return "";
2043
2043
  }
2044
+
2045
+ /**
2046
+ * Name tags of robots standing close together on one floor would print on top of each other. Each robot gets a
2047
+ * stack level: 0 for the first in a cluster, 1, 2... for the next ones, so their tags can be raised one above the
2048
+ * other. `near` is in plan percent.
2049
+ * ponytail: O(n^2) per floor, fine for the handful of robots a floor carries.
2050
+ */
2051
+ export function nameTagStack(robots: { id: string; left: string; top: string }[], near = { x: 14, y: 8 }): Record<string, number> {
2052
+ const pct = (v: string) => Number.parseFloat(v) || 0;
2053
+ const out: Record<string, number> = {};
2054
+ robots.forEach((r, i) => {
2055
+ const taken = new Set(robots.slice(0, i).filter((o) => Math.abs(pct(o.left) - pct(r.left)) < near.x && Math.abs(pct(o.top) - pct(r.top)) < near.y).map((o) => out[o.id]));
2056
+ let level = 0;
2057
+ while (taken.has(level)) level++;
2058
+ out[r.id] = level;
2059
+ });
2060
+ return out;
2061
+ }
2062
+