diff --git a/app/components/Inspector.jsx b/app/components/Inspector.jsx index 215b7afa..48f4b560 100644 --- a/app/components/Inspector.jsx +++ b/app/components/Inspector.jsx @@ -1,6 +1,6 @@ -import R from 'ramda'; import React from 'react'; import Widgets from './InspectorWidgets'; +import * as ENTITIES from '../constants/entities'; const styles = { container: { @@ -48,21 +48,23 @@ class Inspector extends React.Component { } else if (selection.length === 1) { const entity = (selection[0].entity); switch (entity) { - default: - case 'Node': + case ENTITIES.NODE: this.widgets = [ new Widgets.HintWidget({ text: 'There are no properties for the selected node.', }), ]; break; - case 'Link': + case ENTITIES.LINK: this.widgets = [ new Widgets.HintWidget({ text: 'Links have not any properties.', }), ]; break; + default: + this.widgets = []; + break; } } else { this.widgets = [ diff --git a/app/constants/entities.js b/app/constants/entities.js new file mode 100644 index 00000000..42e7ab4b --- /dev/null +++ b/app/constants/entities.js @@ -0,0 +1,3 @@ +export const NODE = 'Node'; +export const LINK = 'Link'; +export const PIN = 'Pin'; diff --git a/app/reducers/editor.js b/app/reducers/editor.js index bf5aedc2..ad06fe67 100644 --- a/app/reducers/editor.js +++ b/app/reducers/editor.js @@ -7,6 +7,7 @@ import { EDITOR_SET_MODE, EDITOR_SET_SELECTED_NODETYPE, } from '../actionTypes'; +import * as ENTITIES from '../constants/entities'; const addSelection = (entityName, action, state) => { const select = { @@ -25,9 +26,9 @@ export const editor = (state = {}, action) => { linkingPin: null, }); case EDITOR_SELECT_NODE: - return addSelection('Node', action, state); + return addSelection(ENTITIES.NODE, action, state); case EDITOR_SELECT_LINK: - return addSelection('Link', action, state); + return addSelection(ENTITIES.LINK, action, state); case EDITOR_SELECT_PIN: return R.set(R.lensProp('linkingPin'), action.payload.id, state); case EDITOR_SET_MODE: