about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/ui
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-04-11 20:43:56 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-04-11 20:43:56 +0200
commit2a7602cad449da3590cb1eac2a86a3e5cc606966 (patch)
treee315f30c6cb4b40b670e9cbd15065851d5f44a33 /app/assets/javascripts/components/features/ui
parentb723ee73fc7d74fd5908eb09a8f6b98e73597c2b (diff)
parent06444bf050a267da7001c2801480c5fae3e1559e (diff)
Merge branch 'master' of https://github.com/blackle/mastodon into blackle-master
Diffstat (limited to 'app/assets/javascripts/components/features/ui')
-rw-r--r--app/assets/javascripts/components/features/ui/components/boost_modal.jsx64
-rw-r--r--app/assets/javascripts/components/features/ui/components/modal_root.jsx4
2 files changed, 67 insertions, 1 deletions
diff --git a/app/assets/javascripts/components/features/ui/components/boost_modal.jsx b/app/assets/javascripts/components/features/ui/components/boost_modal.jsx
new file mode 100644
index 000000000..8b9154183
--- /dev/null
+++ b/app/assets/javascripts/components/features/ui/components/boost_modal.jsx
@@ -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);
diff --git a/app/assets/javascripts/components/features/ui/components/modal_root.jsx b/app/assets/javascripts/components/features/ui/components/modal_root.jsx
index d2ae5e145..e7ac02dde 100644
--- a/app/assets/javascripts/components/features/ui/components/modal_root.jsx
+++ b/app/assets/javascripts/components/features/ui/components/modal_root.jsx
@@ -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({