Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add local storage clear button to give user more control and transparency #2220

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ This application can be run as either a web application or a [standalone desktop

This project runs on Node 20. To ensure you're on the proper version, we recommend [nvm](https://github.com/nvm-sh/nvm#installing-and-updating).

With `nvm` installed, you may select a version 16 node using:
With `nvm` installed, you may select a version 20 node using:

```sh
nvm install 20
Expand Down
18 changes: 18 additions & 0 deletions src/components/ClearLocalStorage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Button, ButtonProps } from '@material-ui/core'
import { PropsWithChildren, ReactElement } from 'react'

const ClearLocalStorage = (
props: PropsWithChildren<ButtonProps>
): ReactElement => {
const { children, ...rest } = props

const onClick = () => localStorage.clear()

return (
<Button {...rest} onClick={onClick}>
{children}
</Button>
)
}

export default ClearLocalStorage
5 changes: 5 additions & 0 deletions src/components/UserSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useDispatch } from 'react-redux'
import { fsRecover } from 'ustaxes/redux/fs/Actions'
import { LoadRaw } from 'ustaxes/redux/fs/Load'
import SaveToFile from './SaveToFile'
import ClearLocalStorage from './ClearLocalStorage'

const UserSettings = (): ReactElement => {
const dispatch = useDispatch()
Expand Down Expand Up @@ -36,6 +37,10 @@ const UserSettings = (): ReactElement => {
>
Load
</LoadRaw>
<h3>Delete data</h3>
<ClearLocalStorage variant="contained" color="primary">
Clear Local Storage
</ClearLocalStorage>
</>
)
}
Expand Down
Loading