mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 02:43:50 +00:00
refractor + style tweaks
- bugfix on lower - delay between 0-60 minutes - action buttons in dropdown - added button for toggling element visibility - several css and code cleanups - renamed settingsAPI
This commit is contained in:
@@ -8,6 +8,7 @@ export default function AddIconBtn(props) {
|
||||
icon={<FiPlus />}
|
||||
colorScheme='blue'
|
||||
onClick={props.clickHandler}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ export default function BlockIconBtn(props) {
|
||||
icon={<FiMinusCircle />}
|
||||
colorScheme='purple'
|
||||
onClick={props.clickHandler}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export default function CollapseIconBtn(props) {
|
||||
colorScheme='orange'
|
||||
variant={props.active ? 'solid' : 'outline'}
|
||||
onClick={props.clickHandler}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ export default function DelayIconBtn(props) {
|
||||
icon={<FiClock />}
|
||||
colorScheme='yellow'
|
||||
onClick={props.clickHandler}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ export default function DeleteIconBtn(props) {
|
||||
icon={<FiMinus />}
|
||||
colorScheme='red'
|
||||
onClick={props.clickHandler}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,12 @@ export default function NextIconBtn(props) {
|
||||
return (
|
||||
<IconButton
|
||||
icon={<FiSkipForward />}
|
||||
colorScheme= 'whiteAlpha'
|
||||
colorScheme='whiteAlpha'
|
||||
backgroundColor='#ffffff05'
|
||||
variant= 'outline'
|
||||
variant='outline'
|
||||
onClick={props.clickHandler}
|
||||
width={90}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ export default function PauseIconBtn(props) {
|
||||
colorScheme='orange'
|
||||
variant={props.active ? 'solid' : 'outline'}
|
||||
onClick={props.clickHandler}
|
||||
width={90}
|
||||
width={120}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,12 @@ export default function PrevIconBtn(props) {
|
||||
return (
|
||||
<IconButton
|
||||
icon={<FiSkipBack />}
|
||||
colorScheme= 'whiteAlpha'
|
||||
colorScheme='whiteAlpha'
|
||||
backgroundColor='#ffffff05'
|
||||
variant= 'outline'
|
||||
variant='outline'
|
||||
onClick={props.clickHandler}
|
||||
width={90}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IconButton } from '@chakra-ui/button';
|
||||
import { FiRefreshCcw } from 'react-icons/fi';
|
||||
|
||||
export default function ReloadIconButton(props) {
|
||||
return (
|
||||
<IconButton
|
||||
icon={<FiRefreshCcw />}
|
||||
colorScheme='whiteAlpha'
|
||||
backgroundColor='#ffffff05'
|
||||
variant='outline'
|
||||
onClick={props.clickHandler}
|
||||
width={90}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,9 @@ export default function RollIconBtn(props) {
|
||||
colorScheme='blue'
|
||||
variant={props.active ? 'solid' : 'outline'}
|
||||
onClick={props.clickHandler}
|
||||
width={90}
|
||||
width={120}
|
||||
disabled
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export default function SettingsIconBtn(props) {
|
||||
isRound
|
||||
variant='outline'
|
||||
onClick={props.clickHandler}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ export default function StartIconBtn(props) {
|
||||
colorScheme='green'
|
||||
variant={props.active ? 'solid' : 'outline'}
|
||||
onClick={props.clickHandler}
|
||||
width={90}
|
||||
width={120}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IconButton } from '@chakra-ui/button';
|
||||
import { FiCornerLeftUp } from 'react-icons/fi';
|
||||
|
||||
export default function UnloadIconBtn(props) {
|
||||
return (
|
||||
<IconButton
|
||||
icon={<FiCornerLeftUp />}
|
||||
colorScheme='whiteAlpha'
|
||||
backgroundColor='#ffffff05'
|
||||
variant='outline'
|
||||
onClick={props.clickHandler}
|
||||
width={90}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ export default function VisibleIconBtn(props) {
|
||||
colorScheme='blue'
|
||||
variant={props.active ? 'solid' : 'outline'}
|
||||
onClick={props.clickHandler}
|
||||
_focus={{ boxShadow: 'none' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import EditableTimer from '../../input/EditableTimer';
|
||||
import DelayValue from '../../input/DelayValue';
|
||||
import { showWarningToast } from '../../helpers/toastManager';
|
||||
|
||||
export default function EventTimes(props) {
|
||||
@@ -24,7 +23,6 @@ export default function EventTimes(props) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<DelayValue delay={delay} />
|
||||
<EditableTimer
|
||||
name='timeStart'
|
||||
validate={handleValidate}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { millisToMinutes } from '../dateConfig';
|
||||
import style from './EditableTimer.module.css';
|
||||
import style from '../../features/editors/list/Block.module.css';
|
||||
|
||||
export default function DelayValue(props) {
|
||||
const { delay } = props;
|
||||
const delayed = delay > 0;
|
||||
return (
|
||||
<div className={delayed ? style.delayValue : undefined}>
|
||||
<div className={style.delayValue}>
|
||||
{delayed && <span>{`+ ${millisToMinutes(delay)}`}</span>}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Editable, EditableInput, EditablePreview } from '@chakra-ui/editable';
|
||||
import { useState } from 'react';
|
||||
import style from './EditableText.module.css';
|
||||
|
||||
export default function EditableText(props) {
|
||||
const { label, defaultValue, placeholder, submitHandler } = props;
|
||||
const [text, setText] = useState(props.defaultValue || '');
|
||||
|
||||
const handleSubmit = (submitedVal) => {
|
||||
// No need to update if it hasnt changed
|
||||
@@ -11,19 +13,25 @@ export default function EditableText(props) {
|
||||
submitHandler(submitedVal);
|
||||
};
|
||||
|
||||
const handleChange = (val) => {
|
||||
if (val.length < 40) setText(val);
|
||||
console.log(val.length);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={style.block}>
|
||||
<span className={props.underlined ? style.titleUnderlined : style.title}>
|
||||
{label}
|
||||
</span>
|
||||
<Editable
|
||||
onChange={(v) => handleChange(v)}
|
||||
onSubmit={(v) => handleSubmit(v)}
|
||||
defaultValue={defaultValue}
|
||||
value={text}
|
||||
placeholder={placeholder}
|
||||
className={style.inline}
|
||||
>
|
||||
<EditablePreview />
|
||||
<EditableInput className={style.editable13} />
|
||||
<EditableInput />
|
||||
</Editable>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -14,13 +14,11 @@
|
||||
|
||||
.block {
|
||||
display: 'block';
|
||||
overflow: hidden;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.inline {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.editable13 {
|
||||
width: '13em';
|
||||
min-width: '13em';
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
.time {
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: 4px;
|
||||
width: 5em;
|
||||
height: fit-content;
|
||||
@@ -10,17 +9,9 @@
|
||||
.delayedEditable {
|
||||
text-align: center;
|
||||
border-radius: 4px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.delayedEditable {
|
||||
border: 1px solid #d69e2e55;
|
||||
}
|
||||
|
||||
.delayValue {
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 0.3em 0;
|
||||
text-align: center;
|
||||
align-self: flex-start;
|
||||
background-color: #d69e2e55;
|
||||
}
|
||||
|
||||
@@ -22,14 +22,16 @@ export default function TimeInput(props) {
|
||||
}, [props.value]);
|
||||
|
||||
const handleChange = (val) => {
|
||||
if (val <= 999) setValue(val);
|
||||
if (val <= 666) setValue(val);
|
||||
};
|
||||
|
||||
const handleSubmit = (val) => {
|
||||
if (val === props.value) return;
|
||||
if (val === '') setValue(0);
|
||||
if (val > 0 && val < 60) {
|
||||
if (val >= 0 && val <= 60) {
|
||||
props.submitHandler(val);
|
||||
} else {
|
||||
setValue(60);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user