mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
@@ -64,7 +64,7 @@ const CustomEntitiesDialog = ({
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
if (reason !== 'backdropClick') {
|
||||
onClose();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ const CustomizationDialog = ({
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
if (reason !== 'backdropClick') {
|
||||
onClose();
|
||||
}
|
||||
|
||||
@@ -219,27 +219,33 @@ const Scheduler: FC = () => {
|
||||
<Box>
|
||||
<Typography
|
||||
sx={{ fontSize: 11 }}
|
||||
color={
|
||||
si.flags >= ScheduleFlag.SCHEDULE_TIMER && si.flags !== flag
|
||||
? 'gray'
|
||||
: (si.flags & flag) === flag
|
||||
? 'primary'
|
||||
: 'grey'
|
||||
}
|
||||
color={(si.flags & flag) === flag ? 'primary' : 'grey'}
|
||||
>
|
||||
{flag === ScheduleFlag.SCHEDULE_TIMER
|
||||
? LL.TIMER(0)
|
||||
: flag === ScheduleFlag.SCHEDULE_ONCHANGE
|
||||
? 'On Change'
|
||||
: flag === ScheduleFlag.SCHEDULE_CONDITION
|
||||
? 'Condition'
|
||||
: dow[Math.log(flag) / Math.log(2)]}
|
||||
{dow[Math.log(flag) / Math.log(2)]}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Divider orientation="vertical" flexItem />
|
||||
</>
|
||||
);
|
||||
|
||||
const scheduleType = (si: ScheduleItem) => (
|
||||
<Box>
|
||||
<Typography sx={{ fontSize: 11 }} color="primary">
|
||||
{si.flags === ScheduleFlag.SCHEDULE_IMMEDIATE ? (
|
||||
<>Immediate</>
|
||||
) : si.flags === ScheduleFlag.SCHEDULE_TIMER ? (
|
||||
<>Timer</>
|
||||
) : si.flags === ScheduleFlag.SCHEDULE_CONDITION ? (
|
||||
<>Condition</>
|
||||
) : si.flags === ScheduleFlag.SCHEDULE_ONCHANGE ? (
|
||||
<>On Change</>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
|
||||
useLayoutTitle(LL.SCHEDULER());
|
||||
|
||||
return (
|
||||
@@ -283,9 +289,9 @@ const Scheduler: FC = () => {
|
||||
<Cell stiff>
|
||||
<Stack spacing={0.5} direction="row">
|
||||
<Divider orientation="vertical" flexItem />
|
||||
{si.flags === ScheduleFlag.SCHEDULE_IMMEDIATE ? (
|
||||
<></>
|
||||
) : si.flags < ScheduleFlag.SCHEDULE_TIMER ? (
|
||||
{si.flags > 127 ? (
|
||||
scheduleType(si)
|
||||
) : (
|
||||
<>
|
||||
{dayBox(si, ScheduleFlag.SCHEDULE_MON)}
|
||||
{dayBox(si, ScheduleFlag.SCHEDULE_TUE)}
|
||||
@@ -295,12 +301,6 @@ const Scheduler: FC = () => {
|
||||
{dayBox(si, ScheduleFlag.SCHEDULE_SAT)}
|
||||
{dayBox(si, ScheduleFlag.SCHEDULE_SUN)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{dayBox(si, ScheduleFlag.SCHEDULE_TIMER)}
|
||||
{dayBox(si, ScheduleFlag.SCHEDULE_ONCHANGE)}
|
||||
{dayBox(si, ScheduleFlag.SCHEDULE_CONDITION)}
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
</Cell>
|
||||
|
||||
@@ -144,7 +144,7 @@ const SchedulerDialog = ({
|
||||
</Typography>
|
||||
);
|
||||
|
||||
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
if (reason !== 'backdropClick') {
|
||||
onClose();
|
||||
}
|
||||
@@ -164,6 +164,8 @@ const SchedulerDialog = ({
|
||||
exclusive
|
||||
disabled={!creating}
|
||||
onChange={(_event, flag: ScheduleFlag) => {
|
||||
if (flag !== null) {
|
||||
setFieldErrors(undefined); // clear any validation errors
|
||||
setScheduleType(flag);
|
||||
// wipe the time field when changing the schedule type
|
||||
setEditItem({ ...editItem, time: '' });
|
||||
@@ -178,6 +180,7 @@ const SchedulerDialog = ({
|
||||
? { ...editItem, flags: 0 }
|
||||
: { ...editItem, flags: flag }
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ToggleButton value={ScheduleFlag.SCHEDULE_DAY}>
|
||||
|
||||
@@ -57,7 +57,7 @@ const SensorsAnalogDialog = ({
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
if (reason !== 'backdropClick') {
|
||||
onClose();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ const SensorsTemperatureDialog = ({
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
|
||||
if (reason !== 'backdropClick') {
|
||||
onClose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user