// @ts-check import React from 'react'; import { Sparklines, SparklinesCurve } from 'react-sparklines'; // @ts-expect-error import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { Link } from 'react-router-dom'; // @ts-expect-error import ShortNumber from 'mastodon/components/short_number'; // @ts-expect-error import Skeleton from 'mastodon/components/skeleton'; import classNames from 'classnames'; class SilentErrorBoundary extends React.Component { static propTypes = { children: PropTypes.node, }; state = { error: false, }; componentDidCatch() { this.setState({ error: true }); } render() { if (this.state.error) { return null; } return this.props.children; } } /** * Used to render counter of how much people are talking about hashtag * * @type {(displayNumber: JSX.Element, pluralReady: number) => JSX.Element} */ export const accountsCountRenderer = (displayNumber, pluralReady) => ( {displayNumber}, days: 2, }} /> ); // @ts-expect-error export const ImmutableHashtag = ({ hashtag }) => ( day.get('uses')).toArray()} /> ); ImmutableHashtag.propTypes = { hashtag: ImmutablePropTypes.map.isRequired, }; // @ts-expect-error const Hashtag = ({ name, to, people, uses, history, className, description, withGraph }) => (
{name ? #{name} : } {description ? ( {description} ) : ( typeof people !== 'undefined' ? : )}
{typeof uses !== 'undefined' && (
)} {withGraph && (
{/* @ts-expect-error */} 0)}> {/* @ts-expect-error */}
)}
); Hashtag.propTypes = { name: PropTypes.string, to: PropTypes.string, people: PropTypes.number, description: PropTypes.node, uses: PropTypes.number, history: PropTypes.arrayOf(PropTypes.number), className: PropTypes.string, withGraph: PropTypes.bool, }; Hashtag.defaultProps = { withGraph: true, }; export default Hashtag;