Skip to content
Snippets Groups Projects
Commit c868e915 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

fix(appbar): fix autosave, user dropdown issues

parent 3e816c8b
No related branches found
No related tags found
1 merge request!43Sprint #19
......@@ -19,9 +19,9 @@ const AppBarMenu = ({
expanded,
username,
toggleMenu,
currentUser,
currentUser = {},
}) =>
currentUser ? (
currentUser.user ? (
<Root>
<User onClick={toggleMenu}>
<Text>{username}</Text>
......@@ -93,15 +93,15 @@ const DropdownOption = styled.div`
display: flex;
justify-content: flex-start;
font-family: ${th('fontHeading')};
font-family: ${th('fontReading')};
font-size: ${th('fontSizeBase')};
line-height: ${th('lineHeightBase')};
height: calc(${th('gridUnit')} * 3);
height: calc(${th('gridUnit')} * 4);
padding: ${th('gridUnit')};
&:hover {
background-color: ${th('colorFurniture')};
background-color: ${th('menu.optionBackground')};
}
`
......
......@@ -15,13 +15,9 @@ class AutosaveIndicator extends Component {
this.timer = null
}
componentDidMount() {
this.setTimer()
}
componentWillReceiveProps({ autosave: nextAutosave }) {
const { autosave, toggleVisible } = this.props
if (!isEqual(autosave, nextAutosave)) {
if (autosave && !isEqual(autosave, nextAutosave)) {
toggleVisible()
this.setTimer()
}
......
......@@ -6,6 +6,7 @@ export * from './gridItems'
export { default as ActionLink } from './ActionLink'
export { default as AuthorWithTooltip } from './AuthorWithTooltip'
export { default as Logo } from './Logo'
export { default as AppBar } from './AppBar'
export { default as AppBarMenu } from './AppBarMenu'
export { default as AuthorCard } from './AuthorCard'
......@@ -19,7 +20,6 @@ export { default as FileItem } from './File'
export { default as FileSection } from './FileSection'
export { default as IconButton } from './IconButton'
export { default as Label } from './Label'
export { default as Logo } from './Logo'
export { default as ManuscriptCard } from './ManuscriptCard'
export { default as ReviewerBreakdown } from './ReviewerBreakdown'
export { default as PersonInfo } from './PersonInfo'
......
......@@ -43,7 +43,7 @@ export default (state = initialState, action) => {
case AUTOSAVE_SUCCESS:
return {
...initialState,
lastUpdate: action.receivedAt || action.lastUpdate,
lastUpdate: new Date(),
}
default:
return state
......
......@@ -40,13 +40,13 @@ export default {
margin-top: calc(${th('gridUnit')} / 2);
`,
Options: css`
background: ${th('colorBackground')};
background: ${th('colorBackgroundHue')};
box-shadow: ${th('menu.openerShadow')};
`,
Option: css`
border: none;
color: ${th('colorText')};
font-family: ${th('fontHeading')};
font-family: ${th('fontReading')};
font-size: ${th('fontSizeBase')};
line-height: ${th('lineHeightBase')};
height: calc(${th('gridUnit')} * 4);
......
import React from 'react'
import { get } from 'lodash'
import { connect } from 'react-redux'
import styled from 'styled-components'
import { th } from '@pubsweet/ui-toolkit'
......@@ -13,15 +14,28 @@ import {
AutosaveIndicator,
} from 'pubsweet-component-faraday-ui'
const App = ({ autosave, journal, goTo, children, logout, currentUser }) => (
const App = ({
autosave,
journal = {},
goTo,
children,
logout,
currentUser,
}) => (
<Root className="faraday-root">
<AppBar
autosave={() => <AutosaveIndicator autosave={autosave} delay={4000} />}
autosave={() => (
<AutosaveIndicator
autosave={autosave}
delay={10000}
successText="Progress Saved"
/>
)}
journal={journal}
logo={() => (
<Logo
onClick={() => goTo('/')}
src={journal.metadata.logo}
src={get(journal, 'metadata.logo')}
title="Hindawi"
/>
)}
......
import React from 'react'
import { Logo } from 'pubsweet-components-faraday/src/components'
export default {
issn: '2474-7394',
name: <Logo srcUrl="/assets/hindawi-logo.png" />,
logo: '/assets/hindawi-logo.png',
nameText: 'Faraday Journal',
email: 'faraday@hindawi.com',
......
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