diff options
author | ThibG <thib@sitedethib.com> | 2018-05-16 20:17:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 20:17:08 +0200 |
commit | 80aad16e1035a72fec1af56aaac458a35e1f02c5 (patch) | |
tree | 3553dbe64377e08ca4ed2a2db62a487472bf8405 /app/javascript/flavours/glitch/features/composer | |
parent | 9712d59dda848a7bc7fd9edb814c16717aa9ba6d (diff) | |
parent | 784712791da8c7d21afa62a3bf6a8fdac8c27a80 (diff) |
Merge pull request #405 from ThibG/glitch-soc/features/dm-from-menu
[Glitch] Feature: Direct message from menu
Diffstat (limited to 'app/javascript/flavours/glitch/features/composer')
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/direct_warning/index.js | 49 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/index.js | 2 |
2 files changed, 51 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/direct_warning/index.js b/app/javascript/flavours/glitch/features/composer/direct_warning/index.js new file mode 100644 index 000000000..804c6538b --- /dev/null +++ b/app/javascript/flavours/glitch/features/composer/direct_warning/index.js @@ -0,0 +1,49 @@ +import React from 'react'; +import Motion from 'flavours/glitch/util/optional_motion'; +import spring from 'react-motion/lib/spring'; +import { defineMessages, FormattedMessage } from 'react-intl'; + +// This is the spring used with our motion. +const motionSpring = spring(1, { damping: 35, stiffness: 400 }); + +// Messages. +const messages = defineMessages({ + disclaimer: { + defaultMessage: 'This toot will only be sent to all the mentioned users. However, the operators of your instance and any receiving instances may see this message.', + id: 'compose_form.direct_message_warning', + }, +}); + +// The component. +export default function ComposerDirectWarning () { + return ( + <Motion + defaultStyle={{ + opacity: 0, + scaleX: 0.85, + scaleY: 0.75, + }} + style={{ + opacity: motionSpring, + scaleX: motionSpring, + scaleY: motionSpring, + }} + > + {({ opacity, scaleX, scaleY }) => ( + <div + className='composer--warning' + style={{ + opacity: opacity, + transform: `scale(${scaleX}, ${scaleY})`, + }} + > + <FormattedMessage + {...messages.disclaimer} + /> + </div> + )} + </Motion> + ); +} + +ComposerDirectWarning.propTypes = {}; diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index 3aa283628..de85340a3 100644 --- a/app/javascript/flavours/glitch/features/composer/index.js +++ b/app/javascript/flavours/glitch/features/composer/index.js @@ -39,6 +39,7 @@ import ComposerTextarea from './textarea'; import ComposerUploadForm from './upload_form'; import ComposerWarning from './warning'; import ComposerHashtagWarning from './hashtag_warning'; +import ComposerDirectWarning from './direct_warning'; // Utils. import { countableText } from 'flavours/glitch/util/counter'; @@ -326,6 +327,7 @@ class Composer extends React.Component { onSubmit={handleSubmit} text={spoilerText} /> + {privacy === 'direct' ? <ComposerDirectWarning /> : null} {privacy === 'private' && amUnlocked ? <ComposerWarning /> : null} {privacy !== 'public' && APPROX_HASHTAG_RE.test(text) ? <ComposerHashtagWarning /> : null} {replyContent ? ( |