@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
|
@@ -5,69 +5,121 @@ import { EmptyState as r } from "../../components/EmptyState.js";
|
|
|
5
5
|
import { LoadingSkeleton as i } from "../../components/LoadingSkeleton.js";
|
|
6
6
|
import { Modal as a } from "../../components/Modal.js";
|
|
7
7
|
import "../../components/index.js";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { ChartCard as
|
|
11
|
-
import { BarsChart as
|
|
12
|
-
import { DonutChart as
|
|
13
|
-
import { ProgressMeter as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
8
|
+
import "../../components/maps/index.js";
|
|
9
|
+
import { cn as o, formatDate as ee, formatHours as s, formatTime as c } from "../../utils/helpers.js";
|
|
10
|
+
import { ChartCard as l } from "../../components/ChartCard.js";
|
|
11
|
+
import { BarsChart as te } from "../../components/charts/BarsChart.js";
|
|
12
|
+
import { DonutChart as ne } from "../../components/charts/DonutChart.js";
|
|
13
|
+
import { ProgressMeter as re } from "../../components/charts/ProgressMeter.js";
|
|
14
|
+
import { useTimeCampus as ie } from "../../providers/TimeCampusProvider.js";
|
|
15
|
+
import { DEFAULT_MAP_CENTER as u, formatCoordinates as ae, isValidCoordinate as d, parseStrictNumber as f, roundCoordinate as p, validateLocationEntryForm as oe } from "../../components/maps/locationGeometry.js";
|
|
16
|
+
import { LocationGeofenceMap as m } from "../../components/maps/LocationGeofenceMap.js";
|
|
17
|
+
import { useCreateLocationEntryMutation as se, useDeleteLocationEntryMutation as ce, useGetLocationStatsQuery as le, useListGeofencesQuery as ue, useListLocationEntriesQuery as de } from "../../../generated/wspace-operations.js";
|
|
18
|
+
import { useMemo as h, useState as g } from "react";
|
|
19
|
+
import { Building2 as fe, Clock as pe, Layers as me, MapPin as he, Plus as ge, Route as _e, Satellite as ve, Trash2 as ye } from "lucide-react";
|
|
20
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
18
21
|
// src/timecampus/pages/location-tracking/LocationTrackingPage.tsx
|
|
19
|
-
var
|
|
22
|
+
var b = 25, x = "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus", S = {
|
|
20
23
|
address: "",
|
|
21
|
-
latitude:
|
|
22
|
-
longitude:
|
|
24
|
+
latitude: String(u[0]),
|
|
25
|
+
longitude: String(u[1]),
|
|
23
26
|
startTime: "",
|
|
24
27
|
endTime: ""
|
|
25
28
|
};
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
function C(e, t) {
|
|
30
|
+
return e instanceof Error && e.message.trim() ? e.message : t;
|
|
31
|
+
}
|
|
32
|
+
function w() {
|
|
33
|
+
let { currentUser: w } = ie(), { data: T, loading: E, error: be, refetch: D, fetchMore: xe } = de({ variables: { pagination: {
|
|
34
|
+
limit: b,
|
|
35
|
+
offset: 0
|
|
36
|
+
} } }), { data: Se, loading: Ce, error: we, refetch: O } = le(), { data: k } = ue({ variables: { pagination: {
|
|
37
|
+
limit: 50,
|
|
29
38
|
offset: 0
|
|
30
|
-
} } }), {
|
|
39
|
+
} } }), [Te, { loading: A }] = se(), [Ee, { loading: j }] = ce(), [De, M] = g(!1), [N, P] = g(S), [F, I] = g({}), [L, R] = g(null), [z, B] = g(null), [V, H] = g(null), [U, Oe] = g(!0), [W, ke] = g(!0), [G, K] = g(!1), q = h(() => T?.locationEntries?.items ?? [], [T?.locationEntries?.items]), Ae = T?.locationEntries?.hasMore ?? !1, J = Se?.locationStats, Y = h(() => (k?.geofences?.items ?? []).map((e) => ({
|
|
40
|
+
id: e.id,
|
|
41
|
+
name: e.name,
|
|
42
|
+
latitude: e.latitude,
|
|
43
|
+
longitude: e.longitude,
|
|
44
|
+
radius: e.radius,
|
|
45
|
+
isActive: e.isActive,
|
|
46
|
+
trigger: e.trigger,
|
|
47
|
+
address: e.address
|
|
48
|
+
})), [k?.geofences?.items]), je = h(() => q.map((e) => ({
|
|
49
|
+
id: e.id,
|
|
50
|
+
latitude: e.latitude,
|
|
51
|
+
longitude: e.longitude,
|
|
52
|
+
address: e.address,
|
|
53
|
+
startTime: e.startTime,
|
|
54
|
+
endTime: e.endTime,
|
|
55
|
+
duration: e.duration,
|
|
56
|
+
accuracy: e.accuracy,
|
|
57
|
+
geofenceId: e.geofenceId
|
|
58
|
+
})), [q]), Me = h(() => {
|
|
59
|
+
let e = f(N.latitude), t = f(N.longitude);
|
|
60
|
+
return e === null || t === null || !d(e, t) ? null : {
|
|
61
|
+
latitude: e,
|
|
62
|
+
longitude: t
|
|
63
|
+
};
|
|
64
|
+
}, [N.latitude, N.longitude]), X = q.filter((e) => e.geofenceId).length, Ne = q.length - X, Pe = [{
|
|
31
65
|
name: "Geofenced",
|
|
32
|
-
value:
|
|
66
|
+
value: X
|
|
33
67
|
}, {
|
|
34
68
|
name: "Manual",
|
|
35
|
-
value:
|
|
36
|
-
}],
|
|
69
|
+
value: Ne
|
|
70
|
+
}], Z = q.reduce((e, t) => Math.max(e, t.duration ?? 0), 0), Q = /* @__PURE__ */ new Map();
|
|
37
71
|
for (let e of q) {
|
|
38
72
|
if (!e.duration) continue;
|
|
39
73
|
let t = e.address?.trim() || "Unknown location";
|
|
40
|
-
|
|
74
|
+
Q.set(t, (Q.get(t) ?? 0) + e.duration);
|
|
41
75
|
}
|
|
42
|
-
let
|
|
76
|
+
let Fe = Array.from(Q.entries()).map(([e, t]) => ({
|
|
43
77
|
location: e,
|
|
44
78
|
hours: t / 3600
|
|
45
|
-
})).sort((e, t) => t.hours - e.hours).slice(0, 6),
|
|
46
|
-
let e = /* @__PURE__ */ new Date(), t = (/* @__PURE__ */ new Date(e.getTime() - e.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16);
|
|
47
|
-
|
|
48
|
-
...
|
|
79
|
+
})).sort((e, t) => t.hours - e.hours).slice(0, 6), Ie = () => {
|
|
80
|
+
let e = /* @__PURE__ */ new Date(), t = (/* @__PURE__ */ new Date(e.getTime() - e.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16), n = q.find((e) => d(e.latitude, e.longitude));
|
|
81
|
+
I({}), R(null), P({
|
|
82
|
+
...S,
|
|
83
|
+
latitude: String(p(n ? n.latitude : u[0])),
|
|
84
|
+
longitude: String(p(n ? n.longitude : u[1])),
|
|
49
85
|
startTime: t
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
if (
|
|
53
|
-
let e =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
}), M(!0);
|
|
87
|
+
}, Le = async () => {
|
|
88
|
+
if (R(null), !w?.id) return;
|
|
89
|
+
let e = oe(N);
|
|
90
|
+
if (!e.valid || !e.parsed) I(e.errors);
|
|
91
|
+
else {
|
|
92
|
+
I({});
|
|
93
|
+
try {
|
|
94
|
+
let t = (await Te({ variables: { input: {
|
|
95
|
+
userId: w.id,
|
|
96
|
+
latitude: e.parsed.latitude,
|
|
97
|
+
longitude: e.parsed.longitude,
|
|
98
|
+
address: N.address.trim() || void 0,
|
|
99
|
+
startTime: e.parsed.startTimeIso,
|
|
100
|
+
endTime: e.parsed.endTimeIso,
|
|
101
|
+
duration: e.parsed.durationSeconds
|
|
102
|
+
} } })).data?.createLocationEntry?.id ?? null;
|
|
103
|
+
t && H(t), M(!1), await Promise.all([D(), O()]);
|
|
104
|
+
} catch (e) {
|
|
105
|
+
R(C(e, "Failed to add location entry. Check values and permissions, then try again."));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, Re = async () => {
|
|
109
|
+
if (z) {
|
|
110
|
+
R(null);
|
|
111
|
+
try {
|
|
112
|
+
await Ee({ variables: { id: z.id } }), V === z.id && H(null), B(null), await Promise.all([D(), O()]);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
R(C(e, "Failed to delete location entry.")), B(null);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}, ze = async () => {
|
|
66
118
|
K(!0);
|
|
67
119
|
try {
|
|
68
|
-
await
|
|
120
|
+
await xe({
|
|
69
121
|
variables: { pagination: {
|
|
70
|
-
limit:
|
|
122
|
+
limit: b,
|
|
71
123
|
offset: q.length
|
|
72
124
|
} },
|
|
73
125
|
updateQuery: (e, { fetchMoreResult: t }) => t ? { locationEntries: {
|
|
@@ -78,80 +130,131 @@ function E() {
|
|
|
78
130
|
} finally {
|
|
79
131
|
K(!1);
|
|
80
132
|
}
|
|
81
|
-
}, $ = /* @__PURE__ */
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
133
|
+
}, $ = /* @__PURE__ */ y("button", {
|
|
134
|
+
type: "button",
|
|
135
|
+
onClick: Ie,
|
|
136
|
+
className: "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
|
|
137
|
+
children: [/* @__PURE__ */ v(ge, { className: "h-4 w-4" }), "Add Location Entry"]
|
|
85
138
|
});
|
|
86
|
-
return
|
|
139
|
+
return E && Ce ? /* @__PURE__ */ v(e, {
|
|
87
140
|
title: "Location Tracking",
|
|
88
141
|
description: "Track work locations and productivity",
|
|
89
|
-
children: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ v(i, {
|
|
90
143
|
variant: "list",
|
|
91
144
|
count: 4
|
|
92
145
|
})
|
|
93
|
-
}) :
|
|
146
|
+
}) : be && we ? /* @__PURE__ */ v(e, {
|
|
94
147
|
title: "Location Tracking",
|
|
95
148
|
description: "Track work locations and productivity",
|
|
96
|
-
children: /* @__PURE__ */
|
|
149
|
+
children: /* @__PURE__ */ v("div", {
|
|
150
|
+
role: "alert",
|
|
97
151
|
className: "rounded-lg border border-status-error-bg/40 bg-status-error-bg p-4 text-sm text-status-error-text",
|
|
98
152
|
children: "Failed to load location data. Please try again later."
|
|
99
153
|
})
|
|
100
|
-
}) : /* @__PURE__ */
|
|
154
|
+
}) : /* @__PURE__ */ y(e, {
|
|
101
155
|
title: "Location Tracking",
|
|
102
156
|
description: "Track work locations and productivity",
|
|
103
157
|
purpose: "See where work actually happens — office, home, client sites — and how long you spend at each, so you can verify on-site time, support field teams, and back up location-based billing.",
|
|
104
158
|
actions: $,
|
|
105
159
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ y("div", {
|
|
107
161
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
108
162
|
children: [
|
|
109
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ v(t, {
|
|
110
164
|
featured: !0,
|
|
111
165
|
title: "Total Locations",
|
|
112
166
|
value: String(J?.totalLocations ?? 0),
|
|
113
|
-
icon: /* @__PURE__ */
|
|
167
|
+
icon: /* @__PURE__ */ v(he, { className: "h-5 w-5" })
|
|
114
168
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ v(t, {
|
|
116
170
|
title: "Unique Addresses",
|
|
117
171
|
value: String(J?.uniqueAddresses ?? 0),
|
|
118
|
-
icon: /* @__PURE__ */
|
|
172
|
+
icon: /* @__PURE__ */ v(fe, { className: "h-5 w-5" })
|
|
119
173
|
}),
|
|
120
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ v(t, {
|
|
121
175
|
title: "Most Frequent",
|
|
122
176
|
value: J?.mostFrequentLocation ?? "N/A"
|
|
123
177
|
}),
|
|
124
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ v(t, {
|
|
125
179
|
title: "Total Duration",
|
|
126
180
|
value: s((J?.totalDuration ?? 0) / 3600),
|
|
127
|
-
icon: /* @__PURE__ */
|
|
181
|
+
icon: /* @__PURE__ */ v(pe, { className: "h-5 w-5" }),
|
|
128
182
|
description: "Tracked time"
|
|
129
183
|
})
|
|
130
184
|
]
|
|
131
185
|
}),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
186
|
+
/* @__PURE__ */ y("div", {
|
|
187
|
+
className: "mt-6",
|
|
188
|
+
children: [/* @__PURE__ */ y("div", {
|
|
189
|
+
className: "mb-3 flex flex-wrap items-center justify-between gap-2",
|
|
190
|
+
children: [/* @__PURE__ */ y("div", {
|
|
191
|
+
className: "min-w-0",
|
|
192
|
+
children: [/* @__PURE__ */ v("h2", {
|
|
193
|
+
className: "text-base font-semibold text-text-primary",
|
|
194
|
+
children: "Location History Map"
|
|
195
|
+
}), /* @__PURE__ */ y("p", {
|
|
196
|
+
className: "text-xs text-text-secondary",
|
|
197
|
+
children: [
|
|
198
|
+
q.length,
|
|
199
|
+
" tracked point",
|
|
200
|
+
q.length === 1 ? "" : "s",
|
|
201
|
+
Y.length > 0 ? ` · ${Y.length} workspace geofence${Y.length === 1 ? "" : "s"}` : ""
|
|
202
|
+
]
|
|
203
|
+
})]
|
|
204
|
+
}), /* @__PURE__ */ y("div", {
|
|
205
|
+
className: "flex flex-wrap items-center gap-2",
|
|
206
|
+
children: [/* @__PURE__ */ y("button", {
|
|
207
|
+
type: "button",
|
|
208
|
+
"aria-pressed": U,
|
|
209
|
+
onClick: () => Oe((e) => !e),
|
|
210
|
+
className: o("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus", U ? "border-action-primary-bg bg-action-primary-bg/10 text-text-primary" : "border-border-subtle bg-bg-surface text-text-secondary hover:bg-bg-sunken"),
|
|
211
|
+
children: [/* @__PURE__ */ v(me, { className: "h-3.5 w-3.5" }), "Geofences"]
|
|
212
|
+
}), /* @__PURE__ */ y("button", {
|
|
213
|
+
type: "button",
|
|
214
|
+
"aria-pressed": W,
|
|
215
|
+
onClick: () => ke((e) => !e),
|
|
216
|
+
className: o("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus", W ? "border-action-primary-bg bg-action-primary-bg/10 text-text-primary" : "border-border-subtle bg-bg-surface text-text-secondary hover:bg-bg-sunken"),
|
|
217
|
+
children: [/* @__PURE__ */ v(_e, { className: "h-3.5 w-3.5" }), "Path"]
|
|
218
|
+
})]
|
|
219
|
+
})]
|
|
220
|
+
}), /* @__PURE__ */ v(m, {
|
|
221
|
+
geofences: Y,
|
|
222
|
+
locationEntries: je,
|
|
223
|
+
selectedLocationId: V,
|
|
224
|
+
onSelectLocation: (e) => H(e),
|
|
225
|
+
showGeofences: U,
|
|
226
|
+
showLocationPath: W,
|
|
227
|
+
heightClassName: "h-[300px] sm:h-[380px] lg:h-[440px]",
|
|
228
|
+
ariaLabel: "Location history and geofence overlays map",
|
|
229
|
+
testId: "location-tracking-map"
|
|
230
|
+
})]
|
|
231
|
+
}),
|
|
232
|
+
q.length === 0 && !E ? /* @__PURE__ */ v("div", {
|
|
233
|
+
className: "mt-6",
|
|
234
|
+
children: /* @__PURE__ */ v(r, {
|
|
235
|
+
illustration: "empty-data",
|
|
236
|
+
title: "No location entries found",
|
|
237
|
+
description: "With location tracking enabled, the places you work from will show up here and on the map above. You can also add an entry manually.",
|
|
238
|
+
action: $
|
|
239
|
+
})
|
|
240
|
+
}) : /* @__PURE__ */ y(_, { children: [
|
|
241
|
+
/* @__PURE__ */ y("div", {
|
|
139
242
|
className: "mt-6 grid grid-cols-1 gap-4 lg:grid-cols-2",
|
|
140
|
-
children: [/* @__PURE__ */
|
|
243
|
+
children: [/* @__PURE__ */ v(l, {
|
|
141
244
|
title: "Tracking source",
|
|
142
245
|
description: "How your loaded entries were captured",
|
|
143
|
-
children: /* @__PURE__ */
|
|
144
|
-
data:
|
|
246
|
+
children: /* @__PURE__ */ v(ne, {
|
|
247
|
+
data: Pe,
|
|
145
248
|
centerLabel: "Entries",
|
|
146
249
|
centerValue: q.length,
|
|
147
250
|
ariaLabel: "Geofenced vs manual location entries",
|
|
148
251
|
emptyLabel: "No entries to summarize yet"
|
|
149
252
|
})
|
|
150
|
-
}), /* @__PURE__ */
|
|
253
|
+
}), /* @__PURE__ */ v(l, {
|
|
151
254
|
title: "Time by location",
|
|
152
255
|
description: "Hours logged across your loaded entries",
|
|
153
|
-
children: /* @__PURE__ */
|
|
154
|
-
data:
|
|
256
|
+
children: /* @__PURE__ */ v(te, {
|
|
257
|
+
data: Fe,
|
|
155
258
|
xKey: "location",
|
|
156
259
|
orientation: "horizontal",
|
|
157
260
|
series: [{
|
|
@@ -165,62 +268,69 @@ function E() {
|
|
|
165
268
|
})
|
|
166
269
|
})]
|
|
167
270
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ v("div", {
|
|
169
272
|
className: "mt-6 space-y-3",
|
|
170
273
|
children: q.map((e) => {
|
|
171
|
-
let t = !!e.geofenceId, r = e.duration ?? 0;
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
className: "rounded-xl border
|
|
174
|
-
children: [/* @__PURE__ */
|
|
274
|
+
let t = !!e.geofenceId, r = e.duration ?? 0, i = e.id === V;
|
|
275
|
+
return /* @__PURE__ */ y("div", {
|
|
276
|
+
className: o("rounded-xl border bg-gloss-card p-4 shadow-pop transition-colors hover:bg-bg-sunken/50", i ? "border-action-primary-bg" : "border-border-seam"),
|
|
277
|
+
children: [/* @__PURE__ */ y("div", {
|
|
175
278
|
className: "flex items-start justify-between gap-4",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
177
|
-
|
|
178
|
-
|
|
279
|
+
children: [/* @__PURE__ */ y("button", {
|
|
280
|
+
type: "button",
|
|
281
|
+
onClick: () => H(e.id),
|
|
282
|
+
className: "flex min-w-0 flex-1 items-start gap-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
|
|
283
|
+
children: [/* @__PURE__ */ v("span", {
|
|
179
284
|
className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary",
|
|
180
|
-
children:
|
|
181
|
-
}), /* @__PURE__ */
|
|
285
|
+
children: v(t ? ve : he, { className: "h-5 w-5" })
|
|
286
|
+
}), /* @__PURE__ */ y("div", {
|
|
182
287
|
className: "min-w-0",
|
|
183
|
-
children: [/* @__PURE__ */
|
|
288
|
+
children: [/* @__PURE__ */ v("p", {
|
|
184
289
|
className: "truncate text-sm font-medium text-text-primary",
|
|
185
290
|
children: e.address ?? "Unknown Location"
|
|
186
|
-
}), /* @__PURE__ */
|
|
291
|
+
}), /* @__PURE__ */ y("div", {
|
|
187
292
|
className: "mt-1 flex flex-wrap items-center gap-2 text-xs text-text-secondary",
|
|
188
293
|
children: [
|
|
189
|
-
/* @__PURE__ */
|
|
294
|
+
/* @__PURE__ */ v(n, {
|
|
190
295
|
label: t ? "Geofenced" : "Manual",
|
|
191
296
|
variant: t ? "info" : "muted"
|
|
192
297
|
}),
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ v("span", { children: ee(e.startTime) }),
|
|
299
|
+
/* @__PURE__ */ y("span", {
|
|
195
300
|
className: "text-text-muted",
|
|
196
301
|
children: [c(e.startTime), e.endTime ? ` – ${c(e.endTime)}` : ""]
|
|
302
|
+
}),
|
|
303
|
+
d(e.latitude, e.longitude) && /* @__PURE__ */ v("span", {
|
|
304
|
+
className: "font-mono text-[11px] text-text-muted",
|
|
305
|
+
children: ae(e.latitude, e.longitude)
|
|
197
306
|
})
|
|
198
307
|
]
|
|
199
308
|
})]
|
|
200
309
|
})]
|
|
201
|
-
}), /* @__PURE__ */
|
|
310
|
+
}), /* @__PURE__ */ y("div", {
|
|
202
311
|
className: "flex items-center gap-3",
|
|
203
|
-
children: [/* @__PURE__ */
|
|
312
|
+
children: [/* @__PURE__ */ y("div", {
|
|
204
313
|
className: "text-right",
|
|
205
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ v("p", {
|
|
206
315
|
className: "text-sm font-semibold tabular-nums text-text-primary",
|
|
207
316
|
children: e.duration ? s(e.duration / 3600) : "Active"
|
|
208
|
-
}), /* @__PURE__ */
|
|
317
|
+
}), /* @__PURE__ */ v("p", {
|
|
209
318
|
className: "text-xs text-text-secondary",
|
|
210
319
|
children: "duration"
|
|
211
320
|
})]
|
|
212
|
-
}), /* @__PURE__ */
|
|
213
|
-
|
|
321
|
+
}), /* @__PURE__ */ v("button", {
|
|
322
|
+
type: "button",
|
|
323
|
+
onClick: () => B(e),
|
|
214
324
|
"aria-label": "Delete entry",
|
|
215
|
-
className: "rounded-md border border-border-subtle p-1.5 text-status-error-text hover:bg-status-error-bg",
|
|
216
|
-
children: /* @__PURE__ */
|
|
325
|
+
className: "rounded-md border border-border-subtle p-1.5 text-status-error-text hover:bg-status-error-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
|
|
326
|
+
children: /* @__PURE__ */ v(ye, { className: "h-4 w-4" })
|
|
217
327
|
})]
|
|
218
328
|
})]
|
|
219
|
-
}), e.duration &&
|
|
329
|
+
}), e.duration && Z > 0 ? /* @__PURE__ */ v("div", {
|
|
220
330
|
className: "mt-3",
|
|
221
|
-
children: /* @__PURE__ */
|
|
331
|
+
children: /* @__PURE__ */ v(re, {
|
|
222
332
|
value: r,
|
|
223
|
-
max:
|
|
333
|
+
max: Z,
|
|
224
334
|
tone: "success",
|
|
225
335
|
showValue: !1,
|
|
226
336
|
size: "sm"
|
|
@@ -229,137 +339,228 @@ function E() {
|
|
|
229
339
|
}, e.id);
|
|
230
340
|
})
|
|
231
341
|
}),
|
|
232
|
-
|
|
342
|
+
Ae && /* @__PURE__ */ v("div", {
|
|
233
343
|
className: "mt-6 flex justify-center",
|
|
234
|
-
children: /* @__PURE__ */
|
|
235
|
-
|
|
344
|
+
children: /* @__PURE__ */ v("button", {
|
|
345
|
+
type: "button",
|
|
346
|
+
onClick: () => void ze(),
|
|
236
347
|
disabled: G,
|
|
237
348
|
className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50",
|
|
238
349
|
children: G ? "Loading..." : "Load more"
|
|
239
350
|
})
|
|
240
351
|
})
|
|
241
352
|
] }),
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
open:
|
|
244
|
-
onClose: () =>
|
|
353
|
+
/* @__PURE__ */ y(a, {
|
|
354
|
+
open: De,
|
|
355
|
+
onClose: () => M(!1),
|
|
245
356
|
title: "Add Location Entry",
|
|
246
|
-
description: "
|
|
247
|
-
size: "
|
|
248
|
-
footer: /* @__PURE__ */
|
|
249
|
-
|
|
357
|
+
description: "Click the map to place a pin or enter coordinates manually. Only you and people you share with can see this.",
|
|
358
|
+
size: "xl",
|
|
359
|
+
footer: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
|
|
360
|
+
type: "button",
|
|
361
|
+
onClick: () => M(!1),
|
|
250
362
|
className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50",
|
|
251
363
|
children: "Cancel"
|
|
252
|
-
}), /* @__PURE__ */
|
|
253
|
-
|
|
254
|
-
|
|
364
|
+
}), /* @__PURE__ */ v("button", {
|
|
365
|
+
type: "button",
|
|
366
|
+
onClick: () => void Le(),
|
|
367
|
+
disabled: A || !w?.id,
|
|
255
368
|
className: "rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50",
|
|
256
|
-
children:
|
|
369
|
+
children: A ? "Saving..." : "Add Entry"
|
|
257
370
|
})] }),
|
|
258
371
|
children: [
|
|
259
|
-
|
|
372
|
+
L && /* @__PURE__ */ v("div", {
|
|
373
|
+
role: "alert",
|
|
260
374
|
className: "mb-4 rounded-lg border border-status-error-bg/40 bg-status-error-bg p-3 text-sm text-status-error-text",
|
|
261
|
-
children:
|
|
375
|
+
children: L
|
|
262
376
|
}),
|
|
263
|
-
!
|
|
377
|
+
!w?.id && /* @__PURE__ */ v("div", {
|
|
264
378
|
className: "mb-4 rounded-lg border border-status-warning-bg/40 bg-status-warning-bg p-3 text-sm text-status-warning-text",
|
|
265
379
|
children: "You must be signed in to add a location entry."
|
|
266
380
|
}),
|
|
267
|
-
/* @__PURE__ */
|
|
381
|
+
/* @__PURE__ */ y("div", {
|
|
268
382
|
className: "space-y-4",
|
|
269
383
|
children: [
|
|
270
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ v(m, {
|
|
385
|
+
geofences: Y,
|
|
386
|
+
draftPoint: Me,
|
|
387
|
+
interactiveMode: "pick-point",
|
|
388
|
+
onPickPoint: ({ latitude: e, longitude: t }) => {
|
|
389
|
+
P((n) => ({
|
|
390
|
+
...n,
|
|
391
|
+
latitude: String(p(e)),
|
|
392
|
+
longitude: String(p(t))
|
|
393
|
+
})), I((e) => ({
|
|
394
|
+
...e,
|
|
395
|
+
latitude: void 0,
|
|
396
|
+
longitude: void 0
|
|
397
|
+
}));
|
|
398
|
+
},
|
|
399
|
+
heightClassName: "h-[220px]",
|
|
400
|
+
ariaLabel: "Pick location coordinates on map",
|
|
401
|
+
testId: "location-entry-picker-map"
|
|
402
|
+
}),
|
|
403
|
+
/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
|
|
404
|
+
htmlFor: "loc-address",
|
|
271
405
|
className: "block text-sm font-medium text-text-primary",
|
|
272
406
|
children: "Address (optional)"
|
|
273
|
-
}), /* @__PURE__ */
|
|
407
|
+
}), /* @__PURE__ */ v("input", {
|
|
408
|
+
id: "loc-address",
|
|
274
409
|
type: "text",
|
|
275
|
-
placeholder: "e.g. Client site,
|
|
276
|
-
value:
|
|
277
|
-
onChange: (e) =>
|
|
278
|
-
...
|
|
410
|
+
placeholder: "e.g. Client site, San Francisco",
|
|
411
|
+
value: N.address,
|
|
412
|
+
onChange: (e) => P({
|
|
413
|
+
...N,
|
|
279
414
|
address: e.target.value
|
|
280
415
|
}),
|
|
281
|
-
className:
|
|
416
|
+
className: x
|
|
282
417
|
})] }),
|
|
283
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ y("div", {
|
|
284
419
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
285
|
-
children: [/* @__PURE__ */
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
420
|
+
children: [/* @__PURE__ */ y("div", { children: [
|
|
421
|
+
/* @__PURE__ */ v("label", {
|
|
422
|
+
htmlFor: "loc-lat",
|
|
423
|
+
className: "block text-sm font-medium text-text-primary",
|
|
424
|
+
children: "Latitude"
|
|
425
|
+
}),
|
|
426
|
+
/* @__PURE__ */ v("input", {
|
|
427
|
+
id: "loc-lat",
|
|
428
|
+
type: "number",
|
|
429
|
+
step: "any",
|
|
430
|
+
min: -90,
|
|
431
|
+
max: 90,
|
|
432
|
+
placeholder: "37.774900",
|
|
433
|
+
value: N.latitude,
|
|
434
|
+
onChange: (e) => {
|
|
435
|
+
P({
|
|
436
|
+
...N,
|
|
437
|
+
latitude: e.target.value
|
|
438
|
+
}), I((e) => ({
|
|
439
|
+
...e,
|
|
440
|
+
latitude: void 0
|
|
441
|
+
}));
|
|
442
|
+
},
|
|
443
|
+
className: x
|
|
296
444
|
}),
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
...V,
|
|
308
|
-
longitude: e.target.value
|
|
445
|
+
F.latitude && /* @__PURE__ */ v("p", {
|
|
446
|
+
role: "alert",
|
|
447
|
+
className: "mt-1 text-xs text-status-error-text",
|
|
448
|
+
children: F.latitude
|
|
449
|
+
})
|
|
450
|
+
] }), /* @__PURE__ */ y("div", { children: [
|
|
451
|
+
/* @__PURE__ */ v("label", {
|
|
452
|
+
htmlFor: "loc-lng",
|
|
453
|
+
className: "block text-sm font-medium text-text-primary",
|
|
454
|
+
children: "Longitude"
|
|
309
455
|
}),
|
|
310
|
-
|
|
311
|
-
|
|
456
|
+
/* @__PURE__ */ v("input", {
|
|
457
|
+
id: "loc-lng",
|
|
458
|
+
type: "number",
|
|
459
|
+
step: "any",
|
|
460
|
+
min: -180,
|
|
461
|
+
max: 180,
|
|
462
|
+
placeholder: "-122.419400",
|
|
463
|
+
value: N.longitude,
|
|
464
|
+
onChange: (e) => {
|
|
465
|
+
P({
|
|
466
|
+
...N,
|
|
467
|
+
longitude: e.target.value
|
|
468
|
+
}), I((e) => ({
|
|
469
|
+
...e,
|
|
470
|
+
longitude: void 0
|
|
471
|
+
}));
|
|
472
|
+
},
|
|
473
|
+
className: x
|
|
474
|
+
}),
|
|
475
|
+
F.longitude && /* @__PURE__ */ v("p", {
|
|
476
|
+
role: "alert",
|
|
477
|
+
className: "mt-1 text-xs text-status-error-text",
|
|
478
|
+
children: F.longitude
|
|
479
|
+
})
|
|
480
|
+
] })]
|
|
312
481
|
}),
|
|
313
|
-
/* @__PURE__ */
|
|
482
|
+
/* @__PURE__ */ y("div", {
|
|
314
483
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
315
|
-
children: [/* @__PURE__ */
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
484
|
+
children: [/* @__PURE__ */ y("div", { children: [
|
|
485
|
+
/* @__PURE__ */ v("label", {
|
|
486
|
+
htmlFor: "loc-start",
|
|
487
|
+
className: "block text-sm font-medium text-text-primary",
|
|
488
|
+
children: "Start Time"
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ v("input", {
|
|
491
|
+
id: "loc-start",
|
|
492
|
+
type: "datetime-local",
|
|
493
|
+
value: N.startTime,
|
|
494
|
+
onChange: (e) => {
|
|
495
|
+
P({
|
|
496
|
+
...N,
|
|
497
|
+
startTime: e.target.value
|
|
498
|
+
}), I((e) => ({
|
|
499
|
+
...e,
|
|
500
|
+
startTime: void 0
|
|
501
|
+
}));
|
|
502
|
+
},
|
|
503
|
+
className: x
|
|
504
|
+
}),
|
|
505
|
+
F.startTime && /* @__PURE__ */ v("p", {
|
|
506
|
+
role: "alert",
|
|
507
|
+
className: "mt-1 text-xs text-status-error-text",
|
|
508
|
+
children: F.startTime
|
|
509
|
+
})
|
|
510
|
+
] }), /* @__PURE__ */ y("div", { children: [
|
|
511
|
+
/* @__PURE__ */ v("label", {
|
|
512
|
+
htmlFor: "loc-end",
|
|
513
|
+
className: "block text-sm font-medium text-text-primary",
|
|
514
|
+
children: "End Time (optional)"
|
|
324
515
|
}),
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
516
|
+
/* @__PURE__ */ v("input", {
|
|
517
|
+
id: "loc-end",
|
|
518
|
+
type: "datetime-local",
|
|
519
|
+
value: N.endTime,
|
|
520
|
+
onChange: (e) => {
|
|
521
|
+
P({
|
|
522
|
+
...N,
|
|
523
|
+
endTime: e.target.value
|
|
524
|
+
}), I((e) => ({
|
|
525
|
+
...e,
|
|
526
|
+
endTime: void 0
|
|
527
|
+
}));
|
|
528
|
+
},
|
|
529
|
+
className: x
|
|
335
530
|
}),
|
|
336
|
-
|
|
337
|
-
|
|
531
|
+
F.endTime && /* @__PURE__ */ v("p", {
|
|
532
|
+
role: "alert",
|
|
533
|
+
className: "mt-1 text-xs text-status-error-text",
|
|
534
|
+
children: F.endTime
|
|
535
|
+
})
|
|
536
|
+
] })]
|
|
338
537
|
})
|
|
339
538
|
]
|
|
340
539
|
})
|
|
341
540
|
]
|
|
342
541
|
}),
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
open:
|
|
345
|
-
onClose: () =>
|
|
542
|
+
/* @__PURE__ */ v(a, {
|
|
543
|
+
open: z !== null,
|
|
544
|
+
onClose: () => B(null),
|
|
346
545
|
title: "Delete Location Entry",
|
|
347
546
|
description: "This action cannot be undone.",
|
|
348
|
-
footer: /* @__PURE__ */
|
|
349
|
-
|
|
547
|
+
footer: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
|
|
548
|
+
type: "button",
|
|
549
|
+
onClick: () => B(null),
|
|
350
550
|
className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50",
|
|
351
551
|
children: "Cancel"
|
|
352
|
-
}), /* @__PURE__ */
|
|
353
|
-
|
|
354
|
-
|
|
552
|
+
}), /* @__PURE__ */ v("button", {
|
|
553
|
+
type: "button",
|
|
554
|
+
onClick: () => void Re(),
|
|
555
|
+
disabled: j,
|
|
355
556
|
className: "rounded-md bg-status-error-bg px-4 py-2 text-sm font-medium text-status-error-text hover:bg-status-error-bg/80 disabled:opacity-50",
|
|
356
|
-
children:
|
|
557
|
+
children: j ? "Deleting..." : "Delete"
|
|
357
558
|
})] }),
|
|
358
|
-
children: /* @__PURE__ */
|
|
559
|
+
children: /* @__PURE__ */ y("p", {
|
|
359
560
|
className: "text-sm text-text-secondary",
|
|
360
561
|
children: [
|
|
361
562
|
"Are you sure you want to delete this location entry",
|
|
362
|
-
|
|
563
|
+
z?.address ? ` at ${z.address}` : "",
|
|
363
564
|
"?"
|
|
364
565
|
]
|
|
365
566
|
})
|
|
@@ -367,6 +568,6 @@ function E() {
|
|
|
367
568
|
]
|
|
368
569
|
});
|
|
369
570
|
}
|
|
370
|
-
export {
|
|
571
|
+
export { w as LocationTrackingPage };
|
|
371
572
|
|
|
372
573
|
//# sourceMappingURL=LocationTrackingPage.js.map
|