Skip to content

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

Python

collapsible sidebar.

Murtaza Nasirbfa89e3a017b
diff --git a/app.py b/app.py
index 2732aff3..e8f17f61 100644
--- a/app.py
+++ b/app.py
@@ -1,4 +1,4 @@
-# app.py
+# Speakr - Audio Transcription and Summarization App
import os
import sys
from flask import Flask, render_template, request, jsonify, send_file, Markup
diff --git a/templates/index.html b/templates/index.html
index 3d06c23c..4d4ea2ea 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Audio Transcription App</title>
+ <title>Speakr</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
@@ -97,28 +97,29 @@
--scrollbar-thumb-hover: #718096; /* gray-500 */
}
- /* Existing styles... */
- .drag-area { transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out; }
- .custom-scrollbar::-webkit-scrollbar { width: 8px; }
- .custom-scrollbar::-webkit-scrollbar-track { background: var(--scrollbar-track); border-radius: 10px; }
- .custom-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }
+ /* Modern UI styles */
+ .drag-area { transition: background-color 0.3s ease, border-color 0.3s ease; }
+ .custom-scrollbar::-webkit-scrollbar { width: 6px; }
+ .custom-scrollbar::-webkit-scrollbar-track { background: var(--scrollbar-track); border-radius: 12px; }
+ .custom-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 12px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }
html { /* Apply base colors to html for smoother transitions */
background-color: var(--bg-primary);
color: var(--text-primary);
transition: background-color 0.3s, color 0.3s;
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
html, body { height: 100%; margin: 0; }
#app { min-height: 100%; display: flex; flex-direction: column; }
main { flex-grow: 1; position: relative; }
- .progress-popup { position: fixed; bottom: 1rem; left: 1rem; z-index: 100; transition: all 0.3s ease-in-out; min-width: 300px; }
+ .progress-popup { position: fixed; bottom: 1rem; left: 1rem; z-index: 100; transition: all 0.3s ease-in-out; min-width: 300px; border-radius: 12px; overflow: hidden; }
.progress-popup.minimized { transform: translateY(calc(100% - 45px)); }
.progress-list-item { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; }
- /* Add style for summary pre */
+ /* Modern style for summary box */
.summary-box {
background-color: #f9fafb; /* bg-gray-50 */
- padding: 0.75rem; /* p-3 */
- border-radius: 0.375rem; /* rounded */
+ padding: 1rem; /* p-4 */
+ border-radius: 0.75rem; /* rounded-xl */
border: 1px solid #e5e7eb; /* border-gray-200 */
min-height: 60px; /* min-h-[60px] or adjust as needed */
max-height: 20rem; /* Limit height */
@@ -126,15 +127,28 @@
white-space: pre-wrap;
font-family: inherit; /* Use body font */
font-size: 0.875rem; /* text-sm */
- line-height: 1.25rem;
+ line-height: 1.5; /* Improved line height */
+ box-shadow: 0 1px 2px rgba(0,0,0,0.03); /* Subtle shadow */
+ }
+
+ /* Standardize border radius for all content boxes */
+ .transcription-box,
+ .summary-box,
+ .chat-container,
+ textarea,
+ div[v-if="!editingParticipants"],
+ div[v-if="!editingNotes"] {
+ border-radius: 0.75rem !important; /* rounded-xl */
}
.status-badge {
display: inline-block;
- padding: 0.125rem 0.5rem; /* px-2 py-0.5 */
+ padding: 0.25rem 0.75rem; /* px-3 py-1 */
font-size: 0.75rem; /* text-xs */
- font-weight: 600; /* font-semibold */
+ font-weight: 500; /* font-medium */
border-radius: 9999px; /* rounded-full */
margin-top: 0.5rem; /* mt-2 */
+ box-shadow: 0 1px 2px rgba(0,0,0,0.05);
+ letter-spacing: 0.025em;
}
.status-processing { color: #1d4ed8; background-color: #dbeafe; } /* text-blue-800 bg-blue-100 */
.status-summarizing { color: #92400e; background-color: #fef3c7; } /* text-amber-800 bg-amber-100 */
@@ -149,64 +163,72 @@
position: relative;
}
- /* Copy button styles */
+ /* Modern copy button styles */
.copy-btn {
position: sticky;
top: 10px;
right: 10px;
float: right;
- background-color: rgba(255, 255, 255, 0.8);
+ background-color: rgba(255, 255, 255, 0.9);
border: 1px solid #e5e7eb;
- border-radius: 0.375rem;
- padding: 0.25rem 0.5rem;
+ border-radius: 0.5rem;
+ padding: 0.35rem 0.75rem;
font-size: 0.75rem;
cursor: pointer;
z-index: 10;
- transition: all 0.2s ease-in-out;
+ transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
margin-bottom: 10px;
+ box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.copy-btn:hover {
background-color: #f3f4f6;
+ transform: translateY(-1px);
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
- /* Chat section styles */
+ /* Modern chat section styles */
.chat-container {
border: 1px solid #e5e7eb;
- border-radius: 0.375rem;
+ border-radius: 0.75rem;
display: flex;
flex-direction: column;
height: 100%;
+ box-shadow: 0 1px 3px rgba(0,0,0,0.05);
+ overflow: hidden;
}
.chat-messages {
flex-grow: 1;
overflow-y: auto;
- padding: 1rem;
+ padding: 1.25rem;
}
.chat-input-container {
border-top: 1px solid #e5e7eb;
padding: 0.75rem;
display: flex;
+ background-color: var(--bg-tertiary);
}
.message {
- margin-bottom: 1rem;
+ margin-bottom: 1.25rem;
max-width: 80%;
+ box-shadow: 0 1px 2px rgba(0,0,0,0.05);
+ line-height: 1.5;
}
.user-message {
background-color: #dbeafe;
- border-radius: 1rem 1rem 0.25rem 1rem;
- padding: 0.75rem;
+ border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
+ padding: 0.875rem 1rem;
margin-left: auto;
}
.ai-message {
background-color: #f3f4f6;
- border-radius: 1rem 1rem 1rem 0.25rem;
- padding: 0.75rem;
+ border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
+ padding: 0.875rem 1rem;
}
.copyable {
@@ -286,7 +308,7 @@
color: #666;
}
- /* Toast notification styles */
+ /* Modern toast notification styles */
.toast-container {
position: fixed;
bottom: 20px;
@@ -295,21 +317,22 @@
display: flex;
flex-direction: column;
align-items: flex-end;
- gap: 10px;
+ gap: 12px;
}
.toast {
- padding: 10px 15px;
- border-radius: 4px;
+ padding: 12px 18px;
+ border-radius: 8px;
background-color: #4CAF50;
color: white;
font-size: 14px;
- box-shadow: 0 2px 5px rgba(0,0,0,0.2);
+ box-shadow: 0 4px 12px rgba(0,0,0,0.1);
opacity: 0;
transform: translateY(20px);
- transition: all 0.3s ease;
+ transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
display: flex;
align-items: center;
+ min-width: 200px;
}
.toast.show {
@@ -339,9 +362,12 @@
<div id="app" class="container mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col">
<header class="flex justify-between items-center mb-6 pb-4 border-b border-[var(--border-primary)]">
<h1 class="text-3xl font-bold text-[var(--text-primary)] cursor-pointer" @click="switchToGalleryView" title="Go to Gallery">
- Audio Transcription & Summary
+ Speakr
</h1>
<div class="flex items-center space-x-2">
+ <button @click="toggleSidebar" class="p-2 rounded-full text-[var(--text-muted)] hover:bg-[var(--bg-tertiary)] dark:text-gray-400 dark:hover:bg-gray-700 transition-colors duration-200" :title="isSidebarCollapsed ? 'Show Sidebar' : 'Hide Sidebar'">
+ <i :class="isSidebarCollapsed ? 'fas fa-bars' : 'fas fa-chevron-left'"></i>
+ </button>
<button @click="toggleDarkMode" class="p-2 rounded-full text-[var(--text-muted)] hover:bg-[var(--bg-tertiary)] dark:text-gray-400 dark:hover:bg-gray-700 transition-colors duration-200" :title="isDarkMode ? 'Switch to Light Mode' : 'Switch to Dark Mode'">
<i :class="isDarkMode ? 'fas fa-sun' : 'fas fa-moon'"></i>
</button>
@@ -384,7 +410,7 @@
<div v-if="currentView === 'gallery'" class="flex-grow flex flex-col rounded-lg">
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6 flex-grow">
- <div class="lg:col-span-1 bg-[var(--bg-secondary)] p-4 rounded-lg shadow-md flex flex-col">
+ <div v-show="!isSidebarCollapsed" class="lg:col-span-1 bg-[var(--bg-secondary)] p-4 rounded-lg shadow-md flex flex-col">
<h3 class="text-lg font-semibold mb-4 sticky top-0 bg-[var(--bg-secondary)] pb-3 border-b border-[var(--border-primary)] text-[var(--text-primary)]">Recordings</h3>
<div v-if="isLoadingRecordings" class="text-center text-[var(--text-muted)] py-4">
<i class="fas fa-spinner fa-spin mr-2"></i> Loading recordings...
@@ -439,7 +465,7 @@
</div>
</div>
- <div class="lg:col-span-3 bg-[var(--bg-secondary)] p-6 rounded-lg shadow-md flex flex-col">
+ <div :class="isSidebarCollapsed ? 'lg:col-span-4' : 'lg:col-span-3'" class="bg-[var(--bg-secondary)] p-6 rounded-lg shadow-md flex flex-col">
<div v-if="selectedRecording" class="flex-grow flex flex-col">
<div class="flex flex-col sm:flex-row justify-between items-start mb-4 border-b border-[var(--border-primary)] pb-4">
<div class="mb-3 sm:mb-0 max-w-lg">
@@ -490,15 +516,17 @@
<i class="fas" :class="editingParticipants ? 'fa-check' : 'fa-edit'"></i>
</button>
</div>
- <div v-if="!editingParticipants" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded border border-[var(--border-primary)] min-h-[40px] text-[var(--text-secondary)]">${ selectedRecording.participants || 'None specified' }</div>
+ <div v-if="!editingParticipants" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded-xl border border-[var(--border-primary)] min-h-[40px] text-[var(--text-secondary)]">${ selectedRecording.participants || 'None specified' }</div>
<textarea v-else v-model="selectedRecording.participants" @blur="saveInlineEdit('participants')" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded border border-[var(--border-primary)] min-h-[40px] w-full focus:ring-[var(--ring-focus)] focus:border-[var(--border-focus)] text-[var(--text-secondary)]" placeholder="Enter participants"></textarea>
</div>
<div>
- <h4 class="font-semibold text-[var(--text-secondary)] mb-2 flex-shrink-0">Transcription</h4>
- <div class="transcription-box p-4 bg-[var(--bg-tertiary)] rounded border border-[var(--border-primary)] text-sm custom-scrollbar relative text-[var(--text-secondary)]">
- <button @click="copyTranscription($event)" class="copy-btn bg-[var(--bg-secondary)]/80 border-[var(--border-primary)] text-[var(--text-muted)] hover:bg-[var(--bg-tertiary)]" title="Copy to clipboard">
- <i class="fas fa-copy mr-1"></i> Copy
+ <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">
+ <i class="fas fa-copy"></i>
</button>
+ </div>
+ <div class="transcription-box p-4 bg-[var(--bg-tertiary)] rounded border border-[var(--border-primary)] text-sm custom-scrollbar relative text-[var(--text-secondary)]">
<div v-if="selectedRecording.status === 'COMPLETED' || selectedRecording.status === 'SUMMARIZING'" class="copyable">
<pre class="whitespace-pre-wrap font-sans">${ selectedRecording.transcription || 'No transcription available.' }</pre>
</div>
@@ -554,7 +582,7 @@
<i class="fas" :class="editingNotes ? 'fa-check' : 'fa-edit'"></i>
</button>
</div>
- <div v-if="!editingNotes" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded border border-[var(--border-primary)] custom-scrollbar text-[var(--text-secondary)]" style="height: 200px;" v-html="selectedRecording.notes_html || selectedRecording.notes || 'No notes'"></div>
+ <div v-if="!editingNotes" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded-xl border border-[var(--border-primary)] custom-scrollbar text-[var(--text-secondary)]" style="height: 200px;" v-html="selectedRecording.notes_html || selectedRecording.notes || 'No notes'"></div>
<textarea v-else v-model="selectedRecording.notes" @blur="saveInlineEdit('notes')" class="text-sm bg-[var(--bg-tertiary)] p-3 rounded border border-[var(--border-primary)] custom-scrollbar text-[var(--text-secondary)] w-full focus:ring-[var(--ring-focus)] focus:border-[var(--border-focus)]" style="height: 200px;" placeholder="Enter notes"></textarea>
</div>
</div>
@@ -573,11 +601,11 @@
</div>
</div>
- <!-- Chat Section (Takes available space) -->
- <div class="flex flex-col overflow-hidden flex-grow">
+ <!-- Chat Section (Fixed height to match left column) -->
+ <div class="flex flex-col overflow-hidden">
<h4 class="font-semibold text-[var(--text-secondary)] mb-2 flex-shrink-0">Chat with Transcript</h4>
- <!-- Chat container with height matching left column -->
- <div class="chat-container border-[var(--border-primary)] bg-[var(--bg-secondary)]">
+ <!-- Chat container with fixed height matching left column -->
+ <div class="chat-container border-[var(--border-primary)] bg-[var(--bg-secondary)]" style="height: 684px;">
<div class="chat-messages custom-scrollbar" ref="chatMessagesRef">
<div v-if="chatMessages.length === 0" class="flex items-center justify-center h-full text-[var(--text-muted)]">
<div class="text-center">
@@ -651,7 +679,7 @@
</main>
<footer class="text-center py-4 mt-8 text-xs text-[var(--text-light)] border-t border-[var(--border-primary)]">
- Audio Transcription App &copy; ${ new Date().getFullYear() }
+ Speakr &copy; ${ new Date().getFullYear() }
</footer>
<div v-if="showEditModal" class="fixed inset-0 bg-black bg-opacity-60 flex items-center justify-center z-50 p-4">
@@ -796,6 +824,7 @@
const globalError = ref(null);
const maxFileSizeMB = ref(250); // Default, could fetch from config if needed
const isDarkMode = ref(false); // Dark mode state
+ const isSidebarCollapsed = ref(false); // Sidebar state
// Inline editing state
const editingParticipants = ref(false);
@@ -881,6 +910,14 @@
}
};
// --- End Dark Mode ---
+
+ // --- Sidebar Toggle ---
+ const toggleSidebar = () => {
+ isSidebarCollapsed.value = !isSidebarCollapsed.value;
+ // Optional: Save state to localStorage if persistence is desired
+ // localStorage.setItem('sidebarCollapsed', isSidebarCollapsed.value);
+ };
+ // --- End Sidebar Toggle ---
// Helper to format date for display (e.g., "May 4, 2025")
const formatDisplayDate = (dateString) => {
@@ -1208,7 +1245,9 @@
recordings.value[index].title = payload.title;
recordings.value[index].participants = payload.participants;
recordings.value[index].notes = payload.notes;
+ recordings.value[index].notes_html = data.recording.notes_html;
recordings.value[index].summary = payload.summary;
+ recordings.value[index].summary_html = data.recording.summary_html;
recordings.value[index].meeting_date = payload.meeting_date; // <-- ADDED: Update meeting_date
}
// Update selected if it's the one being saved
@@ -1216,7 +1255,9 @@
selectedRecording.value.title = payload.title;
selectedRecording.value.participants = payload.participants;
selectedRecording.value.notes = payload.notes;
+ selectedRecording.value.notes_html = data.recording.notes_html;
selectedRecording.value.summary = payload.summary;
+ selectedRecording.value.summary_html = data.recording.summary_html;
selectedRecording.value.meeting_date = payload.meeting_date; // <-- ADDED: Update meeting_date
}
return data.recording; // Return the full updated object from backend
@@ -1423,8 +1464,15 @@
};
try {
- const success = await saveMetadata(fullPayload);
- if (success) {
+ const updatedRecording = await saveMetadata(fullPayload);
+ if (updatedRecording) {
+ // Update the HTML versions from the response
+ if (field === 'notes') {
+ selectedRecording.value.notes_html = updatedRecording.notes_html;
+ } else if (field === 'summary') {
+ selectedRecording.value.summary_html = updatedRecording.summary_html;
+ }
+
// Reset the editing state for the field
switch(field) {
case 'participants':
@@ -1691,6 +1739,7 @@
formatFileSize, setGlobalError, handleDragLeave, formatStatus, getStatusClass,
formatDisplayDate, // <-- ADDED: Expose date formatting function
toggleDarkMode, // <-- Added toggleDarkMode
+ toggleSidebar, isSidebarCollapsed, // <-- Added sidebar state and function
// Inline editing methods
toggleEditParticipants, toggleEditMeetingDate, toggleEditSummary, toggleEditNotes, saveInlineEdit,
// Chat Methods