diff --git a/packages/component-dashboard/src/components/AssignEditor.js b/packages/component-dashboard/src/components/AssignEditor.js new file mode 100644 index 0000000000000000000000000000000000000000..06c1ec0b383ad91fd0006e4ba10784892576e38f --- /dev/null +++ b/packages/component-dashboard/src/components/AssignEditor.js @@ -0,0 +1,30 @@ +import React from 'react' +import { Menu } from 'xpub-ui' +import { withJournal } from 'pubsweet-component-xpub-app/src/components' + +const editorOption = editor => ({ + value: editor.user, + label: editor.name +}) + +// TODO: select multiple editors + +const AssignEditor = ({ journal, project, team, teamType, addUserToTeam }) => ( + <Menu + value={team ? team.members[0] : null} + label={journal.roles[teamType]} + options={journal.editors[teamType].map(editorOption)} + placeholder="Assign an editor…" + onChange={user => { + addUserToTeam({ + team, + teamType, + name: journal.roles[teamType], + group: 'editor', + project, + user + }) + }}/> +) + +export default withJournal(AssignEditor)