/
SettingsPage.tsx
42 lines (33 loc) · 1.11 KB
/
SettingsPage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { RouteComponentProps } from 'react-router'
import { SettingsMenu } from '../components/settings/SettingsMenu'
import { IReactReduxProps } from 'types/redux-thunk'
import LayoutMain from 'components/layout/Main'
import { MenuHeader } from 'components/menu/MenuHeader'
import { t } from 'locale'
import styles from './SettingsPage.css'
interface IProps extends RouteComponentProps<void> {}
interface State {
hide?: boolean
}
type PrivateProps = IProps & IReactReduxProps
class _SettingsPage extends Component<PrivateProps, State> {
state: State = {}
/** Force rerender of all children */
private invalidate = () => {
this.setState({ hide: true }, () => {
this.setState({ hide: false })
})
}
render() {
if (this.state.hide) return null
return (
<LayoutMain className={styles.container}>
<MenuHeader text={t('settings')} />
<SettingsMenu invalidate={this.invalidate} />
</LayoutMain>
)
}
}
export const SettingsPage = connect()(_SettingsPage) as React.ComponentClass<IProps>