aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers
diff options
context:
space:
mode:
authorLibravatar André Oliveira <37463445+SpecialAro@users.noreply.github.com>2023-09-02 16:28:04 +0100
committerLibravatar GitHub <noreply@github.com>2023-09-02 15:28:04 +0000
commitd1c623f4c3d72c859f9ad9cb985be127d6a3eb62 (patch)
treee102da856ae328c70e822d60ac53909acd4627b9 /src/containers
parentDowngrade 'electron' to 25.x (diff)
downloadferdium-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')
-rw-r--r--src/containers/download-manager/DownloadManagerScreen.tsx15
-rw-r--r--src/containers/download-manager/DownloadManagerWindow.tsx46
-rw-r--r--src/containers/layout/AppLayoutContainer.tsx4
-rw-r--r--src/containers/settings/EditSettingsScreen.tsx14
4 files changed, 78 insertions, 1 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 @@
1import { Component, ReactElement } from 'react';
2import ErrorBoundary from '../../components/util/ErrorBoundary';
3import DownloadManager from '../../components/downloadManager/DownloadManagerDashboard';
4
5class DownloadManagerScreen extends Component {
6 render(): ReactElement {
7 return (
8 <ErrorBoundary>
9 <DownloadManager {...this.props} />
10 </ErrorBoundary>
11 );
12 }
13}
14
15export 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 @@
1import { inject, observer } from 'mobx-react';
2import { Component, ReactPortal } from 'react';
3import ReactDOM from 'react-dom';
4import { Outlet } from 'react-router-dom';
5
6import { StoresProps } from '../../@types/ferdium-components.types';
7import Layout from '../../components/downloadManager/DownloadManagerLayout';
8import ErrorBoundary from '../../components/util/ErrorBoundary';
9
10interface IProps {}
11
12@inject('stores', 'actions')
13@observer
14class 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
46export default DownloadManagerContainer;
diff --git a/src/containers/layout/AppLayoutContainer.tsx b/src/containers/layout/AppLayoutContainer.tsx
index e30c0e067..8748f1032 100644
--- a/src/containers/layout/AppLayoutContainer.tsx
+++ b/src/containers/layout/AppLayoutContainer.tsx
@@ -52,7 +52,8 @@ class AppLayoutContainer extends Component<IProps> {
52 const { installUpdate, toggleMuteApp, toggleCollapseMenu } = 52 const { installUpdate, toggleMuteApp, toggleCollapseMenu } =
53 this.props.actions.app; 53 this.props.actions.app;
54 54
55 const { openSettings, closeSettings } = this.props.actions.ui; 55 const { openSettings, closeSettings, openDownloads } =
56 this.props.actions.ui;
56 57
57 const isLoadingFeatures = 58 const isLoadingFeatures =
58 features.featuresRequest.isExecuting && 59 features.featuresRequest.isExecuting &&
@@ -89,6 +90,7 @@ class AppLayoutContainer extends Component<IProps> {
89 isAppMuted={settings.all.app.isAppMuted} 90 isAppMuted={settings.all.app.isAppMuted}
90 isMenuCollapsed={settings.all.app.isMenuCollapsed} 91 isMenuCollapsed={settings.all.app.isMenuCollapsed}
91 openSettings={openSettings} 92 openSettings={openSettings}
93 openDownloads={openDownloads}
92 closeSettings={closeSettings} 94 closeSettings={closeSettings}
93 reorder={reorder} 95 reorder={reorder}
94 reload={reload} 96 reload={reload}
diff --git a/src/containers/settings/EditSettingsScreen.tsx b/src/containers/settings/EditSettingsScreen.tsx
index b9732ead0..8190bef3e 100644
--- a/src/containers/settings/EditSettingsScreen.tsx
+++ b/src/containers/settings/EditSettingsScreen.tsx
@@ -255,6 +255,10 @@ const messages = defineMessages({
255 id: 'settings.app.form.hideSettingsButton', 255 id: 'settings.app.form.hideSettingsButton',
256 defaultMessage: 'Hide Settings button', 256 defaultMessage: 'Hide Settings button',
257 }, 257 },
258 hideDownloadButton: {
259 id: 'settings.app.form.hideDownloadButton',
260 defaultMessage: 'Hide Downloads button',
261 },
258 alwaysShowWorkspaces: { 262 alwaysShowWorkspaces: {
259 id: 'settings.app.form.alwaysShowWorkspaces', 263 id: 'settings.app.form.alwaysShowWorkspaces',
260 defaultMessage: 'Always show workspace drawer', 264 defaultMessage: 'Always show workspace drawer',
@@ -425,6 +429,7 @@ class EditSettingsScreen extends Component<
425 hideWorkspacesButton: Boolean(settingsData.hideWorkspacesButton), 429 hideWorkspacesButton: Boolean(settingsData.hideWorkspacesButton),
426 hideNotificationsButton: Boolean(settingsData.hideNotificationsButton), 430 hideNotificationsButton: Boolean(settingsData.hideNotificationsButton),
427 hideSettingsButton: Boolean(settingsData.hideSettingsButton), 431 hideSettingsButton: Boolean(settingsData.hideSettingsButton),
432 hideDownloadButton: Boolean(settingsData.hideDownloadButton),
428 alwaysShowWorkspaces: Boolean(settingsData.alwaysShowWorkspaces), 433 alwaysShowWorkspaces: Boolean(settingsData.alwaysShowWorkspaces),
429 accentColor: settingsData.accentColor, 434 accentColor: settingsData.accentColor,
430 progressbarAccentColor: settingsData.progressbarAccentColor, 435 progressbarAccentColor: settingsData.progressbarAccentColor,
@@ -1081,6 +1086,15 @@ class EditSettingsScreen extends Component<
1081 default: DEFAULT_APP_SETTINGS.hideSettingsButton, 1086 default: DEFAULT_APP_SETTINGS.hideSettingsButton,
1082 type: 'checkbox', 1087 type: 'checkbox',
1083 }, 1088 },
1089 hideDownloadButton: {
1090 label: intl.formatMessage(messages.hideDownloadButton),
1091 value: ifUndefined<boolean>(
1092 settings.all.app.hideDownloadButton,
1093 DEFAULT_APP_SETTINGS.hideDownloadButton,
1094 ),
1095 default: DEFAULT_APP_SETTINGS.hideDownloadButton,
1096 type: 'checkbox',
1097 },
1084 alwaysShowWorkspaces: { 1098 alwaysShowWorkspaces: {
1085 label: intl.formatMessage(messages.alwaysShowWorkspaces), 1099 label: intl.formatMessage(messages.alwaysShowWorkspaces),
1086 value: ifUndefined<boolean>( 1100 value: ifUndefined<boolean>(