/* global $ */ import React, { PropTypes, Component } from 'react' import { Link } from 'react-router' import MetacodeSelect from '../MetacodeSelect' import Permission from './Permission' import Follow from './Follow' class Links extends Component { constructor(props) { super(props) this.state = { showMetacodeSelect: false } } handleMetacodeSelect = metacodeId => { this.setState({ showMetacodeSelect: false }) this.props.updateTopic({ metacode_id: metacodeId }) // this needs to trigger a redraw of the canvas, // which it currently does using backbone. If backbone comes out, make sure it still does } handleMetacodeBarClick = () => { if (this.state.showMetacodeTitle) { this.setState({ showMetacodeSelect: !this.state.showMetacodeSelect }) } } render = () => { const { topic, onTopicFollow, ActiveMapper } = this.props const authorizedToEdit = topic.authorizeToEdit(ActiveMapper) const authorizedPermissionChange = topic.authorizePermissionChange(ActiveMapper) const metacode = topic.getMetacode() const wrappedTopicFollow = () => onTopicFollow(topic) const isFollowing = topic.isFollowedBy(ActiveMapper) return (