Fixes #27
This commit is contained in:
1 parent
c26b6d1409
commit
12c66c74e2
3 files changed
+32
-17
No files matched your search
@@ -9,6 +9,18 @@ const initState = {
|
||||
}
|
||||
|
||||
const rootReducer = (state = initState, action) => {
|
||||
if (action.type === 'HIDE_FOOTER') {
|
||||
let newState = JSON.parse(JSON.stringify(state))
|
||||
newState.context.masterApp.footer.visible = false
|
||||
return newState
|
||||
}
|
||||
|
||||
if (action.type === 'SHOW_FOOTER') {
|
||||
let newState = JSON.parse(JSON.stringify(state))
|
||||
newState.context.masterApp.footer.visible = true
|
||||
return newState
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types'
|
||||
import CssBaseline from '@material-ui/core/CssBaseline'
|
||||
import Typography from '@material-ui/core/Typography'
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import { connect } from 'react-redux'
|
||||
|
||||
const styles = theme => ({
|
||||
'@global': {
|
||||
@@ -30,16 +31,14 @@ class Charts extends Component {
|
||||
window.canvasApp.visible = true
|
||||
let body = document.getElementById('body')
|
||||
body.style = 'margin: 0px; padding: 0px; border: 0px; overflow:hidden;'
|
||||
window.SHOW_FOOTER = false
|
||||
console.log('HIDDING FOOTER')
|
||||
this.props.hideFooter()
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
window.canvasApp.visible = false
|
||||
let body = document.getElementById('body')
|
||||
body.style = ''
|
||||
window.SHOW_FOOTER = true
|
||||
console.log('SHOWING FOOTER')
|
||||
this.props.showFooter()
|
||||
}
|
||||
|
||||
render () {
|
||||
@@ -54,4 +53,17 @@ Charts.propTypes = {
|
||||
classes: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
export default withStyles(styles)(Charts)
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
context: state.context
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
hideFooter: () => { dispatch({type: 'HIDE_FOOTER'}) },
|
||||
showFooter: () => { dispatch({type: 'SHOW_FOOTER'}) }
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(Charts))
|
||||
@@ -41,20 +41,11 @@ const styles = theme => ({
|
||||
|
||||
class Footer extends Component {
|
||||
|
||||
componentDidMount () {
|
||||
console.log('componentDidMount')
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
console.log('componentWillUnmount')
|
||||
}
|
||||
|
||||
render () {
|
||||
let { classes } = this.props
|
||||
console.log('SHOW_FOOTER', window.SHOW_FOOTER)
|
||||
console.log('FOOTER PROPRS', this.props)
|
||||
const { masterApp } = this.props.context.masterApp
|
||||
if (window.SHOW_FOOTER === false) {
|
||||
|
||||
const masterApp = this.props.context.masterApp
|
||||
if (masterApp.footer.visible === false) {
|
||||
return (<div />)
|
||||
} else {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user