Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/editors/task-editor/done.tsx
1691 views
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
/*
7
Checkbox for toggling done status
8
*/
9
10
import { Checkbox, Tooltip } from "antd";
11
import { TaskActions } from "./actions";
12
13
interface Props {
14
actions?: TaskActions;
15
done: boolean;
16
read_only?: boolean;
17
task_id: string;
18
}
19
20
export function DoneCheckbox({ done, read_only, task_id, actions }: Props) {
21
return (
22
<Tooltip
23
title={done ? "This task is done" : "Mark this task done"}
24
placement="left"
25
>
26
<Checkbox
27
onChange={() => {
28
if (read_only || actions == null) return;
29
if (done) {
30
actions.set_task_not_done(task_id);
31
} else {
32
actions.set_task_done(task_id);
33
}
34
}}
35
checked={done}
36
></Checkbox>
37
</Tooltip>
38
);
39
}
40
41