diff --git a/js/components/ascribe_modal/modal_wrapper.js b/js/components/ascribe_modal/modal_wrapper.js index 53f1c90b..f99c1a80 100644 --- a/js/components/ascribe_modal/modal_wrapper.js +++ b/js/components/ascribe_modal/modal_wrapper.js @@ -1,6 +1,7 @@ 'use strict'; import React from 'react'; +import classNames from 'classnames'; import Modal from 'react-bootstrap/lib/Modal'; @@ -16,6 +17,7 @@ let ModalWrapper = React.createClass({ React.PropTypes.string ]).isRequired, + bodyClassNames: React.PropTypes.string, handleCancel: React.PropTypes.func, handleSuccess: React.PropTypes.func, trigger: React.PropTypes.element @@ -70,7 +72,7 @@ let ModalWrapper = React.createClass({ }, render() { - const { trigger, title } = this.props; + const { bodyClassNames, trigger, title } = this.props; // If the trigger component exists, we add the ModalWrapper's show() to its onClick method. // The trigger component should, in most cases, be a button. @@ -88,13 +90,15 @@ let ModalWrapper = React.createClass({ return ( {clonedTrigger} - + {title} -
+
{this.renderChildren()}
diff --git a/js/components/whitelabel/wallet/components/market/market_buttons/market_submit_button.js b/js/components/whitelabel/wallet/components/market/market_buttons/market_submit_button.js index b5dd5d50..6d914853 100644 --- a/js/components/whitelabel/wallet/components/market/market_buttons/market_submit_button.js +++ b/js/components/whitelabel/wallet/components/market/market_buttons/market_submit_button.js @@ -7,6 +7,8 @@ import EditionActions from '../../../../../../actions/edition_actions'; import MarketAdditionalDataForm from '../market_forms/market_additional_data_form'; +import MarketErrorConsignUnavailable from '../market_error_consign_unavailable'; + import AclFormFactory from '../../../../../ascribe_forms/acl_form_factory'; import ConsignForm from '../../../../../ascribe_forms/form_consign'; @@ -41,7 +43,7 @@ let MarketSubmitButton = React.createClass({ }, other_data: otherData } = edition; - return artistBio && displayInstructions && technologyDetails && workDescription && otherData.length; + return !!(artistBio && displayInstructions && technologyDetails && workDescription && otherData.length); } return false; @@ -55,11 +57,13 @@ let MarketSubmitButton = React.createClass({ return editions.reduce((details, curEdition) => { return { solePieceId: details.solePieceId === curEdition.parent ? details.solePieceId : null, + canEdit: details.canEdit && curEdition.acl.acl_edit, canSubmit: details.canSubmit && this.canEditionBeSubmitted(curEdition) }; }, { - solePieceId: editions.length > 0 ? editions[0].parent : null, - canSubmit: this.canEditionBeSubmitted(editions[0]) + solePieceId: editions.length ? editions[0].parent : null, + canEdit: true, + canSubmit: true }); }, @@ -86,7 +90,7 @@ let MarketSubmitButton = React.createClass({ handleSuccess, whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.props; - const { solePieceId, canSubmit } = this.getAggregateEditionDetails(); + const { solePieceId, canEdit, canSubmit } = this.getAggregateEditionDetails(); const message = getAclFormMessage({ aclName: 'acl_consign', entities: editions, @@ -119,44 +123,61 @@ let MarketSubmitButton = React.createClass({ ); if (solePieceId && !canSubmit) { - return ( - - - - + if (canEdit) { + return ( + + + + - { - if (typeof handleSuccess === 'function') { - handleSuccess(...params); - } + { + if (typeof handleSuccess === 'function') { + handleSuccess(...params); + } - this.refreshEdition(); - }} - title={getLangText('Consign artwork')}> - {consignForm} - - - ); + this.refreshEdition(); + }} + title={getLangText('Consign artwork')}> + {consignForm} + + + ); + } else { + return ( + + 1 ? 'these Editions' : 'this Edition')}> + + + + ) + } } else { return ( + title={getLangText('Consign artwork to %s', whitelabelName)} + trigger={triggerButton}> {consignForm} diff --git a/js/components/whitelabel/wallet/components/market/market_error_consign_unavailable.js b/js/components/whitelabel/wallet/components/market/market_error_consign_unavailable.js new file mode 100644 index 00000000..13fbc43e --- /dev/null +++ b/js/components/whitelabel/wallet/components/market/market_error_consign_unavailable.js @@ -0,0 +1,52 @@ +'use strict'; + +import React from 'react'; + +import { getLangText } from '../../../../../utils/lang_utils'; + + +const MarketErrorConsignUnavailable = React.createClass({ + propTypes: { + editions: React.PropTypes.array.isRequired, + whitelabelName: React.PropTypes.string.isRequired, + + handleSuccess: React.PropTypes.func + }, + + contactOnIntercom() { + window.Intercom('showNewMessage', getLangText("Hi, I'm having problems consigning to %s", this.props.whitelabelName)); + }, + + render() { + const { editions, handleSuccess, whitelabelName } = this.props; + const multipleEditions = editions.length > 1; + + return ( +
+

{getLangText("Well, it looks like you've caught us in a bit of a bind!")}

+

+ {getLangText('As a prerequisite, %s requires you to provide additional details before they will ' + + "consider your consignment request. However, it looks like the %s that you're trying " + + "to consign can't be edited anymore. Most likely, another Edition of the same work was " + + 'previously transferred by you or another person.', + whitelabelName, + multipleEditions ? 'Editions' : 'Edition') + } +

+

+ {getLangText("Unfortunately, this means that we're unable to let you consign %s.", + multipleEditions ? 'these Editions' : 'this Edition')} + {getLangText('If this seems incorrect, or if you would still like to consign %s to %s, please ', + multipleEditions ? 'these Editions' : 'this Edition', + whitelabelName)} + {getLangText('contact us')}. +

+ +
+ ); + } +}); + +export default MarketErrorConsignUnavailable; diff --git a/sass/lib/modals.scss b/sass/lib/modals.scss index 20a720c1..29f5739d 100644 --- a/sass/lib/modals.scss +++ b/sass/lib/modals.scss @@ -1,8 +1,12 @@ .modal-body { - padding-top:0; + padding-top: 0; + + &.modal-body-text { + padding-top: 10px; + } } .modal-header { padding: 15px 15px 0 15px; border-bottom: none; -} \ No newline at end of file +}