feat #14740: main window with call list and transcript
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+2
-6
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte'
|
||||
import Main from './routes/Main.svelte'
|
||||
import Prompt from './routes/Prompt.svelte'
|
||||
import Recorder from './routes/Recorder.svelte'
|
||||
import Settings from './routes/Settings.svelte'
|
||||
@@ -24,10 +25,5 @@
|
||||
{:else if route === '/prompt'}
|
||||
<Prompt />
|
||||
{:else}
|
||||
<main class="page">
|
||||
<header class="page-header">
|
||||
<h1>Gesprächsrekorder</h1>
|
||||
<a class="btn" href="#/settings" title="Einstellungen">⚙ Einstellungen</a>
|
||||
</header>
|
||||
</main>
|
||||
<Main />
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<script lang="ts">
|
||||
import type { CallId, CallListItem } from './api'
|
||||
import { formatListTime, formatMinutes } from './format'
|
||||
import StatusPill from './StatusPill.svelte'
|
||||
|
||||
let {
|
||||
calls,
|
||||
selectedId,
|
||||
onselect,
|
||||
}: { calls: CallListItem[]; selectedId: CallId | null; onselect: (id: CallId) => void } =
|
||||
$props()
|
||||
</script>
|
||||
|
||||
{#if calls.length === 0}
|
||||
<p class="empty muted">Noch keine Gespräche aufgezeichnet.</p>
|
||||
{:else}
|
||||
<ul class="calls">
|
||||
{#each calls as call (call.id)}
|
||||
<li>
|
||||
<button
|
||||
class="row"
|
||||
class:selected={call.id === selectedId}
|
||||
aria-current={call.id === selectedId}
|
||||
onclick={() => onselect(call.id)}
|
||||
>
|
||||
<span class="title">
|
||||
{call.app}{#if call.status !== 'recording'} · {formatMinutes(call.duration_secs)}{/if}
|
||||
</span>
|
||||
<span class="meta">
|
||||
<span class="muted">{formatListTime(call.started_at)}</span>
|
||||
<StatusPill status={call.status} interrupted={call.interrupted} />
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.empty {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.calls {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
width: 100%;
|
||||
padding: 9px 10px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: none;
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.row:hover {
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.row.selected {
|
||||
background: var(--primary-soft);
|
||||
box-shadow: inset 3px 0 0 var(--primary);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 4px 8px;
|
||||
}
|
||||
|
||||
.meta .muted {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,51 @@
|
||||
<script lang="ts">
|
||||
import type { CallStatus } from './api'
|
||||
|
||||
let { status, interrupted = false }: { status: CallStatus; interrupted?: boolean } = $props()
|
||||
|
||||
const pills: Record<CallStatus, { text: string; kind: string }> = {
|
||||
done: { text: 'fertig', kind: 'done' },
|
||||
processing: { text: 'wird verarbeitet…', kind: 'processing' },
|
||||
awaiting_decision: { text: 'nicht transkribiert', kind: 'awaiting' },
|
||||
failed: { text: 'fehlgeschlagen', kind: 'failed' },
|
||||
recording: { text: 'Aufnahme läuft', kind: 'recording' },
|
||||
}
|
||||
|
||||
let pill = $derived(pills[status])
|
||||
</script>
|
||||
|
||||
<span class="pill status {pill.kind}">
|
||||
{pill.text}{#if interrupted && status === 'awaiting_decision'}, unterbrochen{/if}
|
||||
</span>
|
||||
|
||||
<style>
|
||||
.status {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.done {
|
||||
background: var(--ok-soft);
|
||||
color: var(--ok);
|
||||
}
|
||||
|
||||
.processing {
|
||||
background: #fff4d6;
|
||||
color: #8a6100;
|
||||
}
|
||||
|
||||
.awaiting {
|
||||
background: #eee;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.failed {
|
||||
background: var(--rec-soft);
|
||||
color: var(--rec);
|
||||
}
|
||||
|
||||
.recording {
|
||||
background: var(--surface);
|
||||
color: var(--rec);
|
||||
box-shadow: inset 0 0 0 1px var(--rec);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,196 @@
|
||||
<script lang="ts">
|
||||
import { errorText, type SegmentView } from './api'
|
||||
import { formatOffset } from './format'
|
||||
|
||||
let {
|
||||
segments,
|
||||
onrename,
|
||||
}: {
|
||||
segments: SegmentView[]
|
||||
/** Saves a speaker's name; an empty name restores the default label. */
|
||||
onrename: (speakerKey: string, name: string) => Promise<void>
|
||||
} = $props()
|
||||
|
||||
// "Ich" is always the primary blue; remote speakers cycle through the rest.
|
||||
const ME_COLOR = '#3b5bdb'
|
||||
const REMOTE_COLORS = ['#2b8a3e', '#c2255c', '#e8590c', '#7048e8', '#0c8599', '#5c940d']
|
||||
|
||||
function speakerColor(key: string): string {
|
||||
if (key === 'me') return ME_COLOR
|
||||
const n = Number(key.replace(/^remote:/, ''))
|
||||
const index = Number.isInteger(n) && n > 0 ? (n - 1) % REMOTE_COLORS.length : 0
|
||||
return REMOTE_COLORS[index]
|
||||
}
|
||||
|
||||
/** "me" first, then remote speakers by number. */
|
||||
function speakerOrder(key: string): number {
|
||||
return key === 'me' ? 0 : Number(key.replace(/^remote:/, '')) || Number.MAX_SAFE_INTEGER
|
||||
}
|
||||
|
||||
/** One chip per speaker present, with its current label. */
|
||||
let speakers = $derived.by(() => {
|
||||
const labels = new Map<string, string>()
|
||||
for (const s of segments) if (!labels.has(s.speaker_key)) labels.set(s.speaker_key, s.label)
|
||||
return [...labels]
|
||||
.map(([key, label]) => ({ key, label }))
|
||||
.sort((a, b) => speakerOrder(a.key) - speakerOrder(b.key))
|
||||
})
|
||||
|
||||
let editing = $state<string | null>(null)
|
||||
let draft = $state('')
|
||||
let saving = $state(false)
|
||||
let error = $state('')
|
||||
|
||||
function startEdit(key: string, label: string) {
|
||||
editing = key
|
||||
draft = label
|
||||
error = ''
|
||||
}
|
||||
|
||||
async function onkeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'Escape') {
|
||||
editing = null
|
||||
} else if (event.key === 'Enter' && editing && !saving) {
|
||||
saving = true
|
||||
error = ''
|
||||
try {
|
||||
await onrename(editing, draft.trim())
|
||||
editing = null
|
||||
} catch (err) {
|
||||
error = errorText(err)
|
||||
} finally {
|
||||
saving = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function focus(node: HTMLInputElement) {
|
||||
node.focus()
|
||||
node.select()
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if segments.length === 0}
|
||||
<p class="muted">Keine Sprache erkannt.</p>
|
||||
{:else}
|
||||
<div class="chips">
|
||||
{#each speakers as { key, label } (key)}
|
||||
<span class="chip" style:--speaker={speakerColor(key)}>
|
||||
{#if editing === key}
|
||||
<input
|
||||
class="rename"
|
||||
aria-label="Name für {label}"
|
||||
placeholder="leer = Standardname"
|
||||
disabled={saving}
|
||||
bind:value={draft}
|
||||
{onkeydown}
|
||||
use:focus
|
||||
/>
|
||||
{:else}
|
||||
<span class="dot"></span>
|
||||
<span>{label}</span>
|
||||
<button class="edit" title="Umbenennen" onclick={() => startEdit(key, label)}>✎</button>
|
||||
{/if}
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{#if editing}
|
||||
<div class="muted hint">Enter speichert, Esc bricht ab.</div>
|
||||
{/if}
|
||||
{#if error}
|
||||
<div class="error">{error}</div>
|
||||
{/if}
|
||||
|
||||
<div class="lines">
|
||||
{#each segments as segment, i (i)}
|
||||
<div class="line">
|
||||
<span class="time">{formatOffset(segment.start)}</span>
|
||||
<span class="speaker" style:color={speakerColor(segment.speaker_key)}>{segment.label}</span>
|
||||
<span class="text">{segment.text}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 2px 4px 2px 10px;
|
||||
border-radius: 999px;
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--speaker);
|
||||
}
|
||||
|
||||
.edit {
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.edit:hover {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.rename {
|
||||
width: 160px;
|
||||
padding: 1px 6px;
|
||||
font-size: 12px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.hint,
|
||||
.error {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.lines {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto 1fr;
|
||||
gap: 8px 12px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.line {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.time {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
.speaker {
|
||||
font-weight: 600;
|
||||
max-width: 160px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.text {
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
</style>
|
||||
@@ -54,6 +54,40 @@ export interface PendingPrompt extends CallBrief {
|
||||
more_waiting: number
|
||||
}
|
||||
|
||||
export type CallStatus = 'recording' | 'awaiting_decision' | 'processing' | 'done' | 'failed'
|
||||
|
||||
/** A row of the main window's call list. Times are RFC 3339. */
|
||||
export interface CallListItem {
|
||||
id: CallId
|
||||
app: string
|
||||
started_at: string
|
||||
/** 0 while recording. */
|
||||
duration_secs: number
|
||||
status: CallStatus
|
||||
interrupted: boolean
|
||||
}
|
||||
|
||||
/** A transcript line; `speaker_key` is "me" or "remote:<n>". */
|
||||
export interface SegmentView {
|
||||
speaker_key: string
|
||||
label: string
|
||||
start: number
|
||||
end: number
|
||||
text: string
|
||||
}
|
||||
|
||||
export interface CallDetail {
|
||||
call: CallListItem & { error: string | null; account_id: string | null }
|
||||
segments: SegmentView[]
|
||||
/** Renamed speakers by key. */
|
||||
speaker_names: Record<string, string>
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
id: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface Levels {
|
||||
mic: number
|
||||
out: number
|
||||
@@ -76,6 +110,14 @@ export const getCallBrief = (id: CallId) => invoke<CallBrief>('get_call_brief',
|
||||
export const transcribeCall = (id: CallId) => invoke<void>('transcribe_call', { id })
|
||||
export const retryCall = (id: CallId) => invoke<void>('retry_call', { id })
|
||||
export const discardCall = (id: CallId) => invoke<void>('discard_call', { id })
|
||||
export const listCalls = () => invoke<CallListItem[]>('list_calls')
|
||||
export const getCall = (id: CallId) => invoke<CallDetail>('get_call', { id })
|
||||
/** An empty name restores the default label. */
|
||||
export const renameSpeaker = (id: CallId, speakerKey: string, name: string) =>
|
||||
invoke<void>('rename_speaker', { id, speakerKey, name })
|
||||
export const listAccounts = () => invoke<Account[]>('list_accounts')
|
||||
export const setAccount = (id: CallId, accountId: string | null) =>
|
||||
invoke<void>('set_account', { id, accountId })
|
||||
|
||||
export const onRecordingState = (handler: (state: RecordingState) => void): Promise<UnlistenFn> =>
|
||||
listen<RecordingState>('recording-state', (event) => handler(event.payload))
|
||||
|
||||
@@ -20,3 +20,36 @@ export function formatTimeRange(startedAt: string, endedAt: string | null, now =
|
||||
const range = endedAt ? `${clock(start)} – ${clock(new Date(endedAt))}` : clock(start)
|
||||
return `${day}, ${range}`
|
||||
}
|
||||
|
||||
const weekdays = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa']
|
||||
|
||||
/** "heute", "gestern", or `other(date)` for an older day. */
|
||||
function dayName(d: Date, now: Date, other: (d: Date) => string): string {
|
||||
if (sameDay(d, now)) return 'heute'
|
||||
const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1)
|
||||
return sameDay(d, yesterday) ? 'gestern' : other(d)
|
||||
}
|
||||
|
||||
const dayMonth = (d: Date) => `${pad(d.getDate())}.${pad(d.getMonth() + 1)}.`
|
||||
|
||||
/** Call list: "heute 10:14", "gestern 10:14" or "04.11. 10:14". */
|
||||
export function formatListTime(startedAt: string, now = new Date()): string {
|
||||
const start = new Date(startedAt)
|
||||
return `${dayName(start, now, dayMonth)} ${clock(start)}`
|
||||
}
|
||||
|
||||
/** Detail header: "heute 10:14", "gestern 10:14" or "Mi 04.11. 10:14". */
|
||||
export function formatDetailTime(startedAt: string, now = new Date()): string {
|
||||
const start = new Date(startedAt)
|
||||
const other = (d: Date) => `${weekdays[d.getDay()]} ${dayMonth(d)}`
|
||||
return `${dayName(start, now, other)} ${clock(start)}`
|
||||
}
|
||||
|
||||
/** Position in the recording: "04:07", or "1:02:07" from one hour on. */
|
||||
export function formatOffset(secs: number): string {
|
||||
const total = Math.max(0, Math.floor(secs))
|
||||
const h = Math.floor(total / 3600)
|
||||
const mm = pad(Math.floor((total % 3600) / 60))
|
||||
const ss = pad(total % 60)
|
||||
return h > 0 ? `${h}:${mm}:${ss}` : `${mm}:${ss}`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,424 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte'
|
||||
import {
|
||||
discardCall,
|
||||
errorText,
|
||||
getCall,
|
||||
listAccounts,
|
||||
listCalls,
|
||||
onCallEnded,
|
||||
onCallUpdated,
|
||||
onPromptChanged,
|
||||
onRecordingState,
|
||||
renameSpeaker,
|
||||
retryCall,
|
||||
setAccount,
|
||||
transcribeCall,
|
||||
type Account,
|
||||
type CallDetail,
|
||||
type CallId,
|
||||
type CallListItem,
|
||||
} from '../lib/api'
|
||||
import CallList from '../lib/CallList.svelte'
|
||||
import { formatDetailTime, formatMinutes } from '../lib/format'
|
||||
import StatusPill from '../lib/StatusPill.svelte'
|
||||
import TranscriptView from '../lib/TranscriptView.svelte'
|
||||
|
||||
let calls = $state<CallListItem[]>([])
|
||||
let loaded = $state(false)
|
||||
let listError = $state('')
|
||||
let accounts = $state<Account[]>([])
|
||||
|
||||
let selectedId = $state<CallId | null>(null)
|
||||
let detail = $state<CallDetail | null>(null)
|
||||
let detailError = $state('')
|
||||
let actionError = $state('')
|
||||
let busy = $state(false)
|
||||
let tab = $state<'summary' | 'transcript'>('transcript')
|
||||
|
||||
// Answers can arrive out of order; only the newest request is applied.
|
||||
let listRequest = 0
|
||||
let detailRequest = 0
|
||||
|
||||
async function refreshList() {
|
||||
const request = ++listRequest
|
||||
try {
|
||||
const next = await listCalls()
|
||||
if (request !== listRequest) return
|
||||
const before = calls.find((c) => c.id === selectedId)
|
||||
const after = next.find((c) => c.id === selectedId)
|
||||
const firstLoad = !loaded
|
||||
calls = next
|
||||
loaded = true
|
||||
listError = ''
|
||||
if (firstLoad && selectedId === null && next.length > 0) {
|
||||
select(next[0].id)
|
||||
} else if (selectedId !== null && !after) {
|
||||
clearSelection() // discarded or deleted elsewhere
|
||||
} else if (JSON.stringify(before) !== JSON.stringify(after)) {
|
||||
refreshDetail()
|
||||
}
|
||||
} catch (err) {
|
||||
listError = errorText(err)
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshDetail() {
|
||||
const id = selectedId
|
||||
if (id === null) return
|
||||
const request = ++detailRequest
|
||||
try {
|
||||
const next = await getCall(id)
|
||||
if (request === detailRequest && id === selectedId) {
|
||||
detail = next
|
||||
detailError = ''
|
||||
}
|
||||
} catch (err) {
|
||||
if (request === detailRequest && id === selectedId) detailError = errorText(err)
|
||||
}
|
||||
}
|
||||
|
||||
function select(id: CallId) {
|
||||
if (id === selectedId) return
|
||||
selectedId = id
|
||||
detail = null
|
||||
detailError = ''
|
||||
actionError = ''
|
||||
refreshDetail()
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
selectedId = null
|
||||
detail = null
|
||||
detailError = ''
|
||||
actionError = ''
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const unlisten = [
|
||||
onCallUpdated((id) => {
|
||||
refreshList()
|
||||
if (id === selectedId) refreshDetail()
|
||||
}),
|
||||
onCallEnded(refreshList),
|
||||
onPromptChanged(refreshList),
|
||||
onRecordingState(refreshList),
|
||||
]
|
||||
refreshList()
|
||||
listAccounts()
|
||||
.then((list) => (accounts = list))
|
||||
.catch((err) => (listError = errorText(err)))
|
||||
return () => unlisten.forEach((u) => u.then((off) => off()))
|
||||
})
|
||||
|
||||
/** Runs a command on the shown call; its error is shown inline. */
|
||||
async function run(action: (id: CallId) => Promise<void>, done?: () => void) {
|
||||
if (!detail) return
|
||||
const id = detail.call.id
|
||||
busy = true
|
||||
actionError = ''
|
||||
try {
|
||||
await action(id)
|
||||
done?.()
|
||||
} catch (err) {
|
||||
if (id === selectedId) actionError = errorText(err)
|
||||
} finally {
|
||||
busy = false
|
||||
}
|
||||
}
|
||||
|
||||
const transcribe = () => run(transcribeCall)
|
||||
const retry = () => run(retryCall)
|
||||
const discard = () =>
|
||||
run(discardCall, () => {
|
||||
clearSelection()
|
||||
refreshList()
|
||||
})
|
||||
|
||||
function changeAccount(event: Event) {
|
||||
const select = event.currentTarget as HTMLSelectElement
|
||||
const previous = detail?.call.account_id ?? ''
|
||||
run(async (id) => {
|
||||
try {
|
||||
await setAccount(id, select.value || null)
|
||||
} catch (err) {
|
||||
select.value = previous
|
||||
throw err
|
||||
}
|
||||
await refreshDetail()
|
||||
})
|
||||
}
|
||||
|
||||
async function rename(speakerKey: string, name: string) {
|
||||
if (!detail) return
|
||||
await renameSpeaker(detail.call.id, speakerKey, name)
|
||||
await refreshDetail()
|
||||
}
|
||||
|
||||
/** "Microsoft Teams · heute 10:14 · 32 min" (no duration while recording). */
|
||||
function title(call: CallListItem): string {
|
||||
const parts = [call.app, formatDetailTime(call.started_at)]
|
||||
if (call.status !== 'recording') parts.push(formatMinutes(call.duration_secs))
|
||||
return parts.join(' · ')
|
||||
}
|
||||
|
||||
/** The account list plus the stored account if it is no longer listed. */
|
||||
let accountOptions = $derived.by(() => {
|
||||
const stored = detail?.call.account_id
|
||||
if (!stored || accounts.some((a) => a.id === stored)) return accounts
|
||||
return [...accounts, { id: stored, name: `${stored} (unbekannt)` }]
|
||||
})
|
||||
|
||||
// A failed start (e.g. missing key) also marks the call failed; its
|
||||
// error is then shown once, in the failure box.
|
||||
let shownActionError = $derived(actionError !== detail?.call.error ? actionError : '')
|
||||
</script>
|
||||
|
||||
<main class="main">
|
||||
<aside class="sidebar">
|
||||
<header class="sidebar-header">
|
||||
<h1>Gespräche</h1>
|
||||
<a class="gear" href="#/settings" title="Einstellungen" aria-label="Einstellungen">⚙</a>
|
||||
</header>
|
||||
<div class="list">
|
||||
{#if listError}
|
||||
<p class="error pad">{listError}</p>
|
||||
{/if}
|
||||
{#if loaded}
|
||||
<CallList {calls} {selectedId} onselect={select} />
|
||||
{/if}
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<section class="detail">
|
||||
{#if detail}
|
||||
{@const call = detail.call}
|
||||
<header class="detail-header">
|
||||
<div class="heading">
|
||||
<h1>{title(call)}</h1>
|
||||
<StatusPill status={call.status} interrupted={call.interrupted} />
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<label class="customer">
|
||||
<span>Kunde:</span>
|
||||
<select value={call.account_id ?? ''} disabled={busy} onchange={changeAccount}>
|
||||
<option value="">— kein Kunde —</option>
|
||||
{#each accountOptions as account (account.id)}
|
||||
<option value={account.id}>{account.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
<span class="actions">
|
||||
{#if call.status === 'awaiting_decision'}
|
||||
<button class="btn primary" disabled={busy} onclick={transcribe}>Transkribieren</button>
|
||||
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
||||
{:else if call.status === 'failed'}
|
||||
<button class="btn primary" disabled={busy} onclick={retry}>Erneut versuchen</button>
|
||||
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
||||
{:else if call.status === 'done'}
|
||||
<span title="Kommt in einer späteren Version">
|
||||
<button class="btn" disabled>In Kundenakte speichern</button>
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
{#if shownActionError}
|
||||
<p class="error">{shownActionError}</p>
|
||||
{/if}
|
||||
</header>
|
||||
|
||||
<div class="body">
|
||||
{#if call.status === 'recording'}
|
||||
<p class="state rec">● Aufnahme läuft</p>
|
||||
{:else if call.status === 'processing'}
|
||||
<p class="state">wird verarbeitet…</p>
|
||||
{:else if call.status === 'awaiting_decision'}
|
||||
<p class="state">
|
||||
{call.interrupted
|
||||
? 'Noch nicht transkribiert. Die Aufnahme wurde unterbrochen.'
|
||||
: 'Noch nicht transkribiert.'}
|
||||
</p>
|
||||
{:else if call.status === 'failed'}
|
||||
<div class="failure">
|
||||
<strong>Verarbeitung fehlgeschlagen</strong>
|
||||
<div>{call.error ?? 'Unbekannter Fehler'}</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="tabs" role="tablist">
|
||||
<button
|
||||
role="tab"
|
||||
aria-selected={tab === 'summary'}
|
||||
class:active={tab === 'summary'}
|
||||
onclick={() => (tab = 'summary')}>Zusammenfassung</button
|
||||
>
|
||||
<button
|
||||
role="tab"
|
||||
aria-selected={tab === 'transcript'}
|
||||
class:active={tab === 'transcript'}
|
||||
onclick={() => (tab = 'transcript')}>Transkript</button
|
||||
>
|
||||
</div>
|
||||
<div class="tab-panel" role="tabpanel">
|
||||
{#if tab === 'summary'}
|
||||
<p class="muted">Die Zusammenfassung kommt in einer späteren Version.</p>
|
||||
{:else}
|
||||
<TranscriptView segments={detail.segments} onrename={rename} />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if detailError}
|
||||
<p class="error pad">{detailError}</p>
|
||||
{:else if loaded && selectedId === null && calls.length > 0}
|
||||
<p class="muted pad">Gespräch links auswählen.</p>
|
||||
{/if}
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
:global(body:has(.main)) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.main {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(260px, 30%) 1fr;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
background: var(--surface);
|
||||
border-right: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px 12px 10px 16px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.sidebar-header h1 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.gear {
|
||||
color: var(--muted);
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
padding: 4px 6px;
|
||||
border-radius: 6px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.gear:hover {
|
||||
color: var(--primary);
|
||||
background: var(--primary-soft);
|
||||
}
|
||||
|
||||
.list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.detail {
|
||||
min-width: 0;
|
||||
overflow-y: auto;
|
||||
padding: 18px 24px 28px;
|
||||
}
|
||||
|
||||
.pad {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px 12px;
|
||||
}
|
||||
|
||||
.heading h1 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px 16px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.customer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.customer select {
|
||||
max-width: 260px;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: inline-flex;
|
||||
gap: 8px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.detail-header .error {
|
||||
margin: 10px 0 0;
|
||||
}
|
||||
|
||||
.state {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.state.rec {
|
||||
color: var(--rec);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.failure {
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
background: var(--rec-soft);
|
||||
color: var(--rec);
|
||||
}
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.tabs button {
|
||||
padding: 8px 14px;
|
||||
border: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1px;
|
||||
background: none;
|
||||
font: inherit;
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tabs button.active {
|
||||
color: var(--primary);
|
||||
border-bottom-color: var(--primary);
|
||||
}
|
||||
|
||||
.tab-panel {
|
||||
padding-top: 14px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user