Skip to content

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

Python

Upload modal — decouple from currentView so the underlying view stays visible behind the overlay — the previous commit used currentView === 'upload' to gate the modal, which (because detail-view's v-if is currentView === 'detail' && selectedRecording) made the detail view disappear behind the modal; now upload visibility is its own state ref showUploadModal (false by default), independent of currentView; switchToUploadView and the post-recording exit paths flip the flag to true, closeUploadView / switchToDetailView / selectRecording / upload-success transitions flip it to false; the recording-flow entry points (startRecording, recoverRecording) clear it so the recording view and the upload modal never compete for the same surface; initial currentView is now null so the user lands on the recordings list / empty state instead of an auto-open upload screen — explicit opt-in via the New Recording button

Murtaza Nasird74934ced15e
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index d55509c4..6c5d5973 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -236,7 +236,19 @@ document.addEventListener('DOMContentLoaded', async () => {
// =========================================================================
// --- Core State ---
- const currentView = ref('upload');
+ // Initial view is null (the recordings list / empty state).
+ // Was 'upload' which made the old full-screen upload view the
+ // landing surface; now that upload is a modal, defaulting to
+ // null lets the user land on their recordings list and open
+ // the modal explicitly via the New Recording button.
+ const currentView = ref(null);
+ // Upload visibility is a modal flag, not a currentView value,
+ // so the underlying list / detail stays mounted behind the
+ // overlay. Set true on switchToUploadView / opened paths;
+ // cleared by closeUploadView and the upload-success transition
+ // to the detail view. Defaults to false so the user lands on
+ // the recordings list / empty state, not on an auto-open modal.
+ const showUploadModal = ref(false);
const dragover = ref(false);
const recordings = ref([]);
const selectedRecording = ref(null);
@@ -1341,7 +1353,7 @@ document.addEventListener('DOMContentLoaded', async () => {
// =========================================================================
const state = {
// Core
- currentView, dragover, recordings, selectedRecording, selectedTab, searchQuery,
+ currentView, showUploadModal, dragover, recordings, selectedRecording, selectedTab, searchQuery,
isLoadingRecordings, globalError, csrfToken,
// Filters
@@ -3251,6 +3263,7 @@ document.addEventListener('DOMContentLoaded', async () => {
const recovered = await audioComposable.recoverRecordingFromDB();
if (recovered) {
currentView.value = 'recording';
+ showUploadModal.value = false;
showToast(safeT('messages.recordingRecovered'), 'success');
} else {
showToast(safeT('messages.failedToRecoverRecording'), 'error');
diff --git a/static/js/modules/composables/audio.js b/static/js/modules/composables/audio.js
index 58d16ab4..c4871aad 100644
--- a/static/js/modules/composables/audio.js
+++ b/static/js/modules/composables/audio.js
@@ -13,7 +13,7 @@ export function useAudio(state, utils) {
audioChunks, recordingTime, recordingInterval, recordingMode, audioBlobURL,
estimatedFileSize, actualBitrate, recordingNotes, recordingQuality,
maxRecordingMB, fileSizeWarningShown, sizeCheckInterval, recordingDisclaimer,
- showRecordingDisclaimerModal, pendingRecordingMode, currentView, isDarkMode, wakeLock, animationFrameId,
+ showRecordingDisclaimerModal, pendingRecordingMode, currentView, showUploadModal, isDarkMode, wakeLock, animationFrameId,
activeStreams, visualizer, micVisualizer, systemVisualizer, canRecordAudio,
canRecordSystemAudio, systemAudioSupported, systemAudioError, globalError,
selectedTagIds, selectedFolderId, asrLanguage, asrMinSpeakers, asrMaxSpeakers, uploadQueue,
@@ -480,6 +480,9 @@ export function useAudio(state, utils) {
isRecording.value = true;
// Switch to recording view immediately so pending wake-lock/notification awaits don't block Safari rendering
currentView.value = 'recording';
+ // Dismiss the upload modal while the recording view is on
+ // screen so the two don't compete for the same surface.
+ showUploadModal.value = false;
// Start timer. Phase C of #287 (c)(d): hours-based hard ceiling
// replaces the size-based auto-stop for server-streamed
@@ -631,7 +634,11 @@ export function useAudio(state, utils) {
await hideRecordingNotification();
try { await RecordingDB.clearRecordingSession(); } catch (_) { /* ignore */ }
_resetServerSessionState();
- currentView.value = 'upload';
+ // Drop the recording view and reopen the upload modal
+ // over whatever was underneath so the finalized
+ // recording lands in the queue ready to finish.
+ currentView.value = null;
+ showUploadModal.value = true;
return result;
} catch (e) {
console.error('[Recording] finalize failed; falling back to single-shot upload:', e);
@@ -692,8 +699,9 @@ export function useAudio(state, utils) {
await releaseWakeLock();
await hideRecordingNotification();
- // Return to upload view (main UI)
- currentView.value = 'upload';
+ // Return to upload modal so the user can finish the upload form.
+ currentView.value = null;
+ showUploadModal.value = true;
// Start upload immediately
progressPopupMinimized.value = false;
@@ -872,8 +880,9 @@ export function useAudio(state, utils) {
await releaseWakeLock();
await hideRecordingNotification();
- // Return to upload view
- currentView.value = 'upload';
+ // Return to upload modal so the user can finish the upload form.
+ currentView.value = null;
+ showUploadModal.value = true;
};
// Draw single visualizer
diff --git a/static/js/modules/composables/modals.js b/static/js/modules/composables/modals.js
index 5dae37d5..34475b33 100644
--- a/static/js/modules/composables/modals.js
+++ b/static/js/modules/composables/modals.js
@@ -113,10 +113,13 @@ 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
+ // 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 = 'upload';
+ currentView.value = null;
}
showToast('Recording deleted.', 'fa-trash');
diff --git a/static/js/modules/composables/recordings.js b/static/js/modules/composables/recordings.js
index 7e6e910d..9cb533f5 100644
--- a/static/js/modules/composables/recordings.js
+++ b/static/js/modules/composables/recordings.js
@@ -13,7 +13,7 @@ export function useRecordings(state, utils, reprocessComposable) {
filterTags, filterSpeakers, filterDatePreset, filterDateRange, filterTextQuery,
filterStarred, filterInbox, filterFolder, sortBy,
availableTags, availableSpeakers, availableFolders, selectedTagIds, uploadLanguage, uploadMinSpeakers, uploadMaxSpeakers, uploadHotwords, uploadInitialPrompt,
- useAsrEndpoint, connectorSupportsDiarization, globalError, uploadQueue, isProcessingActive, currentView,
+ useAsrEndpoint, connectorSupportsDiarization, globalError, uploadQueue, isProcessingActive, currentView, showUploadModal,
isMobileScreen, isSidebarCollapsed, isRecording, audioBlobURL,
speakerColorMap,
// Incognito mode
@@ -259,6 +259,10 @@ export function useRecordings(state, utils, reprocessComposable) {
}
currentView.value = 'detail';
+ // If the upload modal happened to be open, dismiss it so the
+ // user's click on a recording resolves to the detail view
+ // without a competing overlay.
+ showUploadModal.value = false;
if (isRecording.value) {
// Don't interrupt recording
diff --git a/static/js/modules/composables/ui.js b/static/js/modules/composables/ui.js
index d0ab1852..1523dab0 100644
--- a/static/js/modules/composables/ui.js
+++ b/static/js/modules/composables/ui.js
@@ -6,7 +6,7 @@
export function useUI(state, utils, processedTranscription) {
const {
isDarkMode, currentColorScheme, colorSchemes, isSidebarCollapsed,
- showColorSchemeModal, isUserMenuOpen, currentView, selectedRecording,
+ showColorSchemeModal, isUserMenuOpen, currentView, showUploadModal, selectedRecording,
windowWidth, isMobileScreen, showAdvancedFilters, showSortOptions,
searchTipsExpanded, isMetadataExpanded, editingParticipants, editingMeetingDate,
editingSummary, tempSummaryContent, summaryMarkdownEditorInstance,
@@ -176,7 +176,9 @@ export function useUI(state, utils, processedTranscription) {
selectedFolderId.value = null;
}
}
- currentView.value = 'upload';
+ // Upload is now a modal flag, not a currentView value, so the
+ // underlying detail / list stays mounted behind the overlay.
+ showUploadModal.value = true;
if (isMobileScreen.value) {
isSidebarCollapsed.value = true;
}
@@ -185,15 +187,15 @@ export function useUI(state, utils, processedTranscription) {
// Switch to detail view
const switchToDetailView = () => {
currentView.value = 'detail';
+ // Closing implies dismissing the upload modal too in case it
+ // was open while the user navigated into a recording.
+ showUploadModal.value = false;
};
- // Close the upload modal. If a recording was already open behind it,
- // return to its detail view; otherwise drop back to the empty/list
- // state by clearing currentView. Mirrors the "previous view" mental
- // model the user has when dismissing a modal.
+ // Dismiss the upload modal. The underlying view (list or detail)
+ // is unchanged — the modal was overlay-only.
const closeUploadView = () => {
- if (currentView.value !== 'upload') return;
- currentView.value = selectedRecording.value ? 'detail' : null;
+ showUploadModal.value = false;
};
// Switch to recording view
diff --git a/static/js/modules/composables/upload.js b/static/js/modules/composables/upload.js
index 2be5e5be..6f0bbb52 100644
--- a/static/js/modules/composables/upload.js
+++ b/static/js/modules/composables/upload.js
@@ -50,7 +50,7 @@ export function useUpload(state, utils) {
// Video / audio-only upload state
videoRetentionEnabled, keepAudioOnly, maxAudioOnlyVideoSizeMB,
// View state
- currentView,
+ currentView, showUploadModal,
// Upload disclaimer state
uploadDisclaimer, showUploadDisclaimerModal
} = state;
@@ -832,6 +832,9 @@ export function useUpload(state, utils) {
// Auto-select the incognito recording and switch to detail view
selectedRecording.value = incognitoData;
currentView.value = 'detail';
+ // Dismiss the upload modal if it was still open behind the
+ // success transition.
+ if (showUploadModal) showUploadModal.value = false;
// Show toast
showToast(t('incognito.recordingProcessed'), 'fa-user-secret');
@@ -875,6 +878,9 @@ export function useUpload(state, utils) {
if (incognitoRecording && incognitoRecording.value) {
selectedRecording.value = incognitoRecording.value;
currentView.value = 'detail';
+ // Dismiss the upload modal if it was still open behind the
+ // success transition.
+ if (showUploadModal) showUploadModal.value = false;
}
};
diff --git a/templates/components/upload-view.html b/templates/components/upload-view.html
index b7c1c11c..74739869 100644
--- a/templates/components/upload-view.html
+++ b/templates/components/upload-view.html
@@ -4,7 +4,7 @@
the modal calls closeUploadView() which restores currentView to either
'detail' (if a recording is open behind it) or null (drops back to
the empty/list view). Backdrop-click and Esc both dismiss. -->
-<div v-if="currentView === 'upload'"
+<div v-if="showUploadModal"
@click.self="closeUploadView"
@keydown.esc="closeUploadView"
tabindex="-1"