diff options
author | 2023-09-02 16:28:04 +0100 | |
---|---|---|
committer | 2023-09-02 15:28:04 +0000 | |
commit | d1c623f4c3d72c859f9ad9cb985be127d6a3eb62 (patch) | |
tree | e102da856ae328c70e822d60ac53909acd4627b9 /src/containers/download-manager | |
parent | Downgrade 'electron' to 25.x (diff) | |
download | ferdium-app-d1c623f4c3d72c859f9ad9cb985be127d6a3eb62.tar.gz ferdium-app-d1c623f4c3d72c859f9ad9cb985be127d6a3eb62.tar.zst ferdium-app-d1c623f4c3d72c859f9ad9cb985be127d6a3eb62.zip |
feat: Add Download Manager (pause, stop, delete) (#1339)
Diffstat (limited to 'src/containers/download-manager')
-rw-r--r-- | src/containers/download-manager/DownloadManagerScreen.tsx | 15 | ||||
-rw-r--r-- | src/containers/download-manager/DownloadManagerWindow.tsx | 46 |
2 files changed, 61 insertions, 0 deletions
diff --git a/src/containers/download-manager/DownloadManagerScreen.tsx b/src/containers/download-manager/DownloadManagerScreen.tsx new file mode 100644 index 000000000..5d395a180 --- /dev/null +++ b/src/containers/download-manager/DownloadManagerScreen.tsx | |||
@@ -0,0 +1,15 @@ | |||
1 | import { Component, ReactElement } from 'react'; | ||
2 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
3 | import DownloadManager from '../../components/downloadManager/DownloadManagerDashboard'; | ||
4 | |||
5 | class DownloadManagerScreen extends Component { | ||
6 | render(): ReactElement { | ||
7 | return ( | ||
8 | <ErrorBoundary> | ||
9 | <DownloadManager {...this.props} /> | ||
10 | </ErrorBoundary> | ||
11 | ); | ||
12 | } | ||
13 | } | ||
14 | |||
15 | export default DownloadManagerScreen; | ||
diff --git a/src/containers/download-manager/DownloadManagerWindow.tsx b/src/containers/download-manager/DownloadManagerWindow.tsx new file mode 100644 index 000000000..e13e51774 --- /dev/null +++ b/src/containers/download-manager/DownloadManagerWindow.tsx | |||
@@ -0,0 +1,46 @@ | |||
1 | import { inject, observer } from 'mobx-react'; | ||
2 | import { Component, ReactPortal } from 'react'; | ||
3 | import ReactDOM from 'react-dom'; | ||
4 | import { Outlet } from 'react-router-dom'; | ||
5 | |||
6 | import { StoresProps } from '../../@types/ferdium-components.types'; | ||
7 | import Layout from '../../components/downloadManager/DownloadManagerLayout'; | ||
8 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
9 | |||
10 | interface IProps {} | ||
11 | |||
12 | @inject('stores', 'actions') | ||
13 | @observer | ||
14 | class DownloadManagerContainer extends Component<IProps> { | ||
15 | portalRoot: any; | ||
16 | |||
17 | el: HTMLDivElement; | ||
18 | |||
19 | constructor(props: StoresProps) { | ||
20 | super(props); | ||
21 | |||
22 | this.portalRoot = document.querySelector('#portalContainer'); | ||
23 | this.el = document.createElement('div'); | ||
24 | } | ||
25 | |||
26 | componentDidMount(): void { | ||
27 | this.portalRoot.append(this.el); | ||
28 | } | ||
29 | |||
30 | componentWillUnmount(): void { | ||
31 | this.el.remove(); | ||
32 | } | ||
33 | |||
34 | render(): ReactPortal { | ||
35 | return ReactDOM.createPortal( | ||
36 | <ErrorBoundary> | ||
37 | <Layout> | ||
38 | <Outlet /> | ||
39 | </Layout> | ||
40 | </ErrorBoundary>, | ||
41 | this.el, | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | export default DownloadManagerContainer; | ||