Skip to content
Snippets Groups Projects
Commit 3c875264 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

fix(author-submission): fix double clicking on slow networks

parent 77caa7f9
No related branches found
No related tags found
1 merge request!43Sprint #19
...@@ -24,6 +24,7 @@ const AuthorTitle = ({ ...@@ -24,6 +24,7 @@ const AuthorTitle = ({
listIndex, listIndex,
saveChanges, saveChanges,
isSubmitting, isSubmitting,
formSubmitting,
toggleEditMode, toggleEditMode,
isCorresponding, isCorresponding,
}) => ( }) => (
...@@ -46,6 +47,7 @@ const AuthorTitle = ({ ...@@ -46,6 +47,7 @@ const AuthorTitle = ({
top={15} top={15}
/> />
<IconButton <IconButton
disabled={formSubmitting}
icon="check-circle" icon="check-circle"
iconSize={2} iconSize={2}
onClick={saveChanges} onClick={saveChanges}
...@@ -87,10 +89,13 @@ const AuthorEdit = ({ ...@@ -87,10 +89,13 @@ const AuthorEdit = ({
isFetching, isFetching,
handleSubmit, handleSubmit,
toggleEditMode, toggleEditMode,
isSubmitting,
...props
}) => ( }) => (
<AuthorContainer> <AuthorContainer>
<AuthorTitle <AuthorTitle
editMode={editMode} editMode={editMode}
formSubmitting={isSubmitting}
isCorresponding={author.isCorresponding} isCorresponding={author.isCorresponding}
isFetching={isFetching} isFetching={isFetching}
isSubmitting={author.isSubmitting} isSubmitting={author.isSubmitting}
......
...@@ -9,6 +9,7 @@ const IconButton = styled.div` ...@@ -9,6 +9,7 @@ const IconButton = styled.div`
cursor: pointer; cursor: pointer;
display: flex; display: flex;
justify-content: center; justify-content: center;
opacity: ${props => (props.disabled ? 0.7 : 1)};
&:hover { &:hover {
opacity: 0.7; opacity: 0.7;
} }
...@@ -17,8 +18,12 @@ const IconButton = styled.div` ...@@ -17,8 +18,12 @@ const IconButton = styled.div`
${positionHelper}; ${positionHelper};
` `
export default ({ icon, onClick, iconSize = 3, ...props }) => ( export default ({ icon, onClick, iconSize = 3, disabled, ...props }) => (
<IconButton onClick={onClick} {...props}> <IconButton
disabed={disabled}
onClick={!disabled ? onClick : null}
{...props}
>
<Icon size={iconSize} {...props}> <Icon size={iconSize} {...props}>
{icon} {icon}
</Icon> </Icon>
......
...@@ -65,7 +65,7 @@ const WizardAuthors = ({ ...@@ -65,7 +65,7 @@ const WizardAuthors = ({
'https://www.hindawi.com/journals/', 'https://www.hindawi.com/journals/',
)} )}
> >
Journal Author Submission Guidelines Author Submission Guidelines
</ActionLink> </ActionLink>
</Item> </Item>
</Row> </Row>
...@@ -134,7 +134,7 @@ export default compose( ...@@ -134,7 +134,7 @@ export default compose(
editExistingAuthor, editExistingAuthor,
}) => (values, dispatch, { toggleEditMode }) => { }) => (values, dispatch, { toggleEditMode }) => {
if (values.id === 'newAuthor') { if (values.id === 'newAuthor') {
addAuthor( return addAuthor(
{ {
...omit(values, 'id'), ...omit(values, 'id'),
isSubmitting: authors.length === 1, isSubmitting: authors.length === 1,
...@@ -142,10 +142,9 @@ export default compose( ...@@ -142,10 +142,9 @@ export default compose(
project.id, project.id,
version.id, version.id,
).then(saveNewAuthor) ).then(saveNewAuthor)
} else {
editExistingAuthor(values)
setTimeout(toggleEditMode, 10)
} }
editExistingAuthor(values)
setTimeout(toggleEditMode, 10)
}, },
}), }),
)(WizardAuthors) )(WizardAuthors)
......
...@@ -46,7 +46,7 @@ module.exports = { ...@@ -46,7 +46,7 @@ module.exports = {
API_ENDPOINT: '/api', API_ENDPOINT: '/api',
baseUrl: process.env.CLIENT_BASE_URL || 'http://localhost:3000', baseUrl: process.env.CLIENT_BASE_URL || 'http://localhost:3000',
'login-redirect': '/', 'login-redirect': '/',
'redux-log': process.env.NODE_ENV !== 'production', 'redux-log': false, // process.env.NODE_ENV !== 'production',
theme: process.env.PUBSWEET_THEME, theme: process.env.PUBSWEET_THEME,
}, },
orcid: { orcid: {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment