import React, { PropTypes, Component } from 'react' import Title from './Title' import Links from './Links' import Desc from './Desc' import Attachments from './Attachments' import Follow from './Follow' import Util from '../../Metamaps/Util' class ReactTopicCard extends Component { render = () => { const { currentUser, onTopicFollow, updateTopic } = this.props const topic = this.props.openTopic if (!topic) return null const wrappedUpdateTopic = obj => updateTopic(topic, obj) const wrappedTopicFollow = () => onTopicFollow(topic) const authorizedToEdit = topic.authorizeToEdit(currentUser) const isFollowing = topic.isFollowedBy(currentUser) const hasAttachment = topic.get('link') && topic.get('link') !== '' let classname = 'permission' if (authorizedToEdit) { classname += ' canEdit' } else { classname += ' cannotEdit' } if (topic.authorizePermissionChange(currentUser)) classname += ' yourTopic' return (