import React, { PropTypes } from 'react' import ProfileImage from 'boost/components/ProfileImage' import ModeIcon from 'boost/components/ModeIcon' import moment from 'moment' import { IDLE_MODE, CREATE_MODE, EDIT_MODE } from '../actions' export default class ArticleList extends React.Component { render () { let { articles, status } = this.props let articlesEl = articles.map(article => { let tags = Array.isArray(article.Tags) && article.Tags.length > 0 ? article.Tags.map(tag => { return ( #{tag.name} ) }) : ( Not tagged yet ) return (
by {article.User.profileName} {article.status != null ? article.status : moment(article.updatedAt).fromNow()}
{article.status !== 'new' ? article.title : '(New article)'}
{tags}
) }) return (
{ status.mode === 'CREATE_MODE' ? (
{}
'(New article)'
) : null} {articlesEl}
) } } ArticleList.propTypes = { articles: PropTypes.array }