mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +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,49 +68,47 @@ 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">
|
||||
<hr className="hidden-print" style={{marginTop: 0}}/>
|
||||
<hr className="hidden-print" style={{marginTop: 0}} />
|
||||
<h1 className="ascribe-detail-title">{edition.title}</h1>
|
||||
<DetailProperty label="BY" value={edition.artist_name} />
|
||||
<DetailProperty label="DATE" value={Moment(edition.date_created, 'YYYY-MM-DD').year()} />
|
||||
<hr/>
|
||||
<hr />
|
||||
</div>
|
||||
<EditionSummary
|
||||
actionPanelButtonListType={actionPanelButtonListType}
|
||||
edition={edition}
|
||||
currentUser={currentUser}
|
||||
handleSuccess={loadEdition}/>
|
||||
handleSuccess={loadEdition}
|
||||
whitelabel={whitelabel} />
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('Certificate of Authenticity')}
|
||||
show={edition.acl.acl_coa === true}>
|
||||
<CoaDetails
|
||||
coa={edition.coa}
|
||||
coaError={coaError}
|
||||
editionId={edition.bitcoin_id}/>
|
||||
editionId={edition.bitcoin_id} />
|
||||
</CollapsibleParagraph>
|
||||
|
||||
<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
|
||||
@ -125,7 +122,7 @@ let Edition = React.createClass({
|
||||
editable={true}
|
||||
successMessage={getLangText('Private note saved')}
|
||||
url={ApiUrls.note_private_edition}
|
||||
currentUser={currentUser}/>
|
||||
currentUser={currentUser} />
|
||||
<Note
|
||||
id={() => {return {'bitcoin_id': edition.bitcoin_id}; }}
|
||||
label={getLangText('Personal note (public)')}
|
||||
@ -135,13 +132,11 @@ let Edition = React.createClass({
|
||||
show={!!edition.public_note || !!edition.acl.acl_edit}
|
||||
successMessage={getLangText('Public edition note saved')}
|
||||
url={ApiUrls.note_public_edition}
|
||||
currentUser={currentUser}/>
|
||||
currentUser={currentUser} />
|
||||
</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,60 +156,56 @@ 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() {
|
||||
const { status } = this.props.edition;
|
||||
|
||||
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;
|
||||
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
|
||||
label={getLangText('EDITION')}
|
||||
value={ edition.edition_number + ' ' + getLangText('of') + ' ' + edition.num_editions} />
|
||||
value={edition.edition_number + ' ' + getLangText('of') + ' ' + edition.num_editions} />
|
||||
<DetailProperty
|
||||
label={getLangText('ID')}
|
||||
value={ edition.bitcoin_id }
|
||||
value={edition.bitcoin_id}
|
||||
ellipsis={true} />
|
||||
<DetailProperty
|
||||
label={getLangText('OWNER')}
|
||||
value={ edition.owner } />
|
||||
<LicenseDetail license={edition.license_type}/>
|
||||
value={edition.owner} />
|
||||
<LicenseDetail license={edition.license_type} />
|
||||
{this.getStatus()}
|
||||
{/*
|
||||
`acl_view` is always available in `edition.acl`, therefore if it has
|
||||
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');
|
||||
|
||||
if (response) {
|
||||
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">
|
||||
|
@ -74,11 +74,11 @@ let EditionContainer = React.createClass({
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
|
||||
if(state && state.edition && state.edition.digital_work) {
|
||||
let isEncoding = state.edition.digital_work.isEncoding;
|
||||
if (state && state.edition && state.edition.digital_work) {
|
||||
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);
|
||||
this.setState({timerId: timerId});
|
||||
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
|
||||
@ -45,14 +44,15 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
|
||||
mixins: [History],
|
||||
|
||||
getInitialState(){
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
PieceListStore.getState(),
|
||||
PieceStore.getState(),
|
||||
{
|
||||
step: 0,
|
||||
pageExitWarning: getLangText("If you leave this form now, your work will not be loaned to Ikono TV.")
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
@ -90,13 +90,12 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
this.refreshPieceList();
|
||||
|
||||
// also start loading the piece for the next step
|
||||
if(response && response.piece) {
|
||||
if (response && response.piece) {
|
||||
PieceActions.updatePiece(response.piece);
|
||||
}
|
||||
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