mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-01 20:39:18 +00:00
fix: small style tweaks and bug fixes
fix: remove interactive styles from display elements fix: automation form reset on submit fix: prevent empty image src
This commit is contained in:
committed by
Carlos Valente
parent
902edf4a85
commit
836fa52757
@@ -42,7 +42,6 @@ interface AutomationFormProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AutomationForm({ automation, onClose }: AutomationFormProps) {
|
export default function AutomationForm({ automation, onClose }: AutomationFormProps) {
|
||||||
'no memo'; // RHF and react-compiler dont seem to get along
|
|
||||||
const isEdit = isAutomation(automation);
|
const isEdit = isAutomation(automation);
|
||||||
const { data } = useCustomFields();
|
const { data } = useCustomFields();
|
||||||
const { refetch } = useAutomationSettings();
|
const { refetch } = useAutomationSettings();
|
||||||
|
|||||||
+2
-4
@@ -25,8 +25,6 @@ export default function AutomationSettingsForm({
|
|||||||
enabledOscIn,
|
enabledOscIn,
|
||||||
oscPortIn,
|
oscPortIn,
|
||||||
}: AutomationSettingsProps) {
|
}: AutomationSettingsProps) {
|
||||||
'no memo'; // RHF and react-compiler dont seem to get along
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
reset,
|
reset,
|
||||||
@@ -38,15 +36,15 @@ export default function AutomationSettingsForm({
|
|||||||
} = useForm<AutomationSettingsProps>({
|
} = useForm<AutomationSettingsProps>({
|
||||||
mode: 'onChange',
|
mode: 'onChange',
|
||||||
defaultValues: { enabledAutomations, enabledOscIn, oscPortIn },
|
defaultValues: { enabledAutomations, enabledOscIn, oscPortIn },
|
||||||
values: { enabledAutomations, enabledOscIn, oscPortIn },
|
|
||||||
resetOptions: {
|
resetOptions: {
|
||||||
keepDirtyValues: true,
|
keepDirtyValues: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = async (formData: AutomationSettingsProps) => {
|
const onSubmit = async (formData: AutomationSettingsProps) => {
|
||||||
try {
|
try {
|
||||||
await editAutomationSettings(formData);
|
await editAutomationSettings(formData);
|
||||||
|
reset(formData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = maybeAxiosError(error);
|
const message = maybeAxiosError(error);
|
||||||
setError('root', { message });
|
setError('root', { message });
|
||||||
|
|||||||
@@ -248,7 +248,9 @@ export default function ProjectData() {
|
|||||||
{...register(`custom.${idx}.url`)}
|
{...register(`custom.${idx}.url`)}
|
||||||
/>
|
/>
|
||||||
<div className={style.imageContainer}>
|
<div className={style.imageContainer}>
|
||||||
<img src={watch(`custom.${idx}.url`)} alt='' loading='lazy' className='info__image' />
|
{watch(`custom.${idx}.url`) && (
|
||||||
|
<img src={watch(`custom.${idx}.url`)} alt='' loading='lazy' className='info__image' />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -99,10 +99,6 @@
|
|||||||
width: 7.5em;
|
width: 7.5em;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-bottom: 1px solid $gray-1100;
|
border-bottom: 1px solid $gray-1100;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inactive {
|
.inactive {
|
||||||
|
|||||||
@@ -63,19 +63,19 @@ export default function GroupEditor({ group }: GroupEditorProps) {
|
|||||||
// TODO: format with user time settings
|
// TODO: format with user time settings
|
||||||
}
|
}
|
||||||
<Editor.Label>First event start</Editor.Label>
|
<Editor.Label>First event start</Editor.Label>
|
||||||
<TextLikeInput className={style.textLikeInput}>
|
<TextLikeInput className={style.textLikeInput} disabled>
|
||||||
{millisToString(group.timeStart, { fallback: timerPlaceholder })}
|
{millisToString(group.timeStart, { fallback: timerPlaceholder })}
|
||||||
</TextLikeInput>
|
</TextLikeInput>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Editor.Label>Last event end</Editor.Label>
|
<Editor.Label>Last event end</Editor.Label>
|
||||||
<TextLikeInput className={style.textLikeInput}>
|
<TextLikeInput className={style.textLikeInput} disabled>
|
||||||
{millisToString(group.timeEnd, { fallback: timerPlaceholder })}
|
{millisToString(group.timeEnd, { fallback: timerPlaceholder })}
|
||||||
</TextLikeInput>
|
</TextLikeInput>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Editor.Label htmlFor='duration'>Scheduled duration</Editor.Label>
|
<Editor.Label htmlFor='duration'>Scheduled duration</Editor.Label>
|
||||||
<TextLikeInput className={style.textLikeInput}>
|
<TextLikeInput className={style.textLikeInput} disabled>
|
||||||
{millisToString(group.duration, { fallback: enDash })}
|
{millisToString(group.duration, { fallback: enDash })}
|
||||||
</TextLikeInput>
|
</TextLikeInput>
|
||||||
</div>
|
</div>
|
||||||
@@ -86,7 +86,7 @@ export default function GroupEditor({ group }: GroupEditorProps) {
|
|||||||
<TextLikeInput
|
<TextLikeInput
|
||||||
offset={planOffsetLabel}
|
offset={planOffsetLabel}
|
||||||
className={cx([style.textLikeInput, planOffset === null && style.inactive])}
|
className={cx([style.textLikeInput, planOffset === null && style.inactive])}
|
||||||
tabIndex={-1}
|
disabled
|
||||||
>
|
>
|
||||||
{planOffset !== null && planOffset > 0 ? '+' : ''}
|
{planOffset !== null && planOffset > 0 ? '+' : ''}
|
||||||
{millisToString(planOffset, { fallback: enDash })}
|
{millisToString(planOffset, { fallback: enDash })}
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover:not(.disabled) {
|
||||||
background-color: $gray-1100;
|
background-color: $gray-1100;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-3
@@ -7,12 +7,22 @@ import style from './TextLikeInput.module.scss';
|
|||||||
interface TextLikeInputProps extends HTMLAttributes<HTMLSpanElement> {
|
interface TextLikeInputProps extends HTMLAttributes<HTMLSpanElement> {
|
||||||
offset?: 'over' | 'under' | 'muted' | null;
|
offset?: 'over' | 'under' | 'muted' | null;
|
||||||
muted?: boolean;
|
muted?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TextLikeInput = forwardRef(
|
const TextLikeInput = forwardRef(
|
||||||
({ offset, muted, children, className, ...elementProps }: PropsWithChildren<TextLikeInputProps>, textRef) => {
|
(
|
||||||
|
{ offset, muted, disabled, children, className, ...elementProps }: PropsWithChildren<TextLikeInputProps>,
|
||||||
|
textRef,
|
||||||
|
) => {
|
||||||
const ref = useRef<HTMLDivElement | null>(null);
|
const ref = useRef<HTMLDivElement | null>(null);
|
||||||
const classes = cx([style.textInput, offset && style[offset], muted && style.muted, className]);
|
const classes = cx([
|
||||||
|
style.textInput,
|
||||||
|
offset && style[offset],
|
||||||
|
muted && style.muted,
|
||||||
|
disabled && style.disabled,
|
||||||
|
className,
|
||||||
|
]);
|
||||||
|
|
||||||
useImperativeHandle(textRef, () => {
|
useImperativeHandle(textRef, () => {
|
||||||
return {
|
return {
|
||||||
@@ -23,7 +33,7 @@ const TextLikeInput = forwardRef(
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes} tabIndex={0} {...elementProps} ref={ref}>
|
<div className={classes} tabIndex={disabled ? -1 : 0} {...elementProps} ref={ref}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user