From af586875725af02b96ac0d863e4adbc0ce8698c9 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Tue, 10 Nov 2015 19:33:08 +0100 Subject: [PATCH] Add twitter text --- .../ascribe_detail/media_container.js | 48 +++++++++++++------ .../twitter_share_button.js | 3 +- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/js/components/ascribe_detail/media_container.js b/js/components/ascribe_detail/media_container.js index d62b0b84..233f0177 100644 --- a/js/components/ascribe_detail/media_container.js +++ b/js/components/ascribe_detail/media_container.js @@ -14,6 +14,11 @@ import CollapsibleButton from './../ascribe_collapsible/collapsible_button'; import AclProxy from '../acl_proxy'; +import UserActions from '../../actions/user_actions'; +import UserStore from '../../stores/user_store'; + +import { mergeOptions } from '../../utils/general_utils.js'; +import { getLangText } from '../../utils/lang_utils.js'; const EMBED_IFRAME_HEIGHT = { video: 315, @@ -27,10 +32,17 @@ let MediaContainer = React.createClass({ }, getInitialState() { - return {timerId: null}; + return mergeOptions( + UserStore.getState(), + { + timerId: null + }); }, componentDidMount() { + UserStore.listen(this.onChange); + UserActions.fetchCurrentUser(); + if (!this.props.content.digital_work) { return; } @@ -51,16 +63,23 @@ let MediaContainer = React.createClass({ window.clearInterval(this.state.timerId); }, + onChange(state) { + this.setState(state); + }, + render() { - let thumbnail = this.props.content.thumbnail.thumbnail_sizes && this.props.content.thumbnail.thumbnail_sizes['600x600'] ? - this.props.content.thumbnail.thumbnail_sizes['600x600'] : this.props.content.thumbnail.url_safe; - let mimetype = this.props.content.digital_work.mime; + const { content } = this.props; + const didUserRegisterContent = this.state.currentUser && (this.state.currentUser.username === content.user_registered); + + let thumbnail = content.thumbnail.thumbnail_sizes && content.thumbnail.thumbnail_sizes['600x600'] ? + content.thumbnail.thumbnail_sizes['600x600'] : content.thumbnail.url_safe; + let mimetype = content.digital_work.mime; let embed = null; let extraData = null; - let isEmbedDisabled = mimetype === 'video' && this.props.content.digital_work.isEncoding !== undefined && this.props.content.digital_work.isEncoding !== 100; + let isEmbedDisabled = mimetype === 'video' && content.digital_work.isEncoding !== undefined && content.digital_work.isEncoding !== 100; - 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 (content.digital_work.encoding_urls) { + extraData = content.digital_work.encoding_urls.map(e => { return { url: e.url, type: e.label }; }); } if (['video', 'audio'].indexOf(mimetype) > -1) { @@ -76,7 +95,7 @@ let MediaContainer = React.createClass({ panel={
                             {''}
+                                + content.bitcoin_id + '" frameborder="0" allowfullscreen>'}
                         
}/> ); @@ -86,20 +105,21 @@ let MediaContainer = React.createClass({ + encodingStatus={content.digital_work.isEncoding} />

- + - diff --git a/js/components/ascribe_social_share/twitter_share_button.js b/js/components/ascribe_social_share/twitter_share_button.js index 21eec3d2..b2e8a7dc 100644 --- a/js/components/ascribe_social_share/twitter_share_button.js +++ b/js/components/ascribe_social_share/twitter_share_button.js @@ -19,7 +19,8 @@ let TwitterShareButton = React.createClass({ getDefaultProps() { return { - count: 'none' + count: 'none', + via: 'ascribeIO' }; },