Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/editors/task-editor/empty-trash.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
Button to empty the trash, thus "permanently" deleting all deleted tasks.
8
*/
9
10
import { React } from "../../app-framework";
11
import { Button, Popconfirm } from "antd";
12
import { TaskActions } from "./actions";
13
14
interface Props {
15
actions?: TaskActions;
16
count: number;
17
}
18
19
export const EmptyTrash: React.FC<Props> = React.memo(({ actions, count }) => {
20
if (actions == null) {
21
return <span />;
22
}
23
24
return (
25
<Popconfirm
26
title="Empty the trash removing all deleted tasks?"
27
onConfirm={() => {
28
actions.stop_showing_deleted();
29
actions.empty_trash();
30
}}
31
>
32
<Button
33
style={{ marginTop: "3px" }}
34
size="small"
35
danger
36
disabled={count === 0}
37
>
38
Empty Trash ({count})
39
</Button>
40
</Popconfirm>
41
);
42
});
43
44