-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { useState } from 'react'; | ||
import { ALLOW_ANALYTICS, ALLOW_ERROR_REPORTING } from '../../utils/analytics'; | ||
import styles from './notifications.module.scss'; | ||
import Button from '../button'; | ||
|
||
export const ClearStorageButton = () => { | ||
const [isClearing, setIsClearing] = useState(false); | ||
|
||
const clearStorage = () => { | ||
setIsClearing(true); | ||
|
||
// Store the current values of the analytics and error reporting settings | ||
const errorReportingValue = window.localStorage.getItem(ALLOW_ERROR_REPORTING); | ||
const analyticsValue = window.localStorage.getItem(ALLOW_ANALYTICS); | ||
|
||
window.localStorage.clear(); | ||
|
||
// Restore the previous values of the analytics and error reporting settings | ||
if (errorReportingValue) { | ||
window.localStorage.setItem(ALLOW_ERROR_REPORTING, errorReportingValue); | ||
} | ||
if (analyticsValue) { | ||
window.localStorage.setItem(ALLOW_ANALYTICS, analyticsValue); | ||
} | ||
|
||
window.location.reload(); | ||
}; | ||
|
||
return ( | ||
<div className={styles.transactionButtonContainer}> | ||
<Button | ||
type="text-gray" | ||
size="xs" | ||
disabled={isClearing} | ||
className={styles.transactionButton} | ||
onClick={clearStorage} | ||
> | ||
<span>{isClearing ? 'Clearing...' : 'Clear Storage'}</span> | ||
</Button> | ||
</div> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
src/components/notifications/storage-full-notification.module.scss
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
src/components/notifications/storage-full-notification.tsx
This file was deleted.
Oops, something went wrong.