diff --git a/src/App.jsx b/src/App.jsx index 8cf9f3cf..c2de268d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1873,7 +1873,8 @@ const App = memo(() => { > { const { t } = useTranslation(); - if (!cutSegments && invertCutSegments) { - return
{t('Make sure you have no overlapping segments.')}
; - } - - if (!cutSegments || cutSegments.length === 0) { - return
{t('No segments to export.')}
; - } + let headerText = t('Segments to export:'); - const { segActiveBgColor: currentSegActiveBgColor } = getSegColors(currentCutSeg); + if (!outSegments && invertCutSegments) headerText = t('Make sure you have no overlapping segments.'); + else if (!outSegments || outSegments.length === 0) headerText = t('No segments to export.'); async function onLabelSegmentPress() { const { value } = await Swal.fire({ @@ -61,8 +56,100 @@ const SegmentList = memo(({ } } + const Segments = () => outSegments.map((seg, index) => { + const duration = seg.end - seg.start; + const durationMs = duration * 1000; + + const isActive = !invertCutSegments && currentSegIndex === index; + const uuid = seg.uuid || `${seg.start}`; + + function renderNumber() { + if (invertCutSegments) return ; + + const { + segBgColor, segBorderColor, + } = getSegColors(seg); + + return {index + 1}; + } + + const timeStr = `${formatTimecode(seg.start)} - ${formatTimecode(seg.end)}`; + + return ( + !invertCutSegments && onSegClick(index)} + key={uuid} + positionTransition + style={{ originY: 0, margin: '5px 0', border: `1px solid rgba(255,255,255,${isActive ? 1 : 0.3})`, padding: 5, borderRadius: 5 }} + initial={{ scaleY: 0 }} + animate={{ scaleY: 1 }} + exit={{ scaleY: 0 }} + > +
+ {renderNumber()} + {timeStr} +
+
{seg.name}
+
+ {t('Duration')} {prettyMs(durationMs)} +
+
+ ({Math.floor(durationMs)} ms, {getFrameCount(duration)} frames) +
+
+ ); + }); + + const Footer = () => { + const { segActiveBgColor: currentSegActiveBgColor } = getSegColors(currentCutSeg); + + return ( + <> +
+ + + + + + + +
+ +
+
{t('Segments total:')}
+
{formatTimecode(outSegments.reduce((acc, { start, end }) => (end - start) + acc, 0))}
+
+ + ); + }; + return ( - + <>
- {t('Segments to export:')} + {headerText}
- {cutSegments.map((seg, index) => { - const duration = seg.end - seg.start; - const durationMs = duration * 1000; - - const isActive = !invertCutSegments && currentSegIndex === index; - const uuid = seg.uuid || `${seg.start}`; - - function renderNumber() { - if (invertCutSegments) return ; - - const { - segBgColor, segBorderColor, - } = getSegColors(seg); - - return {index + 1}; - } - - const timeStr = `${formatTimecode(seg.start)} - ${formatTimecode(seg.end)}`; - - return ( - !invertCutSegments && onSegClick(index)} - key={uuid} - positionTransition - style={{ originY: 0, margin: '5px 0', border: `1px solid rgba(255,255,255,${isActive ? 1 : 0.3})`, padding: 5, borderRadius: 5 }} - initial={{ scaleY: 0 }} - animate={{ scaleY: 1 }} - exit={{ scaleY: 0 }} - > -
- {renderNumber()} - {timeStr} -
-
{seg.name}
-
- {t('Duration')} {prettyMs(durationMs)} -
-
- ({Math.floor(durationMs)} ms, {getFrameCount(duration)} frames) -
-
- ); - })} + {outSegments && }
-
- - - - - - - -
- -
-
{t('Segments total:')}
-
{formatTimecode(cutSegments.reduce((acc, { start, end }) => (end - start) + acc, 0))}
-
-
+ {outSegments &&