1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 13:41:57 +02:00

check if piece exists in props in wallet details

This commit is contained in:
diminator 2015-09-22 09:20:10 +02:00
parent 904793269b
commit b4c7b864fd

View File

@ -17,7 +17,7 @@ import ApiUrls from '../../../../../constants/api_urls';
import { getLangText } from '../../../../../utils/lang_utils'; import { getLangText } from '../../../../../utils/lang_utils';
import { mergeOptions } from '../../../../../utils/general_utils'; import { mergeOptions } from '../../../../../utils/general_utils';
import AppConstants from '../../../../../constants/application_constants';
let WalletPieceContainer = React.createClass({ let WalletPieceContainer = React.createClass({
@ -30,54 +30,63 @@ let WalletPieceContainer = React.createClass({
render() { render() {
return ( if(this.props.piece && this.props.piece.title) {
<Piece return (
piece={this.props.piece} <Piece
loadPiece={this.loadPiece} piece={this.props.piece}
header={ loadPiece={this.loadPiece}
<div className="ascribe-detail-header"> header={
<hr style={{marginTop: 0}}/> <div className="ascribe-detail-header">
<h1 className="ascribe-detail-title">{this.props.piece.title}</h1> <hr style={{marginTop: 0}}/>
<DetailProperty label="BY" value={this.props.piece.artist_name} /> <h1 className="ascribe-detail-title">{this.props.piece.title}</h1>
<DetailProperty label="DATE" value={ this.props.piece.date_created.slice(0, 4) } /> <DetailProperty label="BY" value={this.props.piece.artist_name} />
<hr/> <DetailProperty label="DATE" value={ this.props.piece.date_created.slice(0, 4) } />
</div> <hr/>
</div>
} }
subheader={ subheader={
<div className="ascribe-detail-header"> <div className="ascribe-detail-header">
<DetailProperty label={getLangText('REGISTREE')} value={ this.props.piece.user_registered } /> <DetailProperty label={getLangText('REGISTREE')} value={ this.props.piece.user_registered } />
<DetailProperty label={getLangText('ID')} value={ this.props.piece.bitcoin_id } ellipsis={true} /> <DetailProperty label={getLangText('ID')} value={ this.props.piece.bitcoin_id } ellipsis={true} />
<hr/> <hr/>
</div> </div>
}> }>
<WalletActionPanel <WalletActionPanel
piece={this.props.piece} piece={this.props.piece}
currentUser={this.props.currentUser} currentUser={this.props.currentUser}
loadPiece={this.loadPiece} loadPiece={this.loadPiece}
submitButtonType={this.props.submitButtonType} /> submitButtonType={this.props.submitButtonType}/>
<CollapsibleParagraph <CollapsibleParagraph
title={getLangText('Loan History')} title={getLangText('Loan History')}
show={this.props.piece.loan_history && this.props.piece.loan_history.length > 0}> show={this.props.piece.loan_history && this.props.piece.loan_history.length > 0}>
<HistoryIterator <HistoryIterator
history={this.props.piece.loan_history} /> history={this.props.piece.loan_history}/>
</CollapsibleParagraph> </CollapsibleParagraph>
<CollapsibleParagraph <CollapsibleParagraph
title={getLangText('Notes')} title={getLangText('Notes')}
show={!!(this.props.currentUser.username || this.props.piece.public_note)}> show={!!(this.props.currentUser.username || this.props.piece.public_note)}>
<Note <Note
id={() => {return {'id': this.props.piece.id}; }} id={() => {return {'id': this.props.piece.id}; }}
label={getLangText('Personal note (private)')} label={getLangText('Personal note (private)')}
defaultValue={this.props.piece.private_note || null} defaultValue={this.props.piece.private_note || null}
placeholder={getLangText('Enter your comments ...')} placeholder={getLangText('Enter your comments ...')}
editable={true} editable={true}
successMessage={getLangText('Private note saved')} successMessage={getLangText('Private note saved')}
url={ApiUrls.note_private_piece} url={ApiUrls.note_private_piece}
currentUser={this.props.currentUser}/> currentUser={this.props.currentUser}/>
</CollapsibleParagraph> </CollapsibleParagraph>
{this.props.children} {this.props.children}
</Piece> </Piece>
); );
}
else {
return (
<div className="fullpage-spinner">
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />
</div>
);
}
} }
}); });