import { State } from '@hookstate/core'; import { Downgraded } from '@hookstate/core'; import { SpringRef } from 'react-spring'; import InputAdornment from '@material-ui/core/InputAdornment'; import TextField from '@material-ui/core/TextField'; import TimecodeInput from '../components/timeinput'; import { globalState, slideAPIprops } from '../pages/editor'; import { TimedVideoPlayer } from '../pages/present'; import { anySlide, delaySlide, loopSlide } from '../timeline'; interface SlidePropertiesPropsType { slide: State; global: State; player: TimedVideoPlayer; api: SpringRef; select: (slides: anySlide[]) => void; } function SlideTimestamp(props: SlidePropertiesPropsType) { return { props.slide.frame.set(newValue); props.api.start({ frame: newValue }); props.select([props.slide.attach(Downgraded).value]); props.global.update.refreshLiveTimeline.value(); }} player={props.player} />; } export default function SlideProperties(props: SlidePropertiesPropsType) { function updateProp(key: keyof slideType) { return (newValue: any) => { // TODO: better typing here props.slide[key as keyof State].set(newValue); props.global.update.refreshLiveTimeline.value(); }; } return
Properties {{ 'default': <> , 'loop': <> ).frame.get() - (props.slide as State).beginFrame.get()} />
).beginFrame.get()} update={updateProp('beginFrame')} player={props.player} /> ).frame.get()} update={updateProp('frame')} player={props.player} /> , 'delay': <>
}} InputLabelProps={{ shrink: true }} value={(props.slide as State).delay.get() / 1000} onChange={event => updateProp('delay')(Number(event.target.value) * 1000)} /> , 'speedChange': <>
}} value={(props.slide as State).delay.get()} onChange={event => updateProp('delay')(Number(event.target.value))} />
, }[props.slide.value.type]}
; }