diff --git a/frontend/src/components/common/ContextMenu.js b/frontend/src/components/common/ContextMenu.js index 273672b5..b5431c56 100644 --- a/frontend/src/components/common/ContextMenu.js +++ b/frontend/src/components/common/ContextMenu.js @@ -76,96 +76,156 @@ class ContextMenu extends Component { } } - render () { - const { contextNode, contextPos, contextOnMetacodeSelect, metacodeSets, - contextDelete, contextHide, contextRemove, contextCenterOn, - contextPopoutTopic, contextSiblingsData, contextFetchSiblings, - currentUser, contextPopulateSiblings, contextFetchingSiblingsData, - topicId, map, mapId, contextUpdatePermissions } = this.props + hide = () => { + const { contextHide } = this.props + return
  • +
    Hide until refresh +
    Ctrl+H
    +
  • + } + remove = () => { + const { contextRemove, map, currentUser } = this.props const canEditMap = map && map.authorizeToEdit(currentUser) - const positionData = this.getPositionData() - const style = Object.assign({}, {position: 'absolute'}, positionData.pos) + if (!canEditMap) { + return null + } + return
  • +
    Remove from map +
    Ctrl+M
    +
  • + } + + delete = () => { + const { contextDelete, map, currentUser } = this.props + const canEditMap = map && map.authorizeToEdit(currentUser) + if (!canEditMap) { + return null + } + return
  • +
    Delete +
    Ctrl+D
    +
  • + } + + center = () => { + const { contextCenterOn, contextNode, topicId } = this.props + if (!(contextNode && topicId)) { + return null + } + return
  • contextCenterOn(contextNode.id)}> +
    Center this topic +
    Alt+E
    +
  • + } + + popout = () => { + const { contextPopoutTopic, contextNode } = this.props + if (!contextNode) { + return null + } + return
  • contextPopoutTopic(contextNode.id)}> +
    Open in new tab +
  • + } + + permission = () => { + const { currentUser, contextUpdatePermissions } = this.props + if (!currentUser) { + return null + } + return
  • +
    Change permissions + +
    +
  • + } + + metacode = () => { + const { metacodeSets, contextOnMetacodeSelect, + currentUser, contextNode } = this.props + if (!currentUser) { + return null + } + return
  • +
    Change metacode +
    + { + contextOnMetacodeSelect(contextNode && contextNode.id, id) + }} + metacodeSets={metacodeSets} /> +
    +
    +
  • + } + + siblings = () => { + const { contextPopulateSiblings, contextFetchSiblings, + contextSiblingsData, contextFetchingSiblingsData, + topicId, contextNode } = this.props const populateSiblings = () => { if (!this.state.populateSiblingsSent) { contextPopulateSiblings(contextNode.id) this.setState({populateSiblingsSent: true}) } } + if (!(contextNode && topicId)) { + return null + } + return
  • +
    Reveal siblings + +
    +
  • + } + + render () { + const { contextNode, currentUser, topicId } = this.props + const positionData = this.getPositionData() + const style = Object.assign({}, {position: 'absolute'}, positionData.pos) + const showSpacer = currentUser || (contextNode && topicId) return
    }