diff --git a/frontend/src/Metamaps/Views/TopicCard.js b/frontend/src/Metamaps/Views/TopicCard.js
index 8c19bbdd..c1814f68 100644
--- a/frontend/src/Metamaps/Views/TopicCard.js
+++ b/frontend/src/Metamaps/Views/TopicCard.js
@@ -4,6 +4,7 @@ import React from 'react'
import ReactDOM from 'react-dom'
import Active from '../Active'
+import Visualize from '../Visualize'
import ReactTopicCard from '../../components/TopicCard'
@@ -16,16 +17,18 @@ const TopicCard = {
},
populateShowCard: function(topic) {
const self = TopicCard
- const topicCardObj = {
- topic: topic,
- ActiveMapper: Active.Mapper,
- updateTopic: obj => {
- topic.save(obj, { success: topic => self.populateShowCard(topic) })
- },
- metacodeSets: self.metacodeSets
- }
ReactDOM.render(
- React.createElement(ReactTopicCard, topicCardObj),
+ React.createElement(ReactTopicCard, {
+ topic: topic,
+ ActiveMapper: Active.Mapper,
+ updateTopic: obj => {
+ topic.save(obj, { success: topic => self.populateShowCard(topic) })
+ },
+ metacodeSets: self.metacodeSets,
+ redrawCanvas: () => {
+ visualize.mGraph.plot()
+ }
+ }),
document.getElementById('showcard')
)
diff --git a/frontend/src/components/TopicCard/Attachments.js b/frontend/src/components/TopicCard/Attachments.js
index 5769f420..94f60897 100644
--- a/frontend/src/components/TopicCard/Attachments.js
+++ b/frontend/src/components/TopicCard/Attachments.js
@@ -41,11 +41,7 @@ class Attachments extends Component {
if (!hasAttachment && !authorizedToEdit) return null
- const embedlyLinkLoaded = 'TODO how to get this value'
-
- const className = hasAttachment
- ? `embeds ${embedlyLinkLoaded ? '' : 'nonEmbedlyLink'}`
- : 'attachments'
+ const className = hasAttachment ? 'embeds' : 'attachments'
return (
diff --git a/frontend/src/components/TopicCard/Links.js b/frontend/src/components/TopicCard/Links.js
index 659beb90..02fd7281 100644
--- a/frontend/src/components/TopicCard/Links.js
+++ b/frontend/src/components/TopicCard/Links.js
@@ -5,9 +5,6 @@ import React, { PropTypes, Component } from 'react'
import MetacodeSelect from '../MetacodeSelect'
import Permission from './Permission'
-// TODO use a callback instead of an import
-import Visualize from '../../Metamaps/Visualize'
-
class Links extends Component {
constructor(props) {
super(props)
@@ -27,7 +24,7 @@ class Links extends Component {
this.props.updateTopic({
metacode_id: metacodeId
})
- Visualize.mGraph.plot()
+ this.props.redrawCanvas()
}
toggleShowMoreMaps = e => {
@@ -149,7 +146,8 @@ Links.propTypes = {
icon_path: PropTypes.string, // url
name: PropTypes.string
}))
- }))
+ })),
+ redrawCanvas: PropTypes.func
}
export default Links
diff --git a/frontend/src/components/TopicCard/Permission.js b/frontend/src/components/TopicCard/Permission.js
index cc4e48db..d92ad72c 100644
--- a/frontend/src/components/TopicCard/Permission.js
+++ b/frontend/src/components/TopicCard/Permission.js
@@ -3,7 +3,6 @@ import React, { PropTypes, Component } from 'react'
// TODO how do we make it so that clicking elsewhere on the topic
// card cancels this
class Permission extends Component {
-
constructor(props) {
super(props)
this.state = {
diff --git a/frontend/src/components/TopicCard/index.js b/frontend/src/components/TopicCard/index.js
index 3c146ef2..c2183d77 100644
--- a/frontend/src/components/TopicCard/index.js
+++ b/frontend/src/components/TopicCard/index.js
@@ -10,7 +10,6 @@ class ReactTopicCard extends Component {
const { topic, ActiveMapper } = this.props
const authorizedToEdit = topic.authorizeToEdit(ActiveMapper)
const hasAttachment = topic.get('link') && topic.get('link') !== ''
- const topicId = topic.isNew() ? topic.cid : topic.id // TODO should we be using cid here???
let classname = 'permission'
if (authorizedToEdit) {
@@ -22,7 +21,7 @@ class ReactTopicCard extends Component {
return (