diff options
author | 2021-10-14 18:20:26 +0200 | |
---|---|---|
committer | 2021-10-14 18:20:26 +0200 | |
commit | c27972c12b2d0dba2aee9e3dcffadcf7806a9afd (patch) | |
tree | 46fcfe261ae55e6faab604e9c75f94f6ffe326ee /src/components/layout/AppLayout.js | |
parent | chore: upgrade 'electron-builder' to '22.14.5' to fix upstream issues. (#2068) (diff) | |
download | ferdium-app-c27972c12b2d0dba2aee9e3dcffadcf7806a9afd.tar.gz ferdium-app-c27972c12b2d0dba2aee9e3dcffadcf7806a9afd.tar.zst ferdium-app-c27972c12b2d0dba2aee9e3dcffadcf7806a9afd.zip |
chore: remove all code related to news (#2069)
Diffstat (limited to 'src/components/layout/AppLayout.js')
-rw-r--r-- | src/components/layout/AppLayout.js | 59 |
1 files changed, 17 insertions, 42 deletions
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index 9c1dbf139..4bacc547b 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer, PropTypes as MobxPropTypes } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import { defineMessages, injectIntl } from 'react-intl'; | 4 | import { defineMessages, injectIntl } from 'react-intl'; |
5 | import { TitleBar } from 'electron-react-titlebar/renderer'; | 5 | import { TitleBar } from 'electron-react-titlebar/renderer'; |
6 | import injectSheet from 'react-jss'; | 6 | import injectSheet from 'react-jss'; |
@@ -20,10 +20,6 @@ import { workspaceStore } from '../../features/workspaces'; | |||
20 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; | 20 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; |
21 | import Todos from '../../features/todos/containers/TodosScreen'; | 21 | import Todos from '../../features/todos/containers/TodosScreen'; |
22 | 22 | ||
23 | function createMarkup(HTMLString) { | ||
24 | return { __html: HTMLString }; | ||
25 | } | ||
26 | |||
27 | const messages = defineMessages({ | 23 | const messages = defineMessages({ |
28 | servicesUpdated: { | 24 | servicesUpdated: { |
29 | id: 'infobar.servicesUpdated', | 25 | id: 'infobar.servicesUpdated', |
@@ -73,11 +69,9 @@ class AppLayout extends Component { | |||
73 | workspacesDrawer: PropTypes.element.isRequired, | 69 | workspacesDrawer: PropTypes.element.isRequired, |
74 | services: PropTypes.element.isRequired, | 70 | services: PropTypes.element.isRequired, |
75 | children: PropTypes.element, | 71 | children: PropTypes.element, |
76 | news: MobxPropTypes.arrayOrObservableArray.isRequired, | ||
77 | showServicesUpdatedInfoBar: PropTypes.bool.isRequired, | 72 | showServicesUpdatedInfoBar: PropTypes.bool.isRequired, |
78 | appUpdateIsDownloaded: PropTypes.bool.isRequired, | 73 | appUpdateIsDownloaded: PropTypes.bool.isRequired, |
79 | authRequestFailed: PropTypes.bool.isRequired, | 74 | authRequestFailed: PropTypes.bool.isRequired, |
80 | removeNewsItem: PropTypes.func.isRequired, | ||
81 | reloadServicesAfterUpdate: PropTypes.func.isRequired, | 75 | reloadServicesAfterUpdate: PropTypes.func.isRequired, |
82 | installAppUpdate: PropTypes.func.isRequired, | 76 | installAppUpdate: PropTypes.func.isRequired, |
83 | showRequiredRequestsError: PropTypes.bool.isRequired, | 77 | showRequiredRequestsError: PropTypes.bool.isRequired, |
@@ -103,11 +97,9 @@ class AppLayout extends Component { | |||
103 | sidebar, | 97 | sidebar, |
104 | services, | 98 | services, |
105 | children, | 99 | children, |
106 | news, | ||
107 | showServicesUpdatedInfoBar, | 100 | showServicesUpdatedInfoBar, |
108 | appUpdateIsDownloaded, | 101 | appUpdateIsDownloaded, |
109 | authRequestFailed, | 102 | authRequestFailed, |
110 | removeNewsItem, | ||
111 | reloadServicesAfterUpdate, | 103 | reloadServicesAfterUpdate, |
112 | installAppUpdate, | 104 | installAppUpdate, |
113 | showRequiredRequestsError, | 105 | showRequiredRequestsError, |
@@ -132,26 +124,6 @@ class AppLayout extends Component { | |||
132 | {sidebar} | 124 | {sidebar} |
133 | <div className="app__service"> | 125 | <div className="app__service"> |
134 | <WorkspaceSwitchingIndicator /> | 126 | <WorkspaceSwitchingIndicator /> |
135 | {news.length > 0 && | ||
136 | news.map(item => ( | ||
137 | <InfoBar | ||
138 | key={item.id} | ||
139 | position="top" | ||
140 | type={item.type} | ||
141 | sticky={item.sticky} | ||
142 | onHide={() => removeNewsItem({ newsId: item.id })} | ||
143 | > | ||
144 | <span | ||
145 | dangerouslySetInnerHTML={createMarkup(item.message)} | ||
146 | onClick={event => { | ||
147 | const { target } = event; | ||
148 | if (target && target.hasAttribute('data-is-news-cta')) { | ||
149 | removeNewsItem({ newsId: item.id }); | ||
150 | } | ||
151 | }} | ||
152 | /> | ||
153 | </InfoBar> | ||
154 | ))} | ||
155 | {!areRequiredRequestsSuccessful && showRequiredRequestsError && ( | 127 | {!areRequiredRequestsSuccessful && showRequiredRequestsError && ( |
156 | <InfoBar | 128 | <InfoBar |
157 | type="danger" | 129 | type="danger" |
@@ -176,19 +148,22 @@ class AppLayout extends Component { | |||
176 | {intl.formatMessage(messages.authRequestFailed)} | 148 | {intl.formatMessage(messages.authRequestFailed)} |
177 | </InfoBar> | 149 | </InfoBar> |
178 | )} | 150 | )} |
179 | {showServicesUpdatedInfoBar && this.state.shouldShowServicesUpdatedInfoBar && ( | 151 | {showServicesUpdatedInfoBar && |
180 | <InfoBar | 152 | this.state.shouldShowServicesUpdatedInfoBar && ( |
181 | type="primary" | 153 | <InfoBar |
182 | ctaLabel={intl.formatMessage(messages.buttonReloadServices)} | 154 | type="primary" |
183 | onClick={reloadServicesAfterUpdate} | 155 | ctaLabel={intl.formatMessage(messages.buttonReloadServices)} |
184 | onHide={() => { | 156 | onClick={reloadServicesAfterUpdate} |
185 | this.setState({ shouldShowServicesUpdatedInfoBar: false }); | 157 | onHide={() => { |
186 | }} | 158 | this.setState({ |
187 | > | 159 | shouldShowServicesUpdatedInfoBar: false, |
188 | <span className="mdi mdi-power-plug" /> | 160 | }); |
189 | {intl.formatMessage(messages.servicesUpdated)} | 161 | }} |
190 | </InfoBar> | 162 | > |
191 | )} | 163 | <span className="mdi mdi-power-plug" /> |
164 | {intl.formatMessage(messages.servicesUpdated)} | ||
165 | </InfoBar> | ||
166 | )} | ||
192 | {appUpdateIsDownloaded && this.state.shouldShowAppUpdateInfoBar && ( | 167 | {appUpdateIsDownloaded && this.state.shouldShowAppUpdateInfoBar && ( |
193 | <AppUpdateInfoBar | 168 | <AppUpdateInfoBar |
194 | onInstallUpdate={installAppUpdate} | 169 | onInstallUpdate={installAppUpdate} |