diff --git a/packages/components-faraday/src/components/AuthorList/AuthorAdder.js b/packages/components-faraday/src/components/AuthorList/AuthorAdder.js index a3380004f8142fa5c4498b6a82ee3c1468075db2..19a4bda77c1d338841d03d25b35d84f653accf27 100644 --- a/packages/components-faraday/src/components/AuthorList/AuthorAdder.js +++ b/packages/components-faraday/src/components/AuthorList/AuthorAdder.js @@ -7,18 +7,12 @@ import { reduxForm } from 'redux-form' import { compose, withProps } from 'recompose' import { selectCurrentUser } from 'xpub-selectors' +import countries from './countries' import { Spinner } from '../UIComponents/' import classes from './AuthorList.local.scss' import { getAuthorFetching } from '../../redux/authors' import { MenuItem, ValidatedTextField } from './FormItems' -const countries = [ - { label: 'Romania', value: 'ro' }, - { label: 'United Kingdom', value: 'uk' }, - { label: 'Germany', value: 'de' }, - { label: 'France', value: 'fr' }, -] - const emailRegex = new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/) const emailValidator = value => diff --git a/packages/components-faraday/src/components/AuthorList/AuthorEditor.js b/packages/components-faraday/src/components/AuthorList/AuthorEditor.js index 10f4f5a81c2915fc8ff19986f2b87a21f1d3e88b..72ea87fc3315b0bf4035f4603368727b68b51a1d 100644 --- a/packages/components-faraday/src/components/AuthorList/AuthorEditor.js +++ b/packages/components-faraday/src/components/AuthorList/AuthorEditor.js @@ -5,19 +5,13 @@ import { Button } from '@pubsweet/ui' import { connect } from 'react-redux' import { reduxForm } from 'redux-form' +import countries from './countries' import { Spinner } from '../UIComponents' import { getAuthorFetching } from '../../redux/authors' import { ValidatedTextField, MenuItem } from './FormItems' import classes from './AuthorList.local.scss' -const countries = [ - { label: 'Romania', value: 'ro' }, - { label: 'United Kingdom', value: 'uk' }, - { label: 'Germany', value: 'de' }, - { label: 'France', value: 'fr' }, -] - const emailRegex = new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/) const emailValidator = value => diff --git a/packages/components-faraday/src/components/AuthorList/AuthorList.js b/packages/components-faraday/src/components/AuthorList/AuthorList.js index 06f4f7bb27e3fb4350c902059019f360770690db..222366bc686aa1b6c023b0f691321f3d421de752 100644 --- a/packages/components-faraday/src/components/AuthorList/AuthorList.js +++ b/packages/components-faraday/src/components/AuthorList/AuthorList.js @@ -1,6 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' +import { get } from 'lodash' import { withRouter } from 'react-router-dom' import { compose, @@ -15,18 +16,12 @@ import { SortableList } from 'pubsweet-components-faraday/src/components' import { addAuthor } from '../../redux/authors' import Author from './Author' +import countries from './countries' import StaticList from './StaticList' import AuthorAdder from './AuthorAdder' import AuthorEditor from './AuthorEditor' import { DragHandle } from './FormItems' -const countries = [ - { label: 'Romania', value: 'ro' }, - { label: 'United Kingdom', value: 'uk' }, - { label: 'Germany', value: 'de' }, - { label: 'France', value: 'fr' }, -] - const Authors = ({ authors, moveAuthor, @@ -111,7 +106,7 @@ export default compose( setFormAuthors(authors) }, countryParser: () => countryCode => - countries.find(c => c.value === countryCode).label, + get(countries.find(c => c.value === countryCode), 'label'), parseAuthorType: () => (isSubmitting, isCorresponding, index) => { if (isSubmitting) return `#${index + 1} Submitting author` if (isCorresponding) return `#${index + 1} Corresponding author` diff --git a/packages/components-faraday/src/components/AuthorList/FormItems.js b/packages/components-faraday/src/components/AuthorList/FormItems.js index a51969f622641759fe00a81fc21479e52a47be81..96b8a93c4cb4ff0f6b68e0e6ddc19df02d26500b 100644 --- a/packages/components-faraday/src/components/AuthorList/FormItems.js +++ b/packages/components-faraday/src/components/AuthorList/FormItems.js @@ -21,7 +21,7 @@ export const ValidatedTextField = ({ } export const MenuItem = ({ label, name, options }) => ( - <div className={classnames(classes['validated-text'])}> + <div className={classnames(classes['validated-text'], classes['fix-height'])}> <span className={classnames(classes.label)}>{label}</span> <ValidatedField component={input => <Menu {...input} options={options} />} diff --git a/packages/components-faraday/src/components/AuthorList/FormItems.local.scss b/packages/components-faraday/src/components/AuthorList/FormItems.local.scss index 2ffbe88971b4e4a576693d4187701f548244254c..1a2e5c0fece6c01f212a10b11d0039241e8f6a08 100644 --- a/packages/components-faraday/src/components/AuthorList/FormItems.local.scss +++ b/packages/components-faraday/src/components/AuthorList/FormItems.local.scss @@ -21,6 +21,13 @@ } } +.fix-height { + div[class^='Menu-local_options-'] { + height: 250px; + overflow-y: scroll; + } +} + .drag-handle { align-items: center; border-right: 1px solid #444; diff --git a/packages/components-faraday/src/components/Dashboard/DashboardFilters.js b/packages/components-faraday/src/components/Dashboard/DashboardFilters.js index 898778b14ed4066ef604323bb89754cf08e493eb..78241263936811ee2b9ce54aa7faddf3607314e3 100644 --- a/packages/components-faraday/src/components/Dashboard/DashboardFilters.js +++ b/packages/components-faraday/src/components/Dashboard/DashboardFilters.js @@ -6,18 +6,6 @@ import { compose, withHandlers } from 'recompose' import classes from './Dashboard.local.scss' import { changeFilter, changeSort } from './redux/filters' -const statusFilterOptions = [ - { label: 'All', value: 'all' }, - { label: 'Submitted', value: 'submitted' }, - { label: 'Draft', value: 'draft' }, -] - -const ownerFilterOptions = [ - { label: 'Everyone', value: 'all' }, - { label: 'My work', value: 'me' }, - { label: `Other's work`, value: 'other' }, -] - const sortOptions = [ { label: 'Newest first', value: 'newest' }, { label: 'Oldest first', value: 'oldest' },