Skip to content

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

Python

Seed the new-recording upload form's folder picker from the sidebar's current folder filter, clearing it when sidebar is on All Recordings or Unfiled

Murtaza Nasirea9e99274880
diff --git a/static/js/modules/composables/ui.js b/static/js/modules/composables/ui.js
index 3764da81..921ea48f 100644
--- a/static/js/modules/composables/ui.js
+++ b/static/js/modules/composables/ui.js
@@ -18,7 +18,11 @@ export function useUI(state, utils, processedTranscription) {
recordingNotes, showDownloadMenu, currentPlayingSegmentIndex, followPlayerMode,
playbackRate, showSpeedMenu, playbackSpeeds, modalPlaybackRate, speedMenuPosition,
videoFullscreen, fullscreenControlsVisible, fullscreenControlsTimer, videoCollapsed,
- regeneratingTitle
+ regeneratingTitle,
+ // Sidebar folder filter and upload-form folder selection — used by
+ // switchToUploadView to seed the new-recording dialog from the
+ // currently-selected sidebar folder.
+ filterFolder, selectedFolderId,
} = state;
const autoSaveDelay = 2000; // 2 seconds
@@ -153,6 +157,25 @@ export function useUI(state, utils, processedTranscription) {
return;
}
}
+ // Mirror the sidebar's folder context into the upload-form folder
+ // picker so opening the new-recording dialog always reflects where
+ // the user thinks they are:
+ // - sidebar set to a real folder -> form pre-fills to it
+ // - sidebar set to All Recordings or Unfiled -> form clears,
+ // so a stale selection from a previous visit doesn't carry
+ // over and a new recording added now will end up unfiled
+ // unless the user explicitly picks something.
+ if (filterFolder && selectedFolderId) {
+ const fid = filterFolder.value;
+ if (fid !== '' && fid !== 'none' && fid != null) {
+ const numeric = typeof fid === 'number' ? fid : parseInt(fid, 10);
+ if (Number.isFinite(numeric) && numeric > 0) {
+ selectedFolderId.value = numeric;
+ }
+ } else {
+ selectedFolderId.value = null;
+ }
+ }
currentView.value = 'upload';
if (isMobileScreen.value) {
isSidebarCollapsed.value = true;