Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
UI fixes
Murtaza Nasirc8f782b9dd71
diff --git a/static/css/styles.css b/static/css/styles.cssindex 121b5688..61921271 100644--- a/static/css/styles.css+++ b/static/css/styles.css@@ -816,19 +816,25 @@ body {.transcription-with-speakers {line-height: 1.6;font-family: inherit;+ display: flex;+ flex-direction: column;+ gap: 0.25rem;}.speaker-bubble {- display: block;- margin: 0.375rem 0;+ display: inline-block;+ margin: 0.125rem 0.25rem 0.125rem 0;padding: 0.5rem 0.75rem;border-radius: 0.75rem;- max-width: 80%;+ max-width: fit-content;+ min-width: fit-content;+ width: auto;word-wrap: break-word;position: relative;box-shadow: 0 1px 2px rgba(0,0,0,0.08);transition: all 0.2s ease;border: 1px solid rgba(255,255,255,0.3);+ vertical-align: top;}.speaker-bubble:hover {@@ -837,15 +843,10 @@ body {}.speaker-bubble.speaker-me {- margin-left: auto;- margin-right: 0;- text-align: right;border-bottom-right-radius: 0.25rem;}.speaker-bubble:not(.speaker-me) {- margin-left: 0;- margin-right: auto;border-bottom-left-radius: 0.25rem;}@@ -854,6 +855,32 @@ body {color: inherit;font-size: 0.875rem;line-height: 1.4;+ white-space: pre-wrap;+}++/* Bubble row container for horizontal grouping */+.bubble-row {+ display: flex;+ flex-wrap: wrap;+ align-items: flex-start;+ margin-bottom: 0.5rem;+ gap: 0.25rem;+}++.bubble-row.speaker-me {+ justify-content: flex-end;+}++.bubble-row:not(.speaker-me) {+ justify-content: flex-start;+}++/* Individual bubbles within rows should size to content */+.bubble-row .speaker-bubble {+ flex: 0 0 auto;+ max-width: 80%;+ width: auto;+ min-width: fit-content;}/* Simple view with speaker tablets */@@ -885,41 +912,47 @@ body {margin-left: 0;}-/* View mode toggle */+/* View mode toggle - compact tablet style */.view-mode-toggle {- display: flex;+ display: inline-flex;align-items: center;- gap: 0.5rem;- margin-bottom: 1rem;- padding: 0.5rem;background-color: var(--bg-tertiary);border: 1px solid var(--border-primary);border-radius: 0.5rem;+ padding: 0.125rem;+ gap: 0.125rem;}.toggle-button {- padding: 0.375rem 0.75rem;- border: 1px solid var(--border-secondary);+ padding: 0.25rem 0.5rem;+ border: none;border-radius: 0.375rem;- background-color: var(--bg-secondary);+ background-color: transparent;color: var(--text-muted);- font-size: 0.75rem;+ font-size: 0.6875rem;font-weight: 500;cursor: pointer;transition: all 0.2s ease;+ white-space: nowrap;+ min-width: 0;}.toggle-button.active {background-color: var(--bg-accent);color: var(--text-accent);- border-color: var(--border-accent);+ box-shadow: 0 1px 2px rgba(0,0,0,0.1);}.toggle-button:hover:not(.active) {- background-color: var(--bg-tertiary);+ background-color: var(--bg-secondary);color: var(--text-secondary);}+.toggle-button i {+ font-size: 0.625rem;+ margin-right: 0.25rem;+}+/* Speaker colors - using a pleasant, accessible color palette */.speaker-color-1 { background-color: #E3F2FD; color: #1565C0; } /* Light Blue */.speaker-color-2 { background-color: #F3E5F5; color: #7B1FA2; } /* Light Purple */@@ -1308,3 +1341,26 @@ body {.toast i {flex-shrink: 0;}++/* Discrete horizontal resize divider to match vertical resizer */+#mainColumnResizer {+ width: 8px !important;+ background-color: transparent !important;+ cursor: ew-resize !important;+ margin: 0 4px !important;+ display: flex !important;+ align-items: center !important;+ justify-content: center !important;+}++#mainColumnResizer .w-1 {+ width: 4px !important;+ height: 40px !important;+ background-color: var(--text-light) !important;+ border-radius: 2px !important;+ transition: background-color 0.15s ease !important;+}++#mainColumnResizer:hover .w-1 {+ background-color: var(--border-accent) !important;+}diff --git a/static/js/app.js b/static/js/app.jsindex d154f998..51e06132 100644--- a/static/js/app.js+++ b/static/js/app.js@@ -182,7 +182,7 @@ document.addEventListener('DOMContentLoaded', () => {const processedTranscription = computed(() => {if (!selectedRecording.value?.transcription) {- return { hasDialogue: false, content: '', speakers: [] };+ return { hasDialogue: false, content: '', speakers: [], simpleSegments: [], bubbleRows: [] };}const transcription = selectedRecording.value.transcription;@@ -195,7 +195,9 @@ document.addEventListener('DOMContentLoaded', () => {return {hasDialogue: false,content: transcription,- speakers: []+ speakers: [],+ simpleSegments: [],+ bubbleRows: []};}@@ -260,9 +262,77 @@ document.addEventListener('DOMContentLoaded', () => {});}+ // Process segments for simple view (only show speaker icon when speaker changes)+ const simpleSegments = [];+ let lastSpeaker = null;++ segments.forEach(segment => {+ simpleSegments.push({+ ...segment,+ showSpeaker: segment.speaker !== lastSpeaker+ });+ lastSpeaker = segment.speaker;+ });++ // Process segments for bubble view (group consecutive segments by speaker)+ const bubbleRows = [];+ let currentRow = null;++ segments.forEach(segment => {+ // Split long text into smaller chunks for better bubble layout+ const maxChunkLength = 150; // Adjust this value as needed+ const chunks = [];++ if (segment.text.length <= maxChunkLength) {+ chunks.push(segment.text);+ } else {+ // Split by sentences first, then by length if needed+ const sentences = segment.text.split(/(?<=[.!?])\s+/);+ let currentChunk = '';++ sentences.forEach(sentence => {+ if (currentChunk.length + sentence.length <= maxChunkLength) {+ currentChunk += (currentChunk ? ' ' : '') + sentence;+ } else {+ if (currentChunk) chunks.push(currentChunk);+ currentChunk = sentence;+ }+ });++ if (currentChunk) chunks.push(currentChunk);+ }++ chunks.forEach(chunk => {+ // Check if we need a new row (different speaker or if current row is getting too long)+ if (!currentRow ||+ currentRow.speaker !== segment.speaker ||+ currentRow.bubbles.length >= 3) { // Max 3 bubbles per row++ if (currentRow) bubbleRows.push(currentRow);++ currentRow = {+ speaker: segment.speaker,+ color: segment.color,+ bubbles: [],+ isMe: segment.speaker && segment.speaker.toLowerCase().includes('me')+ };+ }++ currentRow.bubbles.push({+ text: chunk,+ color: segment.color+ });+ });+ });++ // Don't forget the last row+ if (currentRow) bubbleRows.push(currentRow);+return {hasDialogue: true,segments: segments,+ simpleSegments: simpleSegments,+ bubbleRows: bubbleRows,speakers: speakerList.map(speaker => ({name: speaker,color: speakerColors[speaker] || 'speaker-color-1'diff --git a/templates/index.html b/templates/index.htmlindex b18802b3..9d0dabdf 100644--- a/templates/index.html+++ b/templates/index.html@@ -429,8 +429,8 @@<div v-if="processedTranscription.hasDialogue"><!-- Simple View --><div v-if="transcriptionViewMode === 'simple'" class="transcription-simple-view">- <div v-for="(segment, index) in processedTranscription.segments" :key="index" class="speaker-segment">- <div :class="[segment.color, 'speaker-tablet']">${ segment.speaker }</div>+ <div v-for="(segment, index) in processedTranscription.simpleSegments" :key="index" class="speaker-segment">+ <div v-if="segment.showSpeaker" :class="[segment.color, 'speaker-tablet']">${ segment.speaker }</div><div class="speaker-text">${ segment.text }</div></div></div>@@ -826,27 +826,26 @@<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>- <div class="flex space-x-1">+ <div class="flex items-center space-x-2">+ <!-- View Mode Toggle - compact tablet style next to copy button -->+ <div v-if="processedTranscription.hasDialogue" class="view-mode-toggle">+ <button @click="toggleTranscriptionViewMode"+ :class="{ active: transcriptionViewMode === 'simple' }"+ class="toggle-button">+ <i class="fas fa-list"></i> Simple+ </button>+ <button @click="toggleTranscriptionViewMode"+ :class="{ active: transcriptionViewMode === 'bubble' }"+ class="toggle-button">+ <i class="fas fa-comments"></i> Bubbles+ </button>+ </div><button @click="copyTranscription($event)" class="text-xs text-[var(--text-muted)] hover:text-[var(--text-accent)] p-1 rounded" title="Copy to clipboard"><i class="fas fa-copy"></i></button></div></div>- <!-- View Mode Toggle for Desktop -->- <div v-if="processedTranscription.hasDialogue" class="view-mode-toggle mb-2">- <button @click="toggleTranscriptionViewMode"- :class="{ active: transcriptionViewMode === 'simple' }"- class="toggle-button">- <i class="fas fa-list mr-1"></i> Simple- </button>- <button @click="toggleTranscriptionViewMode"- :class="{ active: transcriptionViewMode === 'bubble' }"- class="toggle-button">- <i class="fas fa-comments mr-1"></i> Bubbles- </button>- </div>-<div class="transcription-box custom-scrollbar relative"><div v-if="selectedRecording.status === 'COMPLETED' || selectedRecording.status === 'SUMMARIZING'" class="copyable"><!-- Speaker Legend (if dialogue detected and bubble view) -->@@ -861,16 +860,19 @@<div v-if="processedTranscription.hasDialogue"><!-- Simple View --><div v-if="transcriptionViewMode === 'simple'" class="transcription-simple-view">- <div v-for="(segment, index) in processedTranscription.segments" :key="index" class="speaker-segment">- <div :class="[segment.color, 'speaker-tablet']">${ segment.speaker }</div>+ <div v-for="(segment, index) in processedTranscription.simpleSegments" :key="index" class="speaker-segment">+ <div v-if="segment.showSpeaker" :class="[segment.color, 'speaker-tablet']">${ segment.speaker }</div><div class="speaker-text">${ segment.text }</div></div></div><!-- Bubble View --><div v-else class="transcription-with-speakers">- <div v-for="(segment, index) in processedTranscription.segments" :key="index"- :class="[segment.color, 'speaker-bubble', { 'speaker-me': segment.speaker && segment.speaker.toLowerCase().includes('me') }]">- <div class="speaker-bubble-content">${ segment.text }</div>+ <div v-for="(row, index) in processedTranscription.bubbleRows" :key="index"+ :class="['bubble-row', { 'speaker-me': row.isMe }]">+ <div v-for="(bubble, bubbleIndex) in row.bubbles" :key="bubbleIndex"+ :class="[row.color, 'speaker-bubble', { 'speaker-me': row.isMe }]">+ <div class="speaker-bubble-content">${ bubble.text }</div>+ </div></div></div></div>