Skip to content
Snippets Groups Projects
Commit 0d1130ef authored by Giannis Kopanas's avatar Giannis Kopanas
Browse files

disable links with pointer-events

parent fb70f079
No related branches found
No related tags found
No related merge requests found
import React from 'react' import React from 'react'
import styled from 'styled-components'
import { compose } from 'recompose' import { compose } from 'recompose'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { withRouter, matchPath } from 'react-router-dom' import { withRouter, matchPath } from 'react-router-dom'
...@@ -13,6 +14,17 @@ const getParams = routerPath => { ...@@ -13,6 +14,17 @@ const getParams = routerPath => {
return matchPath(routerPath, path).params return matchPath(routerPath, path).params
} }
const Root = styled.div`
${({ disableLinks }) =>
disableLinks &&
`
button,
a {
pointer-events: none;
}
`};
`
const App = ({ const App = ({
children, children,
currentUser, currentUser,
...@@ -20,6 +32,7 @@ const App = ({ ...@@ -20,6 +32,7 @@ const App = ({
logoutUser, logoutUser,
history, history,
match, match,
disableLinks,
}) => { }) => {
const { pathname } = history.location const { pathname } = history.location
const showLinks = pathname.match(/submit|manuscript/g) const showLinks = pathname.match(/submit|manuscript/g)
...@@ -50,7 +63,7 @@ const App = ({ ...@@ -50,7 +63,7 @@ const App = ({
} }
return ( return (
<div> <Root disableLinks={disableLinks}>
<AppBar <AppBar
brand={journal.metadata.name} brand={journal.metadata.name}
navLinkComponents={links} navLinkComponents={links}
...@@ -59,7 +72,7 @@ const App = ({ ...@@ -59,7 +72,7 @@ const App = ({
/> />
<div>{children}</div> <div>{children}</div>
</div> </Root>
) )
} }
...@@ -67,6 +80,7 @@ export default compose( ...@@ -67,6 +80,7 @@ export default compose(
connect( connect(
state => ({ state => ({
currentUser: state.currentUser.user, currentUser: state.currentUser.user,
disableLinks: state.conversion.converting,
}), }),
{ logoutUser: actions.logoutUser }, { logoutUser: actions.logoutUser },
), ),
......
...@@ -29,7 +29,9 @@ module.exports = { ...@@ -29,7 +29,9 @@ module.exports = {
path: `${__dirname}/mailer`, path: `${__dirname}/mailer`,
}, },
'pubsweet-server': { 'pubsweet-server': {
db: {}, db: {
port: 5432,
},
port: 3000, port: 3000,
logger, logger,
uploads: 'uploads', uploads: 'uploads',
......
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