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

Merge branch 'hindawi-theme' of https://gitlab.coko.foundation/xpub/xpub-faraday into hindawi-theme

parents 13b25b7a 150ee815
No related branches found
No related tags found
1 merge request!43Sprint #19
...@@ -10,27 +10,27 @@ import { ...@@ -10,27 +10,27 @@ import {
Tag, Tag,
Text, Text,
Row, Row,
// Item, Item,
IconButton, IconButton,
// ActionLink, ActionLink,
AuthorTagList, AuthorTagList,
ReviewerBreakdown, ReviewerBreakdown,
} from './' } from './'
// import { OpenModal } from './modals' import { OpenModal } from './modals'
const ManuscriptCard = ({ const ManuscriptCard = ({
onCardClick,
onDelete, onDelete,
canDelete, canDelete,
onCardClick,
fragment = {}, fragment = {},
manuscriptType = {}, manuscriptType = {},
collection: { visibleStatus = 'Draft', handlingEditor, customId }, collection: { visibleStatus = 'Draft', handlingEditor, customId },
}) => { }) => {
const { const {
authors = [], authors = [],
id: fragmentId,
metadata = {}, metadata = {},
id: fragmentId,
submitted = null, submitted = null,
} = fragment } = fragment
const { title = 'No title', journal = '', type = '' } = metadata const { title = 'No title', journal = '', type = '' } = metadata
...@@ -72,7 +72,7 @@ const ManuscriptCard = ({ ...@@ -72,7 +72,7 @@ const ManuscriptCard = ({
{handlingEditor && ( {handlingEditor && (
<ReviewerBreakdown fragment={fragment} label="Reviewer Reports" /> <ReviewerBreakdown fragment={fragment} label="Reviewer Reports" />
)} )}
{/* {canDelete && ( {canDelete && (
<Item justify="flex-end" onClick={e => e.stopPropagation()}> <Item justify="flex-end" onClick={e => e.stopPropagation()}>
<OpenModal <OpenModal
confirmAction={onDelete} confirmAction={onDelete}
...@@ -87,7 +87,7 @@ const ManuscriptCard = ({ ...@@ -87,7 +87,7 @@ const ManuscriptCard = ({
)} )}
</OpenModal> </OpenModal>
</Item> </Item>
)} */} )}
</Row> </Row>
</MainContainer> </MainContainer>
<SideNavigation> <SideNavigation>
......
...@@ -93,16 +93,16 @@ const collection = { ...@@ -93,16 +93,16 @@ const collection = {
const fragment = { const fragment = {
authors, authors,
created: new Date(), created: Date.now(),
submitted: new Date(), submitted: Date.now(),
metadata: { metadata: {
journal: 'Awesomeness', journal: 'Awesomeness',
title: 'A very ok title with many authors', title: 'A very ok title with many authors',
type: 'Research article', type: 'Research article',
}, },
} };
;<ManuscriptCard <ManuscriptCard
collection={collection} collection={collection}
fragment={fragment} fragment={fragment}
onDelete={() => alert('Deleted')} onDelete={() => alert('Deleted')}
......
...@@ -4,7 +4,7 @@ import { withModal } from 'pubsweet-component-modal/src/components' ...@@ -4,7 +4,7 @@ import { withModal } from 'pubsweet-component-modal/src/components'
import { MultiAction } from './' import { MultiAction } from './'
const OpenModal = ({ onClickEvent, children }) => children(onClickEvent) const OpenModal = ({ showModal, children }) => children(showModal)
export default compose( export default compose(
withModal(() => ({ withModal(() => ({
...@@ -21,11 +21,11 @@ export default compose( ...@@ -21,11 +21,11 @@ export default compose(
}, },
}), }),
withHandlers({ withHandlers({
onClickEvent: ({ showModal: ({
showModal, showModal,
hideModal, hideModal,
setModalError,
handleError, handleError,
setModalError,
confirmAction, confirmAction,
...rest ...rest
}) => e => { }) => e => {
......
...@@ -5,12 +5,30 @@ Open a confirmation modal by clicking on an element ...@@ -5,12 +5,30 @@ Open a confirmation modal by clicking on an element
confirmAction={() => alert('Confirm')} confirmAction={() => alert('Confirm')}
title="Are you sure?" title="Are you sure?"
confirmText="Delete" confirmText="Delete"
modalKey="1" modalKey="123"
> >
{onClickEvent => ( {showModal => (
<ActionLink icon="trash" onClick={onClickEvent}> <ActionLink icon="trash" onClick={showModal}>
Delete Delete
</ActionLink> </ActionLink>
)} )}
</OpenModal> </OpenModal>
``` ```
Pass a custon component as the modal content.
```js
const Custom = () => <div>inside the modal</div>;
<OpenModal
confirmAction={() => alert('Confirm')}
title="Are you sure?"
confirmText="Delete"
content={Custom}
modalKey="123"
>
{showModal => (
<Tag onClick={showModal}>CUSTOM</Tag>
)}
</OpenModal>
```
...@@ -7,7 +7,7 @@ import Modal from './Modal' ...@@ -7,7 +7,7 @@ import Modal from './Modal'
import { showModal, hideModal, setModalError } from '../redux/modal' import { showModal, hideModal, setModalError } from '../redux/modal'
const mapState = state => ({ const mapState = state => ({
modalsVisibility: omit(state.modal, 'props'), modalVisibility: omit(state.modal, ['props', 'error']),
modalProps: state.modal.props, modalProps: state.modal.props,
modalError: state.modal.error, modalError: state.modal.error,
}) })
...@@ -30,12 +30,12 @@ const withModal = mapperFn => BaseComponent => ...@@ -30,12 +30,12 @@ const withModal = mapperFn => BaseComponent =>
modalError, modalError,
isFetching, isFetching,
setModalError, setModalError,
modalsVisibility, modalVisibility,
...rest ...rest
} = baseProps } = baseProps
return ( return (
<React.Fragment> <React.Fragment>
{modalsVisibility[modalKey] && ( {modalVisibility[modalKey] && (
<Modal <Modal
{...modalProps} {...modalProps}
component={Component} component={Component}
......
...@@ -3,24 +3,20 @@ import React, { Component } from 'react' ...@@ -3,24 +3,20 @@ import React, { Component } from 'react'
import { reducer } from 'redux-form' import { reducer } from 'redux-form'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import hindawiTheme from 'hindawi-theme' import hindawiTheme from 'hindawi-theme'
import { createLogger } from 'redux-logger'
import { ThemeProvider } from 'styled-components' import { ThemeProvider } from 'styled-components'
import { createStore, combineReducers } from 'redux' import { client } from 'pubsweet-component-modal'
import { createStore, combineReducers, applyMiddleware } from 'redux'
import withDragDropContext from './withDragDropContext' import withDragDropContext from './withDragDropContext'
const modalReducer = ( const logger = createLogger()
state = {
error: null,
props: {},
},
action,
) => state
const store = createStore( const store = createStore(
combineReducers({ combineReducers({
form: reducer, form: reducer,
modal: modalReducer, modal: client.reducers.modal(),
}), }),
applyMiddleware(logger),
) )
class Wrapper extends Component { class Wrapper extends Component {
......
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