about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-25 14:58:07 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-25 14:58:07 +0200
commit62b384824d39fb56cb211670126b38645fdf10cc (patch)
tree90972faa97c818047a0bf033f9298ed84d18c7bb /app
parent15f51dbf8c19d1072d873c3b92b5a638035728a1 (diff)
Improved styling for media/videos in detailed status view
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/components/components/video_player.jsx13
-rw-r--r--app/assets/javascripts/components/features/account/components/action_bar.jsx8
-rw-r--r--app/assets/javascripts/components/features/status/components/detailed_status.jsx11
3 files changed, 26 insertions, 6 deletions
diff --git a/app/assets/javascripts/components/components/video_player.jsx b/app/assets/javascripts/components/components/video_player.jsx
index fa0675413..9fab6d7c1 100644
--- a/app/assets/javascripts/components/components/video_player.jsx
+++ b/app/assets/javascripts/components/components/video_player.jsx
@@ -4,7 +4,16 @@ import IconButton         from './icon_button';
 
 const VideoPlayer = React.createClass({
   propTypes: {
-    media: ImmutablePropTypes.map.isRequired
+    media: ImmutablePropTypes.map.isRequired,
+    width: React.PropTypes.number,
+    height: React.PropTypes.number
+  },
+
+  getDefaultProps () {
+    return {
+      width: 196,
+      height: 110
+    };
   },
 
   getInitialState () {
@@ -21,7 +30,7 @@ const VideoPlayer = React.createClass({
 
   render () {
     return (
-      <div style={{ cursor: 'default', marginTop: '8px', overflow: 'hidden', width: '196px', height: '110px', boxSizing: 'border-box', background: '#000', position: 'relative' }}>
+      <div style={{ cursor: 'default', marginTop: '8px', overflow: 'hidden', width: `${this.props.width}px`, height: `${this.props.height}px`, boxSizing: 'border-box', background: '#000', position: 'relative' }}>
         <div style={{ position: 'absolute', top: '10px', left: '10px', opacity: '0.8' }}><IconButton title='Toggle sound' icon={this.state.muted ? 'volume-up' : 'volume-off'} onClick={this.handleClick} /></div>
         <video src={this.props.media.get('url')} autoPlay='true' loop={true} muted={this.state.muted} style={{ width: '100%', height: '100%' }} />
       </div>
diff --git a/app/assets/javascripts/components/features/account/components/action_bar.jsx b/app/assets/javascripts/components/features/account/components/action_bar.jsx
index 9fa9fff3d..75b26775c 100644
--- a/app/assets/javascripts/components/features/account/components/action_bar.jsx
+++ b/app/assets/javascripts/components/features/account/components/action_bar.jsx
@@ -16,11 +16,11 @@ const ActionBar = React.createClass({
   render () {
     const { account, me } = this.props;
     
-    let followBack   = '';
+    let infoText     = '';
     let actionButton = '';
 
     if (account.get('id') === me) {
-      actionButton = 'This is you!';
+      infoText = 'This is you!';
     } else {
       if (account.getIn(['relationship', 'following'])) {
         actionButton = <Button text='Unfollow' onClick={this.props.onUnfollow} />
@@ -29,13 +29,13 @@ const ActionBar = React.createClass({
       }
 
       if (account.getIn(['relationship', 'followed_by'])) {
-        followBack = 'Follows you!';
+        infoText = 'Follows you!';
       }
     }
 
     return (
       <div style={{ borderTop: '1px solid #363c4b', borderBottom: '1px solid #363c4b', padding: '10px', lineHeight: '36px' }}>
-        {actionButton} {followBack}
+        {actionButton} <span style={{ color: '#616b86', fontWeight: '500', textTransform: 'uppercase' }}>{infoText}</span>
       </div>
     );
   },
diff --git a/app/assets/javascripts/components/features/status/components/detailed_status.jsx b/app/assets/javascripts/components/features/status/components/detailed_status.jsx
index fbc9cb69b..ffa536ae8 100644
--- a/app/assets/javascripts/components/features/status/components/detailed_status.jsx
+++ b/app/assets/javascripts/components/features/status/components/detailed_status.jsx
@@ -30,6 +30,15 @@ const DetailedStatus = React.createClass({
 
   render () {
     const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status;
+    let media    = '';
+
+    if (status.get('media_attachments').size > 0) {
+      if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
+        media = <VideoPlayer media={status.getIn(['media_attachments', 0])} width={317} height={178} />;
+      } else {
+        media = <MediaGallery media={status.get('media_attachments')} height={300} />;
+      }
+    }
 
     return (
       <div style={{ background: '#2f3441', padding: '14px 10px' }} className='detailed-status'>
@@ -40,6 +49,8 @@ const DetailedStatus = React.createClass({
 
         <StatusContent status={status} />
 
+        {media}
+
         <div style={{ marginTop: '15px', color: '#616b86', fontSize: '14px', lineHeight: '18px' }}>
           <a className='detailed-status__datetime' style={{ color: 'inherit' }} href={status.get('url')} target='_blank' rel='noopener'>{moment(status.get('created_at')).format('HH:mm, DD MMM Y')}</a> · <i className='fa fa-retweet' /><span style={{ fontWeight: '500', fontSize: '12px', marginLeft: '6px', display: 'inline-block' }}>{status.get('reblogs_count')}</span> · <i className='fa fa-star' /><span style={{ fontWeight: '500', fontSize: '12px', marginLeft: '6px', display: 'inline-block' }}>{status.get('favourites_count')}</span>
         </div>