diff options
Diffstat (limited to 'src/components/settings/settings/EditSettingsForm.js')
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index 5cd8bdb36..6d86c09ec 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -99,6 +99,10 @@ const messages = defineMessages({ | |||
99 | id: 'settings.app.cacheInfo', | 99 | id: 'settings.app.cacheInfo', |
100 | defaultMessage: '!!!Ferdi cache is currently using {size} of disk space.', | 100 | defaultMessage: '!!!Ferdi cache is currently using {size} of disk space.', |
101 | }, | 101 | }, |
102 | cacheNotCleared: { | ||
103 | id: 'settings.app.cacheNotCleared', | ||
104 | defaultMessage: 'Couldn\'t clear all cache', | ||
105 | }, | ||
102 | buttonClearAllCache: { | 106 | buttonClearAllCache: { |
103 | id: 'settings.app.buttonClearAllCache', | 107 | id: 'settings.app.buttonClearAllCache', |
104 | defaultMessage: '!!!Clear cache', | 108 | defaultMessage: '!!!Clear cache', |
@@ -169,6 +173,14 @@ export default @observer class EditSettingsForm extends Component { | |||
169 | intl: intlShape, | 173 | intl: intlShape, |
170 | }; | 174 | }; |
171 | 175 | ||
176 | state={ | ||
177 | clearCacheButtonClicked: false, | ||
178 | } | ||
179 | |||
180 | onClearCacheClicked=() => { | ||
181 | this.setState({ clearCacheButtonClicked: true }); | ||
182 | } | ||
183 | |||
172 | submit(e) { | 184 | submit(e) { |
173 | e.preventDefault(); | 185 | e.preventDefault(); |
174 | this.props.form.submit({ | 186 | this.props.form.submit({ |
@@ -217,7 +229,7 @@ export default @observer class EditSettingsForm extends Component { | |||
217 | lockingFeatureEnabled, | 229 | lockingFeatureEnabled, |
218 | scheduledDNDEnabled, | 230 | scheduledDNDEnabled, |
219 | } = window.ferdi.stores.settings.all.app; | 231 | } = window.ferdi.stores.settings.all.app; |
220 | 232 | const notCleared = this.state.clearCacheButtonClicked && isClearingAllCache === false && cacheSize !== 0; | |
221 | return ( | 233 | return ( |
222 | <div className="settings__main"> | 234 | <div className="settings__main"> |
223 | <div className="settings__header"> | 235 | <div className="settings__header"> |
@@ -483,11 +495,17 @@ export default @observer class EditSettingsForm extends Component { | |||
483 | size: cacheSize, | 495 | size: cacheSize, |
484 | })} | 496 | })} |
485 | </p> | 497 | </p> |
498 | {notCleared && ( | ||
499 | <p> | ||
500 | {intl.formatMessage(messages.cacheNotCleared) | ||
501 | } | ||
502 | </p> | ||
503 | )} | ||
486 | <p> | 504 | <p> |
487 | <Button | 505 | <Button |
488 | buttonType="secondary" | 506 | buttonType="secondary" |
489 | label={intl.formatMessage(messages.buttonClearAllCache)} | 507 | label={intl.formatMessage(messages.buttonClearAllCache)} |
490 | onClick={onClearAllCache} | 508 | onClick={() => { onClearAllCache(); this.onClearCacheClicked(); }} |
491 | disabled={isClearingAllCache} | 509 | disabled={isClearingAllCache} |
492 | loaded={!isClearingAllCache} | 510 | loaded={!isClearingAllCache} |
493 | /> | 511 | /> |
@@ -542,10 +560,12 @@ export default @observer class EditSettingsForm extends Component { | |||
542 | <span className="mdi mdi-github-face" /> | 560 | <span className="mdi mdi-github-face" /> |
543 | <span> | 561 | <span> |
544 | 562 | ||
563 | |||
545 | Ferdi is based on | 564 | Ferdi is based on |
546 | {' '} | 565 | {' '} |
547 | <a href="https://github.com/meetfranz/franz" target="_blank">Franz</a> | 566 | <a href="https://github.com/meetfranz/franz" target="_blank">Franz</a> |
548 | 567 | ||
568 | |||
549 | , a project published | 569 | , a project published |
550 | under the | 570 | under the |
551 | {' '} | 571 | {' '} |