mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 18:03:47 +00:00
b7e758bf24
* chore: add typescript and dependencies * refactor: remove react imports * refactor: fix entrypoint * chore: upgrade chakra and deps * chore: configure eslint
60 lines
1.6 KiB
React
60 lines
1.6 KiB
React
import PropTypes from 'prop-types';
|
|
|
|
import { stringFromMillis } from '../../utils/time';
|
|
import EditableTimer from '../input/EditableTimer';
|
|
|
|
import style from './Times.module.scss';
|
|
|
|
export default function TimesDelayed(props) {
|
|
const { handleValidate, actionHandler, delay, timeStart, timeEnd, duration, previousEnd } = props;
|
|
|
|
const scheduledStart = stringFromMillis(timeStart, false);
|
|
const scheduledEnd = stringFromMillis(timeEnd, false);
|
|
|
|
return (
|
|
<>
|
|
<span className={style.label}>
|
|
Start <span>{scheduledStart}</span>
|
|
</span>
|
|
<EditableTimer
|
|
name='timeStart'
|
|
validate={handleValidate}
|
|
actionHandler={actionHandler}
|
|
time={timeStart}
|
|
delay={delay}
|
|
previousEnd={previousEnd}
|
|
/>
|
|
<span className={style.label}>
|
|
End <span>{scheduledEnd}</span>
|
|
</span>
|
|
<EditableTimer
|
|
name='timeEnd'
|
|
validate={handleValidate}
|
|
actionHandler={actionHandler}
|
|
time={timeEnd}
|
|
delay={delay}
|
|
previousEnd={previousEnd}
|
|
/>
|
|
<span className={style.label}>Duration</span>
|
|
<EditableTimer
|
|
name='durationOverride'
|
|
validate={handleValidate}
|
|
actionHandler={actionHandler}
|
|
time={duration}
|
|
delay={0}
|
|
previousEnd={previousEnd}
|
|
/>
|
|
</>
|
|
);
|
|
}
|
|
|
|
TimesDelayed.propTypes = {
|
|
handleValidate: PropTypes.func.isRequired,
|
|
actionHandler: PropTypes.func.isRequired,
|
|
delay: PropTypes.number,
|
|
timeStart: PropTypes.number,
|
|
timeEnd: PropTypes.number,
|
|
duration: PropTypes.number,
|
|
previousEnd: PropTypes.number,
|
|
};
|