diff --git a/src/Settings/index.tsx b/src/Settings/index.tsx index dadace6..af38472 100644 --- a/src/Settings/index.tsx +++ b/src/Settings/index.tsx @@ -2,15 +2,14 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { connect, useSelector } from 'react-redux'; -import { History } from 'history'; +import { useSelector } from 'react-redux'; import Select from '@material-ui/core/Select'; import MenuItem from '@material-ui/core/MenuItem'; import FormControl from '@material-ui/core/FormControl'; import InputLabel from '@material-ui/core/InputLabel'; -import { store, StoreState, SettingsType } from '../store'; +import { store, StoreState } from '../store'; import { setSettings } from '../store/actions'; import Container from '../widgets/Container'; @@ -36,67 +35,37 @@ function SecurityFingerprint() { ); } -interface PropsType { - history: History; -} - -interface PropsTypeInner extends PropsType { - settings: SettingsType; -} - -class Settings extends React.PureComponent { - constructor(props: any) { - super(props); - this.onCancel = this.onCancel.bind(this); - this.handleChange = this.handleChange.bind(this); - } - - public render() { - const { settings } = this.props; - return ( - <> - - -

Security Fingerprint

- -

Date & Time

- - - Locale - - - -
- - ); - } +export default React.memo(function Settings() { + const settings = useSelector((state: StoreState) => state.settings); - public onCancel() { - this.props.history.goBack(); - } - - private handleChange(event: React.ChangeEvent) { + function handleChange(event: React.ChangeEvent) { const name = event.target.name; const value = event.target.value; - const { settings } = this.props; store.dispatch(setSettings({ ...settings, [name]: value })); } -} -const mapStateToProps = (state: StoreState, _props: PropsType) => { - return { - settings: state.settings, - }; -}; - -export default connect( - mapStateToProps -)(Settings); + return ( + <> + + +

Security Fingerprint

+ +

Date & Time

+ + + Locale + + + +
+ + ); +}); diff --git a/src/SyncGate.tsx b/src/SyncGate.tsx index c1dcad9..e58edd6 100644 --- a/src/SyncGate.tsx +++ b/src/SyncGate.tsx @@ -214,10 +214,8 @@ export default withRouter(function SyncGate(props: RouteComponentProps<{}> & Pro ( - + render={() => ( + )} />