|
|
@ -125,6 +125,8 @@ export default function TaskList(props: PropsType) {
|
|
|
|
const classes = useStyles();
|
|
|
|
const classes = useStyles();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { onItemClick } = props;
|
|
|
|
|
|
|
|
|
|
|
|
const handleToggleComplete = (task: TaskType, completed: boolean) => {
|
|
|
|
const handleToggleComplete = (task: TaskType, completed: boolean) => {
|
|
|
|
const clonedTask = task.clone();
|
|
|
|
const clonedTask = task.clone();
|
|
|
|
clonedTask.status = completed ? TaskStatusType.Completed : TaskStatusType.NeedsAction;
|
|
|
|
clonedTask.status = completed ? TaskStatusType.Completed : TaskStatusType.NeedsAction;
|
|
|
@ -222,21 +224,23 @@ export default function TaskList(props: PropsType) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const sortedEntries = entries.sort(getSortFunction(sortBy));
|
|
|
|
function taskListItemFromTask(entry: TaskType) {
|
|
|
|
|
|
|
|
|
|
|
|
const itemList = sortedEntries.map((entry) => {
|
|
|
|
|
|
|
|
const uid = entry.uid;
|
|
|
|
const uid = entry.uid;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<TaskListItem
|
|
|
|
<TaskListItem
|
|
|
|
key={uid}
|
|
|
|
key={uid}
|
|
|
|
entry={entry}
|
|
|
|
entry={entry}
|
|
|
|
subEntries={subEntriesMap.get(uid)}
|
|
|
|
nestedItems={subEntriesMap.get(uid)?.map(taskListItemFromTask)}
|
|
|
|
onClick={props.onItemClick}
|
|
|
|
onClick={onItemClick}
|
|
|
|
onToggleComplete={(entry: TaskType, completed: boolean) => handleToggleComplete(entry, completed)}
|
|
|
|
onToggleComplete={handleToggleComplete}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sortedEntries = entries.sort(getSortFunction(sortBy));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const itemList = sortedEntries.map(taskListItemFromTask);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Grid container spacing={4}>
|
|
|
|
<Grid container spacing={4}>
|
|
|
|