Skip to content

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

Python

Render simple-view timestamps as a two-part pill that pairs the time with the speaker label

Murtaza Nasir1b3dd2b62856
diff --git a/static/css/styles.css b/static/css/styles.css
index 0055d7d0..f77107e7 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -1666,26 +1666,54 @@ body {
transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
-/* Header row that pairs the speaker tablet with an optional timestamp.
- Only rendered when the user has enabled `show_timestamps_simple_view`. */
-.speaker-segment-header {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- margin-bottom: 0.25rem;
+/* Two-part pill that combines a timestamp and a speaker label into a single
+ visual unit. Only rendered when `show_timestamps_simple_view` is on.
+ The `.speaker-color-N` class lives on this wrapper so both halves inherit
+ the same base colour; the time half is slightly darkened with a uniform
+ black overlay so it reads as a different shade in both light and dark
+ themes without needing separate per-mode rules. */
+.speaker-tablet-group {
+ display: inline-flex;
+ align-items: stretch;
+ margin: 0 0.5rem 0.5rem 0;
+ border-radius: 0.375rem;
+ overflow: hidden;
+ box-shadow: 0 1px 2px rgba(0,0,0,0.1);
+ font-size: 0.75rem;
+ font-weight: 600;
+ line-height: 1.4;
+ white-space: nowrap;
}
-.speaker-segment-timestamp {
+.speaker-tablet-group .speaker-tablet-time {
+ padding: 0.25rem 0.55rem;
font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
+ font-weight: 500;
font-size: 0.7rem;
- color: var(--text-muted);
letter-spacing: 0.02em;
user-select: none;
+ /* Tint the half by overlaying a uniform translucent black layer. The
+ inherited speaker-color background shows through and the result reads
+ as a darker shade of the same colour in both themes. */
+ background-image: linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.18));
+ display: inline-flex;
+ align-items: center;
}
-/* Inline variant -- used in the no-dialogue branch where the timestamp sits
- on the same line as the sentence text. */
+.speaker-tablet-group .speaker-tablet-name {
+ padding: 0.25rem 0.55rem;
+ display: inline-flex;
+ align-items: center;
+}
+
+/* Inline timestamp for the no-dialogue branch (single-speaker transcripts).
+ Sits at the start of each sentence in compact mono. */
.speaker-segment-timestamp--inline {
+ font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
+ font-size: 0.7rem;
+ color: var(--text-muted);
+ letter-spacing: 0.02em;
+ user-select: none;
margin-right: 0.5rem;
}
diff --git a/templates/components/detail/desktop-transcription-panel.html b/templates/components/detail/desktop-transcription-panel.html
index 4f895fc3..0d4cd87e 100644
--- a/templates/components/detail/desktop-transcription-panel.html
+++ b/templates/components/detail/desktop-transcription-panel.html
@@ -211,15 +211,16 @@
:title="'Double-click to edit this segment'"
:data-start-time="segment.startTime"
:data-segment-index="index">
- <div v-if="segment.showSpeaker" class="speaker-segment-header">
- <div :class="['speaker-tablet', segment.color]">
+ <template v-if="segment.showSpeaker">
+ <div v-if="showTimestampsSimpleView"
+ :class="['speaker-tablet-group', segment.color]">
+ <span class="speaker-tablet-time">${ formatTimestamp(segment.startTime) }</span>
+ <span class="speaker-tablet-name">${segment.speaker}</span>
+ </div>
+ <div v-else :class="['speaker-tablet', segment.color]">
${segment.speaker}
</div>
- <span v-if="showTimestampsSimpleView"
- class="speaker-segment-timestamp">
- ${ formatTimestamp(segment.startTime) }
- </span>
- </div>
+ </template>
<div class="speaker-text">
${segment.sentence}
</div>
diff --git a/templates/components/detail/mobile-transcript-panel.html b/templates/components/detail/mobile-transcript-panel.html
index fb58d9ef..81626d88 100644
--- a/templates/components/detail/mobile-transcript-panel.html
+++ b/templates/components/detail/mobile-transcript-panel.html
@@ -105,10 +105,13 @@
<div v-if="!processedTranscription.hasDialogue || transcriptionViewMode === 'simple'" class="transcription-simple-view">
<div v-if="processedTranscription.hasDialogue">
<div v-for="(segment, index) in processedTranscription.simpleSegments" :key="`seg-${index}-${segment.startTime}`" :class="['speaker-segment', { 'active-playing-segment': currentPlayingSegmentIndex === index }]" @click="seekAudioFromEvent" @dblclick.stop="openAsrEditorAtSegment(index)" :data-start-time="segment.startTime" :data-segment-index="index">
- <div v-if="segment.showSpeaker" class="speaker-segment-header">
- <div :class="['speaker-tablet', segment.color]">${segment.speaker}</div>
- <span v-if="showTimestampsSimpleView" class="speaker-segment-timestamp">${ formatTimestamp(segment.startTime) }</span>
- </div>
+ <template v-if="segment.showSpeaker">
+ <div v-if="showTimestampsSimpleView" :class="['speaker-tablet-group', segment.color]">
+ <span class="speaker-tablet-time">${ formatTimestamp(segment.startTime) }</span>
+ <span class="speaker-tablet-name">${segment.speaker}</span>
+ </div>
+ <div v-else :class="['speaker-tablet', segment.color]">${segment.speaker}</div>
+ </template>
<div class="speaker-text">${segment.sentence}</div>
</div>
</div>