smcgateway-sv 0.4.2 → 0.4.4
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.
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
const STEP_MS = 10_000;
|
|
25
25
|
const TICK_MS = 200;
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// Default to a time window that ends at the end of the current minute
|
|
28
|
+
let windowStart = $state(new Date(Date.now() - WINDOW_MS + 60000));
|
|
28
29
|
let windowEnd = $derived(new Date(windowStart.getTime() + WINDOW_MS));
|
|
29
30
|
let segments: Segment[] = $state([]);
|
|
30
31
|
let audioEl: HTMLAudioElement;
|
|
@@ -91,13 +92,15 @@
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
const seg = segments[segIdx];
|
|
95
|
+
activeSegment = seg;
|
|
94
96
|
const offsetSec = (cursor - seg.start.getTime()) / 1000;
|
|
95
97
|
|
|
96
98
|
if (!audioEl.src.endsWith(seg.url)) {
|
|
97
99
|
// console.log('LOAD', seg.url, audioEl.src);
|
|
98
|
-
activeSegment = seg;
|
|
99
100
|
audioEl.src = seg.url;
|
|
100
|
-
|
|
101
|
+
if (playing) {
|
|
102
|
+
await audioEl.play().catch(console.error);
|
|
103
|
+
}
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
if (Math.abs(audioEl.currentTime - offsetSec) > 0.5) {
|
|
@@ -252,11 +255,17 @@
|
|
|
252
255
|
</div>
|
|
253
256
|
<div class="d-flex justify-content-between">
|
|
254
257
|
<div class="windowStartLabel">
|
|
255
|
-
{windowStart.toLocaleTimeString(
|
|
258
|
+
{windowStart.toLocaleTimeString([], {
|
|
259
|
+
hour: '2-digit',
|
|
260
|
+
minute: '2-digit'
|
|
261
|
+
})}
|
|
256
262
|
</div>
|
|
257
263
|
<div>{new Date(cursor).toLocaleString()}</div>
|
|
258
264
|
<div class="windowEndLabel">
|
|
259
|
-
{windowEnd.toLocaleTimeString(
|
|
265
|
+
{windowEnd.toLocaleTimeString([], {
|
|
266
|
+
hour: '2-digit',
|
|
267
|
+
minute: '2-digit'
|
|
268
|
+
})}
|
|
260
269
|
</div>
|
|
261
270
|
</div>
|
|
262
271
|
</div>
|
|
@@ -265,9 +274,11 @@
|
|
|
265
274
|
{#snippet callInfo(call: Segment | undefined)}
|
|
266
275
|
<div class="callinfo text-center mt-1">
|
|
267
276
|
{#if call}
|
|
268
|
-
|
|
277
|
+
<span class="active-radio">
|
|
278
|
+
Radio {call.from} [{call.to}]
|
|
279
|
+
</span>
|
|
269
280
|
{:else}
|
|
270
|
-
|
|
281
|
+
<span class="text-muted"> -- silence -- </span>
|
|
271
282
|
{/if}
|
|
272
283
|
</div>
|
|
273
284
|
{/snippet}
|
|
@@ -326,4 +337,7 @@ cursor: {new Date(cursor).toISOString()}<br /> -->
|
|
|
326
337
|
min-width: 2px;
|
|
327
338
|
border-radius: 0;
|
|
328
339
|
}
|
|
340
|
+
.active-radio {
|
|
341
|
+
font-weight: bold;
|
|
342
|
+
}
|
|
329
343
|
</style>
|
package/dist/InputDate.svelte
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
value = $bindable(),
|
|
6
6
|
class: className = '',
|
|
7
7
|
disabled = false,
|
|
8
|
-
nodate =
|
|
8
|
+
nodate = '',
|
|
9
9
|
min = new Date(2000, 1, 1),
|
|
10
10
|
max = new Date()
|
|
11
11
|
}: {
|
|
12
|
-
value: Date |
|
|
12
|
+
value: Date | '';
|
|
13
13
|
class?: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
-
nodate?: Date |
|
|
15
|
+
nodate?: Date | '';
|
|
16
16
|
min?: Date;
|
|
17
17
|
max?: Date;
|
|
18
18
|
} = $props();
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
function toInputFormat(date: Date |
|
|
41
|
+
function toInputFormat(date: Date | ''): string {
|
|
42
42
|
if (date instanceof Date && !isNaN(date.getTime())) {
|
|
43
43
|
let d = new Date(date);
|
|
44
44
|
// Remove timezone
|
|
45
45
|
d.setHours(0, -d.getTimezoneOffset(), 0, 0);
|
|
46
46
|
return d.toISOString().substring(0, 10);
|
|
47
47
|
}
|
|
48
|
-
return
|
|
48
|
+
return "";
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function fromInputFormat(value: string): Date {
|
|
@@ -56,11 +56,22 @@
|
|
|
56
56
|
|
|
57
57
|
function handleInput(event: Event) {
|
|
58
58
|
const target = event.target as HTMLInputElement;
|
|
59
|
+
if (target.value == "") {
|
|
60
|
+
value = ""
|
|
61
|
+
internal = ""
|
|
62
|
+
return
|
|
63
|
+
}
|
|
59
64
|
if (target.value) {
|
|
65
|
+
// Handle year being typed in
|
|
66
|
+
const ymd = target.value.split('-');
|
|
67
|
+
const y = parseInt(ymd[0]);
|
|
68
|
+
if (y < 1000) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
60
71
|
value = fromInputFormat(target.value);
|
|
61
72
|
} else {
|
|
62
|
-
value = nodate
|
|
63
|
-
internal =
|
|
73
|
+
value = nodate;
|
|
74
|
+
internal = '';
|
|
64
75
|
}
|
|
65
76
|
}
|
|
66
77
|
</script>
|