@burdenoff/microfe-timecampus 2026.1114.1 → 2026.1122.1
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/dist/timecampus/components/maps/LocationGeofenceMap.d.ts +60 -0
- package/dist/timecampus/components/maps/LocationGeofenceMap.js +423 -0
- package/dist/timecampus/components/maps/LocationGeofenceMap.js.map +1 -0
- package/dist/timecampus/components/maps/index.d.ts +2 -0
- package/dist/timecampus/components/maps/index.js +3 -0
- package/dist/timecampus/components/maps/locationGeometry.d.ts +105 -0
- package/dist/timecampus/components/maps/locationGeometry.js +114 -0
- package/dist/timecampus/components/maps/locationGeometry.js.map +1 -0
- package/dist/timecampus/components/maps/mapTheme.d.ts +25 -0
- package/dist/timecampus/components/maps/mapTheme.js +45 -0
- package/dist/timecampus/components/maps/mapTheme.js.map +1 -0
- package/dist/timecampus/pages/geofencing/GeofencingPage.js +743 -423
- package/dist/timecampus/pages/geofencing/GeofencingPage.js.map +1 -1
- package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js +386 -185
- package/dist/timecampus/pages/location-tracking/LocationTrackingPage.js.map +1 -1
- package/package.json +12 -9
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export interface MapGeofenceItem {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
latitude: number;
|
|
5
|
+
longitude: number;
|
|
6
|
+
radius: number;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
trigger?: string | null;
|
|
9
|
+
address?: string | null;
|
|
10
|
+
eventsCount?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface MapLocationEntryItem {
|
|
13
|
+
id: string;
|
|
14
|
+
latitude: number;
|
|
15
|
+
longitude: number;
|
|
16
|
+
address?: string | null;
|
|
17
|
+
startTime: string;
|
|
18
|
+
endTime?: string | null;
|
|
19
|
+
duration?: number | null;
|
|
20
|
+
accuracy?: number | null;
|
|
21
|
+
geofenceId?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface DraftGeofenceState {
|
|
24
|
+
latitude: number;
|
|
25
|
+
longitude: number;
|
|
26
|
+
radius: number;
|
|
27
|
+
name?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface DraftPointState {
|
|
30
|
+
latitude: number;
|
|
31
|
+
longitude: number;
|
|
32
|
+
}
|
|
33
|
+
export type MapInteractiveMode = "view" | "place-geofence" | "pick-point";
|
|
34
|
+
export interface LocationGeofenceMapProps {
|
|
35
|
+
geofences?: readonly MapGeofenceItem[];
|
|
36
|
+
locationEntries?: readonly MapLocationEntryItem[];
|
|
37
|
+
selectedGeofenceId?: string | null;
|
|
38
|
+
selectedLocationId?: string | null;
|
|
39
|
+
onSelectGeofence?: (id: string) => void;
|
|
40
|
+
onSelectLocation?: (id: string) => void;
|
|
41
|
+
draftGeofence?: DraftGeofenceState | null;
|
|
42
|
+
draftPoint?: DraftPointState | null;
|
|
43
|
+
interactiveMode?: MapInteractiveMode;
|
|
44
|
+
onDraftGeofenceChange?: (next: {
|
|
45
|
+
latitude: number;
|
|
46
|
+
longitude: number;
|
|
47
|
+
radius: number;
|
|
48
|
+
}) => void;
|
|
49
|
+
onPickPoint?: (coords: {
|
|
50
|
+
latitude: number;
|
|
51
|
+
longitude: number;
|
|
52
|
+
}) => void;
|
|
53
|
+
showGeofences?: boolean;
|
|
54
|
+
showLocationPath?: boolean;
|
|
55
|
+
heightClassName?: string;
|
|
56
|
+
ariaLabel?: string;
|
|
57
|
+
testId?: string;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
export declare function LocationGeofenceMap({ geofences, locationEntries, selectedGeofenceId, selectedLocationId, onSelectGeofence, onSelectLocation, draftGeofence, draftPoint, interactiveMode, onDraftGeofenceChange, onPickPoint, showGeofences, showLocationPath, heightClassName, ariaLabel, testId, className, }: LocationGeofenceMapProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { cn as e } from "../../utils/helpers.js";
|
|
2
|
+
import { DEFAULT_MAP_CENTER as t, clampGeofenceRadius as n, computeCircleHandlePosition as r, formatCoordinates as i, formatRadius as a, haversineDistanceMeters as o, isValidCoordinate as s, isValidGeofenceGeometry as c, partitionValidGeofences as l, partitionValidLocationEntries as ee, roundCoordinate as u } from "./locationGeometry.js";
|
|
3
|
+
import { ensureLeafletStyles as d, resolveCssToken as f, zoneTokenForIndex as p } from "./mapTheme.js";
|
|
4
|
+
import { useCallback as te, useEffect as m, useMemo as ne, useRef as h, useState as g } from "react";
|
|
5
|
+
import { AlertTriangle as re, Crosshair as ie, Minus as ae, Plus as oe, RefreshCw as se, WifiOff as ce } from "lucide-react";
|
|
6
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
7
|
+
import y from "leaflet";
|
|
8
|
+
// src/timecampus/components/maps/LocationGeofenceMap.tsx
|
|
9
|
+
var le = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", ue = "© OpenStreetMap contributors";
|
|
10
|
+
function de(e) {
|
|
11
|
+
let t = document.createElement("div"), n = document.createElement("div");
|
|
12
|
+
n.style.fontWeight = "600", n.textContent = e.name, t.appendChild(n);
|
|
13
|
+
let r = document.createElement("div");
|
|
14
|
+
r.style.marginTop = "2px", r.style.opacity = "0.85";
|
|
15
|
+
let o = e.isActive ? "Active" : "Inactive";
|
|
16
|
+
if (r.textContent = `${a(e.radius)} radius · ${o}`, t.appendChild(r), e.address) {
|
|
17
|
+
let n = document.createElement("div");
|
|
18
|
+
n.style.marginTop = "2px", n.textContent = e.address, t.appendChild(n);
|
|
19
|
+
}
|
|
20
|
+
let s = document.createElement("div");
|
|
21
|
+
return s.style.marginTop = "4px", s.style.fontSize = "11px", s.style.opacity = "0.75", s.textContent = i(e.latitude, e.longitude), t.appendChild(s), t;
|
|
22
|
+
}
|
|
23
|
+
function fe(e, t) {
|
|
24
|
+
let n = document.createElement("div"), r = document.createElement("div");
|
|
25
|
+
r.style.fontWeight = "600", r.textContent = `${t + 1}. ${e.address?.trim() || "Tracked location"}`, n.appendChild(r);
|
|
26
|
+
let a = document.createElement("div");
|
|
27
|
+
a.style.marginTop = "2px", a.style.opacity = "0.85";
|
|
28
|
+
let o = e.geofenceId ? "Geofenced" : "Manual", s = new Date(e.startTime);
|
|
29
|
+
a.textContent = `${o} · ${Number.isFinite(s.getTime()) ? s.toLocaleString() : e.startTime}`, n.appendChild(a);
|
|
30
|
+
let c = document.createElement("div");
|
|
31
|
+
return c.style.marginTop = "4px", c.style.fontSize = "11px", c.style.opacity = "0.75", c.textContent = i(e.latitude, e.longitude), n.appendChild(c), n;
|
|
32
|
+
}
|
|
33
|
+
function b({ geofences: b = [], locationEntries: x = [], selectedGeofenceId: S = null, selectedLocationId: C = null, onSelectGeofence: w, onSelectLocation: T, draftGeofence: E = null, draftPoint: D = null, interactiveMode: O = "view", onDraftGeofenceChange: k, onPickPoint: A, showGeofences: j = !0, showLocationPath: M = !0, heightClassName: pe = "h-[320px] sm:h-[420px] lg:h-[520px]", ariaLabel: me = "Interactive location and geofence map", testId: N = "location-geofence-map", className: he }) {
|
|
34
|
+
let ge = h(null), P = h(null), F = h(null), I = h(null), L = h(null), R = h(null), z = h(!1), B = h({
|
|
35
|
+
loaded: 0,
|
|
36
|
+
errors: 0
|
|
37
|
+
}), [_e, V] = g(!1), [ve, H] = g(""), [U, ye] = g(null), W = h(w), be = h(T), G = h(k), K = h(A), q = h(O), J = h(E);
|
|
38
|
+
m(() => {
|
|
39
|
+
W.current = w, be.current = T, G.current = k, K.current = A, q.current = O, J.current = E;
|
|
40
|
+
}, [
|
|
41
|
+
w,
|
|
42
|
+
T,
|
|
43
|
+
k,
|
|
44
|
+
A,
|
|
45
|
+
O,
|
|
46
|
+
E
|
|
47
|
+
]);
|
|
48
|
+
let { valid: Y, invalid: xe } = ne(() => l(b), [b]), { valid: X, invalid: Se } = ne(() => ee(x), [x]), Z = xe.length + Se.length, Q = te((e = !0) => {
|
|
49
|
+
let n = P.current;
|
|
50
|
+
if (!n) return;
|
|
51
|
+
let i = y.latLngBounds([]);
|
|
52
|
+
if (j) for (let e of Y) {
|
|
53
|
+
let t = r(e.latitude, e.longitude, e.radius);
|
|
54
|
+
i.extend([e.latitude, e.longitude]), i.extend(t);
|
|
55
|
+
}
|
|
56
|
+
for (let e of X) i.extend([e.latitude, e.longitude]);
|
|
57
|
+
E && c(E) && (i.extend([E.latitude, E.longitude]), i.extend(r(E.latitude, E.longitude, E.radius))), D && s(D.latitude, D.longitude) && i.extend([D.latitude, D.longitude]), i.isValid() ? (n.fitBounds(i, {
|
|
58
|
+
padding: [40, 40],
|
|
59
|
+
maxZoom: 16
|
|
60
|
+
}), e && H("Map fitted to visible zones and locations.")) : (n.setView([t[0], t[1]], 13), e && H("Map reset to default view."));
|
|
61
|
+
}, [
|
|
62
|
+
E,
|
|
63
|
+
D,
|
|
64
|
+
j,
|
|
65
|
+
Y,
|
|
66
|
+
X
|
|
67
|
+
]);
|
|
68
|
+
m(() => {
|
|
69
|
+
let e = ge.current;
|
|
70
|
+
if (!e) return;
|
|
71
|
+
d();
|
|
72
|
+
let r = y.map(e, {
|
|
73
|
+
center: [t[0], t[1]],
|
|
74
|
+
zoom: 13,
|
|
75
|
+
zoomControl: !1,
|
|
76
|
+
scrollWheelZoom: !0,
|
|
77
|
+
keyboard: !1
|
|
78
|
+
});
|
|
79
|
+
P.current = r;
|
|
80
|
+
let o = y.tileLayer(le, {
|
|
81
|
+
attribution: ue,
|
|
82
|
+
maxZoom: 19,
|
|
83
|
+
crossOrigin: !0
|
|
84
|
+
});
|
|
85
|
+
o.on("tileload", () => {
|
|
86
|
+
B.current.loaded += 1, V(!1);
|
|
87
|
+
}), o.on("tileerror", () => {
|
|
88
|
+
B.current.errors += 1, (B.current.loaded === 0 || B.current.errors >= 3) && V(!0);
|
|
89
|
+
}), o.addTo(r), F.current = o, y.control.scale({
|
|
90
|
+
imperial: !1,
|
|
91
|
+
position: "bottomright"
|
|
92
|
+
}).addTo(r), I.current = y.layerGroup().addTo(r), L.current = y.layerGroup().addTo(r), R.current = y.layerGroup().addTo(r), r.on("mousemove", (e) => {
|
|
93
|
+
ye({
|
|
94
|
+
latitude: u(e.latlng.lat),
|
|
95
|
+
longitude: u(e.latlng.lng)
|
|
96
|
+
});
|
|
97
|
+
}), r.on("mouseout", () => {
|
|
98
|
+
ye(null);
|
|
99
|
+
}), r.on("click", (e) => {
|
|
100
|
+
let t = q.current, r = u(e.latlng.lat), o = u(e.latlng.lng);
|
|
101
|
+
if (s(r, o)) {
|
|
102
|
+
if (t === "place-geofence") {
|
|
103
|
+
let e = n(J.current?.radius ?? 150);
|
|
104
|
+
G.current?.({
|
|
105
|
+
latitude: r,
|
|
106
|
+
longitude: o,
|
|
107
|
+
radius: e
|
|
108
|
+
}), H(`Placed geofence center at ${i(r, o)} with ${a(e)} radius.`);
|
|
109
|
+
} else t === "pick-point" && (K.current?.({
|
|
110
|
+
latitude: r,
|
|
111
|
+
longitude: o
|
|
112
|
+
}), H(`Selected coordinates ${i(r, o)}.`));
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
let c = typeof ResizeObserver < "u" ? new ResizeObserver(() => {
|
|
116
|
+
r.invalidateSize();
|
|
117
|
+
}) : null;
|
|
118
|
+
c?.observe(e);
|
|
119
|
+
let l = window.setTimeout(() => r.invalidateSize(), 100);
|
|
120
|
+
return () => {
|
|
121
|
+
window.clearTimeout(l), c?.disconnect(), r.remove(), P.current = null, F.current = null, I.current = null, L.current = null, R.current = null, z.current = !1;
|
|
122
|
+
};
|
|
123
|
+
}, []), m(() => {
|
|
124
|
+
let e = I.current;
|
|
125
|
+
if (!e || (e.clearLayers(), !j)) return;
|
|
126
|
+
let t = f("--color-text-muted"), n = f("--color-action-primary-bg");
|
|
127
|
+
Y.forEach((r, i) => {
|
|
128
|
+
let o = r.id === S, s = r.isActive ? o ? n : f(p(i)) : t, c = y.circle([r.latitude, r.longitude], {
|
|
129
|
+
radius: r.radius,
|
|
130
|
+
color: s,
|
|
131
|
+
fillColor: s,
|
|
132
|
+
fillOpacity: o ? .28 : r.isActive ? .16 : .08,
|
|
133
|
+
weight: o ? 3 : 2,
|
|
134
|
+
dashArray: r.isActive ? void 0 : "6 6"
|
|
135
|
+
});
|
|
136
|
+
c.bindTooltip(`${r.name} (${a(r.radius)})`, {
|
|
137
|
+
direction: "top",
|
|
138
|
+
sticky: !0
|
|
139
|
+
}), c.bindPopup(de(r)), c.on("click", () => {
|
|
140
|
+
q.current === "view" && W.current?.(r.id);
|
|
141
|
+
}), c.addTo(e);
|
|
142
|
+
let l = y.circleMarker([r.latitude, r.longitude], {
|
|
143
|
+
radius: o ? 6 : 4,
|
|
144
|
+
color: f("--color-bg-surface"),
|
|
145
|
+
fillColor: s,
|
|
146
|
+
fillOpacity: 1,
|
|
147
|
+
weight: 2
|
|
148
|
+
});
|
|
149
|
+
l.on("click", () => {
|
|
150
|
+
q.current === "view" && W.current?.(r.id);
|
|
151
|
+
}), l.addTo(e);
|
|
152
|
+
});
|
|
153
|
+
}, [
|
|
154
|
+
S,
|
|
155
|
+
j,
|
|
156
|
+
Y
|
|
157
|
+
]), m(() => {
|
|
158
|
+
let e = L.current;
|
|
159
|
+
if (!e || (e.clearLayers(), X.length === 0)) return;
|
|
160
|
+
let t = f("--color-chart-2"), n = f("--color-action-primary-bg"), r = f("--color-chart-4"), a = f("--color-bg-surface");
|
|
161
|
+
if (M && X.length >= 2) {
|
|
162
|
+
let n = X.map((e) => [e.latitude, e.longitude]);
|
|
163
|
+
y.polyline(n, {
|
|
164
|
+
color: t,
|
|
165
|
+
weight: 2.5,
|
|
166
|
+
opacity: .75,
|
|
167
|
+
dashArray: "6 6"
|
|
168
|
+
}).addTo(e);
|
|
169
|
+
}
|
|
170
|
+
X.forEach((t, o) => {
|
|
171
|
+
let s = t.id === C, c = t.geofenceId ? n : r;
|
|
172
|
+
s && typeof t.accuracy == "number" && Number.isFinite(t.accuracy) && t.accuracy > 0 && y.circle([t.latitude, t.longitude], {
|
|
173
|
+
radius: Math.min(t.accuracy, 2e3),
|
|
174
|
+
color: c,
|
|
175
|
+
fillColor: c,
|
|
176
|
+
fillOpacity: .1,
|
|
177
|
+
weight: 1,
|
|
178
|
+
dashArray: "4 4"
|
|
179
|
+
}).addTo(e);
|
|
180
|
+
let l = y.circleMarker([t.latitude, t.longitude], {
|
|
181
|
+
radius: s ? 8 : 5.5,
|
|
182
|
+
color: a,
|
|
183
|
+
fillColor: c,
|
|
184
|
+
fillOpacity: .95,
|
|
185
|
+
weight: s ? 2.5 : 1.5
|
|
186
|
+
});
|
|
187
|
+
l.bindTooltip(`${o + 1}. ${t.address?.trim() || i(t.latitude, t.longitude)}`, { direction: "top" }), l.bindPopup(fe(t, o)), l.on("click", () => {
|
|
188
|
+
be.current?.(t.id);
|
|
189
|
+
}), l.addTo(e);
|
|
190
|
+
});
|
|
191
|
+
}, [
|
|
192
|
+
C,
|
|
193
|
+
M,
|
|
194
|
+
X
|
|
195
|
+
]), m(() => {
|
|
196
|
+
let e = R.current;
|
|
197
|
+
if (!e) return;
|
|
198
|
+
e.clearLayers();
|
|
199
|
+
let t = f("--color-action-primary-bg");
|
|
200
|
+
if (E && c(E)) {
|
|
201
|
+
let c = y.circle([E.latitude, E.longitude], {
|
|
202
|
+
radius: E.radius,
|
|
203
|
+
color: t,
|
|
204
|
+
fillColor: t,
|
|
205
|
+
fillOpacity: .22,
|
|
206
|
+
weight: 2.5,
|
|
207
|
+
dashArray: "8 5"
|
|
208
|
+
}).addTo(e), l = y.divIcon({
|
|
209
|
+
className: "tc-map-dot-marker",
|
|
210
|
+
html: "<div class=\"tc-map-dot-inner--draft\" title=\"Drag to move geofence center\"></div>",
|
|
211
|
+
iconSize: [18, 18],
|
|
212
|
+
iconAnchor: [9, 9]
|
|
213
|
+
}), ee = r(E.latitude, E.longitude, E.radius), d = y.divIcon({
|
|
214
|
+
className: "tc-map-dot-marker",
|
|
215
|
+
html: "<div class=\"tc-map-radius-handle\" title=\"Drag to resize geofence radius\"></div>",
|
|
216
|
+
iconSize: [16, 16],
|
|
217
|
+
iconAnchor: [8, 8]
|
|
218
|
+
}), f = y.marker([E.latitude, E.longitude], {
|
|
219
|
+
icon: l,
|
|
220
|
+
draggable: !0,
|
|
221
|
+
zIndexOffset: 500
|
|
222
|
+
}).addTo(e), p = y.marker(ee, {
|
|
223
|
+
icon: d,
|
|
224
|
+
draggable: !0,
|
|
225
|
+
zIndexOffset: 510
|
|
226
|
+
}).addTo(e);
|
|
227
|
+
f.on("drag", () => {
|
|
228
|
+
let e = f.getLatLng(), t = u(e.lat), i = u(e.lng);
|
|
229
|
+
c.setLatLng([t, i]);
|
|
230
|
+
let a = n(J.current?.radius ?? E.radius);
|
|
231
|
+
p.setLatLng(r(t, i, a));
|
|
232
|
+
}), f.on("dragend", () => {
|
|
233
|
+
let e = f.getLatLng(), t = u(e.lat), r = u(e.lng), a = n(J.current?.radius ?? E.radius);
|
|
234
|
+
s(t, r) && (G.current?.({
|
|
235
|
+
latitude: t,
|
|
236
|
+
longitude: r,
|
|
237
|
+
radius: a
|
|
238
|
+
}), H(`Moved geofence center to ${i(t, r)}.`));
|
|
239
|
+
}), p.on("drag", () => {
|
|
240
|
+
let e = p.getLatLng(), t = f.getLatLng(), r = n(o(t.lat, t.lng, e.lat, e.lng));
|
|
241
|
+
c.setRadius(r);
|
|
242
|
+
}), p.on("dragend", () => {
|
|
243
|
+
let e = p.getLatLng(), t = f.getLatLng(), r = n(o(t.lat, t.lng, e.lat, e.lng));
|
|
244
|
+
G.current?.({
|
|
245
|
+
latitude: u(t.lat),
|
|
246
|
+
longitude: u(t.lng),
|
|
247
|
+
radius: r
|
|
248
|
+
}), H(`Resized geofence radius to ${a(r)}.`);
|
|
249
|
+
});
|
|
250
|
+
} else if (D && s(D.latitude, D.longitude)) {
|
|
251
|
+
let t = y.divIcon({
|
|
252
|
+
className: "tc-map-dot-marker",
|
|
253
|
+
html: "<div class=\"tc-map-dot-inner--draft\" title=\"Drag to adjust location\"></div>",
|
|
254
|
+
iconSize: [18, 18],
|
|
255
|
+
iconAnchor: [9, 9]
|
|
256
|
+
}), n = y.marker([D.latitude, D.longitude], {
|
|
257
|
+
icon: t,
|
|
258
|
+
draggable: !0,
|
|
259
|
+
zIndexOffset: 500
|
|
260
|
+
}).addTo(e);
|
|
261
|
+
n.on("dragend", () => {
|
|
262
|
+
let e = n.getLatLng(), t = u(e.lat), r = u(e.lng);
|
|
263
|
+
s(t, r) && (K.current?.({
|
|
264
|
+
latitude: t,
|
|
265
|
+
longitude: r
|
|
266
|
+
}), H(`Moved location marker to ${i(t, r)}.`));
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}, [E, D]), m(() => {
|
|
270
|
+
z.current || (Y.length > 0 || X.length > 0 || E && c(E) || D && s(D.latitude, D.longitude)) && (z.current = !0, Q(!1));
|
|
271
|
+
}, [
|
|
272
|
+
E,
|
|
273
|
+
D,
|
|
274
|
+
Q,
|
|
275
|
+
Y,
|
|
276
|
+
X
|
|
277
|
+
]), m(() => {
|
|
278
|
+
let e = P.current;
|
|
279
|
+
if (!e || !S) return;
|
|
280
|
+
let t = Y.find((e) => e.id === S);
|
|
281
|
+
if (!t) return;
|
|
282
|
+
let n = r(t.latitude, t.longitude, t.radius), i = y.latLngBounds([[t.latitude, t.longitude], n]);
|
|
283
|
+
e.fitBounds(i, {
|
|
284
|
+
padding: [64, 64],
|
|
285
|
+
maxZoom: 16
|
|
286
|
+
});
|
|
287
|
+
}, [S, Y]), m(() => {
|
|
288
|
+
let e = P.current;
|
|
289
|
+
if (!e || !C) return;
|
|
290
|
+
let t = X.find((e) => e.id === C);
|
|
291
|
+
t && e.setView([t.latitude, t.longitude], Math.max(e.getZoom(), 15));
|
|
292
|
+
}, [C, X]);
|
|
293
|
+
let Ce = () => {
|
|
294
|
+
P.current?.zoomIn(), H("Zoomed in.");
|
|
295
|
+
}, we = () => {
|
|
296
|
+
P.current?.zoomOut(), H("Zoomed out.");
|
|
297
|
+
}, Te = () => {
|
|
298
|
+
B.current = {
|
|
299
|
+
loaded: 0,
|
|
300
|
+
errors: 0
|
|
301
|
+
}, V(!1), F.current?.redraw(), H("Retrying map tiles.");
|
|
302
|
+
}, Ee = (e) => {
|
|
303
|
+
let t = P.current;
|
|
304
|
+
if (t) switch (e.key) {
|
|
305
|
+
case "ArrowUp":
|
|
306
|
+
e.preventDefault(), t.panBy([0, -80]);
|
|
307
|
+
break;
|
|
308
|
+
case "ArrowDown":
|
|
309
|
+
e.preventDefault(), t.panBy([0, 80]);
|
|
310
|
+
break;
|
|
311
|
+
case "ArrowLeft":
|
|
312
|
+
e.preventDefault(), t.panBy([-80, 0]);
|
|
313
|
+
break;
|
|
314
|
+
case "ArrowRight":
|
|
315
|
+
e.preventDefault(), t.panBy([80, 0]);
|
|
316
|
+
break;
|
|
317
|
+
case "+":
|
|
318
|
+
case "=":
|
|
319
|
+
e.preventDefault(), Ce();
|
|
320
|
+
break;
|
|
321
|
+
case "-":
|
|
322
|
+
case "_":
|
|
323
|
+
e.preventDefault(), we();
|
|
324
|
+
break;
|
|
325
|
+
case "0": e.preventDefault(), Q();
|
|
326
|
+
}
|
|
327
|
+
}, $ = U ? i(U.latitude, U.longitude) : E && c(E) ? `${i(E.latitude, E.longitude)} · ${a(E.radius)}` : D && s(D.latitude, D.longitude) ? i(D.latitude, D.longitude) : null;
|
|
328
|
+
return /* @__PURE__ */ v("div", {
|
|
329
|
+
"data-testid": N,
|
|
330
|
+
className: e("relative w-full min-w-0 overflow-hidden rounded-xl border border-border-seam bg-bg-sunken", he),
|
|
331
|
+
children: [
|
|
332
|
+
_e && /* @__PURE__ */ v("div", {
|
|
333
|
+
role: "status",
|
|
334
|
+
"data-testid": "map-tile-error-banner",
|
|
335
|
+
className: "flex flex-wrap items-center justify-between gap-2 border-b border-border-subtle bg-status-warning-bg px-3 py-2 text-xs text-text-primary",
|
|
336
|
+
children: [/* @__PURE__ */ v("span", {
|
|
337
|
+
className: "flex items-center gap-2 font-medium",
|
|
338
|
+
children: [/* @__PURE__ */ _(ce, { className: "h-3.5 w-3.5 shrink-0" }), "Map tiles could not be loaded. Coordinate placement, geofence overlays, and controls remain available."]
|
|
339
|
+
}), /* @__PURE__ */ v("button", {
|
|
340
|
+
type: "button",
|
|
341
|
+
onClick: Te,
|
|
342
|
+
className: "inline-flex items-center gap-1 rounded-md border border-border-default bg-bg-surface px-2 py-1 text-xs font-medium text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
|
|
343
|
+
children: [/* @__PURE__ */ _(se, { className: "h-3 w-3" }), "Retry tiles"]
|
|
344
|
+
})]
|
|
345
|
+
}),
|
|
346
|
+
Z > 0 && /* @__PURE__ */ v("div", {
|
|
347
|
+
role: "status",
|
|
348
|
+
"data-testid": "map-malformed-geometry-banner",
|
|
349
|
+
className: "flex items-center gap-2 border-b border-border-subtle bg-status-warning-bg px-3 py-2 text-xs text-text-primary",
|
|
350
|
+
children: [/* @__PURE__ */ _(re, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ v("span", { children: [
|
|
351
|
+
"Skipped ",
|
|
352
|
+
Z,
|
|
353
|
+
" record",
|
|
354
|
+
Z === 1 ? "" : "s",
|
|
355
|
+
" ",
|
|
356
|
+
"with invalid coordinates or radius."
|
|
357
|
+
] })]
|
|
358
|
+
}),
|
|
359
|
+
/* @__PURE__ */ v("div", {
|
|
360
|
+
role: "region",
|
|
361
|
+
"aria-label": me,
|
|
362
|
+
tabIndex: 0,
|
|
363
|
+
onKeyDown: Ee,
|
|
364
|
+
className: e("tc-map-canvas relative w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-focus", pe, O !== "view" && "cursor-crosshair"),
|
|
365
|
+
children: [
|
|
366
|
+
/* @__PURE__ */ _("div", {
|
|
367
|
+
ref: ge,
|
|
368
|
+
className: "h-full w-full",
|
|
369
|
+
"data-testid": `${N}-canvas`
|
|
370
|
+
}),
|
|
371
|
+
O !== "view" && /* @__PURE__ */ _("div", {
|
|
372
|
+
className: "pointer-events-none absolute left-3 top-3 z-[420] max-w-[calc(100%-5rem)] rounded-lg border border-border-default bg-bg-surface/95 px-3 py-1.5 text-xs font-medium text-text-primary shadow-sm backdrop-blur-sm",
|
|
373
|
+
children: O === "place-geofence" ? "Click on the map to place the geofence center, then drag the pin or outer handle to adjust." : "Click on the map to place or move the location pin."
|
|
374
|
+
}),
|
|
375
|
+
/* @__PURE__ */ v("div", {
|
|
376
|
+
className: "absolute right-3 top-3 z-[420] flex flex-col overflow-hidden rounded-lg border border-border-default bg-bg-surface/95 shadow-sm backdrop-blur-sm",
|
|
377
|
+
role: "group",
|
|
378
|
+
"aria-label": "Map navigation controls",
|
|
379
|
+
children: [
|
|
380
|
+
/* @__PURE__ */ _("button", {
|
|
381
|
+
type: "button",
|
|
382
|
+
onClick: Ce,
|
|
383
|
+
"aria-label": "Zoom in",
|
|
384
|
+
title: "Zoom in (+)",
|
|
385
|
+
className: "flex h-8 w-8 items-center justify-center border-b border-border-subtle text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-focus",
|
|
386
|
+
children: /* @__PURE__ */ _(oe, { className: "h-4 w-4" })
|
|
387
|
+
}),
|
|
388
|
+
/* @__PURE__ */ _("button", {
|
|
389
|
+
type: "button",
|
|
390
|
+
onClick: we,
|
|
391
|
+
"aria-label": "Zoom out",
|
|
392
|
+
title: "Zoom out (-)",
|
|
393
|
+
className: "flex h-8 w-8 items-center justify-center border-b border-border-subtle text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-focus",
|
|
394
|
+
children: /* @__PURE__ */ _(ae, { className: "h-4 w-4" })
|
|
395
|
+
}),
|
|
396
|
+
/* @__PURE__ */ _("button", {
|
|
397
|
+
type: "button",
|
|
398
|
+
onClick: () => Q(!0),
|
|
399
|
+
"aria-label": "Fit map to zones and points",
|
|
400
|
+
title: "Fit all (0)",
|
|
401
|
+
className: "flex h-8 w-8 items-center justify-center text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-focus",
|
|
402
|
+
children: /* @__PURE__ */ _(ie, { className: "h-4 w-4" })
|
|
403
|
+
})
|
|
404
|
+
]
|
|
405
|
+
}),
|
|
406
|
+
$ && /* @__PURE__ */ _("div", {
|
|
407
|
+
"data-testid": "map-coordinates-readout",
|
|
408
|
+
className: "pointer-events-none absolute bottom-3 left-3 z-[420] rounded-md border border-border-subtle bg-bg-surface/90 px-2.5 py-1 font-mono text-[11px] text-text-secondary backdrop-blur-sm",
|
|
409
|
+
children: $
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ _("div", {
|
|
412
|
+
className: "sr-only",
|
|
413
|
+
"aria-live": "polite",
|
|
414
|
+
children: ve
|
|
415
|
+
})
|
|
416
|
+
]
|
|
417
|
+
})
|
|
418
|
+
]
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
export { b as LocationGeofenceMap };
|
|
422
|
+
|
|
423
|
+
//# sourceMappingURL=LocationGeofenceMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocationGeofenceMap.js","names":["L","OSM_TILE_URL","OSM_ATTRIBUTION","buildGeofencePopup","wrap","title","fence","meta","statusText","formatRadius","addr","coords","formatCoordinates","buildLocationPopup","index","entry","sourceLabel","startDate","LocationGeofenceMap","containerRef","useRef","mapRef","tileLayerRef","geofenceLayerRef","locationLayerRef","draftLayerRef","hasAutoFittedRef","tileStatsRef","tileDegraded","setTileDegraded","useState","statusAnnouncement","setStatusAnnouncement","cursorCoords","setCursorCoords","onSelectGeofenceRef","onSelectGeofence","onSelectLocationRef","onSelectLocation","onDraftGeofenceChangeRef","onDraftGeofenceChange","onPickPointRef","onPickPoint","interactiveModeRef","interactiveMode","draftGeofenceRef","draftGeofence","validGeofences","invalidGeofences","useMemo","partitionValidGeofences","geofences","validLocations","invalidLocations","partitionValidLocationEntries","locationEntries","malformedCount","fitAllFeatures","useCallback","map","bounds","showGeofences","edge","computeCircleHandlePosition","isValidGeofenceGeometry","draftPoint","isValidCoordinate","announce","DEFAULT_MAP_CENTER","useEffect","el","tileLayer","roundCoordinate","event","mode","lat","lng","radius","clampGeofenceRadius","resizeObserver","timer","group","mutedStroke","resolveCssToken","primaryStroke","isSelected","selectedGeofenceId","tokenColor","zoneTokenForIndex","circle","centerMarker","pathColor","geofencedColor","manualColor","surfaceColor","showLocationPath","latLngs","selectedLocationId","fillColor","marker","primaryColor","draftCircle","centerIcon","handlePosition","handleIcon","handleMarker","pos","nextLat","nextLng","currentRadius","handlePos","centerPos","nextRadius","haversineDistanceMeters","pointIcon","target","f","handleZoomIn","handleZoomOut","handleRetryTiles","handleKeyDown","activeCoordsLabel","testId","cn","className","WifiOff","RefreshCw","AlertTriangle","ariaLabel","heightClassName","Plus","Minus","Crosshair"],"sources":["../../../../src/timecampus/components/maps/LocationGeofenceMap.tsx"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n} from \"react\";\nimport L from \"leaflet\";\nimport {\n AlertTriangle,\n Crosshair,\n Minus,\n Plus,\n RefreshCw,\n WifiOff,\n} from \"lucide-react\";\nimport { cn } from \"../../utils/helpers\";\nimport {\n DEFAULT_GEOFENCE_RADIUS_METERS,\n DEFAULT_MAP_CENTER,\n DEFAULT_MAP_ZOOM,\n clampGeofenceRadius,\n computeCircleHandlePosition,\n formatCoordinates,\n formatRadius,\n haversineDistanceMeters,\n isValidCoordinate,\n isValidGeofenceGeometry,\n partitionValidGeofences,\n partitionValidLocationEntries,\n roundCoordinate,\n} from \"./locationGeometry\";\nimport {\n ensureLeafletStyles,\n resolveCssToken,\n zoneTokenForIndex,\n} from \"./mapTheme\";\n\nexport interface MapGeofenceItem {\n id: string;\n name: string;\n latitude: number;\n longitude: number;\n radius: number;\n isActive: boolean;\n trigger?: string | null;\n address?: string | null;\n eventsCount?: number;\n}\n\nexport interface MapLocationEntryItem {\n id: string;\n latitude: number;\n longitude: number;\n address?: string | null;\n startTime: string;\n endTime?: string | null;\n duration?: number | null;\n accuracy?: number | null;\n geofenceId?: string | null;\n}\n\nexport interface DraftGeofenceState {\n latitude: number;\n longitude: number;\n radius: number;\n name?: string;\n}\n\nexport interface DraftPointState {\n latitude: number;\n longitude: number;\n}\n\nexport type MapInteractiveMode = \"view\" | \"place-geofence\" | \"pick-point\";\n\nexport interface LocationGeofenceMapProps {\n geofences?: readonly MapGeofenceItem[];\n locationEntries?: readonly MapLocationEntryItem[];\n selectedGeofenceId?: string | null;\n selectedLocationId?: string | null;\n onSelectGeofence?: (id: string) => void;\n onSelectLocation?: (id: string) => void;\n draftGeofence?: DraftGeofenceState | null;\n draftPoint?: DraftPointState | null;\n interactiveMode?: MapInteractiveMode;\n onDraftGeofenceChange?: (next: {\n latitude: number;\n longitude: number;\n radius: number;\n }) => void;\n onPickPoint?: (coords: { latitude: number; longitude: number }) => void;\n showGeofences?: boolean;\n showLocationPath?: boolean;\n heightClassName?: string;\n ariaLabel?: string;\n testId?: string;\n className?: string;\n}\n\nconst OSM_TILE_URL = \"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\";\nconst OSM_ATTRIBUTION = \"© OpenStreetMap contributors\";\n\nfunction buildGeofencePopup(fence: MapGeofenceItem): HTMLElement {\n const wrap = document.createElement(\"div\");\n const title = document.createElement(\"div\");\n title.style.fontWeight = \"600\";\n title.textContent = fence.name;\n wrap.appendChild(title);\n\n const meta = document.createElement(\"div\");\n meta.style.marginTop = \"2px\";\n meta.style.opacity = \"0.85\";\n const statusText = fence.isActive ? \"Active\" : \"Inactive\";\n meta.textContent = `${formatRadius(fence.radius)} radius · ${statusText}`;\n wrap.appendChild(meta);\n\n if (fence.address) {\n const addr = document.createElement(\"div\");\n addr.style.marginTop = \"2px\";\n addr.textContent = fence.address;\n wrap.appendChild(addr);\n }\n\n const coords = document.createElement(\"div\");\n coords.style.marginTop = \"4px\";\n coords.style.fontSize = \"11px\";\n coords.style.opacity = \"0.75\";\n coords.textContent = formatCoordinates(fence.latitude, fence.longitude);\n wrap.appendChild(coords);\n\n return wrap;\n}\n\nfunction buildLocationPopup(\n entry: MapLocationEntryItem,\n index: number,\n): HTMLElement {\n const wrap = document.createElement(\"div\");\n const title = document.createElement(\"div\");\n title.style.fontWeight = \"600\";\n title.textContent = `${index + 1}. ${entry.address?.trim() || \"Tracked location\"}`;\n wrap.appendChild(title);\n\n const meta = document.createElement(\"div\");\n meta.style.marginTop = \"2px\";\n meta.style.opacity = \"0.85\";\n const sourceLabel = entry.geofenceId ? \"Geofenced\" : \"Manual\";\n const startDate = new Date(entry.startTime);\n const timeText = Number.isFinite(startDate.getTime())\n ? startDate.toLocaleString()\n : entry.startTime;\n meta.textContent = `${sourceLabel} · ${timeText}`;\n wrap.appendChild(meta);\n\n const coords = document.createElement(\"div\");\n coords.style.marginTop = \"4px\";\n coords.style.fontSize = \"11px\";\n coords.style.opacity = \"0.75\";\n coords.textContent = formatCoordinates(entry.latitude, entry.longitude);\n wrap.appendChild(coords);\n\n return wrap;\n}\n\nexport function LocationGeofenceMap({\n geofences = [],\n locationEntries = [],\n selectedGeofenceId = null,\n selectedLocationId = null,\n onSelectGeofence,\n onSelectLocation,\n draftGeofence = null,\n draftPoint = null,\n interactiveMode = \"view\",\n onDraftGeofenceChange,\n onPickPoint,\n showGeofences = true,\n showLocationPath = true,\n heightClassName = \"h-[320px] sm:h-[420px] lg:h-[520px]\",\n ariaLabel = \"Interactive location and geofence map\",\n testId = \"location-geofence-map\",\n className,\n}: LocationGeofenceMapProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const mapRef = useRef<L.Map | null>(null);\n const tileLayerRef = useRef<L.TileLayer | null>(null);\n const geofenceLayerRef = useRef<L.LayerGroup | null>(null);\n const locationLayerRef = useRef<L.LayerGroup | null>(null);\n const draftLayerRef = useRef<L.LayerGroup | null>(null);\n const hasAutoFittedRef = useRef(false);\n const tileStatsRef = useRef({ loaded: 0, errors: 0 });\n\n const [tileDegraded, setTileDegraded] = useState(false);\n const [statusAnnouncement, setStatusAnnouncement] = useState(\"\");\n const [cursorCoords, setCursorCoords] = useState<{\n latitude: number;\n longitude: number;\n } | null>(null);\n\n const onSelectGeofenceRef = useRef(onSelectGeofence);\n const onSelectLocationRef = useRef(onSelectLocation);\n const onDraftGeofenceChangeRef = useRef(onDraftGeofenceChange);\n const onPickPointRef = useRef(onPickPoint);\n const interactiveModeRef = useRef(interactiveMode);\n const draftGeofenceRef = useRef(draftGeofence);\n\n useEffect(() => {\n onSelectGeofenceRef.current = onSelectGeofence;\n onSelectLocationRef.current = onSelectLocation;\n onDraftGeofenceChangeRef.current = onDraftGeofenceChange;\n onPickPointRef.current = onPickPoint;\n interactiveModeRef.current = interactiveMode;\n draftGeofenceRef.current = draftGeofence;\n }, [\n onSelectGeofence,\n onSelectLocation,\n onDraftGeofenceChange,\n onPickPoint,\n interactiveMode,\n draftGeofence,\n ]);\n\n const { valid: validGeofences, invalid: invalidGeofences } = useMemo(\n () => partitionValidGeofences(geofences),\n [geofences],\n );\n\n const { valid: validLocations, invalid: invalidLocations } = useMemo(\n () => partitionValidLocationEntries(locationEntries),\n [locationEntries],\n );\n\n const malformedCount = invalidGeofences.length + invalidLocations.length;\n\n const fitAllFeatures = useCallback(\n (announce = true) => {\n const map = mapRef.current;\n if (!map) return;\n\n const bounds = L.latLngBounds([]);\n if (showGeofences) {\n for (const fence of validGeofences) {\n const edge = computeCircleHandlePosition(\n fence.latitude,\n fence.longitude,\n fence.radius,\n );\n bounds.extend([fence.latitude, fence.longitude]);\n bounds.extend(edge);\n }\n }\n for (const entry of validLocations) {\n bounds.extend([entry.latitude, entry.longitude]);\n }\n if (draftGeofence && isValidGeofenceGeometry(draftGeofence)) {\n bounds.extend([draftGeofence.latitude, draftGeofence.longitude]);\n bounds.extend(\n computeCircleHandlePosition(\n draftGeofence.latitude,\n draftGeofence.longitude,\n draftGeofence.radius,\n ),\n );\n }\n if (\n draftPoint &&\n isValidCoordinate(draftPoint.latitude, draftPoint.longitude)\n ) {\n bounds.extend([draftPoint.latitude, draftPoint.longitude]);\n }\n\n if (bounds.isValid()) {\n map.fitBounds(bounds, { padding: [40, 40], maxZoom: 16 });\n if (announce) {\n setStatusAnnouncement(\"Map fitted to visible zones and locations.\");\n }\n } else {\n map.setView(\n [DEFAULT_MAP_CENTER[0], DEFAULT_MAP_CENTER[1]],\n DEFAULT_MAP_ZOOM,\n );\n if (announce) {\n setStatusAnnouncement(\"Map reset to default view.\");\n }\n }\n },\n [draftGeofence, draftPoint, showGeofences, validGeofences, validLocations],\n );\n\n // Initialize Leaflet instance once on mount.\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return undefined;\n\n ensureLeafletStyles();\n\n const map = L.map(el, {\n center: [DEFAULT_MAP_CENTER[0], DEFAULT_MAP_CENTER[1]],\n zoom: DEFAULT_MAP_ZOOM,\n zoomControl: false,\n scrollWheelZoom: true,\n keyboard: false,\n });\n mapRef.current = map;\n\n const tileLayer = L.tileLayer(OSM_TILE_URL, {\n attribution: OSM_ATTRIBUTION,\n maxZoom: 19,\n crossOrigin: true,\n });\n\n tileLayer.on(\"tileload\", () => {\n tileStatsRef.current.loaded += 1;\n setTileDegraded(false);\n });\n\n tileLayer.on(\"tileerror\", () => {\n tileStatsRef.current.errors += 1;\n if (\n tileStatsRef.current.loaded === 0 ||\n tileStatsRef.current.errors >= 3\n ) {\n setTileDegraded(true);\n }\n });\n\n tileLayer.addTo(map);\n tileLayerRef.current = tileLayer;\n L.control.scale({ imperial: false, position: \"bottomright\" }).addTo(map);\n\n geofenceLayerRef.current = L.layerGroup().addTo(map);\n locationLayerRef.current = L.layerGroup().addTo(map);\n draftLayerRef.current = L.layerGroup().addTo(map);\n\n map.on(\"mousemove\", (event: L.LeafletMouseEvent) => {\n setCursorCoords({\n latitude: roundCoordinate(event.latlng.lat),\n longitude: roundCoordinate(event.latlng.lng),\n });\n });\n\n map.on(\"mouseout\", () => {\n setCursorCoords(null);\n });\n\n map.on(\"click\", (event: L.LeafletMouseEvent) => {\n const mode = interactiveModeRef.current;\n const lat = roundCoordinate(event.latlng.lat);\n const lng = roundCoordinate(event.latlng.lng);\n if (!isValidCoordinate(lat, lng)) return;\n\n if (mode === \"place-geofence\") {\n const radius = clampGeofenceRadius(\n draftGeofenceRef.current?.radius ?? DEFAULT_GEOFENCE_RADIUS_METERS,\n );\n onDraftGeofenceChangeRef.current?.({\n latitude: lat,\n longitude: lng,\n radius,\n });\n setStatusAnnouncement(\n `Placed geofence center at ${formatCoordinates(lat, lng)} with ${formatRadius(radius)} radius.`,\n );\n } else if (mode === \"pick-point\") {\n onPickPointRef.current?.({ latitude: lat, longitude: lng });\n setStatusAnnouncement(\n `Selected coordinates ${formatCoordinates(lat, lng)}.`,\n );\n }\n });\n\n const resizeObserver =\n typeof ResizeObserver !== \"undefined\"\n ? new ResizeObserver(() => {\n map.invalidateSize();\n })\n : null;\n resizeObserver?.observe(el);\n\n const timer = window.setTimeout(() => map.invalidateSize(), 100);\n\n return () => {\n window.clearTimeout(timer);\n resizeObserver?.disconnect();\n map.remove();\n mapRef.current = null;\n tileLayerRef.current = null;\n geofenceLayerRef.current = null;\n locationLayerRef.current = null;\n draftLayerRef.current = null;\n hasAutoFittedRef.current = false;\n };\n }, []);\n\n // Render stored geofences.\n useEffect(() => {\n const group = geofenceLayerRef.current;\n if (!group) return;\n group.clearLayers();\n\n if (!showGeofences) return;\n\n const mutedStroke = resolveCssToken(\"--color-text-muted\");\n const primaryStroke = resolveCssToken(\"--color-action-primary-bg\");\n\n validGeofences.forEach((fence, index) => {\n const isSelected = fence.id === selectedGeofenceId;\n const tokenColor = fence.isActive\n ? isSelected\n ? primaryStroke\n : resolveCssToken(zoneTokenForIndex(index))\n : mutedStroke;\n\n const circle = L.circle([fence.latitude, fence.longitude], {\n radius: fence.radius,\n color: tokenColor,\n fillColor: tokenColor,\n fillOpacity: isSelected ? 0.28 : fence.isActive ? 0.16 : 0.08,\n weight: isSelected ? 3 : 2,\n dashArray: fence.isActive ? undefined : \"6 6\",\n });\n\n circle.bindTooltip(`${fence.name} (${formatRadius(fence.radius)})`, {\n direction: \"top\",\n sticky: true,\n });\n circle.bindPopup(buildGeofencePopup(fence));\n circle.on(\"click\", () => {\n if (interactiveModeRef.current === \"view\") {\n onSelectGeofenceRef.current?.(fence.id);\n }\n });\n circle.addTo(group);\n\n const centerMarker = L.circleMarker([fence.latitude, fence.longitude], {\n radius: isSelected ? 6 : 4,\n color: resolveCssToken(\"--color-bg-surface\"),\n fillColor: tokenColor,\n fillOpacity: 1,\n weight: 2,\n });\n centerMarker.on(\"click\", () => {\n if (interactiveModeRef.current === \"view\") {\n onSelectGeofenceRef.current?.(fence.id);\n }\n });\n centerMarker.addTo(group);\n });\n }, [selectedGeofenceId, showGeofences, validGeofences]);\n\n // Render location history points and chronological path.\n useEffect(() => {\n const group = locationLayerRef.current;\n if (!group) return;\n group.clearLayers();\n\n if (validLocations.length === 0) return;\n\n const pathColor = resolveCssToken(\"--color-chart-2\");\n const geofencedColor = resolveCssToken(\"--color-action-primary-bg\");\n const manualColor = resolveCssToken(\"--color-chart-4\");\n const surfaceColor = resolveCssToken(\"--color-bg-surface\");\n\n if (showLocationPath && validLocations.length >= 2) {\n const latLngs: L.LatLngExpression[] = validLocations.map((entry) => [\n entry.latitude,\n entry.longitude,\n ]);\n L.polyline(latLngs, {\n color: pathColor,\n weight: 2.5,\n opacity: 0.75,\n dashArray: \"6 6\",\n }).addTo(group);\n }\n\n validLocations.forEach((entry, index) => {\n const isSelected = entry.id === selectedLocationId;\n const fillColor = entry.geofenceId ? geofencedColor : manualColor;\n\n if (\n isSelected &&\n typeof entry.accuracy === \"number\" &&\n Number.isFinite(entry.accuracy) &&\n entry.accuracy > 0\n ) {\n L.circle([entry.latitude, entry.longitude], {\n radius: Math.min(entry.accuracy, 2000),\n color: fillColor,\n fillColor,\n fillOpacity: 0.1,\n weight: 1,\n dashArray: \"4 4\",\n }).addTo(group);\n }\n\n const marker = L.circleMarker([entry.latitude, entry.longitude], {\n radius: isSelected ? 8 : 5.5,\n color: surfaceColor,\n fillColor,\n fillOpacity: 0.95,\n weight: isSelected ? 2.5 : 1.5,\n });\n\n marker.bindTooltip(\n `${index + 1}. ${entry.address?.trim() || formatCoordinates(entry.latitude, entry.longitude)}`,\n { direction: \"top\" },\n );\n marker.bindPopup(buildLocationPopup(entry, index));\n marker.on(\"click\", () => {\n onSelectLocationRef.current?.(entry.id);\n });\n marker.addTo(group);\n });\n }, [selectedLocationId, showLocationPath, validLocations]);\n\n // Render interactive draft geofence (draggable center + radius handle) or draft point.\n useEffect(() => {\n const group = draftLayerRef.current;\n if (!group) return;\n group.clearLayers();\n\n const primaryColor = resolveCssToken(\"--color-action-primary-bg\");\n\n if (draftGeofence && isValidGeofenceGeometry(draftGeofence)) {\n const draftCircle = L.circle(\n [draftGeofence.latitude, draftGeofence.longitude],\n {\n radius: draftGeofence.radius,\n color: primaryColor,\n fillColor: primaryColor,\n fillOpacity: 0.22,\n weight: 2.5,\n dashArray: \"8 5\",\n },\n ).addTo(group);\n\n const centerIcon = L.divIcon({\n className: \"tc-map-dot-marker\",\n html: '<div class=\"tc-map-dot-inner--draft\" title=\"Drag to move geofence center\"></div>',\n iconSize: [18, 18],\n iconAnchor: [9, 9],\n });\n\n const handlePosition = computeCircleHandlePosition(\n draftGeofence.latitude,\n draftGeofence.longitude,\n draftGeofence.radius,\n );\n\n const handleIcon = L.divIcon({\n className: \"tc-map-dot-marker\",\n html: '<div class=\"tc-map-radius-handle\" title=\"Drag to resize geofence radius\"></div>',\n iconSize: [16, 16],\n iconAnchor: [8, 8],\n });\n\n const centerMarker = L.marker(\n [draftGeofence.latitude, draftGeofence.longitude],\n {\n icon: centerIcon,\n draggable: true,\n zIndexOffset: 500,\n },\n ).addTo(group);\n\n const handleMarker = L.marker(handlePosition, {\n icon: handleIcon,\n draggable: true,\n zIndexOffset: 510,\n }).addTo(group);\n\n centerMarker.on(\"drag\", () => {\n const pos = centerMarker.getLatLng();\n const nextLat = roundCoordinate(pos.lat);\n const nextLng = roundCoordinate(pos.lng);\n draftCircle.setLatLng([nextLat, nextLng]);\n const currentRadius = clampGeofenceRadius(\n draftGeofenceRef.current?.radius ?? draftGeofence.radius,\n );\n handleMarker.setLatLng(\n computeCircleHandlePosition(nextLat, nextLng, currentRadius),\n );\n });\n\n centerMarker.on(\"dragend\", () => {\n const pos = centerMarker.getLatLng();\n const nextLat = roundCoordinate(pos.lat);\n const nextLng = roundCoordinate(pos.lng);\n const currentRadius = clampGeofenceRadius(\n draftGeofenceRef.current?.radius ?? draftGeofence.radius,\n );\n if (isValidCoordinate(nextLat, nextLng)) {\n onDraftGeofenceChangeRef.current?.({\n latitude: nextLat,\n longitude: nextLng,\n radius: currentRadius,\n });\n setStatusAnnouncement(\n `Moved geofence center to ${formatCoordinates(nextLat, nextLng)}.`,\n );\n }\n });\n\n handleMarker.on(\"drag\", () => {\n const handlePos = handleMarker.getLatLng();\n const centerPos = centerMarker.getLatLng();\n const nextRadius = clampGeofenceRadius(\n haversineDistanceMeters(\n centerPos.lat,\n centerPos.lng,\n handlePos.lat,\n handlePos.lng,\n ),\n );\n draftCircle.setRadius(nextRadius);\n });\n\n handleMarker.on(\"dragend\", () => {\n const handlePos = handleMarker.getLatLng();\n const centerPos = centerMarker.getLatLng();\n const nextRadius = clampGeofenceRadius(\n haversineDistanceMeters(\n centerPos.lat,\n centerPos.lng,\n handlePos.lat,\n handlePos.lng,\n ),\n );\n onDraftGeofenceChangeRef.current?.({\n latitude: roundCoordinate(centerPos.lat),\n longitude: roundCoordinate(centerPos.lng),\n radius: nextRadius,\n });\n setStatusAnnouncement(\n `Resized geofence radius to ${formatRadius(nextRadius)}.`,\n );\n });\n\n return;\n }\n\n if (\n draftPoint &&\n isValidCoordinate(draftPoint.latitude, draftPoint.longitude)\n ) {\n const pointIcon = L.divIcon({\n className: \"tc-map-dot-marker\",\n html: '<div class=\"tc-map-dot-inner--draft\" title=\"Drag to adjust location\"></div>',\n iconSize: [18, 18],\n iconAnchor: [9, 9],\n });\n const marker = L.marker([draftPoint.latitude, draftPoint.longitude], {\n icon: pointIcon,\n draggable: true,\n zIndexOffset: 500,\n }).addTo(group);\n\n marker.on(\"dragend\", () => {\n const pos = marker.getLatLng();\n const nextLat = roundCoordinate(pos.lat);\n const nextLng = roundCoordinate(pos.lng);\n if (isValidCoordinate(nextLat, nextLng)) {\n onPickPointRef.current?.({ latitude: nextLat, longitude: nextLng });\n setStatusAnnouncement(\n `Moved location marker to ${formatCoordinates(nextLat, nextLng)}.`,\n );\n }\n });\n }\n }, [draftGeofence, draftPoint]);\n\n // Fit bounds once when initial data arrives.\n useEffect(() => {\n if (hasAutoFittedRef.current) return;\n if (\n validGeofences.length > 0 ||\n validLocations.length > 0 ||\n (draftGeofence && isValidGeofenceGeometry(draftGeofence)) ||\n (draftPoint &&\n isValidCoordinate(draftPoint.latitude, draftPoint.longitude))\n ) {\n hasAutoFittedRef.current = true;\n fitAllFeatures(false);\n }\n }, [\n draftGeofence,\n draftPoint,\n fitAllFeatures,\n validGeofences,\n validLocations,\n ]);\n\n // Focus selected geofence smoothly when selection changes.\n useEffect(() => {\n const map = mapRef.current;\n if (!map || !selectedGeofenceId) return;\n const target = validGeofences.find((f) => f.id === selectedGeofenceId);\n if (!target) return;\n const edge = computeCircleHandlePosition(\n target.latitude,\n target.longitude,\n target.radius,\n );\n const bounds = L.latLngBounds([[target.latitude, target.longitude], edge]);\n map.fitBounds(bounds, { padding: [64, 64], maxZoom: 16 });\n }, [selectedGeofenceId, validGeofences]);\n\n // Focus selected location entry smoothly when selection changes.\n useEffect(() => {\n const map = mapRef.current;\n if (!map || !selectedLocationId) return;\n const target = validLocations.find((e) => e.id === selectedLocationId);\n if (!target) return;\n map.setView(\n [target.latitude, target.longitude],\n Math.max(map.getZoom(), 15),\n );\n }, [selectedLocationId, validLocations]);\n\n const handleZoomIn = () => {\n mapRef.current?.zoomIn();\n setStatusAnnouncement(\"Zoomed in.\");\n };\n\n const handleZoomOut = () => {\n mapRef.current?.zoomOut();\n setStatusAnnouncement(\"Zoomed out.\");\n };\n\n const handleRetryTiles = () => {\n tileStatsRef.current = { loaded: 0, errors: 0 };\n setTileDegraded(false);\n tileLayerRef.current?.redraw();\n setStatusAnnouncement(\"Retrying map tiles.\");\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const map = mapRef.current;\n if (!map) return;\n const PAN_PX = 80;\n switch (event.key) {\n case \"ArrowUp\":\n event.preventDefault();\n map.panBy([0, -PAN_PX]);\n break;\n case \"ArrowDown\":\n event.preventDefault();\n map.panBy([0, PAN_PX]);\n break;\n case \"ArrowLeft\":\n event.preventDefault();\n map.panBy([-PAN_PX, 0]);\n break;\n case \"ArrowRight\":\n event.preventDefault();\n map.panBy([PAN_PX, 0]);\n break;\n case \"+\":\n case \"=\":\n event.preventDefault();\n handleZoomIn();\n break;\n case \"-\":\n case \"_\":\n event.preventDefault();\n handleZoomOut();\n break;\n case \"0\":\n event.preventDefault();\n fitAllFeatures();\n break;\n default:\n break;\n }\n };\n\n const activeCoordsLabel = cursorCoords\n ? formatCoordinates(cursorCoords.latitude, cursorCoords.longitude)\n : draftGeofence && isValidGeofenceGeometry(draftGeofence)\n ? `${formatCoordinates(draftGeofence.latitude, draftGeofence.longitude)} · ${formatRadius(draftGeofence.radius)}`\n : draftPoint &&\n isValidCoordinate(draftPoint.latitude, draftPoint.longitude)\n ? formatCoordinates(draftPoint.latitude, draftPoint.longitude)\n : null;\n\n return (\n <div\n data-testid={testId}\n className={cn(\n \"relative w-full min-w-0 overflow-hidden rounded-xl border border-border-seam bg-bg-sunken\",\n className,\n )}\n >\n {tileDegraded && (\n <div\n role=\"status\"\n data-testid=\"map-tile-error-banner\"\n className=\"flex flex-wrap items-center justify-between gap-2 border-b border-border-subtle bg-status-warning-bg px-3 py-2 text-xs text-text-primary\"\n >\n <span className=\"flex items-center gap-2 font-medium\">\n <WifiOff className=\"h-3.5 w-3.5 shrink-0\" />\n Map tiles could not be loaded. Coordinate placement, geofence\n overlays, and controls remain available.\n </span>\n <button\n type=\"button\"\n onClick={handleRetryTiles}\n className=\"inline-flex items-center gap-1 rounded-md border border-border-default bg-bg-surface px-2 py-1 text-xs font-medium text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus\"\n >\n <RefreshCw className=\"h-3 w-3\" />\n Retry tiles\n </button>\n </div>\n )}\n\n {malformedCount > 0 && (\n <div\n role=\"status\"\n data-testid=\"map-malformed-geometry-banner\"\n className=\"flex items-center gap-2 border-b border-border-subtle bg-status-warning-bg px-3 py-2 text-xs text-text-primary\"\n >\n <AlertTriangle className=\"h-3.5 w-3.5 shrink-0\" />\n <span>\n Skipped {malformedCount} record{malformedCount === 1 ? \"\" : \"s\"}{\" \"}\n with invalid coordinates or radius.\n </span>\n </div>\n )}\n\n <div\n role=\"region\"\n aria-label={ariaLabel}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n className={cn(\n \"tc-map-canvas relative w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-focus\",\n heightClassName,\n interactiveMode !== \"view\" && \"cursor-crosshair\",\n )}\n >\n <div\n ref={containerRef}\n className=\"h-full w-full\"\n data-testid={`${testId}-canvas`}\n />\n\n {/* Interactive mode helper badge */}\n {interactiveMode !== \"view\" && (\n <div className=\"pointer-events-none absolute left-3 top-3 z-[420] max-w-[calc(100%-5rem)] rounded-lg border border-border-default bg-bg-surface/95 px-3 py-1.5 text-xs font-medium text-text-primary shadow-sm backdrop-blur-sm\">\n {interactiveMode === \"place-geofence\"\n ? \"Click on the map to place the geofence center, then drag the pin or outer handle to adjust.\"\n : \"Click on the map to place or move the location pin.\"}\n </div>\n )}\n\n {/* Accessible zoom and fit controls */}\n <div\n className=\"absolute right-3 top-3 z-[420] flex flex-col overflow-hidden rounded-lg border border-border-default bg-bg-surface/95 shadow-sm backdrop-blur-sm\"\n role=\"group\"\n aria-label=\"Map navigation controls\"\n >\n <button\n type=\"button\"\n onClick={handleZoomIn}\n aria-label=\"Zoom in\"\n title=\"Zoom in (+)\"\n className=\"flex h-8 w-8 items-center justify-center border-b border-border-subtle text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-focus\"\n >\n <Plus className=\"h-4 w-4\" />\n </button>\n <button\n type=\"button\"\n onClick={handleZoomOut}\n aria-label=\"Zoom out\"\n title=\"Zoom out (-)\"\n className=\"flex h-8 w-8 items-center justify-center border-b border-border-subtle text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-focus\"\n >\n <Minus className=\"h-4 w-4\" />\n </button>\n <button\n type=\"button\"\n onClick={() => fitAllFeatures(true)}\n aria-label=\"Fit map to zones and points\"\n title=\"Fit all (0)\"\n className=\"flex h-8 w-8 items-center justify-center text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-border-focus\"\n >\n <Crosshair className=\"h-4 w-4\" />\n </button>\n </div>\n\n {/* Coordinate readout pill */}\n {activeCoordsLabel && (\n <div\n data-testid=\"map-coordinates-readout\"\n className=\"pointer-events-none absolute bottom-3 left-3 z-[420] rounded-md border border-border-subtle bg-bg-surface/90 px-2.5 py-1 font-mono text-[11px] text-text-secondary backdrop-blur-sm\"\n >\n {activeCoordsLabel}\n </div>\n )}\n\n <div className=\"sr-only\" aria-live=\"polite\">\n {statusAnnouncement}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAqGA,IAAMC,KAAe,sDACfC,KAAkB;AAExB,SAASC,GAAmB,GAAqC;CAC/D,IAAMC,IAAO,SAAS,cAAc,KAAK,GACnCC,IAAQ,SAAS,cAAc,KAAK;CAG1C,AAFA,EAAM,MAAM,aAAa,OACzB,EAAM,cAAcC,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A;OAC1B,CAAA;MACL;;KAGJX,KACC,kBAAC,OAAD;MACE,eAAY;MACZ,WAAU;MAET,UAAAA;KACE,CAAA;KAGP,kBAAC,OAAD;MAAK,WAAU;MAAU,aAAU;MAChC,UAAA1F;KACE,CAAA;IACF;;EACF;;AAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { LocationGeofenceMap, type DraftGeofenceState, type DraftPointState, type LocationGeofenceMapProps, type MapGeofenceItem, type MapInteractiveMode, type MapLocationEntryItem, } from './LocationGeofenceMap';
|
|
2
|
+
export { DEFAULT_GEOFENCE_RADIUS_METERS, DEFAULT_MAP_CENTER, DEFAULT_MAP_ZOOM, MAX_GEOFENCE_RADIUS_METERS, MIN_GEOFENCE_RADIUS_METERS, clampGeofenceRadius, computeCircleHandlePosition, formatCoordinates, formatRadius, haversineDistanceMeters, isValidCoordinate, isValidGeofenceGeometry, parseStrictNumber, partitionValidGeofences, partitionValidLocationEntries, roundCoordinate, validateGeofenceForm, validateLocationEntryForm, type GeofenceFormDraft, type GeofenceFormValidationResult, type LocationEntryFormDraft, type LocationEntryFormValidationResult, } from './locationGeometry';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DEFAULT_MAP_CENTER as e, MAX_GEOFENCE_RADIUS_METERS as t, clampGeofenceRadius as n, formatCoordinates as r, formatRadius as i, isValidCoordinate as a, isValidGeofenceGeometry as o, parseStrictNumber as s, roundCoordinate as c, validateGeofenceForm as l, validateLocationEntryForm as u } from "./locationGeometry.js";
|
|
2
|
+
import { LocationGeofenceMap as d } from "./LocationGeofenceMap.js";
|
|
3
|
+
export { e as DEFAULT_MAP_CENTER, d as LocationGeofenceMap, t as MAX_GEOFENCE_RADIUS_METERS, n as clampGeofenceRadius, r as formatCoordinates, i as formatRadius, a as isValidCoordinate, o as isValidGeofenceGeometry, s as parseStrictNumber, c as roundCoordinate, l as validateGeofenceForm, u as validateLocationEntryForm };
|