Skip to content

Commit

Permalink
fix transcript loaded in preview
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbuks committed Oct 22, 2024
1 parent 68c0a7a commit 7903472
Showing 1 changed file with 47 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ function VoiceMessageAttachmentPlayer(props: Props) {
const open = Boolean(anchorEl);

useEffect(() => {
fetchTranscript();
if (!props.isPreview) {
fetchTranscript();
}
}, []);

const fetchTranscript = async () => {
Expand Down Expand Up @@ -142,10 +144,14 @@ function VoiceMessageAttachmentPlayer(props: Props) {
className='image-name'
>
<div id='image-name-text'>
{isLoadingTranscript ? (
loadingMessage
) : (
transcriptReady
{props.isPreview ? null : (
<>
{isLoadingTranscript ? (
loadingMessage
) : (
transcriptReady
)}
</>
)}
</div>
</div>
Expand Down Expand Up @@ -241,41 +247,43 @@ function VoiceMessageAttachmentPlayer(props: Props) {
</div>
</div>
<div>
<div>
<div className='file-view--single'>
<div className='file__image'>
{transcriptHeader}
{props.isPreview ? null : (
<div>
<div className='file-view--single'>
<div className='file__image'>
{transcriptHeader}
</div>
</div>
</div>
<div >
<>
{!isLoadingTranscript && transcript && transcriptDatas && isTranscriptModalOpen && (
<div style={{paddingTop: '5px'}}>
{transcript.length > 300 ? transcript.substring(0, 300) + '... ' : transcript + ' '}
<a
className='transcript-link-view'
onClick={(event) => {
handleClick(event);
}}
>
<FormattedMessage
id={'vocals.loading_transcript'}
defaultMessage={'View the transcript'}
/>
</a>
</div>
)}
{transcriptDatas && !isLoadingTranscript && (
<TranscriptComponent
transcriptDatas={transcriptDatas}
handleClose={handleClose}
open={open}
anchorEl={anchorEl}
/>
)}
</>
</div>
</div>
<div >
<>
{!isLoadingTranscript && transcript && transcriptDatas && isTranscriptModalOpen && (
<div style={{paddingTop: '5px'}}>
{transcript.length > 300 ? transcript.substring(0, 300) + '... ' : transcript + ' '}
<a
className='transcript-link-view'
onClick={(event) => {
handleClick(event);
}}
>
<FormattedMessage
id={'vocals.loading_transcript'}
defaultMessage={'View the transcript'}
/>
</a>
</div>
)}
{transcriptDatas && !isLoadingTranscript && (
<TranscriptComponent
transcriptDatas={transcriptDatas}
handleClose={handleClose}
open={open}
anchorEl={anchorEl}
/>
)}
</>
</div>
</div>)
}
{error && <div className='transcript-error'>{error}</div>}
</div>
</>
Expand Down

0 comments on commit 7903472

Please sign in to comment.