about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/components/components/status.jsx2
-rw-r--r--app/assets/javascripts/components/features/status/components/action_bar.jsx30
-rw-r--r--app/assets/javascripts/components/features/status/components/detailed_status.jsx52
-rw-r--r--app/assets/javascripts/components/features/status/index.jsx23
-rw-r--r--app/assets/stylesheets/components.scss27
-rw-r--r--app/models/user.rb3
6 files changed, 122 insertions, 15 deletions
diff --git a/app/assets/javascripts/components/components/status.jsx b/app/assets/javascripts/components/components/status.jsx
index 9f9e877e6..a1ab60ae1 100644
--- a/app/assets/javascripts/components/components/status.jsx
+++ b/app/assets/javascripts/components/components/status.jsx
@@ -80,7 +80,7 @@ const Status = React.createClass({
       <div style={{ padding: '8px 10px', paddingLeft: '68px', position: 'relative', minHeight: '48px', borderBottom: '1px solid #363c4b', cursor: 'pointer' }} onClick={this.handleClick}>
         <div style={{ fontSize: '15px' }}>
           <div style={{ float: 'right', fontSize: '14px' }}>
-            <a href={status.get('url')} className='status__relative-time' style={{ color: '#616b86' }}><RelativeTimestamp timestamp={status.get('created_at')} /></a>
+            <a href={status.get('url')} className='status__relative-time' style={{ color: '#616b86' }} target='_blank' rel='noopener'><RelativeTimestamp timestamp={status.get('created_at')} /></a>
           </div>
 
           <a onClick={this.handleAccountClick.bind(this, status.getIn(['account', 'id']))} href={status.getIn(['account', 'url'])} className='status__display-name' style={{ display: 'block', maxWidth: '100%', paddingRight: '25px', color: '#616b86' }}>
diff --git a/app/assets/javascripts/components/features/status/components/action_bar.jsx b/app/assets/javascripts/components/features/status/components/action_bar.jsx
new file mode 100644
index 000000000..51332dc95
--- /dev/null
+++ b/app/assets/javascripts/components/features/status/components/action_bar.jsx
@@ -0,0 +1,30 @@
+import PureRenderMixin    from 'react-addons-pure-render-mixin';
+import IconButton         from '../../../components/icon_button';
+import ImmutablePropTypes from 'react-immutable-proptypes';
+
+const ActionBar = React.createClass({
+  
+  propTypes: {
+    status: ImmutablePropTypes.map.isRequired,
+    onReply: React.PropTypes.func.isRequired,
+    onReblog: React.PropTypes.func.isRequired,
+    onFavourite: React.PropTypes.func.isRequired
+  },
+
+  mixins: [PureRenderMixin],
+
+  render () {
+    const { status } = this.props;
+
+    return (
+      <div style={{ background: '#2f3441', display: 'flex', flexDirection: 'row', borderTop: '1px solid #363c4b', borderBottom: '1px solid #363c4b', padding: '10px 0' }}>
+        <div style={{ flex: '1 1 auto', textAlign: 'center' }}><IconButton title='Reply' icon='reply' onClick={this.props.onReply.bind(this, status)} /></div>
+        <div style={{ flex: '1 1 auto', textAlign: 'center' }}><IconButton active={status.get('reblogged')} title='Reblog' icon='retweet' onClick={this.props.onReblog.bind(this, status)} /></div>
+        <div style={{ flex: '1 1 auto', textAlign: 'center' }}><IconButton active={status.get('favourited')} title='Favourite' icon='star' onClick={this.props.onFavourite.bind(this, status)} /></div>
+      </div>
+    );
+  }
+
+});
+
+export default ActionBar;
diff --git a/app/assets/javascripts/components/features/status/components/detailed_status.jsx b/app/assets/javascripts/components/features/status/components/detailed_status.jsx
new file mode 100644
index 000000000..fbc9cb69b
--- /dev/null
+++ b/app/assets/javascripts/components/features/status/components/detailed_status.jsx
@@ -0,0 +1,52 @@
+import PureRenderMixin    from 'react-addons-pure-render-mixin';
+import ImmutablePropTypes from 'react-immutable-proptypes';
+import Avatar             from '../../../components/avatar';
+import DisplayName        from '../../../components/display_name';
+import StatusContent      from '../../../components/status_content';
+import MediaGallery       from '../../../components/media_gallery';
+import VideoPlayer        from '../../../components/video_player';
+import moment             from 'moment';
+
+const DetailedStatus = React.createClass({
+
+  contextTypes: {
+    router: React.PropTypes.object
+  },
+
+  propTypes: {
+    status: ImmutablePropTypes.map.isRequired
+  },
+
+  mixins: [PureRenderMixin],
+
+  handleAccountClick (e) {
+    if (e.button === 0) {
+      e.preventDefault();
+      this.context.router.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
+    }
+
+    e.stopPropagation();
+  },
+
+  render () {
+    const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status;
+
+    return (
+      <div style={{ background: '#2f3441', padding: '14px 10px' }} className='detailed-status'>
+        <a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='detailed-status__display-name' style={{ display: 'block', overflow: 'hidden', marginBottom: '15px' }}>
+          <div style={{ float: 'left', marginRight: '10px' }}><Avatar src={status.getIn(['account', 'avatar'])} size={48} /></div>
+          <DisplayName account={status.get('account')} />
+        </a>
+
+        <StatusContent status={status} />
+
+        <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>
+      </div>
+    );
+  }
+
+});
+
+export default DetailedStatus;
diff --git a/app/assets/javascripts/components/features/status/index.jsx b/app/assets/javascripts/components/features/status/index.jsx
index 7a810d474..167864a1c 100644
--- a/app/assets/javascripts/components/features/status/index.jsx
+++ b/app/assets/javascripts/components/features/status/index.jsx
@@ -1,12 +1,14 @@
-import { connect }              from 'react-redux';
-import PureRenderMixin          from 'react-addons-pure-render-mixin';
-import ImmutablePropTypes       from 'react-immutable-proptypes';
-import { fetchStatus }          from '../../actions/statuses';
-import Immutable                from 'immutable';
-import EmbeddedStatus           from '../../components/status';
-import { favourite, reblog }    from '../../actions/interactions';
-import { replyCompose }         from '../../actions/compose';
-import { selectStatus }         from '../../reducers/timelines';
+import { connect }           from 'react-redux';
+import PureRenderMixin       from 'react-addons-pure-render-mixin';
+import ImmutablePropTypes    from 'react-immutable-proptypes';
+import { fetchStatus }       from '../../actions/statuses';
+import Immutable             from 'immutable';
+import EmbeddedStatus        from '../../components/status';
+import DetailedStatus        from './components/detailed_status';
+import ActionBar             from './components/action_bar';
+import { favourite, reblog } from '../../actions/interactions';
+import { replyCompose }      from '../../actions/compose';
+import { selectStatus }      from '../../reducers/timelines';
 
 function selectStatuses(state, ids) {
   return ids.map(id => selectStatus(state, id)).filterNot(status => status === null);
@@ -69,7 +71,8 @@ const Status = React.createClass({
       <div style={{ overflowY: 'scroll', flex: '1 1 auto' }} className='scrollable'>
         <div>{this.renderChildren(ancestors)}</div>
 
-        <EmbeddedStatus status={status} onReply={this.handleReplyClick} onFavourite={this.handleFavouriteClick} onReblog={this.handleReblogClick} />
+        <DetailedStatus status={status} />
+        <ActionBar status={status} onReply={this.handleReplyClick} onFavourite={this.handleFavouriteClick} onReblog={this.handleReblogClick} />
 
         <div>{this.renderChildren(descendants)}</div>
       </div>
diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss
index 409ba31f8..cf3dc8397 100644
--- a/app/assets/stylesheets/components.scss
+++ b/app/assets/stylesheets/components.scss
@@ -82,6 +82,13 @@
   }
 }
 
+.detailed-status {
+  .status__content {
+    font-size: 19px;
+    line-height: 24px;
+  }
+}
+
 .reply-indicator__content {
   color: #282c37;
   font-size: 14px;
@@ -91,7 +98,7 @@
   }
 }
 
-.status__display-name, .status__relative-time {
+.status__display-name, .status__relative-time, .detailed-status__display-name, .detailed-status__datetime {
   text-decoration: none;
 }
 
@@ -101,7 +108,7 @@
   }
 }
 
-.status__display-name, .reply-indicator__display-name {
+.status__display-name, .reply-indicator__display-name, .detailed-status__display-name {
   &:hover {
     strong {
       text-decoration: underline;
@@ -109,7 +116,21 @@
   }
 }
 
-.status__relative-time {
+.detailed-status__display-name {
+  color: #d9e1e8;
+  line-height: 24px;
+
+  strong, span {
+    display: block;
+  }
+
+  strong {
+    font-size: 16px;
+    color: #fff;
+  }
+}
+
+.status__relative-time, .detailed-status__datetime {
   &:hover {
     text-decoration: underline;
   }
diff --git a/app/models/user.rb b/app/models/user.rb
index 066e376f4..d4361ffa1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -10,7 +10,8 @@ class User < ApplicationRecord
 
   scope :prolific, -> { joins('inner join statuses on statuses.account_id = users.account_id').select('users.*, count(statuses.id) as statuses_count').group('users.id').order('statuses_count desc') }
   scope :recent,   -> { order('created_at desc') }
-
+  scope :admins,   -> { where(admin: true) }
+  
   def admin?
     self.admin
   end