mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-17 20:32:56 +00:00
a36dfbb2aa
Port fd33bcb3b2
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
28 lines
951 B
JavaScript
28 lines
951 B
JavaScript
import { openDropdownMenu, closeDropdownMenu } from 'flavours/glitch/actions/dropdown_menu';
|
|
import { openModal, closeModal } from 'flavours/glitch/actions/modal';
|
|
import { connect } from 'react-redux';
|
|
import DropdownMenu from 'flavours/glitch/components/dropdown_menu';
|
|
import { isUserTouching } from '../is_mobile';
|
|
|
|
const mapStateToProps = state => ({
|
|
openDropdownId: state.getIn(['dropdown_menu', 'openId']),
|
|
openedViaKeyboard: state.getIn(['dropdown_menu', 'keyboard']),
|
|
});
|
|
|
|
const mapDispatchToProps = (dispatch, { status, items, scrollKey }) => ({
|
|
onOpen(id, onItemClick, keyboard) {
|
|
dispatch(isUserTouching() ? openModal('ACTIONS', {
|
|
status,
|
|
actions: items,
|
|
onClick: onItemClick,
|
|
}) : openDropdownMenu(id, keyboard, scrollKey));
|
|
},
|
|
|
|
onClose(id) {
|
|
dispatch(closeModal('ACTIONS'));
|
|
dispatch(closeDropdownMenu(id));
|
|
},
|
|
});
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(DropdownMenu);
|