Spaces:
Sleeping
Sleeping
File size: 1,368 Bytes
bb3e925 4ecf44b 2b8eed1 bb3e925 4ecf44b bb3e925 4ecf44b bb3e925 4ecf44b bb3e925 4ecf44b bb3e925 4ecf44b bb3e925 4ecf44b bb3e925 4ecf44b bb3e925 4ecf44b bb3e925 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | import { memo } from 'react'
import { transcriptTags } from '../lib/mockData'
import { Waveform } from './Waveform'
type LiveTranscriptProps = {
active?: boolean
audioLevel?: number
statusLabel: string
visibleWords: string[]
wordCount: number
waveformLabel?: string
}
export const LiveTranscript = memo(function LiveTranscript({
active = false,
audioLevel = 0,
statusLabel,
visibleWords,
wordCount,
waveformLabel,
}: LiveTranscriptProps) {
return (
<aside className="transcript-panel">
<header>
<div>
<i className="rec-dot" />
<span>Live transcript</span>
</div>
<span>{wordCount} W / {statusLabel}</span>
</header>
<div className="transcript-scroll">
<p className="transcript-copy live-copy">
{visibleWords.length > 0 ? visibleWords.join(' ') : <span>{statusLabel}</span>}
{active && <b className="cursor">|</b>}
</p>
</div>
<div className="waveform-wrap">
<div>
<span>WAVEFORM</span>
<span>{waveformLabel ?? (active || wordCount > 0 ? '-12 dB' : 'armed')}</span>
</div>
<Waveform active={active} audioLevel={audioLevel} />
</div>
<footer>
{transcriptTags.map((tag) => (
<span key={tag}>{tag}</span>
))}
</footer>
</aside>
)
})
|