diff --git a/packages/xod-client/src/core/styles/components/Node.scss b/packages/xod-client/src/core/styles/components/Node.scss index 36532a97..423f64dd 100644 --- a/packages/xod-client/src/core/styles/components/Node.scss +++ b/packages/xod-client/src/core/styles/components/Node.scss @@ -104,6 +104,9 @@ &.error { stroke: $color-datatype-dead; } + &.generic { + stroke: $color-node-outline; + } } .nodeLabelContainer { diff --git a/packages/xod-client/src/project/components/nodeParts/JumperNodeBody.jsx b/packages/xod-client/src/project/components/nodeParts/JumperNodeBody.jsx index a9d05467..36370069 100644 --- a/packages/xod-client/src/project/components/nodeParts/JumperNodeBody.jsx +++ b/packages/xod-client/src/project/components/nodeParts/JumperNodeBody.jsx @@ -2,32 +2,28 @@ import R from 'ramda'; import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { foldEither } from 'xod-func-tools'; +import { foldEither, foldMaybe, maybePath } from 'xod-func-tools'; import { NODE_CORNER_RADIUS } from '../../nodeLayout'; const INPUT_PINKEY = '__in__'; const OUTPUT_PINKEY = '__out__'; +const getDeducedTypeOfPin = R.curry((pinkey, pins) => + R.compose( + foldMaybe('generic', R.identity), + R.map(foldEither('error', R.identity)), + maybePath([INPUT_PINKEY, 'deducedType']) + )(pins) +); + const JumperNodeBody = ({ pins }) => { const inConnected = R.path([INPUT_PINKEY, 'isConnected'], pins); const outConnected = R.path([OUTPUT_PINKEY, 'isConnected'], pins); const type = R.cond([ - [ - () => inConnected, - R.compose( - foldEither('error', R.identity), - R.path([INPUT_PINKEY, 'deducedType']) - ), - ], - [ - () => outConnected, - R.compose( - foldEither('error', R.identity), - R.path([OUTPUT_PINKEY, 'deducedType']) - ), - ], - [R.T, R.always('')], + [() => inConnected, getDeducedTypeOfPin(INPUT_PINKEY)], + [() => outConnected, getDeducedTypeOfPin(OUTPUT_PINKEY)], + [R.T, R.always('generic')], ])(pins); const isConnected =