mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
disable clear data button when clicked once
This commit is contained in:
parent
2a8d7ab0cb
commit
55effdecb4
2 changed files with 7 additions and 1 deletions
|
|
@ -7,11 +7,13 @@ const { Button, Image } = require('stremio/common');
|
|||
const styles = require('./styles');
|
||||
|
||||
const ErrorDialog = ({ className }) => {
|
||||
const [dataCleared, setDataCleared] = React.useState(false);
|
||||
const reload = React.useCallback(() => {
|
||||
window.location.reload();
|
||||
}, []);
|
||||
const clearData = React.useCallback(() => {
|
||||
window.localStorage.clear();
|
||||
setDataCleared(true);
|
||||
}, []);
|
||||
return (
|
||||
<div className={classnames(className, styles['error-container'])}>
|
||||
|
|
@ -25,7 +27,7 @@ const ErrorDialog = ({ className }) => {
|
|||
<Button className={styles['button-container']} title={'Try again'} onClick={reload}>
|
||||
<div className={styles['label']}>Try again</div>
|
||||
</Button>
|
||||
<Button className={styles['button-container']} title={'Clear data'} onClick={clearData}>
|
||||
<Button className={styles['button-container']} disabled={dataCleared} title={'Clear data'} onClick={clearData}>
|
||||
<div className={styles['label']}>Clear data</div>
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@
|
|||
background-color: @color-accent3-light1;
|
||||
}
|
||||
|
||||
&:global(.disabled) {
|
||||
background-color: @color-surface-dark5;
|
||||
}
|
||||
|
||||
.label {
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue