diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-25 14:20:29 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-25 14:20:29 +0200 |
commit | 15f51dbf8c19d1072d873c3b92b5a638035728a1 (patch) | |
tree | fcba052482b155ffe3985cfe941e27b221d04f2d /app/assets/javascripts/components | |
parent | fc7b982b67996bb34e801866eaace5109677c08e (diff) |
Better styling for selected status in detailed view
Diffstat (limited to 'app/assets/javascripts/components')
4 files changed, 96 insertions, 11 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> |