import { connect } from 'react-redux'; import cn from 'classnames'; import withToggle from 'HOCs/withToggle'; import { IconButton, SlideModal, NoContent } from 'UI'; import { updateAppearance } from 'Duck/user'; import { WIDGET_LIST } from 'Types/dashboard'; import stl from './addWidgets.css'; import OutsideClickDetectingDiv from 'Shared/OutsideClickDetectingDiv'; @connect(state => ({ appearance: state.getIn([ 'user', 'account', 'appearance' ]), }), { updateAppearance, }) @withToggle() export default class AddWidgets extends React.PureComponent { makeAddHandler = widgetKey => () => { const { appearance } = this.props; const newAppearance = appearance.setIn([ 'dashboard', widgetKey ], true); this.props.switchOpen(false); this.props.updateAppearance(newAppearance) } render() { const { appearance, disabled } = this.props; const avaliableWidgets = WIDGET_LIST.filter(({ key, type }) => !appearance.dashboard[ key ] && type === this.props.type ); return (
this.props.switchOpen(false)}> {this.props.open &&
{avaliableWidgets.map(w => (
{w.name}
))}
}
{ avaliableWidgets.map(({ key, name, description, thumb }) => (

{ name }

))} } onClose={ this.props.switchOpen } />
); } }