diff --git a/js/components/ascribe_detail/media_container.js b/js/components/ascribe_detail/media_container.js index c5439925..03d222ef 100644 --- a/js/components/ascribe_detail/media_container.js +++ b/js/components/ascribe_detail/media_container.js @@ -14,21 +14,13 @@ import AclProxy from '../acl_proxy'; let MediaContainer = React.createClass({ propTypes: { - content: React.PropTypes.object + digitalWork: React.PropTypes.object.isRequired, + thumbnail: React.PropTypes.string }, - render() { - let thumbnail = this.props.content.thumbnail; - let mimetype = this.props.content.digital_work.mime; - let embed = null; - let extraData = null; - - if (this.props.content.digital_work.encoding_urls) { - extraData = this.props.content.digital_work.encoding_urls.map(e => { return { url: e.url, type: e.label }; }); - } - - if (['video', 'audio'].indexOf(mimetype) > -1){ - embed = ( + getEmbed() { + if (['video', 'audio'].indexOf(mimetype) > -1) { + return ( @@ -44,21 +36,35 @@ let MediaContainer = React.createClass({ }/> ); } + }, + + render() { + if(!this.props.digitalWork) { + return null; + } + + let extraData = null; + + if (this.props.digitalWork.encoding_urls) { + extraData = this.props.digitalWork.encoding_urls.map(e => { return { url: e.url, type: e.label }; }); + } + return (
- +

- - {embed} + {this.getEmbed()}

); diff --git a/js/components/ascribe_detail/piece.js b/js/components/ascribe_detail/piece.js index 0eae0579..66470e91 100644 --- a/js/components/ascribe_detail/piece.js +++ b/js/components/ascribe_detail/piece.js @@ -128,7 +128,8 @@ let Piece = React.createClass({ + digitalWork={this.props.piece.digitalWork} + thumbnail={this.props.piece.thumbnail}/>