2018-03-29 21:13:47 +02:00
|
|
|
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';
|
2018-09-25 14:46:14 +02:00
|
|
|
import { termsLink} from 'flavours/glitch/util/backend_links';
|
2018-03-29 21:13:47 +02:00
|
|
|
|
|
|
|
// This is the spring used with our motion.
|
|
|
|
const motionSpring = spring(1, { damping: 35, stiffness: 400 });
|
|
|
|
|
|
|
|
// Messages.
|
|
|
|
const messages = defineMessages({
|
|
|
|
disclaimer: {
|
2018-05-24 18:11:43 +02:00
|
|
|
defaultMessage: 'This toot will only be sent to all the mentioned users.',
|
2018-03-29 21:13:47 +02:00
|
|
|
id: 'compose_form.direct_message_warning',
|
|
|
|
},
|
2018-05-24 18:11:43 +02:00
|
|
|
learn_more: {
|
|
|
|
defaultMessage: 'Learn more',
|
|
|
|
id: 'compose_form.direct_message_warning_learn_more'
|
|
|
|
}
|
2018-03-29 21:13:47 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// 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})`,
|
|
|
|
}}
|
|
|
|
>
|
2018-05-24 18:11:43 +02:00
|
|
|
<span>
|
2018-09-25 14:46:14 +02:00
|
|
|
<FormattedMessage {...messages.disclaimer} />
|
|
|
|
{ termsLink !== undefined && <a href={termsLink} target='_blank'><FormattedMessage {...messages.learn_more} /></a> }
|
2018-05-24 18:11:43 +02:00
|
|
|
</span>
|
2018-03-29 21:13:47 +02:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</Motion>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ComposerDirectWarning.propTypes = {};
|