From e763931397eea4887b20949aa2d58a7ade87f356 Mon Sep 17 00:00:00 2001 From: Evgeny Kochetkov Date: Wed, 6 Feb 2019 18:42:39 +0300 Subject: [PATCH] feat(xod-client): special UI for tweak nodes --- .../src/project/components/Node.jsx | 2 ++ .../components/nodeParts/ConstantNodeBody.jsx | 2 +- .../components/nodeParts/TweakNodeBody.jsx | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 packages/xod-client/src/project/components/nodeParts/TweakNodeBody.jsx diff --git a/packages/xod-client/src/project/components/Node.jsx b/packages/xod-client/src/project/components/Node.jsx index 0d31aebc..7e6ed3fb 100644 --- a/packages/xod-client/src/project/components/Node.jsx +++ b/packages/xod-client/src/project/components/Node.jsx @@ -11,6 +11,7 @@ import { isPinSelected } from '../../editor/utils'; import RegularNodeBody from './nodeParts/RegularNodeBody'; import WatchNodeBody from './nodeParts/WatchNodeBody'; +import TweakNodeBody from './nodeParts/TweakNodeBody'; import TerminalNodeBody from './nodeParts/TerminalNodeBody'; import ConstantNodeBody from './nodeParts/ConstantNodeBody'; import BusNodeBody from './nodeParts/BusNodeBody'; @@ -114,6 +115,7 @@ class Node extends React.Component { [XP.isTerminalPatchPath, () => ], [XP.isWatchPatchPath, () => ], [XP.isConstantNodeType, () => ], + [XP.isTweakPath, () => ], [isBusNodeType, () => ], [XP.isJumperPatchPath, () => ], [R.T, () => ], diff --git a/packages/xod-client/src/project/components/nodeParts/ConstantNodeBody.jsx b/packages/xod-client/src/project/components/nodeParts/ConstantNodeBody.jsx index cca556e3..af9b8e75 100644 --- a/packages/xod-client/src/project/components/nodeParts/ConstantNodeBody.jsx +++ b/packages/xod-client/src/project/components/nodeParts/ConstantNodeBody.jsx @@ -6,7 +6,7 @@ import { noop } from 'xod-func-tools'; import RegularNodeBody from './RegularNodeBody'; -const getConstantValue = ({ pins }) => +export const getConstantValue = ({ pins }) => R.compose(R.prop('value'), R.head, R.values)(pins); const ConstantNodeBody = props => ( diff --git a/packages/xod-client/src/project/components/nodeParts/TweakNodeBody.jsx b/packages/xod-client/src/project/components/nodeParts/TweakNodeBody.jsx new file mode 100644 index 00000000..ee671653 --- /dev/null +++ b/packages/xod-client/src/project/components/nodeParts/TweakNodeBody.jsx @@ -0,0 +1,25 @@ +import * as R from 'ramda'; +import React from 'react'; +import PropTypes from 'prop-types'; +import * as XP from 'xod-project'; +import { noop } from 'xod-func-tools'; + +import WatchNodeBody from './WatchNodeBody'; +import { getConstantValue } from './ConstantNodeBody'; + +const TweakNodeBody = props => ( + +); + +TweakNodeBody.defaultProps = { + onVariadicHandleDown: noop, +}; + +TweakNodeBody.propTypes = R.merge(WatchNodeBody.propTypes, { + pins: PropTypes.any, +}); + +export default TweakNodeBody;