[Glitch] Convert dropdown_menu state to Typescript

Port 4b7bc1f07c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Renaud Chaput
2023-09-22 18:18:46 +02:00
committed by Claire
parent b2d67fbe33
commit 919ed0e469
9 changed files with 69 additions and 41 deletions

View File

@@ -6,9 +6,12 @@ import DropdownMenu from 'flavours/glitch/components/dropdown_menu';
import { isUserTouching } from '../is_mobile';
/**
* @param {import('flavours/glitch/store').RootState} state
*/
const mapStateToProps = state => ({
openDropdownId: state.getIn(['dropdown_menu', 'openId']),
openedViaKeyboard: state.getIn(['dropdown_menu', 'keyboard']),
openDropdownId: state.dropdownMenu.openId,
openedViaKeyboard: state.dropdownMenu.keyboard,
});
const mapDispatchToProps = (dispatch, { status, items, scrollKey }) => ({
@@ -20,7 +23,7 @@ const mapDispatchToProps = (dispatch, { status, items, scrollKey }) => ({
actions: items,
onClick: onItemClick,
},
}) : openDropdownMenu(id, keyboard, scrollKey));
}) : openDropdownMenu({ id, keyboard, scrollKey }));
},
onClose(id) {
@@ -28,7 +31,7 @@ const mapDispatchToProps = (dispatch, { status, items, scrollKey }) => ({
modalType: 'ACTIONS',
ignoreFocus: false,
}));
dispatch(closeDropdownMenu(id));
dispatch(closeDropdownMenu({ id }));
},
});