Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Hoist formatTimestamp declaration above state object so the reference resolves at load time
Murtaza Nasir84a17d3e488e
diff --git a/static/js/app.modular.js b/static/js/app.modular.jsindex 55870103..00e29f2c 100644--- a/static/js/app.modular.js+++ b/static/js/app.modular.js@@ -639,6 +639,19 @@ document.addEventListener('DOMContentLoaded', async () => {]};+ // Compact mm:ss / h:mm:ss formatter for transcript timestamps. Returns+ // an empty string when the input is missing so templates can render+ // "" without a guard. Declared before `state` because state references it.+ const formatTimestamp = (seconds) => {+ if (seconds == null || isNaN(seconds)) return '';+ const total = Math.max(0, Math.floor(seconds));+ const h = Math.floor(total / 3600);+ const m = Math.floor((total % 3600) / 60);+ const s = total % 60;+ const pad = (n) => n < 10 ? '0' + n : '' + n;+ return h > 0 ? `${h}:${pad(m)}:${pad(s)}` : `${pad(m)}:${pad(s)}`;+ };+// =========================================================================// COLLECT ALL STATE INTO SINGLE OBJECT FOR COMPOSABLES// =========================================================================@@ -1030,19 +1043,6 @@ document.addEventListener('DOMContentLoaded', async () => {// COMPUTED PROPERTIES (define before composables that need them)// =========================================================================- // Compact mm:ss / h:mm:ss formatter for transcript timestamps. Returns- // an empty string when the input is missing so templates can render- // "" without a guard.- const formatTimestamp = (seconds) => {- if (seconds == null || isNaN(seconds)) return '';- const total = Math.max(0, Math.floor(seconds));- const h = Math.floor(total / 3600);- const m = Math.floor((total % 3600) / 60);- const s = total % 60;- const pad = (n) => n < 10 ? '0' + n : '' + n;- return h > 0 ? `${h}:${pad(m)}:${pad(s)}` : `${pad(m)}:${pad(s)}`;- };-const processedTranscription = computed(() => {if (!selectedRecording.value?.transcription) {return { hasDialogue: false, content: '', speakers: [], simpleSegments: [], bubbleRows: [], isError: false };