import React from 'react' import cls from 'classnames' import i18n from 'i18next' import newEventActions from 'actions/newEvent' import newEventStores from 'stores/newEvent' export default class JengaNavMemo extends React.Component { constructor(props) { super(props) this.state = { expanded: newEventStores.showMemo } this.onEventChange = this.onEventChange.bind(this) this.onToggleMemo = this.onToggleMemo.bind(this) } componentDidMount() { this.unsubscribe = newEventStores.listen(this.onEventChange) } componentWillUnmount() { this.unsubscribe() } onEventChange(status) { let obj = {} if (status && status.types) { if (status.types.includes('showMemo')) { if (this.state.expanded !== status.data.showMemo) { obj.expanded = status.data.showMemo } } } if (Object.keys(obj).length > 0) { this.setState(obj) } } onToggleMemo() { newEventActions.toggleMemo({}) } render() { return (