diff-message.js 867 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* jshint ignore:start */
  2. import React from 'react';
  3. export default function(props) {
  4. const { diffSize, applyDiff } = props;
  5. if (diffSize === 0) return null;
  6. return (
  7. <li className="list-group-item threads-diff-message">
  8. <button
  9. type="button"
  10. className="btn btn-block btn-default"
  11. onClick={applyDiff}
  12. >
  13. <span className="material-icon">
  14. cached
  15. </span>
  16. <span className="diff-message">
  17. {getMessage(diffSize)}
  18. </span>
  19. </button>
  20. </li>
  21. );
  22. }
  23. export function getMessage(diffSize) {
  24. const message = ngettext(
  25. "There is %(threads)s new or updated thread. Click this message to show it.",
  26. "There are %(threads)s new or updated threads. Click this message to show them.",
  27. diffSize);
  28. return interpolate(message, {
  29. threads: diffSize
  30. }, true);
  31. }