Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Add Stats tab to the mobile bottom navigation — was desktop-only since the queue #1 work; now exposed alongside Events in the More overflow with a parallel mobile-stats-panel.html template; (1) new mobile-stats-panel.html: same data as desktop-stats-tab but laid out for narrow screens — 2-column metric grid (Total length / Speakers / Turns / Words) instead of desktop's 4-column, then a card-stack of per-speaker breakdowns (each card has speaker pill + duration on top, slim proportion bar, 3-column secondary stats grid '% audio / Turns / Words', WPM line at the bottom if available) instead of the wide HTML table that won't fit on phones; silence row preserved as its own muted card; empty state mirrors desktop with the chart-bar icon; (2) tab-navigation.html: the More button now activates whenever EITHER Events OR Stats are available (was: only Events) via a new hasMobileMoreOverflow computed, and the popup gains a Stats entry between Notes and Events with a speaker-count pill on the right; the active-tab dot lights up for stats / events / notes as before; (3) hasMobileMoreOverflow computed in app.modular.js derives from hasRecordingStats and selectedRecording.events.length, exposed in setup return so the template can use it; (4) the existing detail-view.html include list now includes the mobile-stats-panel.html sibling so the new panel actually renders when mobileTab === 'stats'

Murtaza Nasir2119feaea3e0
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index f53c9e82..87ac39af 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -1320,6 +1320,15 @@ document.addEventListener('DOMContentLoaded', async () => {
const hasRecordingStats = computed(() =>
!!recordingStats.value && recordingStats.value.speakerRows.length > 0
);
+ // True when the mobile bottom nav needs a More overflow:
+ // either Events or Stats is available alongside Notes.
+ // Otherwise the bar keeps Notes as a direct 4th tab.
+ const hasMobileMoreOverflow = computed(() =>
+ hasRecordingStats.value
+ || (selectedRecording.value
+ && Array.isArray(selectedRecording.value.events)
+ && selectedRecording.value.events.length > 0)
+ );
// Aggregate `{{name}}` variables across the currently selected
// tags / folder / user / admin prompt chain. The pure helpers
@@ -1448,7 +1457,7 @@ document.addEventListener('DOMContentLoaded', async () => {
currentColorScheme, showColorSchemeModal, windowWidth, mobileTab, mobileMoreOpen, isMetadataExpanded, expandedSection,
showSortOptions, currentLanguage, currentLanguageName, availableLanguages, showLanguageMenu,
colorSchemes, isMobileScreen, isMobileDevice,
- summaryWordCount, notesWordCount, recordingStats, hasRecordingStats,
+ summaryWordCount, notesWordCount, recordingStats, hasRecordingStats, hasMobileMoreOverflow,
// Upload
uploadQueue, allJobs, currentlyProcessingFile, processingProgress, processingMessage,
diff --git a/templates/components/detail-view.html b/templates/components/detail-view.html
index fd341b40..284ab09b 100644
--- a/templates/components/detail-view.html
+++ b/templates/components/detail-view.html
@@ -43,6 +43,7 @@
{% include 'components/detail/mobile-notes-panel.html' %}
{% include 'components/detail/mobile-chat-panel.html' %}
{% include 'components/detail/mobile-events-panel.html' %}
+ {% include 'components/detail/mobile-stats-panel.html' %}
</div>
<!-- Persistent mini-player (compact strip) -->
diff --git a/templates/components/detail/mobile-stats-panel.html b/templates/components/detail/mobile-stats-panel.html
new file mode 100644
index 00000000..d0987c4d
--- /dev/null
+++ b/templates/components/detail/mobile-stats-panel.html
@@ -0,0 +1,95 @@
+<!-- Mobile Stats Panel — same data as desktop-stats-tab.html but laid
+ out for narrow screens: 2-column metric grid instead of 4-column,
+ stacked per-speaker cards instead of a wide HTML table. Gated on
+ hasRecordingStats so the tab only surfaces meaningful data (the
+ stats are derived from per-segment start/end times). -->
+<div v-if="mobileTab === 'stats'" class="h-full overflow-y-auto px-3 py-3">
+ <div v-if="hasRecordingStats" class="space-y-4">
+
+ <!-- Headline metrics -->
+ <div class="grid grid-cols-2 gap-2">
+ <div class="bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-md p-3">
+ <div class="t-label">Total length</div>
+ <div class="t-subhead mt-1" v-text="recordingStats.total.durationLabel"></div>
+ </div>
+ <div class="bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-md p-3">
+ <div class="t-label">Speakers</div>
+ <div class="t-subhead mt-1" v-text="recordingStats.total.speakers"></div>
+ </div>
+ <div class="bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-md p-3">
+ <div class="t-label">Turns</div>
+ <div class="t-subhead mt-1" v-text="recordingStats.total.turns"></div>
+ </div>
+ <div class="bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-md p-3">
+ <div class="t-label">Words</div>
+ <div class="t-subhead mt-1" v-text="recordingStats.total.words.toLocaleString()"></div>
+ </div>
+ </div>
+
+ <!-- Per-speaker stack — one card per speaker, sorted by
+ speaking time. Each card has the speaker pill + a
+ proportion bar across the top, then a 2-column grid of
+ secondary stats below. -->
+ <div>
+ <div class="flex items-center justify-between mb-2 px-1">
+ <h3 class="t-subhead">Per speaker</h3>
+ <span class="t-meta">sorted by time</span>
+ </div>
+ <div class="space-y-2">
+ <div v-for="row in recordingStats.speakerRows" :key="row.speakerId"
+ class="bg-[var(--bg-secondary)] border border-[var(--border-primary)] rounded-md p-3">
+ <div class="flex items-center justify-between gap-2 mb-2">
+ <span :class="['speaker-tablet', row.color]"
+ style="font-size: 11px; padding: 2px 8px;"
+ v-text="row.name"></span>
+ <span class="t-meta font-mono" v-text="row.durationLabel"></span>
+ </div>
+ <!-- Slim proportion bar -->
+ <div class="h-1.5 w-full rounded-full bg-[var(--bg-tertiary)] overflow-hidden mb-2">
+ <div class="h-full" :style="{ width: row.pct.toFixed(1) + '%', background: 'var(--text-accent)' }"></div>
+ </div>
+ <!-- Secondary stats: 3-column grid -->
+ <div class="grid grid-cols-3 gap-2 text-center">
+ <div>
+ <div class="t-label">% audio</div>
+ <div class="text-sm font-medium mt-0.5">${ row.pct.toFixed(1) }%</div>
+ </div>
+ <div>
+ <div class="t-label">Turns</div>
+ <div class="text-sm font-medium mt-0.5" v-text="row.turns"></div>
+ </div>
+ <div>
+ <div class="t-label">Words</div>
+ <div class="text-sm font-medium mt-0.5" v-text="row.words.toLocaleString()"></div>
+ </div>
+ </div>
+ <div v-if="row.wpm" class="mt-2 pt-2 border-t border-[var(--border-secondary)] flex items-center justify-between t-meta">
+ <span>Speaking rate</span>
+ <span class="font-mono font-medium" style="color: var(--text-primary);">${ row.wpm } WPM</span>
+ </div>
+ </div>
+
+ <!-- Silence card -->
+ <div v-if="recordingStats.silence.seconds > 0"
+ class="bg-[var(--bg-tertiary)]/50 border border-[var(--border-secondary)] rounded-md p-3">
+ <div class="flex items-center justify-between gap-2 mb-2">
+ <span class="t-meta italic">Silence</span>
+ <span class="t-meta font-mono" v-text="recordingStats.silence.durationLabel"></span>
+ </div>
+ <div class="h-1.5 w-full rounded-full bg-[var(--bg-tertiary)] overflow-hidden mb-2">
+ <div class="h-full" :style="{ width: recordingStats.silence.pct.toFixed(1) + '%', background: 'var(--text-muted)' }"></div>
+ </div>
+ <div class="t-meta text-center">
+ ${ recordingStats.silence.pct.toFixed(1) }% of total
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div v-else class="empty">
+ <div class="empty__icon"><i class="fas fa-chart-bar"></i></div>
+ <div class="empty__title">No stats yet</div>
+ <div class="empty__body">Stats appear once this recording has been transcribed with speaker diarization and segment timestamps.</div>
+ </div>
+</div>
diff --git a/templates/components/detail/tab-navigation.html b/templates/components/detail/tab-navigation.html
index 2349d152..f1f4ad7b 100644
--- a/templates/components/detail/tab-navigation.html
+++ b/templates/components/detail/tab-navigation.html
@@ -29,24 +29,24 @@
${chatMessages.length}
</span>
</button>
- <!-- Notes appears DIRECTLY in the bar when the recording has no
- events (total stays at 4 tabs); when events ARE present it
- moves into the More overflow alongside Events. -->
- <button v-if="!selectedRecording || !selectedRecording.events || selectedRecording.events.length === 0"
+ <!-- Notes appears DIRECTLY in the bar when there's nothing in the
+ More overflow (no events, no stats); otherwise Notes moves
+ into More alongside Events and Stats so the bar stays at 4
+ tabs and overflow content has a single home. -->
+ <button v-if="!hasMobileMoreOverflow"
@click="mobileTab = 'notes'"
class="flex-1 flex flex-col items-center justify-center gap-0.5 px-2 transition-colors"
:class="mobileTab === 'notes' ? 'text-[var(--text-accent)]' : 'text-[var(--text-muted)]'">
<i class="fas fa-sticky-note text-base"></i>
<span class="text-[10px] font-medium" v-text="t('notes.title')"></span>
</button>
- <!-- More menu only when there's actual overflow (events present). -->
<button v-else
@click="mobileMoreOpen = !mobileMoreOpen"
class="flex-1 flex flex-col items-center justify-center gap-0.5 px-2 transition-colors relative"
- :class="['notes','events'].includes(mobileTab) ? 'text-[var(--text-accent)]' : 'text-[var(--text-muted)]'">
+ :class="['notes','events','stats'].includes(mobileTab) ? 'text-[var(--text-accent)]' : 'text-[var(--text-muted)]'">
<i class="fas fa-ellipsis-h text-base"></i>
<span class="text-[10px] font-medium">More</span>
- <span v-if="['notes','events'].includes(mobileTab)"
+ <span v-if="['notes','events','stats'].includes(mobileTab)"
class="absolute top-1 right-3 inline-flex items-center justify-center w-1.5 h-1.5 rounded-full"
style="background: var(--text-accent);"></span>
</button>
@@ -54,9 +54,7 @@
<!-- More popup (slides up over the nav). Bottom-sheet feel. -->
<Teleport to="body">
<div v-if="mobileMoreOpen" class="fixed inset-0 z-[60] flex flex-col">
- <!-- Backdrop -->
<div class="flex-1" style="background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(2px);" @click="mobileMoreOpen = false"></div>
- <!-- Sheet -->
<div class="surface-raised flex-shrink-0" style="border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: env(safe-area-inset-bottom);">
<div class="flex justify-center py-2">
<span style="width: 36px; height: 4px; border-radius: 2px; background: var(--border-primary);"></span>
@@ -68,6 +66,14 @@
<i class="fas fa-sticky-note w-5 text-center"></i>
<span class="font-medium" v-text="t('notes.title')"></span>
</button>
+ <button v-if="hasRecordingStats"
+ @click="mobileTab = 'stats'; mobileMoreOpen = false"
+ class="w-full flex items-center gap-3 px-3 py-3 rounded-md hover:bg-[var(--bg-tertiary)] transition-colors"
+ :class="mobileTab === 'stats' ? 'text-[var(--text-accent)]' : 'text-[var(--text-primary)]'">
+ <i class="fas fa-chart-bar w-5 text-center"></i>
+ <span class="font-medium">Stats</span>
+ <span class="ml-auto pill-status pill-status--info">${ recordingStats.total.speakers }</span>
+ </button>
<button v-if="selectedRecording && selectedRecording.events && selectedRecording.events.length > 0"
@click="mobileTab = 'events'; mobileMoreOpen = false"
class="w-full flex items-center gap-3 px-3 py-3 rounded-md hover:bg-[var(--bg-tertiary)] transition-colors"