import React from 'react' const inmaps = (topic) => { const inmapsArray = topic.get('inmaps') || [] const inmapsLinks = topic.get('inmapsLinks') || [] let html = '' if (inmapsArray.length < 6) { for (let i = 0; i < inmapsArray.length; i++) { const url = '/maps/' + inmapsLinks[i] html += '
  • ' + inmapsArray[i] + '
  • ' } } else { for (let i = 0; i < 5; i++) { const url = '/maps/' + inmapsLinks[i] html += '
  • ' + inmapsArray[i] + '
  • ' } const extra = inmapsArray.length - 5 html += '
  • See ' + extra + ' more...
  • ' for (let i = 5; i < inmapsArray.length; i++) { const url = '/maps/' + inmapsLinks[i] html += '
  • ' + inmapsArray[i] + '
  • ' } } return html } const Links = (props) => { const { topic } = props const topicId = topic.isNew() ? topic.cid : topic.id // TODO should we really be using cid here?!? const permission = topic.get('permission') // the code for this is stored in /views/main/_metacodeOptions.html.erb const metacodeSelectHTML = $('#metacodeOptions').html() return (
    {topic.getMetacode().get('name')}
    {topic.get('user_name')}
    {topic.get('map_count').toString()}
    Click to see which maps topic appears on
      {inmaps(props.topic)}
    {topic.get('synapse_count').toString()}
    Click to see this topics synapses
    ) } /* * Links.propTypes = { * topic: PropTypes.object, // backbone object * } */ export default Links