import React, {useMemo} from 'react' import {useAppSelector} from '../hooks/redux' import {getDisplay, getTransText} from '../util/biz_util' import classNames from 'classnames' const CompactSegmentItem = (props: { item: TranscriptItem idx: number isIn: boolean last: boolean moveCallback: (event: any) => void move2Callback: (event: any) => void }) => { const {item, idx, last, isIn, moveCallback, move2Callback} = props const transResult = useAppSelector(state => state.env.transResults[idx]) const envData = useAppSelector(state => state.env.envData) const fontSize = useAppSelector(state => state.env.envData.fontSize) const autoTranslate = useAppSelector(state => state.env.autoTranslate) const transText = useMemo(() => getTransText(transResult, envData.hideOnDisableAutoTranslate, autoTranslate), [autoTranslate, envData.hideOnDisableAutoTranslate, transResult]) const display = useMemo(() => getDisplay(envData.transDisplay, item.content, transText), [envData.transDisplay, item.content, transText]) return