You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.5 KiB

  1. import React from 'react';
  2. import Motion from 'flavours/glitch/util/optional_motion';
  3. import spring from 'react-motion/lib/spring';
  4. import { defineMessages, FormattedMessage } from 'react-intl';
  5. import { profileLink } from 'flavours/glitch/util/backend_links';
  6. // This is the spring used with our motion.
  7. const motionSpring = spring(1, { damping: 35, stiffness: 400 });
  8. // Messages.
  9. const messages = defineMessages({
  10. disclaimer: {
  11. defaultMessage: 'Your account is not {locked}. Anyone can follow you to view your follower-only posts.',
  12. id: 'compose_form.lock_disclaimer',
  13. },
  14. locked: {
  15. defaultMessage: 'locked',
  16. id: 'compose_form.lock_disclaimer.lock',
  17. },
  18. });
  19. // The component.
  20. export default function ComposerWarning () {
  21. let lockedLink = <FormattedMessage {...messages.locked} />;
  22. if (profileLink !== undefined) {
  23. lockedLink = <a href={profileLink}>{lockedLink}</a>;
  24. }
  25. return (
  26. <Motion
  27. defaultStyle={{
  28. opacity: 0,
  29. scaleX: 0.85,
  30. scaleY: 0.75,
  31. }}
  32. style={{
  33. opacity: motionSpring,
  34. scaleX: motionSpring,
  35. scaleY: motionSpring,
  36. }}
  37. >
  38. {({ opacity, scaleX, scaleY }) => (
  39. <div
  40. className='composer--warning'
  41. style={{
  42. opacity: opacity,
  43. transform: `scale(${scaleX}, ${scaleY})`,
  44. }}
  45. >
  46. <FormattedMessage
  47. {...messages.disclaimer}
  48. values={{ locked: lockedLink }}
  49. />
  50. </div>
  51. )}
  52. </Motion>
  53. );
  54. }
  55. ComposerWarning.propTypes = {};