From bb6890ffa5899e113d18058aa61cbce58dfad802 Mon Sep 17 00:00:00 2001 From: Alex Phillips Date: Thu, 26 May 2022 20:08:31 -0400 Subject: [PATCH] adding new category to a group defaults the selected group, hitting 'enter' on login screen submits a login attempt --- frontend/src/components/CategoryForm.js | 6 +++++- frontend/src/components/Login.js | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/CategoryForm.js b/frontend/src/components/CategoryForm.js index 7441ddb..46df811 100644 --- a/frontend/src/components/CategoryForm.js +++ b/frontend/src/components/CategoryForm.js @@ -18,6 +18,8 @@ export default function NewCategoryDialog(props) { const dispatch = useDispatch() const categoryGroups = useSelector(categoryGroupsSelectors.selectAll) + console.log(props) + /** * State block */ @@ -86,8 +88,10 @@ export default function NewCategoryDialog(props) { return } + const isSelected = group.id === props.categoryGroupId + return ( - + {group.name} ) diff --git a/frontend/src/components/Login.js b/frontend/src/components/Login.js index 1ef9285..f02bb32 100644 --- a/frontend/src/components/Login.js +++ b/frontend/src/components/Login.js @@ -156,6 +156,13 @@ export default function Login() { await initUser() } + const onKeyPress = e => { + switch (e.key) { + case 'Enter': + return handleLogin() + } + } + return (
setAlertDialogOpen(false)} /> @@ -172,6 +179,7 @@ export default function Login() { fullWidth variant="standard" onChange={onEmailChange} + onKeyPress={onKeyPress} />