diff --git a/config/webpack.config.js b/config/webpack.config.js index a0deabc15..40248121d 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -255,7 +255,9 @@ module.exports = { // It is guaranteed to exist because we tweak it in `env.js` process.env.NODE_PATH.split(path.delimiter).filter(Boolean), ), - alias: {}, + alias: { + concaveman: path.join(paths.appSrc, 'utils', 'webShims', 'concavemock.js'), + }, plugins: [ // Prevents users from importing files from outside of src/ (or node_modules/). // This often causes confusion because we only process files within src/ with babel. diff --git a/src/components/StageEditor/Interfaces/NameGenerator.js b/src/components/StageEditor/Interfaces/NameGenerator.js index f66a6f2e7..e70882f99 100644 --- a/src/components/StageEditor/Interfaces/NameGenerator.js +++ b/src/components/StageEditor/Interfaces/NameGenerator.js @@ -1,7 +1,7 @@ import { Name, NodeType, - Form, + FormWithQuickAdd, NameGeneratorPrompts, NodePanels, } from '../sections'; @@ -10,7 +10,7 @@ const NameGenerator = { sections: [ Name, NodeType, - Form, + FormWithQuickAdd, NameGeneratorPrompts, NodePanels, ], diff --git a/src/components/StageEditor/sections/FormWithQuickAdd.js b/src/components/StageEditor/sections/FormWithQuickAdd.js new file mode 100644 index 000000000..f6d0af1e5 --- /dev/null +++ b/src/components/StageEditor/sections/FormWithQuickAdd.js @@ -0,0 +1,58 @@ +import React, { PureComponent } from 'react'; +import { connect } from 'react-redux'; +import { compose } from 'recompose'; +import cx from 'classnames'; +import { Field, formValueSelector } from 'redux-form'; +import Guidance from '../../Guidance'; +import { Toggle } from '../../../ui/components/Fields'; +import Form from './Form'; + +class FormWithQuickAdd extends PureComponent { + render() { + const { + quickAdd, + disabled, + } = this.props; + + const formClasses = cx( + 'stage-editor-section', + { 'stage-editor-section--disabled': disabled }, + ); + + return ( +
+ +
+

Quick Add

+

Should this stage use the quick add function?

+
+ +
+
+
+ { !quickAdd &&
} +
+ ); + } +} + +const mapStateToProps = (state, { form }) => { + const selector = formValueSelector(form.name); + const quickAdd = selector(state, 'quickAdd'); + const nodeType = selector(state, 'subject.type'); + + return { + quickAdd, + disabled: !nodeType, + }; +}; + +export { FormWithQuickAdd }; + +export default compose( + connect(mapStateToProps), +)(FormWithQuickAdd); diff --git a/src/components/StageEditor/sections/index.js b/src/components/StageEditor/sections/index.js index b61689bde..92857df95 100644 --- a/src/components/StageEditor/sections/index.js +++ b/src/components/StageEditor/sections/index.js @@ -3,6 +3,7 @@ export { default as Title } from './Title'; export { default as Name } from './Name'; export { default as NodeType } from './NodeType'; export { default as Form } from './Form'; +export { default as FormWithQuickAdd } from './FormWithQuickAdd'; export { default as NameGeneratorPrompts } from './NameGeneratorPrompts'; export { default as NameGeneratorListPrompts } from './NameGeneratorListPrompts'; export { default as NameGeneratorAutoCompletePrompts } from './NameGeneratorAutoCompletePrompts'; diff --git a/src/locales/en-US.js b/src/locales/en-US.js index 4469ecf91..2735c126d 100644 --- a/src/locales/en-US.js +++ b/src/locales/en-US.js @@ -60,6 +60,20 @@ export default {

), + 'guidance.editor.quickAdd': ( + +

The Quick Add function

+

Using the quick add function allowa your participants to create a node by simply + entering a display label for it and pressing the enter key. The quick add form does not + obscure the node list, and will stay open and focused while the participant types, + providing an ideal environment for quickly listing off names. +

+

This function bypasses the new node form, and no other node attribute data collection is + possible at the time the node is created (although it can of course be collected in future + stages). +

+
+ ), 'guidance.editor.form': (

Choosing a Form

diff --git a/src/network-canvas b/src/network-canvas index 1aee497e1..9faf28234 160000 --- a/src/network-canvas +++ b/src/network-canvas @@ -1 +1 @@ -Subproject commit 1aee497e17883e080fad714d9cf01ae9cb309ba4 +Subproject commit 9faf282348887f1d1d5e1e9c93bd0085fa95b3df diff --git a/src/ui b/src/ui index 42cef8284..c94c23fa7 160000 --- a/src/ui +++ b/src/ui @@ -1 +1 @@ -Subproject commit 42cef8284fb2644b77c2ace66e5ea69111cfb37a +Subproject commit c94c23fa7e23dd2f942de02ebc29d4504e4fb80d diff --git a/src/utils/webShims/concavemock.js b/src/utils/webShims/concavemock.js new file mode 100644 index 000000000..9f0d482cd --- /dev/null +++ b/src/utils/webShims/concavemock.js @@ -0,0 +1,2 @@ +// Temporary workaround until unsafe-eval issue is resolved +module.exports = () => {}; diff --git a/src/utils/webShims/mockProtocol.json b/src/utils/webShims/mockProtocol.json index e81521bee..c087f1847 100644 --- a/src/utils/webShims/mockProtocol.json +++ b/src/utils/webShims/mockProtocol.json @@ -473,35 +473,6 @@ "entity": "node", "type": "d39a47507bbe27c2a7948861847f3607eda8e1be" }, - "skipLogic": { - "action": "SHOW", - "operator": "EXACTLY", - "value": "3", - "filter": { - "join": "OR", - "rules": [ - { - "type": "alter", - "id": "15218241538622", - "options": { - "type": "d39a47507bbe27c2a7948861847f3607eda8e1be", - "attribute": "6ae999552a0d2dca14d62e2bc8b764d377b1dd6c", - "operator": "EXACTLY", - "value": "Dee" - } - }, - { - "type": "ego", - "id": "15218241553253", - "options": { - "attribute": "6ae999552a0d2dca14d62e2bc8b764d377b1dd6c", - "operator": "EXACTLY", - "value": "Bob" - } - } - ] - } - }, "panels": [ { "title": "Already mentioned",