logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

dropdown_menu_container.js (958B)


  1. import { openDropdownMenu, closeDropdownMenu } from '../actions/dropdown_menu';
  2. import { openModal, closeModal } from '../actions/modal';
  3. import { connect } from 'react-redux';
  4. import DropdownMenu from '../components/dropdown_menu';
  5. import { isUserTouching } from '../is_mobile';
  6. const mapStateToProps = state => ({
  7. isModalOpen: state.get('modal').modalType === 'ACTIONS',
  8. dropdownPlacement: state.getIn(['dropdown_menu', 'placement']),
  9. openDropdownId: state.getIn(['dropdown_menu', 'openId']),
  10. });
  11. const mapDispatchToProps = (dispatch, { status, items }) => ({
  12. onOpen(id, onItemClick, dropdownPlacement) {
  13. dispatch(isUserTouching() ? openModal('ACTIONS', {
  14. status,
  15. actions: items,
  16. onClick: onItemClick,
  17. }) : openDropdownMenu(id, dropdownPlacement));
  18. },
  19. onClose(id) {
  20. dispatch(closeModal());
  21. dispatch(closeDropdownMenu(id));
  22. },
  23. });
  24. export default connect(mapStateToProps, mapDispatchToProps)(DropdownMenu);