Add base support for editing an existing task

This commit is contained in:
Dane Everitt 2020-03-18 22:28:32 -07:00
parent edb9657e2b
commit ef38a51d6d
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 266 additions and 27 deletions

View file

@ -75,19 +75,17 @@ export default ({ match, location: { state } }: RouteComponentProps<Params, {},
schedule.tasks
.sort((a, b) => a.sequenceId - b.sequenceId)
.map(task => (
<div
<ScheduleTaskRow
key={task.id}
className={'bg-neutral-700 border border-neutral-600 mb-2 px-6 py-4 rounded'}
>
<ScheduleTaskRow
task={task}
schedule={schedule.id}
onTaskRemoved={() => setSchedule(s => ({
...s!,
tasks: s!.tasks.filter(t => t.id !== task.id),
}))}
/>
</div>
task={task}
schedule={schedule.id}
onTaskUpdated={task => setSchedule(s => ({
...s!, tasks: s!.tasks.map(t => t.id === task.id ? task : t),
}))}
onTaskRemoved={() => setSchedule(s => ({
...s!, tasks: s!.tasks.filter(t => t.id !== task.id),
}))}
/>
))
}
{schedule.tasks.length > 1 &&