({scene, duration}: SlideTrackProps)
| 11 | } |
| 12 | |
| 13 | export function SlideTrack({scene, duration}: SlideTrackProps) { |
| 14 | const {player} = useApplication(); |
| 15 | const slides = useSubscribableValue(scene.slides.onChanged); |
| 16 | |
| 17 | return slides.length > 0 ? ( |
| 18 | <div className={styles.slideTrack}> |
| 19 | {slides[0].time > 0 && ( |
| 20 | <div |
| 21 | className={clsx(styles.clip, styles.continuation)} |
| 22 | style={{left: 0, width: `${(slides[0].time / duration) * 100}%`}} |
| 23 | /> |
| 24 | )} |
| 25 | {slides.map((slide, index) => ( |
| 26 | <div |
| 27 | className={styles.clip} |
| 28 | style={{ |
| 29 | width: `${ |
| 30 | (((slides[index + 1]?.time ?? duration) - slide.time) / |
| 31 | duration) * |
| 32 | 100 |
| 33 | }%`, |
| 34 | }} |
| 35 | > |
| 36 | <div className={styles.container}> |
| 37 | <div |
| 38 | title="Go to source" |
| 39 | className={styles.name} |
| 40 | onMouseUp={async event => { |
| 41 | event.stopPropagation(); |
| 42 | if (event.button === 1) { |
| 43 | player.requestSeek( |
| 44 | scene.firstFrame + |
| 45 | player.status.secondsToFrames(slide.time), |
| 46 | ); |
| 47 | } else if (event.button === 0) { |
| 48 | await findAndOpenFirstUserFile(slide.stack); |
| 49 | } |
| 50 | }} |
| 51 | > |
| 52 | {slide.name} |
| 53 | </div> |
| 54 | </div> |
| 55 | </div> |
| 56 | ))} |
| 57 | </div> |
| 58 | ) : ( |
| 59 | <></> |
| 60 | ); |
| 61 | } |
nothing calls this directly
no test coverage detected