From 15f51dbf8c19d1072d873c3b92b5a638035728a1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 25 Sep 2016 14:20:29 +0200 Subject: Better styling for selected status in detailed view --- .../javascripts/components/components/status.jsx | 2 +- .../features/status/components/action_bar.jsx | 30 +++++++++++++ .../features/status/components/detailed_status.jsx | 52 ++++++++++++++++++++++ .../components/features/status/index.jsx | 23 +++++----- 4 files changed, 96 insertions(+), 11 deletions(-) create mode 100644 app/assets/javascripts/components/features/status/components/action_bar.jsx create mode 100644 app/assets/javascripts/components/features/status/components/detailed_status.jsx (limited to 'app/assets/javascripts') 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({
- +
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 ( +
+
+
+
+
+ ); + } + +}); + +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 ( +
+ +
+ +
+ + + +
+ {moment(status.get('created_at')).format('HH:mm, DD MMM Y')} · {status.get('reblogs_count')} · {status.get('favourites_count')} +
+
+ ); + } + +}); + +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({
{this.renderChildren(ancestors)}
- + +
{this.renderChildren(descendants)}
-- cgit