Skip to content

Commit

Permalink
feat: update condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Rassl committed Dec 5, 2024
1 parent 1019f7f commit a2fa0e4
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions src/components/mindset/components/Sidebar/Transcript/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,29 @@ export const Transcript = () => {
return () => clearInterval(interval)
}, [playerRef, setCurrentTime])

return (
currentTime && (
<Wrapper>
<Flex className="heading">Transcript</Flex>
{clips.map((clip) => {
const timestamp: string | undefined = clip?.properties?.timestamp
return currentTime ? (
<Wrapper>
<Flex className="heading">Transcript</Flex>
{clips.map((clip) => {
const timestamp: string | undefined = clip?.properties?.timestamp

const [start, end] = timestamp
? (timestamp as string).split('-').map(Number) // Directly convert to numbers
: [0, 0]
const [start, end] = timestamp
? (timestamp as string).split('-').map(Number) // Directly convert to numbers
: [0, 0]

if (start <= currentTime * 1000 && currentTime * 1000 < end) {
// Multiply playingTime by 1000 to match millisecond format
return (
<TranscriptWrapper key={clip.ref_id} direction="row">
{clip.properties?.transcript && <Viewer transcriptString={clip.properties?.transcript} />}
</TranscriptWrapper>
)
}
if (start <= currentTime * 1000 && currentTime * 1000 < end) {
// Multiply playingTime by 1000 to match millisecond format
return (
<TranscriptWrapper key={clip.ref_id} direction="row">
{clip.properties?.transcript && <Viewer transcriptString={clip.properties?.transcript} />}
</TranscriptWrapper>
)
}

return null
})}
</Wrapper>
)
)
return null
})}
</Wrapper>
) : null
}

const Wrapper = styled(Flex)`
Expand Down

0 comments on commit a2fa0e4

Please sign in to comment.