Skip to content

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

Python

resize

Murtaza Nasir1b4389a9bc9d
diff --git a/templates/index.html b/templates/index.html
index 2467525c..c71e2e4d 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -209,7 +209,7 @@
/* Tab content section - takes up remaining space and aligns with chat box */
.tab-section {
flex: 1;
- min-height: 0; /* Allows flex to work properly */
+ min-height: 100px; /* Minimum height to prevent collapsing too much */
overflow: hidden;
display: flex;
flex-direction: column;
@@ -798,7 +798,7 @@
</div>
<!-- Transcription Section -->
- <div class="transcription-section">
+ <div class="transcription-section" :style="{ flex: transcriptionFlex }">
<div class="flex justify-between items-center mb-1">
<h4 class="font-semibold text-[var(--text-secondary)]">Transcription</h4>
<button @click="copyTranscription($event)" class="text-xs text-[var(--text-muted)] hover:text-[var(--text-accent)] p-1 rounded" title="Copy to clipboard">
@@ -819,8 +819,16 @@
</div>
</div>
+ <!-- Resizable Handle -->
+ <div
+ class="resize-handle cursor-ns-resize h-2 bg-[var(--border-primary)] hover:bg-[var(--border-accent)] rounded-full my-1 flex items-center justify-center"
+ @mousedown="startResize"
+ title="Drag to resize">
+ <div class="w-10 h-1 bg-[var(--text-light)] rounded-full"></div>
+ </div>
+
<!-- Tabs Section -->
- <div class="tab-section">
+ <div class="tab-section" :style="{ flex: tabsFlex }">
<div class="border-b border-[var(--border-primary)]">
<nav class="-mb-px flex space-x-4" aria-label="Tabs">
<button @click="selectedTab = 'summary'"
@@ -1988,6 +1996,14 @@
// --- Chat functionality ---
+ // Resizable panels state
+ const transcriptionFlex = ref(2);
+ const tabsFlex = ref(1);
+ const isResizing = ref(false);
+ const startY = ref(0);
+ const startTranscriptionFlex = ref(0);
+ const startTabsFlex = ref(0);
+
const showChat = ref(false);
const chatMessages = ref([]);
const chatInput = ref('');
@@ -2186,6 +2202,55 @@
}
};
+ // Resize functionality
+ const startResize = (e) => {
+ isResizing.value = true;
+ startY.value = e.clientY;
+ startTranscriptionFlex.value = transcriptionFlex.value;
+ startTabsFlex.value = tabsFlex.value;
+
+ // Add event listeners for mousemove and mouseup
+ document.addEventListener('mousemove', handleResize);
+ document.addEventListener('mouseup', stopResize);
+
+ // Prevent text selection during resize
+ document.body.style.userSelect = 'none';
+ };
+
+ const handleResize = (e) => {
+ if (!isResizing.value) return;
+
+ const deltaY = e.clientY - startY.value;
+ const totalFlex = startTranscriptionFlex.value + startTabsFlex.value;
+
+ // Calculate new flex values based on mouse movement
+ // Moving down increases transcription section, decreases tabs
+ // This is more intuitive - drag down to make transcription bigger
+ const flexChange = deltaY / 200; // Reduced sensitivity (was 10)
+
+ let newTranscriptionFlex = Math.max(1, startTranscriptionFlex.value + flexChange);
+ let newTabsFlex = Math.max(0.5, totalFlex - newTranscriptionFlex);
+
+ // Ensure minimum heights are maintained
+ if (newTranscriptionFlex < 1) {
+ newTranscriptionFlex = 1;
+ newTabsFlex = totalFlex - 1;
+ } else if (newTabsFlex < 0.5) {
+ newTabsFlex = 0.5;
+ newTranscriptionFlex = totalFlex - 0.5;
+ }
+
+ transcriptionFlex.value = newTranscriptionFlex;
+ tabsFlex.value = newTabsFlex;
+ };
+
+ const stopResize = () => {
+ isResizing.value = false;
+ document.removeEventListener('mousemove', handleResize);
+ document.removeEventListener('mouseup', stopResize);
+ document.body.style.userSelect = '';
+ };
+
// Clear chat messages when recording changes
watch(selectedRecording, (newVal) => {
chatMessages.value = [];
@@ -2203,6 +2268,9 @@
isProcessingActive, progressPopupMinimized, progressPopupClosed,
// Chat State
showChat, chatMessages, chatInput, isChatLoading, chatMessagesRef, // <-- Added chatMessagesRef
+ // Resize functionality
+ transcriptionFlex, tabsFlex, isResizing, startY, startTranscriptionFlex, startTabsFlex,
+ startResize, handleResize, stopResize,
// Computed
groupedRecordings, totalInQueue, completedInQueue, queuedFiles, finishedFilesInQueue,
// Inline editing state