mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
Add consign error to market white labels
Can you beliebe? Magical 100th commit.
This commit is contained in:
parent
c1959033c0
commit
cb972eb448
@ -3,6 +3,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import MarketConsignError from '../market_consign_error';
|
||||||
|
|
||||||
import MarketAdditionalDataForm from '../market_forms/market_additional_data_form';
|
import MarketAdditionalDataForm from '../market_forms/market_additional_data_form';
|
||||||
|
|
||||||
import AclFormFactory from '../../../../../ascribe_forms/acl_form_factory';
|
import AclFormFactory from '../../../../../ascribe_forms/acl_form_factory';
|
||||||
@ -12,6 +14,7 @@ import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper';
|
|||||||
|
|
||||||
import AclProxy from '../../../../../acl_proxy';
|
import AclProxy from '../../../../../acl_proxy';
|
||||||
|
|
||||||
|
import EditionListActions from '../../../../../../actions/edition_list_actions';
|
||||||
import PieceActions from '../../../../../../actions/piece_actions';
|
import PieceActions from '../../../../../../actions/piece_actions';
|
||||||
import WhitelabelActions from '../../../../../../actions/whitelabel_actions';
|
import WhitelabelActions from '../../../../../../actions/whitelabel_actions';
|
||||||
import WhitelabelStore from '../../../../../../stores/whitelabel_store';
|
import WhitelabelStore from '../../../../../../stores/whitelabel_store';
|
||||||
@ -89,6 +92,11 @@ let MarketSubmitButton = React.createClass({
|
|||||||
this.refs.consignModal.show();
|
this.refs.consignModal.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleConsignError() {
|
||||||
|
// Unselect failed editions
|
||||||
|
EditionListActions.clearAllEditionSelections();
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { availableAcls, currentUser, className, editions, handleSuccess } = this.props;
|
const { availableAcls, currentUser, className, editions, handleSuccess } = this.props;
|
||||||
const { whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.state;
|
const { whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.state;
|
||||||
@ -120,6 +128,7 @@ let MarketSubmitButton = React.createClass({
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (solePieceId && !canSubmit) {
|
if (solePieceId && !canSubmit) {
|
||||||
|
if (availableAcls.acl_edit) {
|
||||||
return (
|
return (
|
||||||
<AclProxy
|
<AclProxy
|
||||||
aclObject={availableAcls}
|
aclObject={availableAcls}
|
||||||
@ -141,6 +150,23 @@ let MarketSubmitButton = React.createClass({
|
|||||||
</ModalWrapper>
|
</ModalWrapper>
|
||||||
</AclProxy>
|
</AclProxy>
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
// Oops, well this is a difficult situation...
|
||||||
|
// The user's likely already transferred another edition from the piece so
|
||||||
|
// they can't update the missing fields that are necessary for consignment
|
||||||
|
// to marketplaces.
|
||||||
|
// Let's show an error in response to explain the problem and let them
|
||||||
|
// contact the whitelabel themselves.
|
||||||
|
return (
|
||||||
|
<ModalWrapper
|
||||||
|
trigger={triggerButton}
|
||||||
|
handleSuccess={this.handleConsignError}
|
||||||
|
title={getLangText("Oops, we can't consign this piece to %s", whitelabelName)}>
|
||||||
|
<MarketConsignError
|
||||||
|
whitelabelName={whitelabelName} />
|
||||||
|
</ModalWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<AclProxy
|
<AclProxy
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { getLangText } from '../../../../../utils/lang_utils';
|
||||||
|
|
||||||
|
let MarketConsignError = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
handleSuccess: React.PropTypes.func,
|
||||||
|
whitelabelName: React.PropTypes.string
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSuccess() {
|
||||||
|
const { handleSuccess, whitelabelName } = this.props;
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
Intercom('showNewMessage', getLangText("I'm having trouble consigning my edition to %s because I don't " +
|
||||||
|
"have the permissions to edit its details.", whitelabelName));
|
||||||
|
/* eslint-enable */
|
||||||
|
|
||||||
|
if (typeof handleSuccess === 'function') {
|
||||||
|
handleSuccess();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { handleSuccess, whitelabelName } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="ascribe-form-error-popup">
|
||||||
|
<div className="error-popup-content">
|
||||||
|
<p>
|
||||||
|
{getLangText('Unfortunately, %s requires you to provide more information ' +
|
||||||
|
"about this edition, but it appears that you don't have the " +
|
||||||
|
'permissions to edit the piece associated with this edition.', whitelabelName)}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{getLangText('Please contact us if you would still like to consign this piece to %s.', whitelabelName)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
onClick={this.handleSuccess}
|
||||||
|
className="btn btn-default btn-wide">
|
||||||
|
{getLangText('Contact us for help')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default MarketConsignError;
|
@ -24,3 +24,10 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ascribe-form-error-popup {
|
||||||
|
.error-popup-content {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user