diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index f7840c5bb..7a0aead15 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -2,6 +2,7 @@ import { remote } from 'electron'; | |||
2 | import React, { Component, Fragment } from 'react'; | 2 | import React, { Component, Fragment } from 'react'; |
3 | import PropTypes from 'prop-types'; | 3 | import PropTypes from 'prop-types'; |
4 | import { observer } from 'mobx-react'; | 4 | import { observer } from 'mobx-react'; |
5 | import prettyBytes from 'pretty-bytes'; | ||
5 | import { defineMessages, intlShape } from 'react-intl'; | 6 | import { defineMessages, intlShape } from 'react-intl'; |
6 | 7 | ||
7 | import Form from '../../../lib/Form'; | 8 | import Form from '../../../lib/Form'; |
@@ -165,7 +166,7 @@ export default @observer class EditSettingsForm extends Component { | |||
165 | updateIsReadyToInstall: PropTypes.bool.isRequired, | 166 | updateIsReadyToInstall: PropTypes.bool.isRequired, |
166 | isClearingAllCache: PropTypes.bool.isRequired, | 167 | isClearingAllCache: PropTypes.bool.isRequired, |
167 | onClearAllCache: PropTypes.func.isRequired, | 168 | onClearAllCache: PropTypes.func.isRequired, |
168 | cacheSize: PropTypes.string.isRequired, | 169 | getCacheSize: PropTypes.func.isRequired, |
169 | isSpellcheckerIncludedInCurrentPlan: PropTypes.bool.isRequired, | 170 | isSpellcheckerIncludedInCurrentPlan: PropTypes.bool.isRequired, |
170 | isTodosEnabled: PropTypes.bool.isRequired, | 171 | isTodosEnabled: PropTypes.bool.isRequired, |
171 | isTodosActivated: PropTypes.bool.isRequired, | 172 | isTodosActivated: PropTypes.bool.isRequired, |
@@ -221,7 +222,7 @@ export default @observer class EditSettingsForm extends Component { | |||
221 | updateIsReadyToInstall, | 222 | updateIsReadyToInstall, |
222 | isClearingAllCache, | 223 | isClearingAllCache, |
223 | onClearAllCache, | 224 | onClearAllCache, |
224 | cacheSize, | 225 | getCacheSize, |
225 | isSpellcheckerIncludedInCurrentPlan, | 226 | isSpellcheckerIncludedInCurrentPlan, |
226 | isTodosEnabled, | 227 | isTodosEnabled, |
227 | isWorkspaceEnabled, | 228 | isWorkspaceEnabled, |
@@ -248,7 +249,20 @@ export default @observer class EditSettingsForm extends Component { | |||
248 | lockingFeatureEnabled, | 249 | lockingFeatureEnabled, |
249 | scheduledDNDEnabled, | 250 | scheduledDNDEnabled, |
250 | } = window.ferdi.stores.settings.all.app; | 251 | } = window.ferdi.stores.settings.all.app; |
251 | const notCleared = this.state.clearCacheButtonClicked && isClearingAllCache === false && cacheSize !== 0; | 252 | |
253 | let cacheSize; | ||
254 | let notCleared; | ||
255 | if (this.state.activeSetttingsTab === 'advanced') { | ||
256 | const cacheSizeBytes = getCacheSize(); | ||
257 | if (typeof cacheSizeBytes === 'number') { | ||
258 | cacheSize = prettyBytes(cacheSizeBytes); | ||
259 | notCleared = this.state.clearCacheButtonClicked && isClearingAllCache === false && cacheSizeBytes !== 0; | ||
260 | } else { | ||
261 | cacheSize = '…'; | ||
262 | notCleared = false; | ||
263 | } | ||
264 | } | ||
265 | |||
252 | return ( | 266 | return ( |
253 | <div className="settings__main"> | 267 | <div className="settings__main"> |
254 | <div className="settings__header"> | 268 | <div className="settings__header"> |