import { h } from 'preact'; import PropTypes from 'prop-types'; import { articlePropTypes } from '../src/components/common-prop-types/article-prop-types'; import { CommentsCount, ContentTitle, OrganizationHeadline, PublishDate, ReadingTime, SaveButton, SearchSnippet, TagList, ReactionsCount, } from './components'; import { PodcastArticle } from './PodcastArticle'; /* global timeAgo */ export const Article = ({ article, currentTag, isBookmarked, reactionsIcon, commentsIcon, videoIcon, bookmarkClick, }) => { if (article && article.type_of === 'podcast_episodes') { return ; } const timeAgoIndicator = timeAgo({ oldTimeInSeconds: article.published_at_int, formatter: x => x, }) return (
{article.cloudinary_video_url && (
video camera {article.video_duration_in_minutes}
)}
{`${article.user.username}
{article.class_name === 'Article' && ( // eslint-disable-next-line no-underscore-dangle )}

{filterXSS( article.class_name === 'User' ? article.user.username : article.user.name, )} {article.readable_publish_date ? '・' : ''} {article.readable_publish_date && ( )} {article.published_at_int ? ( {timeAgoIndicator.length > 0 ? `(${timeAgoIndicator})`: '' } ) : null}

{article.class_name !== 'User' && ( )} {article.class_name !== 'User' && ( )} {article.class_name === 'Article' && ( )}
); }; Article.defaultProps = { currentTag: null, isBookmarked: false, }; Article.propTypes = { article: articlePropTypes.isRequired, currentTag: PropTypes.string, isBookmarked: PropTypes.bool, reactionsIcon: PropTypes.string.isRequired, commentsIcon: PropTypes.string.isRequired, videoIcon: PropTypes.string.isRequired, bookmarkClick: PropTypes.func.isRequired, };