mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Small bug fixes for components affected by the UserStore and WhitelabelStore being passed down as a prop
This commit is contained in:
parent
5b2178eb7e
commit
b22ae7def1
@ -36,10 +36,12 @@ import { getLangText } from '../../utils/lang_utils';
|
||||
*/
|
||||
let Edition = React.createClass({
|
||||
propTypes: {
|
||||
currentUser: React.PropTypes.object.isRequired,
|
||||
edition: React.PropTypes.object.isRequired,
|
||||
whitelabel: React.PropTypes.object.isRequired,
|
||||
|
||||
actionPanelButtonListType: React.PropTypes.func,
|
||||
coaError: React.PropTypes.object,
|
||||
currentUser: React.PropTypes.object,
|
||||
edition: React.PropTypes.object,
|
||||
furtherDetailsType: React.PropTypes.func,
|
||||
loadEdition: React.PropTypes.func
|
||||
},
|
||||
@ -50,10 +52,6 @@ let Edition = React.createClass({
|
||||
};
|
||||
},
|
||||
|
||||
updateEdition() {
|
||||
return EditionActions.fetchEdition(this.props.edition.bitcoin_id);
|
||||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
actionPanelButtonListType,
|
||||
@ -61,7 +59,8 @@ let Edition = React.createClass({
|
||||
currentUser,
|
||||
edition,
|
||||
furtherDetailsType: FurtherDetailsType,
|
||||
loadEdition } = this.props;
|
||||
loadEdition,
|
||||
whitelabel } = this.props;
|
||||
|
||||
return (
|
||||
<Row>
|
||||
@ -69,7 +68,7 @@ let Edition = React.createClass({
|
||||
<MediaContainer
|
||||
content={edition}
|
||||
currentUser={currentUser}
|
||||
refreshObject={this.updateEdition} />
|
||||
refreshObject={loadEdition} />
|
||||
</Col>
|
||||
<Col md={6} className="ascribe-edition-details ascribe-print-col-right">
|
||||
<div className="ascribe-detail-header">
|
||||
@ -83,7 +82,8 @@ let Edition = React.createClass({
|
||||
actionPanelButtonListType={actionPanelButtonListType}
|
||||
edition={edition}
|
||||
currentUser={currentUser}
|
||||
handleSuccess={loadEdition}/>
|
||||
handleSuccess={loadEdition}
|
||||
whitelabel={whitelabel} />
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('Certificate of Authenticity')}
|
||||
show={edition.acl.acl_coa === true}>
|
||||
@ -95,23 +95,20 @@ let Edition = React.createClass({
|
||||
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('Provenance/Ownership History')}
|
||||
show={edition.ownership_history && edition.ownership_history.length > 0}>
|
||||
<HistoryIterator
|
||||
history={edition.ownership_history} />
|
||||
show={edition.ownership_history && edition.ownership_history.length}>
|
||||
<HistoryIterator history={edition.ownership_history} />
|
||||
</CollapsibleParagraph>
|
||||
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('Consignment History')}
|
||||
show={edition.consign_history && edition.consign_history.length > 0}>
|
||||
<HistoryIterator
|
||||
history={edition.consign_history} />
|
||||
<HistoryIterator history={edition.consign_history} />
|
||||
</CollapsibleParagraph>
|
||||
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('Loan History')}
|
||||
show={edition.loan_history && edition.loan_history.length > 0}>
|
||||
<HistoryIterator
|
||||
history={edition.loan_history} />
|
||||
<HistoryIterator history={edition.loan_history} />
|
||||
</CollapsibleParagraph>
|
||||
|
||||
<CollapsibleParagraph
|
||||
@ -139,9 +136,7 @@ let Edition = React.createClass({
|
||||
</CollapsibleParagraph>
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('Further Details')}
|
||||
show={edition.acl.acl_edit ||
|
||||
Object.keys(edition.extra_data).length > 0 ||
|
||||
edition.other_data.length > 0}>
|
||||
show={edition.acl.acl_edit || Object.keys(edition.extra_data).length || edition.other_data.length}>
|
||||
<FurtherDetailsType
|
||||
editable={edition.acl.acl_edit}
|
||||
pieceId={edition.parent}
|
||||
@ -149,10 +144,8 @@ let Edition = React.createClass({
|
||||
otherData={edition.other_data}
|
||||
handleSuccess={loadEdition} />
|
||||
</CollapsibleParagraph>
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('SPOOL Details')}>
|
||||
<SpoolDetails
|
||||
edition={edition} />
|
||||
<CollapsibleParagraph title={getLangText('SPOOL Details')}>
|
||||
<SpoolDetails edition={edition} />
|
||||
</CollapsibleParagraph>
|
||||
</Col>
|
||||
</Row>
|
||||
@ -163,32 +156,27 @@ let Edition = React.createClass({
|
||||
|
||||
let EditionSummary = React.createClass({
|
||||
propTypes: {
|
||||
currentUser: React.PropTypes.object.isRequired,
|
||||
edition: React.PropTypes.object.isRequired,
|
||||
whitelabel: React.PropTypes.object.isRequired,
|
||||
|
||||
actionPanelButtonListType: React.PropTypes.func,
|
||||
edition: React.PropTypes.object,
|
||||
currentUser: React.PropTypes.object,
|
||||
handleSuccess: React.PropTypes.func
|
||||
},
|
||||
|
||||
handleSuccess() {
|
||||
this.props.handleSuccess();
|
||||
},
|
||||
|
||||
getStatus() {
|
||||
let status = null;
|
||||
if (this.props.edition.status.length > 0){
|
||||
let statusStr = this.props.edition.status.join(', ').replace(/_/g, ' ');
|
||||
status = <DetailProperty label="STATUS" value={ statusStr }/>;
|
||||
if (this.props.edition.pending_new_owner && this.props.edition.acl.acl_withdraw_transfer){
|
||||
status = (
|
||||
<DetailProperty label="STATUS" value={ statusStr } />
|
||||
);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
const { status } = this.props.edition;
|
||||
|
||||
return status.length ? (
|
||||
<DetailProperty
|
||||
label="STATUS"
|
||||
value={status.join(', ').replace(/_/g, ' ')} />
|
||||
) : null;
|
||||
},
|
||||
|
||||
render() {
|
||||
let { actionPanelButtonListType, edition, currentUser } = this.props;
|
||||
const { actionPanelButtonListType, currentUser, edition, handleSuccess, whitelabel } = this.props;
|
||||
|
||||
return (
|
||||
<div className="ascribe-detail-header">
|
||||
<DetailProperty
|
||||
@ -208,15 +196,16 @@ let EditionSummary = React.createClass({
|
||||
no more than 1 key, we're hiding the `DetailProperty` actions as otherwise
|
||||
`AclInformation` would show up
|
||||
*/}
|
||||
<AclProxy show={currentUser && currentUser.email && Object.keys(edition.acl).length > 1}>
|
||||
<AclProxy show={currentUser.email && Object.keys(edition.acl).length > 1}>
|
||||
<DetailProperty
|
||||
label={getLangText('ACTIONS')}
|
||||
className="hidden-print">
|
||||
<EditionActionPanel
|
||||
actionPanelButtonListType={actionPanelButtonListType}
|
||||
edition={edition}
|
||||
currentUser={currentUser}
|
||||
handleSuccess={this.handleSuccess} />
|
||||
edition={edition}
|
||||
handleSuccess={handleSuccess}
|
||||
whitelabel={whitelabel} />
|
||||
</DetailProperty>
|
||||
</AclProxy>
|
||||
<hr/>
|
||||
@ -365,4 +354,5 @@ let SpoolDetails = React.createClass({
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
export default Edition;
|
||||
|
@ -36,8 +36,9 @@ import { getLangText } from '../../utils/lang_utils';
|
||||
*/
|
||||
let EditionActionPanel = React.createClass({
|
||||
propTypes: {
|
||||
edition: React.PropTypes.object.isRequired,
|
||||
currentUser: React.PropTypes.object.isRequired,
|
||||
edition: React.PropTypes.object.isRequired,
|
||||
whitelabel: React.PropTypes.object.isRequired,
|
||||
|
||||
actionPanelButtonListType: React.PropTypes.func,
|
||||
handleSuccess: React.PropTypes.func
|
||||
@ -87,21 +88,25 @@ let EditionActionPanel = React.createClass({
|
||||
|
||||
handleSuccess(response) {
|
||||
this.refreshCollection();
|
||||
this.props.handleSuccess();
|
||||
|
||||
if (response) {
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success');
|
||||
const notification = new GlobalNotificationModel(response.notification, 'success');
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
}
|
||||
|
||||
if (typeof this.props.handleSuccess === 'function') {
|
||||
this.props.handleSuccess();
|
||||
}
|
||||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
actionPanelButtonListType: ActionPanelButtonListType,
|
||||
currentUser,
|
||||
edition,
|
||||
currentUser } = this.props;
|
||||
whitelabel } = this.props;
|
||||
|
||||
if (edition.notifications &&
|
||||
edition.notifications.length > 0){
|
||||
if (edition.notifications && edition.notifications.length) {
|
||||
return (
|
||||
<ListRequestActions
|
||||
currentUser={currentUser}
|
||||
@ -116,8 +121,9 @@ let EditionActionPanel = React.createClass({
|
||||
availableAcls={edition.acl}
|
||||
className="ascribe-button-list"
|
||||
currentUser={currentUser}
|
||||
handleSuccess={this.handleSuccess}
|
||||
pieceOrEditions={[edition]}
|
||||
handleSuccess={this.handleSuccess}>
|
||||
whitelabel={whitelabel}>
|
||||
<AclProxy
|
||||
aclObject={edition.acl}
|
||||
aclName="acl_withdraw_transfer">
|
||||
|
@ -75,9 +75,9 @@ let EditionContainer = React.createClass({
|
||||
this.setState(state);
|
||||
|
||||
if (state && state.edition && state.edition.digital_work) {
|
||||
let isEncoding = state.edition.digital_work.isEncoding;
|
||||
const isEncoding = state.edition.digital_work.isEncoding;
|
||||
if (state.edition.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
||||
let timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
|
||||
const timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
|
||||
this.setState({ timerId: timerId });
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ let SignupForm = React.createClass({
|
||||
type="email"
|
||||
placeholder={getLangText('(e.g. andy@warhol.co.uk)')}
|
||||
autoComplete="on"
|
||||
defaultValue={email}
|
||||
defaultValue={emailQuery}
|
||||
required/>
|
||||
</Property>
|
||||
<Property
|
||||
|
@ -32,7 +32,6 @@ import { getLangText } from '../../../../../utils/lang_utils';
|
||||
|
||||
let IkonotvRegisterPiece = React.createClass({
|
||||
propTypes: {
|
||||
piece: React.PropTypes.object.isRequired,
|
||||
handleSuccess: React.PropTypes.func,
|
||||
|
||||
// Provided from PrizeApp
|
||||
@ -52,7 +51,8 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
{
|
||||
step: 0,
|
||||
pageExitWarning: getLangText("If you leave this form now, your work will not be loaned to Ikono TV.")
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
@ -95,8 +95,7 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
}
|
||||
if (!this.canSubmit()) {
|
||||
this.history.push('/collection');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.incrementStep();
|
||||
this.refs.slidesContainer.nextSlide();
|
||||
}
|
||||
@ -119,7 +118,7 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
handleLoanSuccess(response) {
|
||||
this.setState({ pageExitWarning: null });
|
||||
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||
const notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
||||
this.refreshPieceList();
|
||||
@ -189,7 +188,8 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
|
||||
getSlideLoan() {
|
||||
if (this.canSubmit()) {
|
||||
const { piece, whitelabel } = this.props;
|
||||
const { whitelabel } = this.props;
|
||||
const { piece } = this.state;
|
||||
const today = new Moment();
|
||||
const endDate = (new Moment()).add(2, 'years');
|
||||
|
||||
|
@ -46,7 +46,10 @@ let MarketAclButtonList = React.createClass({
|
||||
return (
|
||||
<div className={className}>
|
||||
<MarketSubmitButton
|
||||
{...buttonProps}
|
||||
availableAcls={availableAcls}
|
||||
currentUser={currentUser}
|
||||
editions={pieceOrEditions}
|
||||
handleSuccess={handleSuccess}
|
||||
whitelabel={whitelabel} />
|
||||
<EmailButton {...buttonProps} />
|
||||
<TransferButton {...buttonProps} />
|
||||
|
@ -115,7 +115,7 @@ let MarketAdditionalDataForm = React.createClass({
|
||||
this.props.handleSuccess();
|
||||
}
|
||||
|
||||
let notification = new GlobalNotificationModel(getLangText('Further details successfully updated'), 'success', 10000);
|
||||
const notification = new GlobalNotificationModel(getLangText('Further details successfully updated'), 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
||||
@ -128,7 +128,8 @@ let MarketAdditionalDataForm = React.createClass({
|
||||
render() {
|
||||
const { editable, isInline, handleSuccess, showHeading, showNotification, submitLabel } = this.props;
|
||||
const { piece } = this.state;
|
||||
let buttons, heading;
|
||||
let buttons;
|
||||
let heading;
|
||||
|
||||
let spinner = <AscribeSpinner color='dark-blue' size='lg' />;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user