The code powering m.abunchtell.com https://m.abunchtell.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

29 рядки
964 B

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { shortNumberFormat } from 'mastodon/utils/numbers';
  4. import { FormattedMessage } from 'react-intl';
  5. export default class AutosuggestHashtag extends React.PureComponent {
  6. static propTypes = {
  7. tag: PropTypes.shape({
  8. name: PropTypes.string.isRequired,
  9. url: PropTypes.string,
  10. history: PropTypes.array,
  11. }).isRequired,
  12. };
  13. render () {
  14. const { tag } = this.props;
  15. const weeklyUses = tag.history && shortNumberFormat(tag.history.reduce((total, day) => total + (day.uses * 1), 0));
  16. return (
  17. <div className='autosuggest-hashtag'>
  18. <div className='autosuggest-hashtag__name'>#<strong>{tag.name}</strong></div>
  19. {tag.history !== undefined && <div className='autosuggest-hashtag__uses'><FormattedMessage id='autosuggest_hashtag.per_week' defaultMessage='{count} per week' values={{ count: weeklyUses }} /></div>}
  20. </div>
  21. );
  22. }
  23. }