Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Two empty-state improvements — (1) deleting a recording now auto-selects the next neighbour (the recording at the same index after removal, or the new last entry if the deleted one was at the end of the list) instead of dropping the user onto a blank surface; falls back to clearing selection only when the list is genuinely empty after the delete; (2) the empty/landing surface itself rebuilt — the v-if now triggers whenever no recording is selected and we're not in the recording flow (was scoped to currentView === 'detail' which meant it never showed after deletion-to-null or first load), and has two flavours: a friendly 'Ready to capture' panel with a single New recording CTA when there are zero recordings, and a minimal 'Select a recording' prompt with a ghost-styled CTA when the list has items but the user navigated to none; both use the design system primitives instead of bespoke chrome
Murtaza Nasirfea412f784b7
diff --git a/static/js/modules/composables/modals.js b/static/js/modules/composables/modals.jsindex 34475b33..f787e1b4 100644--- a/static/js/modules/composables/modals.js+++ b/static/js/modules/composables/modals.js@@ -98,6 +98,15 @@ export function useModals(state, utils) {const data = await response.json();if (!response.ok) throw new Error(data.error || 'Failed to delete recording');+ // Capture the deleted recording's index BEFORE removing it,+ // so when the deleted one was the selectedRecording we can+ // pick a sensible neighbour to land on (the next sibling+ // visually, or the previous one if we deleted the last+ // entry) instead of dropping the user into an empty+ // surface.+ const wasSelected = selectedRecording.value?.id === deletedId;+ const deletedIndex = recordings.value.findIndex(r => r.id === deletedId);+// Remove from recordings listrecordings.value = recordings.value.filter(r => r.id !== deletedId);totalRecordings.value--;@@ -113,13 +122,21 @@ export function useModals(state, utils) {allJobs.value = allJobs.value.filter(job => job.recording_id !== deletedId);}- // Clear selected recording if it's the one being deleted.- // currentView is left as-is — the empty/list view is what- // shows when selectedRecording is null and currentView isn't- // explicitly 'recording' or 'detail'.- if (selectedRecording.value?.id === deletedId) {- selectedRecording.value = null;- currentView.value = null;+ // Re-select a neighbour when the deleted recording was the+ // selected one. If anything remains: pick the recording at+ // the same index (next sibling) or the new last one if we+ // were at the end. Falls back to clearing selection only+ // when the list is now empty.+ if (wasSelected) {+ const remaining = recordings.value;+ if (remaining.length > 0) {+ const nextIndex = Math.min(deletedIndex, remaining.length - 1);+ selectedRecording.value = remaining[nextIndex];+ currentView.value = 'detail';+ } else {+ selectedRecording.value = null;+ currentView.value = null;+ }}showToast('Recording deleted.', 'fa-trash');diff --git a/templates/components/detail/empty-state.html b/templates/components/detail/empty-state.htmlindex 69565e08..54469be7 100644--- a/templates/components/detail/empty-state.html+++ b/templates/components/detail/empty-state.html@@ -1,12 +1,52 @@-<!-- Empty State -->-<div v-if="currentView === 'detail' && !selectedRecording" class="flex-1 flex items-center justify-center">- <div class="text-center">- <i class="fas fa-microphone text-6xl text-[var(--text-muted)] mb-4"></i>- <h2 class="text-2xl font-bold mb-2" v-text="t('colorScheme.selectRecording')"></h2>- <p class="text-[var(--text-muted)] mb-6" v-text="t('colorScheme.chooseRecording')"></p>- <button @click="switchToUploadView"- class="px-6 py-3 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg hover:bg-[var(--bg-button-hover)] transition-colors">- <i class="fas fa-plus mr-2"></i>Upload New Recording- </button>+<!-- Empty / landing surface.++ Shows whenever no recording is selected AND we are not in the+ recording flow. Two flavours:+ - First-time / truly empty: a friendly "Get started" panel with+ an explicit Upload and Record CTA.+ - Recordings list has items but none selected (e.g. just after a+ deletion auto-selected nothing): a minimal "Select a recording+ or upload a new one" prompt.++ Sits as the landing surface of the main column. The detail view+ (its sibling) has its own v-if for the populated state. -->+<div v-if="!selectedRecording && currentView !== 'recording'"+ class="flex-1 flex items-center justify-center p-6">+ <div class="max-w-md w-full text-center">+ <!-- TRULY EMPTY (no recordings at all) -->+ <template v-if="!recordings || recordings.length === 0">+ <div class="mx-auto mb-6 w-20 h-20 rounded-full flex items-center justify-center"+ style="background: var(--bg-tertiary);">+ <i class="fas fa-microphone text-3xl" style="color: var(--text-accent);"></i>+ </div>+ <h2 class="text-2xl font-semibold mb-2" style="color: var(--text-primary);">+ Ready to capture+ </h2>+ <p class="t-body mb-6" style="color: var(--text-muted);">+ Drop an audio file, record from your microphone, or capture system audio — Speakr turns it into a searchable transcript with summary and chat.+ </p>+ <div class="flex flex-col sm:flex-row gap-2 justify-center">+ <button @click="switchToUploadView" class="btn btn--primary">+ <i class="fas fa-plus"></i><span>New recording</span>+ </button>+ </div>+ </template>++ <!-- SOMETHING SELECTABLE EXISTS but nothing currently selected -->+ <template v-else>+ <div class="mx-auto mb-4 w-14 h-14 rounded-full flex items-center justify-center"+ style="background: var(--bg-tertiary);">+ <i class="fas fa-list text-xl" style="color: var(--text-muted);"></i>+ </div>+ <h2 class="text-lg font-semibold mb-1" style="color: var(--text-primary);">+ Select a recording+ </h2>+ <p class="t-meta mb-5">+ Pick one from the sidebar or start a new recording.+ </p>+ <button @click="switchToUploadView" class="btn btn--ghost">+ <i class="fas fa-plus"></i><span>New recording</span>+ </button>+ </template></div></div>