Commit baaa770c authored by Audrey Hamelers's avatar Audrey Hamelers

notification system in config, auto holiday notification

parent ed4f34ca
Pipeline #13414 failed with stages
in 26 seconds
import React from 'react'
import { Icon } from '@pubsweet/ui'
import { lighten } from '@pubsweet/ui-toolkit'
import styled from 'styled-components'
import { notification } from 'config'
import moment from 'moment'
import { Notification } from './ui'
const Christmas = styled(Notification)`
background-color: ${lighten('colorWarning', 70)};
div {
display: flex;
align-items: flex-start;
.text {
margin-left: 8px;
}
}
`
const start = moment(notification.holiday.start).format('dddd, D MMMM')
const end = moment(notification.holiday.end).format('dddd, D MMMM')
const Holiday = props => (
<Christmas>
<Icon color="green" size={2.5}>
gift
</Icon>
<Icon color="#a80202" size={2.5}>
gift
</Icon>
<span className="text">
Please note that the Helpdesk will be unavailable from {start} to {end}.
Any calls or e-mails will be saved and responded to on our return. Happy
Holidays from the Europe PMC team.{' '}
</span>
</Christmas>
)
export default Holiday
import React from 'react'
import { Field } from 'formik'
import { isEmpty } from 'lodash'
import {
ErrorText,
H1,
Link,
Button,
TextField,
Checkbox,
Icon,
} from '@pubsweet/ui'
import { th, lighten } from '@pubsweet/ui-toolkit'
import moment from 'moment'
import { ErrorText, H1, Link, Button, TextField, Checkbox } from '@pubsweet/ui'
import { th } from '@pubsweet/ui-toolkit'
import styled from 'styled-components'
import { notification } from 'config'
import { Page, Notification } from '../ui'
import SignInFooter from '../SignInFooter'
import Holiday from '../Holiday'
const Signup = styled.p`
margin-bottom: 0;
......@@ -31,19 +26,6 @@ const PasswordField = styled.div`
position: relative;
max-width: 500px;
`
const Christmas = styled(Notification)`
background-color: ${lighten('colorWarning', 70)};
div {
display: flex;
align-items: flex-start;
.text {
margin-left: 8px;
}
}
`
const Container = styled.form`
margin: 0 0;
max-width: 350px;
......@@ -80,24 +62,17 @@ class Login extends React.Component {
passwordReset = true,
location,
} = this.props
const { holiday } = notification
return (
<Page>
<H1>Sign in with your Europe PMC plus account</H1>
{notification.show && (
<Notification type={notification.type}>
{notification.message}
</Notification>
)}
{holiday.show && moment().isBefore(holiday.end) && <Holiday />}
{!isEmpty(errors) && <Notification type="error">{errors}</Notification>}
<Christmas>
<Icon color="green" size={2.5}>
gift
</Icon>
<Icon color="#a80202" size={2.5}>
gift
</Icon>
<span className="text">
Please note that the Helpdesk will be unavailable from Wednesday, 25
December to Tuesday 2 January. Any calls or e-mails will be saved
and responded to on our return. Happy Holidays from the Europe PMC
team.{' '}
</span>
</Christmas>
<Container onSubmit={handleSubmit}>
<Field component={EmailInput} name="email" />
<PasswordField>
......
......@@ -212,6 +212,7 @@ module.exports = {
'file',
'pageSize',
'states',
'notification',
],
// do we need this elife variable?
elife: {
......@@ -234,6 +235,17 @@ module.exports = {
},
},
states,
notification: {
show: false,
type: 'info',
message:
'The Europe PMC plus website has recently been upgraded. Please use the email address associated with your account to log in.',
holiday: {
show: true,
start: '2019-12-25T00:00:00Z',
end: '2020-01-02T00:00:00Z',
},
},
user: {
identity: {
default: 'local',
......
Markdown is supported
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