1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00
onion/js/components/edition.js

79 lines
2.7 KiB
JavaScript
Raw Normal View History

import React from 'react';
2015-05-27 09:34:49 +02:00
2015-05-26 13:33:35 +02:00
import ImageViewer from './ascribe_media/image_viewer';
import TransferModalButton from './ascribe_modal/modal_transfer';
2015-05-27 09:34:49 +02:00
import ShareModalButton from './ascribe_modal/modal_share';
2015-05-26 10:41:41 +02:00
/**
2015-05-26 10:52:20 +02:00
* This is the component that implements display-specific functionality
2015-05-26 10:41:41 +02:00
*/
2015-05-26 13:48:46 +02:00
let Edition = React.createClass({
2015-05-26 13:33:35 +02:00
render() {
return (
<div>
<div className="col-md-7">
2015-05-26 13:48:46 +02:00
<ImageViewer thumbnail={this.props.edition.thumbnail}/>
2015-05-26 13:33:35 +02:00
</div>
<div className="col-md-5">
2015-05-26 14:58:11 +02:00
<EditionHeader edition={this.props.edition}/>
2015-05-27 09:34:49 +02:00
<EditionDetails edition={this.props.edition} currentUser={ this.props.currentUser }/>
2015-05-26 13:33:35 +02:00
</div>
2015-05-26 16:46:02 +02:00
2015-05-26 13:33:35 +02:00
</div>
);
}
});
2015-05-26 13:48:46 +02:00
let EditionHeader = React.createClass({
2015-05-26 13:33:35 +02:00
render() {
2015-05-26 15:31:28 +02:00
var title_html = <div className="ascribe-detail-title">{this.props.edition.title}</div>;
2015-05-26 13:33:35 +02:00
return (
<div className="ascribe-detail-header">
2015-05-26 15:31:28 +02:00
<EditionDetailProperty label="title" value={title_html} />
<EditionDetailProperty label="by" value={this.props.edition.artist_name} />
<EditionDetailProperty label="date" value={ this.props.edition.date_created.slice(0,4) } />
2015-05-26 13:33:35 +02:00
<hr/>
</div>
);
}
});
2015-05-26 13:48:46 +02:00
let EditionDetails = React.createClass({
2015-05-26 13:33:35 +02:00
render() {
return (
<div className="ascribe-detail-header">
2015-05-26 15:31:28 +02:00
<EditionDetailProperty label="edition"
value={this.props.edition.edition_number + " of " + this.props.edition.num_editions} />
<EditionDetailProperty label="id" value={ this.props.edition.bitcoin_id } />
<EditionDetailProperty label="owner" value={ this.props.edition.owner } />
2015-05-27 15:53:26 +02:00
<br/>
<TransferModalButton edition={ this.props.edition } currentUser={ this.props.currentUser }/>
2015-05-27 09:34:49 +02:00
<ShareModalButton edition={ this.props.edition } currentUser={ this.props.currentUser }/>
2015-05-26 15:31:28 +02:00
<hr/>
</div>
);
2015-05-27 09:34:49 +02:00
2015-05-26 15:31:28 +02:00
}
});
let EditionDetailProperty = React.createClass({
render() {
return (
<div className="row ascribe-detail-property">
<div className="row-same-height">
<div className="col-xs-2 col-xs-height col-bottom">
<div>{ this.props.label }:</div>
2015-05-26 13:33:35 +02:00
</div>
2015-05-26 15:31:28 +02:00
<div className="col-xs-10 col-xs-height col-bottom">
<div>{ this.props.value }</div>
2015-05-26 13:33:35 +02:00
</div>
</div>
</div>
);
}
});
2015-05-26 16:46:02 +02:00
2015-05-27 09:34:49 +02:00
export default Edition;
2015-05-26 13:33:35 +02:00