@7365admin1/layer-common 4.2.24 → 4.2.26
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.
- package/CHANGELOG.md +32 -4
- package/assets/css/screens.css +132 -0
- package/assets/css/shell.css +4 -0
- package/components/NotificationSettings.vue +15 -26
- package/components/VisitorSocketPopUp.vue +71 -36
- package/composables/useNotificationPreference.ts +6 -3
- package/composables/useVisitorSocket.ts +31 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.2.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0b370e9: Notification Settings: say which channels are on, and stop drawing a switch that cannot move.
|
|
8
|
+
|
|
9
|
+
Every category read "On everywhere" while the Email row beneath it was disabled with a sentence explaining that nothing emails anyone about it — the screen offered a control it could not honour, then counted the two controls it could as all three. The summary now names the channels that are on ("On: In the app, Phone alerts"), and only the channels a category can actually deliver on are drawn. Both mobile settings screens get the same treatment in their own repositories.
|
|
10
|
+
|
|
11
|
+
## 4.2.25
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 332119d: Redraw the ANPR "New plate detected" toast on the product's own card surface
|
|
16
|
+
|
|
17
|
+
The realtime plate toast was Vuetify's default: a flat `color="info"` slab with
|
|
18
|
+
the plate concatenated onto the label at the same weight, an underlined
|
|
19
|
+
uppercase text link for the action and a bare 24px cross. It matched nothing
|
|
20
|
+
else in the product.
|
|
21
|
+
|
|
22
|
+
It is now the design's card - `--card` on a `--border` rule at `--r-card` with
|
|
23
|
+
the menu shadow - with the plate set at 21px above a 13.5px label, a
|
|
24
|
+
`directions_car` glyph, `AppButton`'s ghost variant for the action and a 44px
|
|
25
|
+
close button with an accessible name. The message sits in a polite live region
|
|
26
|
+
and Escape dismisses it.
|
|
27
|
+
|
|
28
|
+
Presentation only: when the toast fires, where it links and how long it stays
|
|
29
|
+
are unchanged.
|
|
30
|
+
|
|
3
31
|
## 4.2.24
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -765,11 +793,11 @@
|
|
|
765
793
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
766
794
|
own rule from two endpoints the console already calls, unprojected:
|
|
767
795
|
|
|
768
|
-
|
|
769
|
-
|
|
796
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
797
|
+
GET /api/roles/id/:role that membership's role document
|
|
770
798
|
|
|
771
|
-
|
|
772
|
-
|
|
799
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
800
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
773
801
|
|
|
774
802
|
`role.default` is the marker because it is the only property of a platform
|
|
775
803
|
staff role no API caller can set - `role.controller.ts` validates create and
|
package/assets/css/screens.css
CHANGED
|
@@ -896,6 +896,138 @@
|
|
|
896
896
|
text-transform: none;
|
|
897
897
|
}
|
|
898
898
|
|
|
899
|
+
/* ------------------------------------------------------------------ */
|
|
900
|
+
/* The ANPR plate toast (`components/VisitorSocketPopUp.vue`). */
|
|
901
|
+
/* */
|
|
902
|
+
/* The generic toast above is a coloured slab with a sentence on it, */
|
|
903
|
+
/* which is the wrong shape for this one: it carries a PAYLOAD - the */
|
|
904
|
+
/* plate the camera read - and the operator reads the number, not the */
|
|
905
|
+
/* sentence. So it is the design's own CARD instead: `--card` on a */
|
|
906
|
+
/* `--border` rule at `--r-card`, the menu shadow, and the plate set */
|
|
907
|
+
/* two steps above the label. */
|
|
908
|
+
/* */
|
|
909
|
+
/* No colour is written down here. The tint is `--info` over */
|
|
910
|
+
/* `--info-bg`, the same pair `.tone-info` paints a chip with, so the */
|
|
911
|
+
/* toast follows the theme instead of Vuetify's flat `color="info"` */
|
|
912
|
+
/* fill - which is what the owner was shown and what this replaces. */
|
|
913
|
+
/* ------------------------------------------------------------------ */
|
|
914
|
+
.anpr-toast .v-snackbar__wrapper {
|
|
915
|
+
background: var(--card);
|
|
916
|
+
color: var(--text);
|
|
917
|
+
border: 1px solid var(--border);
|
|
918
|
+
border-radius: var(--r-card);
|
|
919
|
+
box-shadow: var(--shadow-menu);
|
|
920
|
+
/* One width for every read, so the toast does not resize between plates.
|
|
921
|
+
Vuetify's own 344px minimum is left behind deliberately: a plate set at
|
|
922
|
+
21px needs the room, and a long read wraps inside this box. Vuetify's own
|
|
923
|
+
344px minimum is zeroed first, or a narrow phone gets a toast wider than
|
|
924
|
+
the screen. */
|
|
925
|
+
min-width: 0;
|
|
926
|
+
width: min(92vw, 400px);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.anpr-toast .v-snackbar__content {
|
|
930
|
+
width: 100%;
|
|
931
|
+
padding: 14px 14px 16px 16px;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
.anpr-toast__row {
|
|
935
|
+
display: flex;
|
|
936
|
+
align-items: flex-start;
|
|
937
|
+
gap: 12px;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/* The leading glyph says WHAT was detected - a vehicle, not "information".
|
|
941
|
+
`mdi-car` resolves to `directions_car` through `utils/materialSymbols.ts`. */
|
|
942
|
+
.anpr-toast__icon {
|
|
943
|
+
flex: 0 0 auto;
|
|
944
|
+
display: inline-flex;
|
|
945
|
+
align-items: center;
|
|
946
|
+
justify-content: center;
|
|
947
|
+
width: 34px;
|
|
948
|
+
height: 34px;
|
|
949
|
+
border-radius: var(--r-pill);
|
|
950
|
+
background: var(--info-bg);
|
|
951
|
+
color: var(--info);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.anpr-toast__text {
|
|
955
|
+
flex: 1 1 auto;
|
|
956
|
+
/* Without this a long read stretches the flex item instead of wrapping. */
|
|
957
|
+
min-width: 0;
|
|
958
|
+
display: flex;
|
|
959
|
+
flex-direction: column;
|
|
960
|
+
gap: 2px;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/* The label is the SMALL half. `--fs-btn` is the size the generic toast
|
|
964
|
+
already uses, so nothing here is set smaller than the product's own toast
|
|
965
|
+
text - the plate is what got bigger. */
|
|
966
|
+
/* `--text2`, not `--muted`. `utils/theme.ts` measures `--muted` at 3.24:1 on a
|
|
967
|
+
card - below AA - and this is real text, not a graphical mark. */
|
|
968
|
+
.anpr-toast__label {
|
|
969
|
+
font-size: var(--fs-btn);
|
|
970
|
+
font-weight: var(--fw-btn);
|
|
971
|
+
line-height: 1.3;
|
|
972
|
+
color: var(--text2);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/* The payload. Tabular figures so `0`/`8` and `1`/`7` cannot be mistaken for
|
|
976
|
+
one another at a barrier, and `anywhere` so a malformed read wraps inside
|
|
977
|
+
the card rather than widening it. */
|
|
978
|
+
.anpr-toast__plate {
|
|
979
|
+
font-size: 21px;
|
|
980
|
+
font-weight: var(--fw-h1);
|
|
981
|
+
letter-spacing: 0.05em;
|
|
982
|
+
line-height: 1.25;
|
|
983
|
+
color: var(--text);
|
|
984
|
+
font-variant-numeric: tabular-nums;
|
|
985
|
+
overflow-wrap: anywhere;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/* 44px, the touch minimum - the bare 24px Vuetify cross this replaces was
|
|
989
|
+
under half that. Pulled out by its own padding so the glyph still sits on
|
|
990
|
+
the card's optical edge. */
|
|
991
|
+
.anpr-toast__close {
|
|
992
|
+
flex: 0 0 auto;
|
|
993
|
+
display: inline-flex;
|
|
994
|
+
align-items: center;
|
|
995
|
+
justify-content: center;
|
|
996
|
+
width: 44px;
|
|
997
|
+
height: 44px;
|
|
998
|
+
margin: -10px -10px 0 0;
|
|
999
|
+
padding: 0;
|
|
1000
|
+
border: 0;
|
|
1001
|
+
border-radius: var(--r-inner-sm);
|
|
1002
|
+
background: transparent;
|
|
1003
|
+
color: var(--muted);
|
|
1004
|
+
cursor: pointer;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
.anpr-toast__close:hover {
|
|
1008
|
+
background: var(--hover);
|
|
1009
|
+
color: var(--text);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.anpr-toast__close:focus-visible {
|
|
1013
|
+
outline: 2px solid var(--accent);
|
|
1014
|
+
outline-offset: 2px;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/* Indented to the text column, so the button reads as belonging to the plate
|
|
1018
|
+
above it rather than to the card's edge. */
|
|
1019
|
+
.anpr-toast__actions {
|
|
1020
|
+
display: flex;
|
|
1021
|
+
margin: 12px 0 0 46px;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/* `AppButton`'s ghost is 40px everywhere else in the product; in a toast the
|
|
1025
|
+
operator is often on a tablet at a gate, so it is raised to the touch
|
|
1026
|
+
minimum here rather than changed for every screen. */
|
|
1027
|
+
.anpr-toast__actions .app-btn {
|
|
1028
|
+
min-height: 44px;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
899
1031
|
/* ------------------------------------------------------------------ */
|
|
900
1032
|
/* The "Back" link that sits above a page title. */
|
|
901
1033
|
/* `SpecificAttr.vue` (17 caller files) and `Container/Standard.vue`. */
|
package/assets/css/shell.css
CHANGED
|
@@ -284,8 +284,12 @@
|
|
|
284
284
|
pointer-events: none;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
/* `button` is on the list because the design's own controls - `AppButton` and
|
|
288
|
+
the plate toast's close - are plain `<button>` elements, not `v-btn`. Left
|
|
289
|
+
off, a redesigned toast draws a button that cannot be clicked. */
|
|
287
290
|
.v-snackbar .v-snackbar__wrapper .v-btn,
|
|
288
291
|
.v-snackbar .v-snackbar__wrapper a,
|
|
292
|
+
.v-snackbar .v-snackbar__wrapper button,
|
|
289
293
|
.v-snackbar .v-snackbar__wrapper [role="button"] {
|
|
290
294
|
pointer-events: auto;
|
|
291
295
|
}
|
|
@@ -109,28 +109,24 @@
|
|
|
109
109
|
</AppButton>
|
|
110
110
|
|
|
111
111
|
<!-- one channel per row: a switch must never sit beside the
|
|
112
|
-
NEXT channel's label, which is what a three-up grid does
|
|
112
|
+
NEXT channel's label, which is what a three-up grid does.
|
|
113
|
+
Only channels this category can really deliver on are
|
|
114
|
+
drawn — a switch that will not move is not a setting. -->
|
|
113
115
|
<v-row no-gutters>
|
|
114
116
|
<v-col
|
|
115
|
-
v-for="(channel, index) in category
|
|
117
|
+
v-for="(channel, index) in switchableIn(category)"
|
|
116
118
|
:key="channel.key"
|
|
117
119
|
cols="12"
|
|
118
|
-
:class="index < category.
|
|
120
|
+
:class="index < switchableIn(category).length - 1 ? 'border-b-thin' : ''"
|
|
119
121
|
>
|
|
120
|
-
<div
|
|
121
|
-
class="d-flex align-center justify-space-between py-2"
|
|
122
|
-
:class="{ 'channel-unavailable': !channel.supported }"
|
|
123
|
-
>
|
|
122
|
+
<div class="d-flex align-center justify-space-between py-2">
|
|
124
123
|
<div class="pr-4">
|
|
125
124
|
<div class="channel-label">{{ channel.label }}</div>
|
|
126
|
-
<div v-if="!channel.supported" class="channel-note mt-1">
|
|
127
|
-
{{ channel.note }}
|
|
128
|
-
</div>
|
|
129
125
|
</div>
|
|
130
126
|
|
|
131
127
|
<v-switch
|
|
132
128
|
:model-value="channel.enabled"
|
|
133
|
-
:disabled="
|
|
129
|
+
:disabled="saving"
|
|
134
130
|
color="primary"
|
|
135
131
|
hide-details
|
|
136
132
|
density="compact"
|
|
@@ -206,11 +202,17 @@ const allOn = computed(
|
|
|
206
202
|
categories.value.every((category) => categoryAllOn(category)),
|
|
207
203
|
);
|
|
208
204
|
|
|
209
|
-
/**
|
|
205
|
+
/**
|
|
206
|
+
* What is on, in words — so a collapsed panel still says what it is doing.
|
|
207
|
+
*
|
|
208
|
+
* The channels are NAMED rather than summarised as "on everywhere". Not every
|
|
209
|
+
* category can reach a person every way, so "everywhere" was a claim about
|
|
210
|
+
* three channels for a category that only ever had two — the screen said the
|
|
211
|
+
* email nobody sends was on.
|
|
212
|
+
*/
|
|
210
213
|
function summaryFor(category: TNotificationCategorySetting) {
|
|
211
214
|
const on = switchableIn(category).filter((c) => c.enabled);
|
|
212
215
|
if (!on.length) return "Off";
|
|
213
|
-
if (on.length === switchableIn(category).length) return "On everywhere";
|
|
214
216
|
return `On: ${on.map((c) => c.label).join(", ")}`;
|
|
215
217
|
}
|
|
216
218
|
|
|
@@ -357,17 +359,4 @@ onMounted(load);
|
|
|
357
359
|
font-size: var(--fs-breadcrumb);
|
|
358
360
|
color: var(--text2);
|
|
359
361
|
}
|
|
360
|
-
|
|
361
|
-
/* Unavailable channels are shown and explained, never hidden.
|
|
362
|
-
*
|
|
363
|
-
* They are NOT faded. The disabled switch already says the control cannot be
|
|
364
|
-
* moved, and the sentence beside it is the only place a person is told why —
|
|
365
|
-
* dimming that sentence is dimming the explanation. A blanket opacity here
|
|
366
|
-
* measured 2.3:1 against the card, which is unreadable; the row is now marked
|
|
367
|
-
* by a rule down its edge instead, and every word stays at full strength. */
|
|
368
|
-
.channel-unavailable {
|
|
369
|
-
border-left: 2px solid rgb(var(--v-border-color));
|
|
370
|
-
padding-left: 12px;
|
|
371
|
-
opacity: 1;
|
|
372
|
-
}
|
|
373
362
|
</style>
|
|
@@ -31,38 +31,54 @@
|
|
|
31
31
|
</ul>
|
|
32
32
|
</section> -->
|
|
33
33
|
|
|
34
|
+
<!--
|
|
35
|
+
THE PLATE TOAST.
|
|
36
|
+
|
|
37
|
+
The estate's own toast surface (`.app-toast`, `assets/css/screens.css`)
|
|
38
|
+
rather than Vuetify's flat `color="info"` slab, and the plate is set
|
|
39
|
+
apart from the label because the plate IS the payload - a guard reads the
|
|
40
|
+
number, not the sentence around it. Nothing here changes when the toast
|
|
41
|
+
fires, what it links to, or how long it stays; only how it is drawn.
|
|
42
|
+
-->
|
|
34
43
|
<v-snackbar
|
|
35
44
|
v-if="!isUnregisteredVisitorRoute && enableUnregisteredSnackbar && canViewVisitor"
|
|
36
45
|
v-model="snackBarMessage.modal"
|
|
37
|
-
:color="snackBarMessage.color"
|
|
38
46
|
:timeout="snackBarMessage.timeout"
|
|
39
47
|
location="bottom center"
|
|
40
|
-
class="
|
|
48
|
+
class="app-toast anpr-toast"
|
|
41
49
|
multi-line
|
|
42
50
|
:z-index="100000000"
|
|
43
51
|
>
|
|
44
|
-
<div class="
|
|
45
|
-
<
|
|
46
|
-
<
|
|
52
|
+
<div class="anpr-toast__row">
|
|
53
|
+
<span class="anpr-toast__icon" aria-hidden="true">
|
|
54
|
+
<v-icon icon="mdi-car" :size="20" />
|
|
55
|
+
</span>
|
|
56
|
+
|
|
57
|
+
<!--
|
|
58
|
+
One live region for both halves, so a screen reader announces
|
|
59
|
+
"New plate detected SLD7537A" as a single message. `polite`: a plate
|
|
60
|
+
read must not interrupt whatever the operator is being told.
|
|
61
|
+
-->
|
|
62
|
+
<div class="anpr-toast__text" role="status" aria-live="polite">
|
|
63
|
+
<span class="anpr-toast__label">{{ plateCopy.label }}</span>
|
|
64
|
+
<span class="anpr-toast__plate">{{ plateCopy.plate }}</span>
|
|
47
65
|
</div>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@click="
|
|
66
|
+
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
class="anpr-toast__close"
|
|
70
|
+
aria-label="Dismiss plate notification"
|
|
71
|
+
@click="handleCloseSnackbar"
|
|
54
72
|
>
|
|
55
|
-
|
|
56
|
-
</
|
|
73
|
+
<v-icon icon="mdi-close" :size="18" />
|
|
74
|
+
</button>
|
|
57
75
|
</div>
|
|
58
76
|
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/>
|
|
65
|
-
</template>
|
|
77
|
+
<div class="anpr-toast__actions">
|
|
78
|
+
<AppButton variant="ghost" @click="goToUnregistered">
|
|
79
|
+
Go to Unregistered
|
|
80
|
+
</AppButton>
|
|
81
|
+
</div>
|
|
66
82
|
</v-snackbar>
|
|
67
83
|
|
|
68
84
|
<!--
|
|
@@ -138,12 +154,13 @@ const lastPlateNumber = ref("");
|
|
|
138
154
|
|
|
139
155
|
const snackBarMessage = reactive({
|
|
140
156
|
timeout: 3000,
|
|
141
|
-
|
|
142
|
-
|
|
157
|
+
/** The camera's raw read. `plateToast` decides what is drawn for it. */
|
|
158
|
+
plateNumber: "",
|
|
143
159
|
modal: false,
|
|
144
|
-
isUnregistered: false,
|
|
145
160
|
});
|
|
146
161
|
|
|
162
|
+
const plateCopy = computed(() => plateToast(snackBarMessage.plateNumber));
|
|
163
|
+
|
|
147
164
|
const permanentMessageDialog = reactive({
|
|
148
165
|
modal: false,
|
|
149
166
|
text: "",
|
|
@@ -226,20 +243,21 @@ const handleCloseSnackbar = () => {
|
|
|
226
243
|
|
|
227
244
|
};
|
|
228
245
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
246
|
+
/*
|
|
247
|
+
* Several reads in quick succession REPLACE each other in this one toast -
|
|
248
|
+
* they have never stacked, and they still do not. At a busy gate a queue of
|
|
249
|
+
* toasts would put the operator several plates behind the barrier; the newest
|
|
250
|
+
* read is the one that matters, and the ones before it are on the Unregistered
|
|
251
|
+
* tab the toast links to.
|
|
252
|
+
*/
|
|
253
|
+
const showPlate = (plateNumber: string) => {
|
|
234
254
|
if (!enableUnregisteredSnackbar.value) {
|
|
235
255
|
return;
|
|
236
256
|
}
|
|
237
257
|
|
|
238
|
-
snackBarMessage.
|
|
239
|
-
snackBarMessage.color = color;
|
|
258
|
+
snackBarMessage.plateNumber = plateNumber;
|
|
240
259
|
snackBarMessage.modal = true;
|
|
241
260
|
snackBarMessage.timeout = 20000;
|
|
242
|
-
snackBarMessage.isUnregistered = isUnregistered;
|
|
243
261
|
};
|
|
244
262
|
|
|
245
263
|
const connectSocket = () => {
|
|
@@ -270,11 +288,7 @@ const connectSocket = () => {
|
|
|
270
288
|
newVisitor.value = data;
|
|
271
289
|
|
|
272
290
|
if (isCheckIn) {
|
|
273
|
-
|
|
274
|
-
`New plate detected: ${plateNumber}`,
|
|
275
|
-
"info",
|
|
276
|
-
true
|
|
277
|
-
);
|
|
291
|
+
showPlate(plateNumber);
|
|
278
292
|
lastPlateNumber.value = plateNumber;
|
|
279
293
|
return;
|
|
280
294
|
}
|
|
@@ -359,7 +373,28 @@ watch(enableUnregisteredSnackbar, (enabled) => {
|
|
|
359
373
|
}
|
|
360
374
|
});
|
|
361
375
|
|
|
376
|
+
/*
|
|
377
|
+
* Escape closes it. The close button is a real `<button>` and is reachable by
|
|
378
|
+
* tab, so the toast was already dismissible from the keyboard; Escape is what
|
|
379
|
+
* anyone actually reaches for, and it is bound only while the toast is up.
|
|
380
|
+
*/
|
|
381
|
+
const onEscape = (event: KeyboardEvent) => {
|
|
382
|
+
if (event.key === "Escape") handleCloseSnackbar();
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
watch(
|
|
386
|
+
() => snackBarMessage.modal,
|
|
387
|
+
(open) => {
|
|
388
|
+
if (typeof document === "undefined") return;
|
|
389
|
+
if (open) document.addEventListener("keydown", onEscape);
|
|
390
|
+
else document.removeEventListener("keydown", onEscape);
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
|
|
362
394
|
onUnmounted(() => {
|
|
395
|
+
if (typeof document !== "undefined") {
|
|
396
|
+
document.removeEventListener("keydown", onEscape);
|
|
397
|
+
}
|
|
363
398
|
disconnectSocket();
|
|
364
399
|
});
|
|
365
400
|
|
|
@@ -14,10 +14,13 @@
|
|
|
14
14
|
export type TNotificationChannelSetting = {
|
|
15
15
|
key: string;
|
|
16
16
|
label: string;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Whether this category can reach them this way at all. The server now sends
|
|
19
|
+
* only the channels that can, so this is true for everything it sends; the
|
|
20
|
+
* screen still filters on it so an older server, which sent all three and
|
|
21
|
+
* marked the dead one false, draws the same two switches.
|
|
22
|
+
*/
|
|
18
23
|
supported: boolean;
|
|
19
|
-
/** the plain-English reason, present only when unsupported */
|
|
20
|
-
note?: string;
|
|
21
24
|
enabled: boolean;
|
|
22
25
|
};
|
|
23
26
|
|
|
@@ -33,6 +33,37 @@ export const cameraAlertMessage = (messages: string[]): string => {
|
|
|
33
33
|
);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The two halves of the plate toast.
|
|
38
|
+
*
|
|
39
|
+
* The camera's read is the payload, so it is returned SEPARATELY from the
|
|
40
|
+
* label rather than concatenated into one sentence - the toast sets it at its
|
|
41
|
+
* own size and weight, and a run-on `"New plate detected: SLD7537A"` cannot be
|
|
42
|
+
* typeset that way.
|
|
43
|
+
*
|
|
44
|
+
* `plate` is never empty: the socket only raises this toast when a plate was
|
|
45
|
+
* read, but a build that ever calls it without one gets a word rather than a
|
|
46
|
+
* dangling label. A read is a handful of characters - anything past
|
|
47
|
+
* `MAX_PLATE_CHARS` is a malformed payload, not a number plate, and is cut so
|
|
48
|
+
* it cannot stretch the toast off the screen.
|
|
49
|
+
*/
|
|
50
|
+
export const MAX_PLATE_CHARS = 24;
|
|
51
|
+
|
|
52
|
+
export const plateToast = (
|
|
53
|
+
plateNumber?: string | null,
|
|
54
|
+
): { label: string; plate: string } => {
|
|
55
|
+
const plate = (plateNumber ?? "").trim();
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
label: "New plate detected",
|
|
59
|
+
plate: plate
|
|
60
|
+
? plate.length > MAX_PLATE_CHARS
|
|
61
|
+
? `${plate.slice(0, MAX_PLATE_CHARS)}…`
|
|
62
|
+
: plate
|
|
63
|
+
: "Unknown",
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
36
67
|
export const useVisitorSocket = () => {
|
|
37
68
|
const socketUnregisteredVisitorTrigger = useState(
|
|
38
69
|
"socketUnregisteredVisitorTrigger",
|
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.2.
|
|
5
|
+
"version": "4.2.26",
|
|
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.",
|