Pull request: merge schedule

Updates #6177

Squashed commit of the following:

commit 2f8e4164d40af338d9e4664d5c9ea0aab7113e26
Author: Ildar Kamalov <ik@adguard.com>
Date:   Fri Sep 8 10:09:32 2023 +0300

    client: merge schedule
This commit is contained in:
Ildar Kamalov
2023-09-08 13:23:00 +03:00
parent acf539b11d
commit 62da8f4974

View File

@@ -72,31 +72,16 @@ export const Modal = ({
const onFormSubmit = (e) => { const onFormSubmit = (e) => {
e.preventDefault(); e.preventDefault();
if (currentDay) { const newSchedule = schedule;
const newSchedule = schedule;
Array.from(days).forEach((day) => { Array.from(days).forEach((day) => {
newSchedule[day] = { newSchedule[day] = {
start: startTime, start: startTime,
end: endTime, end: endTime,
};
});
onSubmit(newSchedule);
} else {
const newSchedule = {
time_zone: timezone,
}; };
});
Array.from(days).forEach((day) => { onSubmit(newSchedule);
newSchedule[day] = {
start: startTime,
end: endTime,
};
});
onSubmit(newSchedule);
}
}; };
return ( return (
@@ -133,7 +118,7 @@ export const Modal = ({
> >
{getShortDayName(t, day)} {getShortDayName(t, day)}
</button> </button>
)) } ))}
</div> </div>
<div className="schedule__time-wrap"> <div className="schedule__time-wrap">