-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Make side panel for cut segments - Use up/down key to jump prev/next segment #254
- Loading branch information
Showing
9 changed files
with
158 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { memo, Fragment } from 'react'; | ||
import prettyMs from 'pretty-ms'; | ||
import { FaSave } from 'react-icons/fa'; | ||
import { motion } from 'framer-motion'; | ||
|
||
import { saveColor } from './colors'; | ||
|
||
const SegmentList = memo(({ | ||
formatTimecode, cutSegments, getFrameCount, getSegColors, onSegClick, | ||
currentSegIndex, invertCutSegments, | ||
}) => { | ||
if (!cutSegments && invertCutSegments) { | ||
return <div>Make sure you have no overlapping segments.</div>; | ||
} | ||
|
||
if (!cutSegments || cutSegments.length === 0) { | ||
return <div>No segments to export.</div>; | ||
} | ||
|
||
return ( | ||
<Fragment> | ||
<div style={{ fontSize: 14, marginBottom: 10 }}>Segments to export:</div> | ||
{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 <FaSave style={{ color: saveColor, marginRight: 5, verticalAlign: 'middle' }} size={14} />; | ||
|
||
const { | ||
segBgColor, segBorderColor, | ||
} = getSegColors(seg); | ||
|
||
return <b style={{ color: 'white', padding: '0 3px', marginRight: 5, background: segBgColor, border: `1px solid ${isActive ? segBorderColor : 'transparent'}`, borderRadius: 10, fontSize: 12 }}>{index + 1}</b>; | ||
} | ||
|
||
return ( | ||
<motion.div | ||
role="button" | ||
onClick={() => !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 }} | ||
> | ||
<div style={{ fontSize: 13, whiteSpace: 'nowrap', color: 'white', marginBottom: 3 }}> | ||
{renderNumber()} | ||
<span>{formatTimecode(seg.start)} - {formatTimecode(seg.end)}</span> | ||
</div> | ||
<div style={{ fontSize: 13 }}> | ||
Duration {prettyMs(durationMs)} | ||
</div> | ||
<div style={{ fontSize: 12 }}> | ||
({Math.floor(durationMs)} ms, {getFrameCount(duration)} frames) | ||
</div> | ||
<div style={{ fontSize: 12, color: 'white' }}>{seg.name}</div> | ||
</motion.div> | ||
); | ||
})} | ||
</Fragment> | ||
); | ||
}); | ||
|
||
export default SegmentList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const saveColor = 'hsl(158, 100%, 43%)'; | ||
export const primaryColor = 'hsl(194, 78%, 47%)'; | ||
export const controlsBackground = '#6b6b6b'; |
Oops, something went wrong.