Merge branch 'master' of https://github.com/blackle/mastodon into blackle-master
This commit is contained in:
commit
2a7602cad4
16 changed files with 144 additions and 18 deletions
|
@ -31,7 +31,7 @@ const IconButton = React.createClass({
|
|||
e.preventDefault();
|
||||
|
||||
if (!this.props.disabled) {
|
||||
this.props.onClick();
|
||||
this.props.onClick(e);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ const Status = React.createClass({
|
|||
onOpenMedia: React.PropTypes.func,
|
||||
onBlock: React.PropTypes.func,
|
||||
me: React.PropTypes.number,
|
||||
boostModal: React.PropTypes.bool,
|
||||
muted: React.PropTypes.bool
|
||||
},
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ const StatusActionBar = React.createClass({
|
|||
this.props.onFavourite(this.props.status);
|
||||
},
|
||||
|
||||
handleReblogClick () {
|
||||
this.props.onReblog(this.props.status);
|
||||
handleReblogClick (e) {
|
||||
this.props.onReblog(this.props.status, e);
|
||||
},
|
||||
|
||||
handleDeleteClick () {
|
||||
|
|
|
@ -26,7 +26,8 @@ const makeMapStateToProps = () => {
|
|||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
status: getStatus(state, props.id),
|
||||
me: state.getIn(['meta', 'me'])
|
||||
me: state.getIn(['meta', 'me']),
|
||||
boostModal: state.getIn(['meta', 'boost_modal'])
|
||||
});
|
||||
|
||||
return mapStateToProps;
|
||||
|
@ -38,11 +39,19 @@ const mapDispatchToProps = (dispatch) => ({
|
|||
dispatch(replyCompose(status, router));
|
||||
},
|
||||
|
||||
onReblog (status) {
|
||||
onModalReblog (status) {
|
||||
dispatch(reblog(status));
|
||||
},
|
||||
|
||||
onReblog (status, e) {
|
||||
if (status.get('reblogged')) {
|
||||
dispatch(unreblog(status));
|
||||
} else {
|
||||
dispatch(reblog(status));
|
||||
if (e.altKey || !this.boostModal) {
|
||||
this.onModalReblog(status);
|
||||
} else {
|
||||
dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ const ActionBar = React.createClass({
|
|||
this.props.onReply(this.props.status);
|
||||
},
|
||||
|
||||
handleReblogClick () {
|
||||
this.props.onReblog(this.props.status);
|
||||
handleReblogClick (e) {
|
||||
this.props.onReblog(this.props.status, e);
|
||||
},
|
||||
|
||||
handleFavouriteClick () {
|
||||
|
|
|
@ -38,7 +38,8 @@ const makeMapStateToProps = () => {
|
|||
status: getStatus(state, Number(props.params.statusId)),
|
||||
ancestorsIds: state.getIn(['timelines', 'ancestors', Number(props.params.statusId)]),
|
||||
descendantsIds: state.getIn(['timelines', 'descendants', Number(props.params.statusId)]),
|
||||
me: state.getIn(['meta', 'me'])
|
||||
me: state.getIn(['meta', 'me']),
|
||||
boostModal: state.getIn(['meta', 'boost_modal'])
|
||||
});
|
||||
|
||||
return mapStateToProps;
|
||||
|
@ -55,7 +56,8 @@ const Status = React.createClass({
|
|||
status: ImmutablePropTypes.map,
|
||||
ancestorsIds: ImmutablePropTypes.list,
|
||||
descendantsIds: ImmutablePropTypes.list,
|
||||
me: React.PropTypes.number
|
||||
me: React.PropTypes.number,
|
||||
boostModal: React.PropTypes.bool
|
||||
},
|
||||
|
||||
mixins: [PureRenderMixin],
|
||||
|
@ -82,11 +84,19 @@ const Status = React.createClass({
|
|||
this.props.dispatch(replyCompose(status, this.context.router));
|
||||
},
|
||||
|
||||
handleReblogClick (status) {
|
||||
handleModalReblog (status) {
|
||||
this.props.dispatch(reblog(status));
|
||||
},
|
||||
|
||||
handleReblogClick (status, e) {
|
||||
if (status.get('reblogged')) {
|
||||
this.props.dispatch(unreblog(status));
|
||||
} else {
|
||||
this.props.dispatch(reblog(status));
|
||||
if (e.altKey || !this.props.boostModal) {
|
||||
this.handleModalReblog(status);
|
||||
} else {
|
||||
this.props.dispatch(openModal('BOOST', { status, onReblog: this.handleModalReblog }));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import IconButton from '../../../components/icon_button';
|
||||
import Button from '../../../components/button';
|
||||
import DetailedStatus from '../../status/components/detailed_status';
|
||||
|
||||
const messages = defineMessages({
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||
reblog: { id: 'status.reblog', defaultMessage: 'Boost' }
|
||||
});
|
||||
|
||||
const closeStyle = {
|
||||
position: 'absolute',
|
||||
top: '4px',
|
||||
right: '4px'
|
||||
};
|
||||
|
||||
const buttonContainerStyle = {
|
||||
textAlign: 'right',
|
||||
padding: '10px'
|
||||
};
|
||||
|
||||
const BoostModal = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
status: ImmutablePropTypes.map.isRequired,
|
||||
onReblog: React.PropTypes.func.isRequired,
|
||||
onClose: React.PropTypes.func.isRequired,
|
||||
intl: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
mixins: [PureRenderMixin],
|
||||
|
||||
handleReblog() {
|
||||
this.props.onReblog(this.props.status);
|
||||
this.props.onClose();
|
||||
},
|
||||
|
||||
handleOpenMedia() {
|
||||
// do nothing"
|
||||
},
|
||||
|
||||
render () {
|
||||
const { status, intl, onClose } = this.props;
|
||||
|
||||
const reblogButton = <span><i className='fa fa-retweet' /> {intl.formatMessage(messages.reblog)}</span>;
|
||||
|
||||
return (
|
||||
<div className='modal-root__modal boost-modal'>
|
||||
<IconButton title={intl.formatMessage(messages.close)} icon='times' onClick={onClose} size={16} style={closeStyle} />
|
||||
<div>
|
||||
<DetailedStatus status={status} onOpenMedia={this.handleOpenMedia} />
|
||||
</div>
|
||||
<div style={buttonContainerStyle}>
|
||||
<Button text={reblogButton} onClick={this.handleReblog} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
export default injectIntl(BoostModal);
|
|
@ -1,9 +1,11 @@
|
|||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
import MediaModal from './media_modal';
|
||||
import BoostModal from './boost_modal';
|
||||
import { TransitionMotion, spring } from 'react-motion';
|
||||
|
||||
const MODAL_COMPONENTS = {
|
||||
'MEDIA': MediaModal
|
||||
'MEDIA': MediaModal,
|
||||
'BOOST': BoostModal
|
||||
};
|
||||
|
||||
const ModalRoot = React.createClass({
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1215,7 +1215,7 @@ a.status__content__spoiler-link {
|
|||
|
||||
@import 'boost';
|
||||
|
||||
button i.fa-retweet {
|
||||
button.icon-button i.fa-retweet {
|
||||
height: 19px;
|
||||
width: 22px;
|
||||
background-position: 0 0;
|
||||
|
@ -1227,7 +1227,7 @@ button i.fa-retweet {
|
|||
}
|
||||
}
|
||||
|
||||
button.active i.fa-retweet {
|
||||
button.icon-button.active i.fa-retweet {
|
||||
transition-duration: 0.9s;
|
||||
background-position: 0 100%;
|
||||
}
|
||||
|
@ -1936,3 +1936,32 @@ button.active i.fa-retweet {
|
|||
max-height: 80vh;
|
||||
}
|
||||
}
|
||||
|
||||
.boost-modal {
|
||||
display: block;
|
||||
|
||||
color: white;
|
||||
background: lighten($color1, 13%);
|
||||
|
||||
max-width: 90vw;
|
||||
width: 480px;
|
||||
|
||||
padding-top: 25px;
|
||||
border-radius: 3px;
|
||||
|
||||
position: relative;
|
||||
|
||||
& .detailed-status {
|
||||
pointer-events: none;
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
& > .icon-button {
|
||||
color: lighten($color1, 40%);
|
||||
|
||||
&:hover, &:active {
|
||||
color: lighten($color1, 60%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue