mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 18:33:53 +00:00
V1 (#118)
* chore: upgrade minor versions * chore: upgrade cypress * chore: upgrade fe dependencies * update readme * update osx images * update readme * upgrade dependencies * upgrade test dependency * feat: add option to input autofill * feat: autofill to the left * chore: update docs * chore: cleanup ci * version bump * style: prevent zero height bar * fix: prevent loosing menu * ux: improve input, no spellcheck or autocomplete * small ux improvements in cuesheets * feat 111/increase maximum number of events * fix: optimistic delete issue with filter * refact: pincode workflow * chore: add versioning to packages
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||
import { Editable, EditableInput, EditablePreview } from '@chakra-ui/editable';
|
||||
import { forgivingStringToMillis } from '../utils/dateConfig';
|
||||
import { LoggingContext } from '../../app/context/LoggingContext';
|
||||
@@ -7,12 +7,12 @@ import { stringFromMillis } from '../utils/time';
|
||||
import style from './EditableTimer.module.scss';
|
||||
|
||||
export default function EditableTimer(props) {
|
||||
const { name, actionHandler, time, delay, validate, previousEnd } = props;
|
||||
const { name, actionHandler, time = 0, delay, validate, previousEnd } = props;
|
||||
const { emitError } = useContext(LoggingContext);
|
||||
const [value, setValue] = useState('');
|
||||
|
||||
|
||||
const handleSubmit = (value) => {
|
||||
const handleSubmit = useCallback((value) => {
|
||||
// Check if there is anything there
|
||||
if (value === '') return false;
|
||||
|
||||
@@ -46,10 +46,10 @@ export default function EditableTimer(props) {
|
||||
actionHandler('update', { field: name, value: newValMillis });
|
||||
|
||||
return true;
|
||||
};
|
||||
},[actionHandler, delay, name, previousEnd, time, validate]);
|
||||
|
||||
// prepare time fields
|
||||
const validateValue = (value) => {
|
||||
const validateValue = useCallback((value) => {
|
||||
const success = handleSubmit(value);
|
||||
if (success) {
|
||||
const ms = forgivingStringToMillis(value);
|
||||
@@ -57,7 +57,7 @@ export default function EditableTimer(props) {
|
||||
} else {
|
||||
setValue(stringFromMillis(time + delay));
|
||||
}
|
||||
};
|
||||
},[delay, handleSubmit, time]);
|
||||
|
||||
useEffect(() => {
|
||||
if (time == null) return;
|
||||
|
||||
Reference in New Issue
Block a user