refactor: Remove unused text prop and related logic from AudioPlayer component
This commit is contained in:
@@ -50,8 +50,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.audioPlayerWrapper :global(.waveform-title) {
|
.audioPlayerWrapper :global(.waveform-title) {
|
||||||
text-align: center;
|
display: none;
|
||||||
font-size: 0.8125rem;
|
}
|
||||||
|
|
||||||
|
.audioPlayerWrapper :global(.waveform-body) {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.audioPlayerWrapper :global(.waveform-track) {
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.audioPlayerWrapper :global(.waveform-time) {
|
.audioPlayerWrapper :global(.waveform-time) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ interface AudioPlayerProps {
|
|||||||
text?: string
|
text?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioPlayer = memo(({ audioUrl, jobId, text }: AudioPlayerProps) => {
|
const AudioPlayer = memo(({ audioUrl, jobId }: AudioPlayerProps) => {
|
||||||
const { t } = useTranslation('common')
|
const { t } = useTranslation('common')
|
||||||
const [blobUrl, setBlobUrl] = useState<string>('')
|
const [blobUrl, setBlobUrl] = useState<string>('')
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
@@ -71,11 +71,6 @@ const AudioPlayer = memo(({ audioUrl, jobId, text }: AudioPlayerProps) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!containerRef.current || !blobUrl) return
|
if (!containerRef.current || !blobUrl) return
|
||||||
|
|
||||||
const truncateText = (str: string, maxLength: number = 30) => {
|
|
||||||
if (!str) return ''
|
|
||||||
return str.length > maxLength ? str.substring(0, maxLength) + '...' : str
|
|
||||||
}
|
|
||||||
|
|
||||||
const player = new WaveformPlayer(containerRef.current, {
|
const player = new WaveformPlayer(containerRef.current, {
|
||||||
url: blobUrl,
|
url: blobUrl,
|
||||||
waveformStyle: 'mirror',
|
waveformStyle: 'mirror',
|
||||||
@@ -87,7 +82,6 @@ const AudioPlayer = memo(({ audioUrl, jobId, text }: AudioPlayerProps) => {
|
|||||||
showPlaybackSpeed: false,
|
showPlaybackSpeed: false,
|
||||||
autoplay: false,
|
autoplay: false,
|
||||||
enableMediaSession: true,
|
enableMediaSession: true,
|
||||||
title: text ? truncateText(text) : undefined,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
playerInstanceRef.current = player
|
playerInstanceRef.current = player
|
||||||
@@ -109,7 +103,7 @@ const AudioPlayer = memo(({ audioUrl, jobId, text }: AudioPlayerProps) => {
|
|||||||
playerInstanceRef.current = null
|
playerInstanceRef.current = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [blobUrl, text])
|
}, [blobUrl])
|
||||||
|
|
||||||
const handleDownload = useCallback(() => {
|
const handleDownload = useCallback(() => {
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
|
|||||||
Reference in New Issue
Block a user