From cfb4a26999f24290693223625a8edcc753c22018 Mon Sep 17 00:00:00 2001 From: angatupyry Date: Mon, 18 Sep 2023 11:49:32 -0400 Subject: [PATCH] Rename props to be more descriptive Signed-off-by: angatupyry --- .../dashboard/src/components/tasks/task-schedule.tsx | 8 ++++---- packages/react-components/lib/tasks/create-task.tsx | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/dashboard/src/components/tasks/task-schedule.tsx b/packages/dashboard/src/components/tasks/task-schedule.tsx index 0312b57b5..a9efaa804 100644 --- a/packages/dashboard/src/components/tasks/task-schedule.tsx +++ b/packages/dashboard/src/components/tasks/task-schedule.tsx @@ -78,7 +78,7 @@ export const TaskSchedule = () => { const [calendarEvents, setCalendarEvents] = React.useState([]); const [openDeleteScheduleDialog, setOpenDeleteScheduleDialog] = React.useState(false); const [openCreateTaskForm, setOpenCreateTaskForm] = React.useState(false); - const [selectedSchedule, setSelectedSchedule] = React.useState({ + const [scheduleToEdit, setScheduleToEdit] = React.useState({ startOn: new Date(), days: [false, false, false, false, false, false, false], until: undefined, @@ -146,9 +146,9 @@ export const TaskSchedule = () => { throw new Error('No task found'); } setCurrentScheduledTask(task); - setSelectedSchedule(apiScheduleToSchedule(task.schedules)); + setScheduleToEdit(apiScheduleToSchedule(task.schedules)); if (eventScope === EventScopes.CURRENT) { - setSelectedSchedule(scheduleWithSelectedDay(task.schedules, exceptDateRef.current)); + setScheduleToEdit(scheduleWithSelectedDay(task.schedules, exceptDateRef.current)); } AppEvents.refreshTaskApp.next(); scheduler.close(); @@ -288,7 +288,7 @@ export const TaskSchedule = () => { pickupPoints={pickupPoints} dropoffPoints={dropoffPoints} open={openCreateTaskForm} - currentSchedule={selectedSchedule} + scheduleToEdit={scheduleToEdit} requestTask={currentScheduleTask?.task_request} onClose={() => { setOpenCreateTaskForm(false); diff --git a/packages/react-components/lib/tasks/create-task.tsx b/packages/react-components/lib/tasks/create-task.tsx index e6dfddb10..fb17f1790 100644 --- a/packages/react-components/lib/tasks/create-task.tsx +++ b/packages/react-components/lib/tasks/create-task.tsx @@ -672,7 +672,7 @@ export interface CreateTaskFormProps pickupPoints?: Record; dropoffPoints?: Record; favoritesTasks?: TaskFavorite[]; - currentSchedule?: Schedule; + scheduleToEdit?: Schedule; requestTask?: TaskRequest; submitTasks?(tasks: TaskRequest[], schedule: Schedule | null): Promise; tasksFromFile?(): Promise | TaskRequest[]; @@ -693,7 +693,7 @@ export function CreateTaskForm({ pickupPoints = {}, dropoffPoints = {}, favoritesTasks = [], - currentSchedule, + scheduleToEdit, requestTask, submitTasks, tasksFromFile, @@ -734,7 +734,7 @@ export function CreateTaskForm({ const taskRequest = taskRequests[selectedTaskIdx]; const [openSchedulingDialog, setOpenSchedulingDialog] = React.useState(false); const [schedule, setSchedule] = React.useState( - currentSchedule ?? { + scheduleToEdit ?? { startOn: new Date(), days: [true, true, true, true, true, true, true], until: undefined, @@ -742,7 +742,7 @@ export function CreateTaskForm({ ); const [atTime, setAtTime] = React.useState(new Date()); const [scheduleUntilValue, setScheduleUntilValue] = React.useState( - currentSchedule?.until ? ScheduleUntilValue.ON : ScheduleUntilValue.NEVER, + scheduleToEdit?.until ? ScheduleUntilValue.ON : ScheduleUntilValue.NEVER, ); const handleScheduleUntilValue = (event: React.ChangeEvent) => { @@ -1139,13 +1139,13 @@ export function CreateTaskForm({ className={classes.actionBtn} onClick={() => setOpenSchedulingDialog(true)} > - {currentSchedule ? 'Edit schedule' : 'Add to Schedule'} + {scheduleToEdit ? 'Edit schedule' : 'Add to Schedule'}