Skip to content

Commit a96940d

Browse files
committed
Implement task completion ...viewing
1 parent 5c3a9a9 commit a96940d

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

components/Jotting/JottingOptionsBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function JottingOptionsBar(props) {
1212
await deleteJotting(props);
1313
Jotting.closeJotting(router);
1414
} catch {
15-
alert("The note was not deleted due to a system error");
15+
alert("The jotting was not deleted due to a system error");
1616
}
1717
};
1818

components/Jotting/noteOptionsBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function NoteOptionsBar(props) {
1212
};
1313

1414
return (
15-
<JottingOptionsBar {...props}>
15+
<JottingOptionsBar jotType="note" {...props}>
1616
<button onClick={handleShareClick}>
1717
<Image height={35} width={55} src="/images/share.png" alt="share icon" title="Share jotting" />
1818
</button>

components/Jotting/task.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,38 @@ import JottingOptionsBar from "./JottingOptionsBar";
55
import SubtaskList from "./subtaskList";
66
import CreateJottingButton from "../CreateJottingButton/createJottingButton";
77
import { useState } from "react";
8+
import StyledCheckbox from "../StyledCheckbox/styledCheckbox";
89

910
export default function Task(task) {
1011
return (
1112
<Jotting jotType="task" {...task}>
12-
<JottingOptionsBar {...task} />
13+
<JottingOptionsBar jotType="task" {...task}>
14+
<div>
15+
<StyledCheckbox
16+
id={task.id}
17+
prefix="task-completion-box-"
18+
completed={task.completed == 1}
19+
/>
20+
</div>
21+
</JottingOptionsBar>
1322
<JottingDetails jotType="task" jottingInfo={task} />
1423
<SubtasksControl task={task} />
1524
</Jotting>
1625
);
1726
}
1827

19-
function SubtasksControl({task}) {
28+
function SubtasksControl({ task }) {
2029
const [subtasks, setSubtasks] = useState(null);
2130
return (
2231
<div className={jotting.subtasksControl}>
2332
<h3 className={jotting.subtaskHeading}>Subtasks</h3>
24-
<SubtaskList id={task.id} subtasksState={[subtasks, setSubtasks]}/>
33+
<SubtaskList id={task.id} subtasksState={[subtasks, setSubtasks]} />
2534
<CreateJottingButton
2635
requestFunc="createSubtask"
2736
jotType="subtask"
28-
jots={subtasks}
29-
setJots={setSubtasks}
30-
requestArg1={task.id}
37+
jots={subtasks}
38+
setJots={setSubtasks}
39+
requestArg1={task.id}
3140
/>
3241
</div>
3342
);

0 commit comments

Comments
 (0)