blob: 8b6a99eb650d3845c977240e2478b35f41ee7bef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
import { clearCompleted } from '../../../lib/transfers';
import React, { useState } from 'react';
import { toast } from 'react-toastify';
import { Button, Divider, Header, Icon } from 'semantic-ui-react';
const clear = async ({ direction, setState }) => {
setState(true);
await clearCompleted({ direction });
setState(false);
toast.success(`Completed ${direction}s cleared!`);
};
const Data = () => {
const [up, setUp] = useState(false);
const [down, setDown] = useState(false);
return (
<div>
<Header
as="h3"
className="transfer-header"
>
Transfer Data
</Header>
<Divider />
<p>
<span>
The Uploads and Downloads pages can become unresponsive if too many
transfers are displayed. If you're having trouble with either page,
try using the buttons below to remove completed transfers.
</span>
</p>
<Button
loading={up}
onClick={() => clear({ direction: 'upload', setState: setUp })}
primary
>
<Icon name="trash alternate" />
Clear All Completed Uploads
</Button>
<Button
loading={down}
onClick={() => clear({ direction: 'download', setState: setDown })}
primary
>
<Icon name="trash alternate" />
Clear All Completed Downloads
</Button>
</div>
);
};
export default Data;
|