Skip to content

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

Python
3.2 KB
Raw Blame
<!-- Edit Speakers Modal (design system v1) -->
<div v-if="showEditSpeakersModal" @click.self="closeEditSpeakersModal" class="modal-overlay">
    <div class="modal-panel modal-panel--sm">
        <div class="modal-header">
            <h3 class="modal-title" v-text="t('modal.editSpeakers')"></h3>
            <button @click="closeEditSpeakersModal" class="modal-close" :title="t('buttons.close')"><i class="fas fa-times"></i></button>
        </div>
        <div class="modal-body">
            <p class="t-meta mb-3" v-text="t('modal.editSpeakersHint')"></p>
            <div class="space-y-2">
                <div v-for="(speaker, index) in editingSpeakersList" :key="index" class="relative">
                    <div class="flex items-center gap-2">
                        <span class="w-24 t-meta truncate">${speaker.original || t('common.new')}</span>
                        <i class="fas fa-arrow-right text-[var(--text-muted)]"></i>
                        <div class="flex-1 relative" :ref="'editSpeakerInput' + index">
                            <input v-model="speaker.current"
                                   @input="filterEditingSpeakerSuggestions(index)"
                                   @focus="filterEditingSpeakerSuggestions(index)"
                                   @blur="onEditSpeakerBlur(index)"
                                   type="text" class="field edit-speaker-name-input" :placeholder="t('form.newNamePlaceholder')">
                        </div>
                        <teleport to="body">
                            <div v-if="editingSpeakerSuggestions[index]?.length > 0"
                                 class="fixed z-[100] surface-raised max-h-32 overflow-y-auto"
                                 :style="getEditSpeakerDropdownPosition(index)">
                                <button v-for="suggestion in editingSpeakerSuggestions[index]" :key="suggestion.id"
                                        @mousedown="selectEditingSpeakerSuggestion(index, suggestion.name)"
                                        class="w-full px-3 py-2 text-left hover:bg-[var(--bg-tertiary)] transition-colors text-sm">
                                    ${suggestion.name}
                                </button>
                            </div>
                        </teleport>
                        <button @click="removeEditingSpeaker(index)" class="btn btn--icon btn--sm" style="color: var(--text-muted);">
                            <i class="fas fa-times"></i>
                        </button>
                    </div>
                </div>
            </div>
            <button @click="addEditingSpeaker"
                    class="mt-3 w-full py-2 border border-dashed border-[var(--border-primary)] rounded-md text-sm text-[var(--text-muted)] hover:border-[var(--text-accent)] hover:text-[var(--text-accent)] transition-colors">
                <i class="fas fa-plus mr-2"></i>${ t('buttons.addSpeaker') }
            </button>
        </div>
        <div class="modal-footer">
            <button @click="closeEditSpeakersModal" class="btn btn--ghost">${ t('buttons.cancel') }</button>
            <button @click="saveEditingSpeakers" class="btn btn--primary">${ t('buttons.save') || 'Save Changes' }</button>
        </div>
    </div>
</div>