@joewinke/jatui 0.1.23 → 0.1.24

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.
Files changed (124) hide show
  1. package/CLAUDE.md +244 -0
  2. package/package.json +23 -10
  3. package/src/lib/actions/collapse.ts +0 -136
  4. package/src/lib/actions/railNav.ts +0 -473
  5. package/src/lib/components/AnnotationLayer.svelte +0 -108
  6. package/src/lib/components/AnnotationPanel.svelte +0 -319
  7. package/src/lib/components/AudioWaveform.svelte +0 -698
  8. package/src/lib/components/AvailabilityModal.svelte +0 -177
  9. package/src/lib/components/AvatarUpload.svelte +0 -234
  10. package/src/lib/components/Badge.svelte +0 -38
  11. package/src/lib/components/BookingForm.svelte +0 -278
  12. package/src/lib/components/BurndownChart.svelte +0 -778
  13. package/src/lib/components/Button.svelte +0 -81
  14. package/src/lib/components/CalendarPicker.svelte +0 -284
  15. package/src/lib/components/Card.svelte +0 -67
  16. package/src/lib/components/CharacterCounter.svelte +0 -82
  17. package/src/lib/components/ChipInput.svelte +0 -609
  18. package/src/lib/components/Collapse.svelte +0 -82
  19. package/src/lib/components/ColorSelector.svelte +0 -167
  20. package/src/lib/components/CommentThread.svelte +0 -773
  21. package/src/lib/components/ConfirmDialog.svelte +0 -348
  22. package/src/lib/components/ConfirmModal.svelte +0 -142
  23. package/src/lib/components/ContextMenu.svelte +0 -188
  24. package/src/lib/components/CountdownTimer.svelte +0 -94
  25. package/src/lib/components/DateRangePicker.svelte +0 -194
  26. package/src/lib/components/Drawer.svelte +0 -143
  27. package/src/lib/components/EmojiPicker.svelte +0 -159
  28. package/src/lib/components/EntityPreviewCard.svelte +0 -104
  29. package/src/lib/components/FileDropzone.svelte +0 -493
  30. package/src/lib/components/FilePicker.svelte +0 -488
  31. package/src/lib/components/FileThumbnail.svelte +0 -80
  32. package/src/lib/components/FilterDropdown.svelte +0 -203
  33. package/src/lib/components/FloatingActionBar.svelte +0 -354
  34. package/src/lib/components/GPSTracker.svelte +0 -202
  35. package/src/lib/components/HunkDiffView.svelte +0 -348
  36. package/src/lib/components/ImageLightbox.svelte +0 -274
  37. package/src/lib/components/ImageUpload.svelte +0 -147
  38. package/src/lib/components/InlineEdit.svelte +0 -291
  39. package/src/lib/components/InputDialog.svelte +0 -327
  40. package/src/lib/components/KeyboardShortcutsOverlay.svelte +0 -296
  41. package/src/lib/components/LazyImage.svelte +0 -123
  42. package/src/lib/components/LinkShortener.svelte +0 -274
  43. package/src/lib/components/LoadingSpinner.svelte +0 -106
  44. package/src/lib/components/LocationMap.svelte +0 -186
  45. package/src/lib/components/MapView.svelte +0 -341
  46. package/src/lib/components/MarkupEditor.svelte +0 -485
  47. package/src/lib/components/MarkupOverlay.svelte +0 -55
  48. package/src/lib/components/MediaWorkbench.svelte +0 -871
  49. package/src/lib/components/MilestoneCard.svelte +0 -98
  50. package/src/lib/components/MilestoneTimeline.svelte +0 -91
  51. package/src/lib/components/Modal.svelte +0 -244
  52. package/src/lib/components/PDFViewer.svelte +0 -105
  53. package/src/lib/components/PdfThumbnail.svelte +0 -63
  54. package/src/lib/components/PhoneInput.svelte +0 -212
  55. package/src/lib/components/ResizableDivider.svelte +0 -307
  56. package/src/lib/components/ResizablePanel.svelte +0 -305
  57. package/src/lib/components/SearchDropdown.svelte +0 -421
  58. package/src/lib/components/SelectInput.svelte +0 -237
  59. package/src/lib/components/SidebarUserFooter.svelte +0 -34
  60. package/src/lib/components/SignaturePad.svelte +0 -175
  61. package/src/lib/components/SmartImageEditor.svelte +0 -720
  62. package/src/lib/components/SortDropdown.svelte +0 -156
  63. package/src/lib/components/Sparkline.svelte +0 -116
  64. package/src/lib/components/SpeechForm.svelte +0 -114
  65. package/src/lib/components/StatusBadge.svelte +0 -157
  66. package/src/lib/components/TaskTypeIcon.svelte +0 -54
  67. package/src/lib/components/TextArea.svelte +0 -162
  68. package/src/lib/components/TextInput.svelte +0 -131
  69. package/src/lib/components/ThemeSelector.svelte +0 -206
  70. package/src/lib/components/TimeSlotPicker.svelte +0 -162
  71. package/src/lib/components/UserAvatar.svelte +0 -72
  72. package/src/lib/components/VariablePicker.svelte +0 -170
  73. package/src/lib/components/VoicePlayer.svelte +0 -422
  74. package/src/lib/components/linked-columns/LinkedColumns.svelte +0 -526
  75. package/src/lib/components/markup.ts +0 -287
  76. package/src/lib/components/messaging/Avatar.svelte +0 -81
  77. package/src/lib/components/messaging/ChannelInfoModal.svelte +0 -163
  78. package/src/lib/components/messaging/ChannelList.svelte +0 -107
  79. package/src/lib/components/messaging/ChannelMemberAvatarStack.svelte +0 -69
  80. package/src/lib/components/messaging/ChannelMembersModal.svelte +0 -182
  81. package/src/lib/components/messaging/CreateChannelModal.svelte +0 -190
  82. package/src/lib/components/messaging/DirectMessageList.svelte +0 -145
  83. package/src/lib/components/messaging/EmojiSelector.svelte +0 -261
  84. package/src/lib/components/messaging/MentionAutocomplete.svelte +0 -193
  85. package/src/lib/components/messaging/MessageAttachment.svelte +0 -273
  86. package/src/lib/components/messaging/MessageAttachmentUpload.svelte +0 -243
  87. package/src/lib/components/messaging/MessageInput.svelte +0 -452
  88. package/src/lib/components/messaging/MessageItem.svelte +0 -341
  89. package/src/lib/components/messaging/MessageThread.svelte +0 -306
  90. package/src/lib/components/messaging/NotificationSettingsModal.svelte +0 -234
  91. package/src/lib/components/messaging/QuotedMessageDisplay.svelte +0 -123
  92. package/src/lib/components/messaging/StartDMModal.svelte +0 -100
  93. package/src/lib/components/messaging/ThreadPanel.svelte +0 -153
  94. package/src/lib/components/pipeline/DESIGN.md +0 -361
  95. package/src/lib/components/pipeline/Pipeline.svelte +0 -391
  96. package/src/lib/components/pipeline/PipelineCard.svelte +0 -94
  97. package/src/lib/components/pipeline/PipelineColumn.svelte +0 -163
  98. package/src/lib/components/replay/ChapterTimeline.svelte +0 -326
  99. package/src/lib/components/session-nav/transcriptModel.ts +0 -352
  100. package/src/lib/data/emojis.ts +0 -1208
  101. package/src/lib/index.ts +0 -405
  102. package/src/lib/stores/confirmDialog.svelte.ts +0 -48
  103. package/src/lib/stores/inputDialog.svelte.ts +0 -51
  104. package/src/lib/styles/rail.css +0 -63
  105. package/src/lib/types/annotation.ts +0 -38
  106. package/src/lib/types/booking.ts +0 -143
  107. package/src/lib/types/comments.ts +0 -97
  108. package/src/lib/types/entityPreview.ts +0 -45
  109. package/src/lib/types/filePicker.ts +0 -16
  110. package/src/lib/types/googleMaps.d.ts +0 -51
  111. package/src/lib/types/maps.ts +0 -43
  112. package/src/lib/types/messaging.ts +0 -459
  113. package/src/lib/types/milestone.ts +0 -22
  114. package/src/lib/types/pipeline.ts +0 -150
  115. package/src/lib/types/smartImageEditor.ts +0 -39
  116. package/src/lib/types/templateVars.ts +0 -36
  117. package/src/lib/utils/currency.ts +0 -20
  118. package/src/lib/utils/daisyuiColors.ts +0 -243
  119. package/src/lib/utils/dateFormatters.ts +0 -196
  120. package/src/lib/utils/googleMapsLoader.ts +0 -84
  121. package/src/lib/utils/mentionParser.ts +0 -188
  122. package/src/lib/utils/phone.ts +0 -80
  123. package/src/lib/utils/phoneFormat.ts +0 -74
  124. package/src/lib/utils/taskUtils.ts +0 -75
@@ -1,341 +0,0 @@
1
- <script lang="ts">
2
- /**
3
- * MapView — multi-marker Google Maps component.
4
- *
5
- * Generic map for dispatching / field-service use cases. Renders job pins
6
- * (colored by status) and agent pins (colored by availability status) using
7
- * Google Maps Advanced Markers.
8
- *
9
- * API key is passed explicitly — jatui has no $env dependency.
10
- *
11
- * Usage:
12
- *
13
- * <MapView
14
- * apiKey={PUBLIC_GOOGLE_MAPS_API_KEY}
15
- * jobs={jobs}
16
- * agents={technicians}
17
- * onJobClick={(job) => openDetail(job)}
18
- * />
19
- *
20
- * Ported from flush DispatchMap (622L) — steelbridge fork capture (jst-e0d1u.4).
21
- */
22
- import { onMount, onDestroy, mount, unmount } from 'svelte';
23
- import { loadGoogleMapsAPI, isGoogleMapsLoaded } from '../utils/googleMapsLoader';
24
- import UserAvatar from './UserAvatar.svelte';
25
- import type { MapJob, MapAgent } from '../types/maps';
26
-
27
- export type { MapJob, MapAgent };
28
-
29
- interface Props {
30
- apiKey: string;
31
- jobs?: MapJob[];
32
- agents?: MapAgent[];
33
- /** Default map center — lat/lng. Defaults to West Palm Beach. */
34
- defaultCenter?: { lat: number; lng: number };
35
- showLegend?: boolean;
36
- onJobClick?: (job: MapJob) => void;
37
- onAgentClick?: (agent: MapAgent) => void;
38
- }
39
-
40
- let {
41
- apiKey,
42
- jobs = [],
43
- agents = [],
44
- defaultCenter = { lat: 26.3683, lng: -80.1289 },
45
- showLegend = true,
46
- onJobClick,
47
- onAgentClick
48
- }: Props = $props();
49
-
50
- // Job status → hex color (hardcoded by design — not themed, maps sit outside DaisyUI theming)
51
- const STATUS_COLORS: Record<string, string> = {
52
- pending: '#f59e0b',
53
- scheduled: '#3b82f6',
54
- in_progress: '#10b981',
55
- completed: '#6b7280',
56
- cancelled: '#ef4444'
57
- };
58
-
59
- let mapContainer: HTMLElement;
60
- let map: google.maps.Map;
61
- let jobMarkers: any[] = [];
62
- let agentMarkers: any[] = [];
63
- let AdvancedMarkerElement: any;
64
-
65
- onMount(async () => {
66
- if (!apiKey) {
67
- console.warn('MapView: No Google Maps API key provided');
68
- return;
69
- }
70
- try {
71
- await loadGoogleMapsAPI({ apiKey, libraries: ['geometry', 'marker'] });
72
- if (window.google?.maps?.marker) {
73
- AdvancedMarkerElement = window.google.maps.marker.AdvancedMarkerElement;
74
- }
75
- if (isGoogleMapsLoaded()) initializeMap();
76
- } catch (e) {
77
- console.warn('MapView: Failed to load Google Maps API', e);
78
- }
79
- });
80
-
81
- onDestroy(() => {
82
- clearAllMarkers();
83
- });
84
-
85
- async function geocodeAddress(address: string): Promise<{ lat: number; lng: number } | null> {
86
- if (!apiKey || !address) return null;
87
- try {
88
- const res = await fetch(
89
- `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(address)}&key=${apiKey}`
90
- );
91
- const data = await res.json();
92
- if (data.status === 'OK' && data.results.length > 0) {
93
- const loc = data.results[0].geometry.location;
94
- return { lat: loc.lat, lng: loc.lng };
95
- }
96
- } catch {
97
- // silently skip
98
- }
99
- return null;
100
- }
101
-
102
- function initializeMap() {
103
- map = new google.maps.Map(mapContainer, {
104
- zoom: 10,
105
- center: defaultCenter,
106
- mapTypeId: google.maps.MapTypeId.ROADMAP,
107
- mapId: 'jatui-map-view',
108
- styles: [{ featureType: 'poi', elementType: 'labels', stylers: [{ visibility: 'off' }] }]
109
- });
110
- updateMarkers();
111
- fitMapToMarkers();
112
- }
113
-
114
- function updateMarkers() {
115
- clearAllMarkers();
116
- createJobMarkers();
117
- createAgentMarkers();
118
- }
119
-
120
- function clearAllMarkers() {
121
- jobMarkers.forEach((m) => (m.map = null));
122
- agentMarkers.forEach((m) => {
123
- m.map = null;
124
- if (m._component) unmount(m._component);
125
- });
126
- jobMarkers = [];
127
- agentMarkers = [];
128
- }
129
-
130
- function createJobMarkers() {
131
- jobs.forEach((job) => {
132
- if (!job.location?.latitude || !job.location?.longitude) {
133
- // Try geocoding if we have an address but no coords
134
- if (job.location?.address) {
135
- geocodeAddress(job.location.address).then((coords) => {
136
- if (coords) placeJobMarker(job, coords);
137
- });
138
- }
139
- return;
140
- }
141
- placeJobMarker(job, { lat: job.location.latitude, lng: job.location.longitude });
142
- });
143
- }
144
-
145
- function placeJobMarker(job: MapJob, position: { lat: number; lng: number }) {
146
- if (!AdvancedMarkerElement) return;
147
-
148
- const pin = document.createElement('div');
149
- pin.style.cssText = `width:24px;height:24px;border-radius:50%;background:${STATUS_COLORS[job.status] ?? STATUS_COLORS.pending};border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,.3)`;
150
-
151
- const marker = new AdvancedMarkerElement({
152
- position,
153
- map,
154
- title: `${job.customer?.name ?? 'Unknown'} — ${job.type ?? ''}`,
155
- content: pin
156
- });
157
-
158
- const infoWindow = new google.maps.InfoWindow({ content: buildJobInfo(job) });
159
-
160
- marker.addListener('click', () => {
161
- infoWindow.open(map, marker);
162
- onJobClick?.(job);
163
- });
164
-
165
- jobMarkers.push(marker);
166
- fitMapToMarkers();
167
- }
168
-
169
- function createAgentMarkers() {
170
- agents.forEach((agent) => {
171
- let position: { lat: number; lng: number } | null = null;
172
-
173
- // Priority 1: fresh GPS (< 5 min)
174
- if (agent.location?.latitude && agent.location?.longitude) {
175
- const ageMins = (agent.location.age_seconds ?? 0) / 60;
176
- if (ageMins < 5) position = { lat: agent.location.latitude, lng: agent.location.longitude };
177
- }
178
-
179
- // Priority 2: active dispatch job location
180
- if (!position && agent.dispatches) {
181
- const active = agent.dispatches.find(
182
- (d) => d.status === 'in_progress' || d.status === 'en_route'
183
- );
184
- if (active) {
185
- const assignedJob = jobs.find((j) => j.id === active.job_id);
186
- if (assignedJob?.location?.latitude && assignedJob?.location?.longitude) {
187
- position = { lat: assignedJob.location.latitude, lng: assignedJob.location.longitude };
188
- }
189
- }
190
- }
191
-
192
- if (!position) return;
193
-
194
- const container = document.createElement('div');
195
- container.style.cssText = 'display:flex;flex-direction:column;align-items:center;cursor:pointer';
196
-
197
- const avatarEl = document.createElement('div');
198
- container.appendChild(avatarEl);
199
-
200
- const label = document.createElement('div');
201
- label.style.cssText =
202
- 'font-size:10px;font-weight:600;white-space:nowrap;margin-top:2px;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.8)';
203
- label.textContent = agent.name.split(' ')[0];
204
- container.appendChild(label);
205
-
206
- // Mount UserAvatar into the DOM node
207
- const avatarComponent = mount(UserAvatar, {
208
- target: avatarEl,
209
- props: {
210
- name: agent.name,
211
- email: agent.email,
212
- avatarUrl: agent.avatarUrl,
213
- size: 'sm',
214
- tooltip: false
215
- }
216
- });
217
-
218
- const marker = new AdvancedMarkerElement({
219
- position,
220
- map,
221
- title: agent.name,
222
- content: container
223
- });
224
-
225
- const infoWindow = new google.maps.InfoWindow({ content: buildAgentInfo(agent) });
226
-
227
- marker.addListener('click', () => {
228
- infoWindow.open(map, marker);
229
- onAgentClick?.(agent);
230
- });
231
-
232
- marker._component = avatarComponent;
233
- agentMarkers.push(marker);
234
- });
235
- }
236
-
237
- function buildJobInfo(job: MapJob): string {
238
- const statusBadge = `<span class="badge badge-sm" style="background:${STATUS_COLORS[job.status] ?? '#888'};color:#fff">${job.status.replace(/_/g, ' ')}</span>`;
239
- const priority =
240
- job.priority === 'urgent'
241
- ? `<span class="badge badge-error badge-sm">urgent</span>`
242
- : '';
243
- return `<div style="padding:8px;min-width:180px;font-family:sans-serif;font-size:13px">
244
- <div style="display:flex;align-items:center;gap:6px;margin-bottom:6px;font-weight:600">
245
- ${job.customer?.name ?? 'Unknown Customer'} ${statusBadge}
246
- </div>
247
- ${job.type ? `<div><b>Service:</b> ${job.type.replace(/_/g, ' ')}</div>` : ''}
248
- ${job.customer?.phone ? `<div><b>Phone:</b> ${job.customer.phone}</div>` : ''}
249
- ${job.location?.address ? `<div><b>Address:</b> ${job.location.address}</div>` : ''}
250
- ${job.scheduled_at ? `<div><b>Scheduled:</b> ${new Date(job.scheduled_at).toLocaleString()}</div>` : ''}
251
- ${priority}
252
- ${job.description ? `<div style="margin-top:4px"><b>Notes:</b> ${job.description}</div>` : ''}
253
- </div>`;
254
- }
255
-
256
- function buildAgentInfo(agent: MapAgent): string {
257
- const gpsAge = agent.location?.age_seconds ?? 0;
258
- const gpsMins = Math.floor(gpsAge / 60);
259
- const hasGps = !!(agent.location?.latitude && agent.location?.longitude);
260
- return `<div style="padding:8px;min-width:180px;font-family:sans-serif;font-size:13px">
261
- <div style="font-weight:600;margin-bottom:6px">${agent.name}</div>
262
- ${agent.status ? `<div><b>Status:</b> ${agent.status}</div>` : ''}
263
- ${agent.capacity ? `<div><b>Capacity:</b> ${agent.capacity}</div>` : ''}
264
- ${hasGps ? `<div><b>GPS:</b> <span style="color:${gpsMins < 5 ? '#16a34a' : '#d97706'}">${gpsMins < 1 ? 'Live' : `${gpsMins}m ago`}</span></div>` : ''}
265
- ${agent.specializations?.length ? `<div><b>Specializations:</b> ${agent.specializations.join(', ')}</div>` : ''}
266
- ${agent.vehicle?.name ? `<div><b>Vehicle:</b> ${agent.vehicle.name}</div>` : ''}
267
- </div>`;
268
- }
269
-
270
- function fitMapToMarkers() {
271
- if (!map) return;
272
- const all = [...jobMarkers, ...agentMarkers];
273
- if (all.length === 0) return;
274
-
275
- const bounds = new google.maps.LatLngBounds();
276
- all.forEach((m) => m.position && bounds.extend(m.position));
277
- map.fitBounds(bounds);
278
-
279
- const listener = google.maps.event.addListener(map, 'idle', () => {
280
- if ((map.getZoom() ?? 0) > 15) map.setZoom(15);
281
- google.maps.event.removeListener(listener);
282
- });
283
- }
284
-
285
- // Reactive: re-render markers when jobs/agents change
286
- $effect(() => {
287
- if (map) {
288
- updateMarkers();
289
- fitMapToMarkers();
290
- }
291
- });
292
- </script>
293
-
294
- <div class="h-full flex flex-col">
295
- <div class="map-container flex-1 w-full rounded-lg border border-base-300 overflow-hidden relative">
296
- <div bind:this={mapContainer} class="w-full h-full"></div>
297
- </div>
298
-
299
- {#if showLegend}
300
- <div class="p-3 bg-base-100 border-t border-base-300 flex-shrink-0">
301
- <div class="flex flex-wrap items-center gap-x-6 gap-y-2 text-sm">
302
- <span class="font-semibold">Legend</span>
303
-
304
- <div class="flex items-center gap-2">
305
- <span class="font-medium text-xs">Job status</span>
306
- <div class="tooltip" data-tip="Pending">
307
- <div class="w-3.5 h-3.5 rounded-full" style="background:#f59e0b"></div>
308
- </div>
309
- <div class="tooltip" data-tip="Scheduled">
310
- <div class="w-3.5 h-3.5 rounded-full" style="background:#3b82f6"></div>
311
- </div>
312
- <div class="tooltip" data-tip="In Progress">
313
- <div class="w-3.5 h-3.5 rounded-full" style="background:#10b981"></div>
314
- </div>
315
- <div class="tooltip" data-tip="Completed">
316
- <div class="w-3.5 h-3.5 rounded-full" style="background:#6b7280"></div>
317
- </div>
318
- <div class="tooltip" data-tip="Cancelled">
319
- <div class="w-3.5 h-3.5 rounded-full" style="background:#ef4444"></div>
320
- </div>
321
- </div>
322
-
323
- <div class="flex items-center gap-2">
324
- <span class="font-medium text-xs">Agents</span>
325
- <div class="tooltip" data-tip="Available">
326
- <div class="w-7 h-7 rounded-full bg-neutral ring-2 ring-offset-1 ring-offset-base-100 ring-success flex items-center justify-center text-neutral-content text-[10px] font-bold">A</div>
327
- </div>
328
- <div class="tooltip" data-tip="En Route">
329
- <div class="w-7 h-7 rounded-full bg-neutral ring-2 ring-offset-1 ring-offset-base-100 ring-warning flex items-center justify-center text-neutral-content text-[10px] font-bold">E</div>
330
- </div>
331
- <div class="tooltip" data-tip="On Job">
332
- <div class="w-7 h-7 rounded-full bg-neutral ring-2 ring-offset-1 ring-offset-base-100 ring-primary flex items-center justify-center text-neutral-content text-[10px] font-bold">W</div>
333
- </div>
334
- <div class="tooltip" data-tip="Offline">
335
- <div class="w-7 h-7 rounded-full bg-neutral ring-2 ring-offset-1 ring-offset-base-100 ring-base-300 flex items-center justify-center text-neutral-content text-[10px] font-bold">O</div>
336
- </div>
337
- </div>
338
- </div>
339
- </div>
340
- {/if}
341
- </div>