Skip to content

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

Python

Briefly highlight the ASR editor row jumped to from a simple-view double-click

Murtaza Nasir5bf6a6c54d8a
diff --git a/static/css/styles.css b/static/css/styles.css
index f77107e7..a0579d07 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -1717,6 +1717,19 @@ body {
margin-right: 0.5rem;
}
+/* Brief highlight shown on the ASR editor row that was the target of a
+ double-click-to-edit jump from the simple view. Theme-apt: tints the row
+ with the accent colour at low alpha and fades out gracefully. */
+.asr-editor-row--highlighted {
+ animation: asr-editor-row-highlight 2.8s ease-out forwards;
+}
+
+@keyframes asr-editor-row-highlight {
+ 0% { box-shadow: inset 4px 0 0 var(--border-accent), inset 0 0 0 9999px rgba(99, 102, 241, 0.18); }
+ 60% { box-shadow: inset 4px 0 0 var(--border-accent), inset 0 0 0 9999px rgba(99, 102, 241, 0.12); }
+ 100% { box-shadow: inset 0 0 0 transparent, inset 0 0 0 9999px transparent; }
+}
+
/* Active segment highlighting - for currently playing transcript */
.speaker-segment.active-playing-segment,
.transcript-segment.active-playing-segment {
diff --git a/static/js/modules/composables/transcription.js b/static/js/modules/composables/transcription.js
index d9189ae4..cd644ca4 100644
--- a/static/js/modules/composables/transcription.js
+++ b/static/js/modules/composables/transcription.js
@@ -18,7 +18,7 @@ export function useTranscription(state, utils) {
showTextEditorModal, showAsrEditorModal, selectedRecording,
editingTranscriptionContent, editingSegments, availableSpeakers,
recordings, dropdownPositions, openAsrDropdownIndex,
- asrEditorRef, asrEditorSaveFlash, editorAutosave
+ asrEditorRef, asrEditorSaveFlash, asrEditorHighlightIndex, editorAutosave
} = state;
const { showToast, setGlobalError, nextTick } = utils;
@@ -134,15 +134,28 @@ export function useTranscription(state, utils) {
};
// Open the editor and scroll to a specific segment index. Used by the
- // double-click-on-simple-view-row affordance.
+ // double-click-on-simple-view-row affordance. Also briefly highlights
+ // the target row so the user can see where they landed.
const openAsrEditorAtSegment = (segmentIndex) => {
_asrEditorPendingScrollIndex = segmentIndex;
+ if (asrEditorHighlightIndex) {
+ asrEditorHighlightIndex.value = segmentIndex;
+ // The CSS animation handles the visual fade; clearing the index
+ // after the animation completes keeps the DOM clean.
+ setTimeout(() => {
+ if (asrEditorHighlightIndex.value === segmentIndex) {
+ asrEditorHighlightIndex.value = null;
+ }
+ }, 3000);
+ }
return openAsrEditorModal();
};
const closeAsrEditorModal = () => {
// Cancel any pending autosave so we don't issue a write after close.
_resetAutosave();
+ // Clear any pending row highlight.
+ if (asrEditorHighlightIndex) asrEditorHighlightIndex.value = null;
// Save scroll position so reopening the same recording within this
// session lands the user back where they were.
diff --git a/templates/modals/asr-editor-modal.html b/templates/modals/asr-editor-modal.html
index 6c68d82f..0c7ebcd2 100644
--- a/templates/modals/asr-editor-modal.html
+++ b/templates/modals/asr-editor-modal.html
@@ -93,7 +93,7 @@
<!-- Virtual scroll spacer (top) -->
<tr v-if="asrEditorSpacerBefore > 0"><td colspan="5" :style="{ height: asrEditorSpacerBefore + 'px', padding: 0 }"></td></tr>
- <tr v-for="segment in asrEditorVisibleSegments" :key="`asr-${segment._originalIndex}-${segment.start_time}`" :data-segment-index="segment._originalIndex" class="hover:bg-[var(--bg-tertiary)] transition-colors border-b border-[var(--border-primary)]">
+ <tr v-for="segment in asrEditorVisibleSegments" :key="`asr-${segment._originalIndex}-${segment.start_time}`" :data-segment-index="segment._originalIndex" :class="['hover:bg-[var(--bg-tertiary)] transition-colors border-b border-[var(--border-primary)]', { 'asr-editor-row--highlighted': asrEditorHighlightIndex === segment._originalIndex }]">
<td class="border-r border-[var(--border-primary)] align-middle">
<div class="relative h-full">
<div class="flex items-center h-full">