-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove not used function * Refactor part of the workflow store and add basic node details panel * Refactor the way we handle editedWorkflow * Update the changelog
- Loading branch information
1 parent
6fca600
commit a673cb1
Showing
12 changed files
with
499 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
assets/jsx/workflow-editor/components/node-inspector/node-details-panel.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { PanelRow, TextControl } from "@wordpress/components"; | ||
import { __ } from "@wordpress/i18n"; | ||
import PersistentPanelBody from "../persistent-panel-body"; | ||
import { useSelect, useDispatch } from "@wordpress/data"; | ||
import { store as workflowStore } from '../workflow-store'; | ||
import { store as editorStore } from '../editor-store'; | ||
import { useCallback } from "@wordpress/element"; | ||
import Text from "../data-fields/text"; | ||
|
||
export const NodeDetailsPanel = ({ node }) => { | ||
const { | ||
getNodeTypeByName, | ||
} = useSelect((select) => { | ||
return { | ||
getNodeTypeByName: select(editorStore).getNodeTypeByName, | ||
}; | ||
}); | ||
|
||
const { | ||
updateNode, | ||
} = useDispatch(workflowStore); | ||
|
||
const nodeType = getNodeTypeByName(node.data.name); | ||
|
||
const onChangeLabel = useCallback((name, value) => { | ||
const newNode = { | ||
id: node.id, | ||
data: { | ||
label: value, | ||
}, | ||
}; | ||
|
||
updateNode(newNode); | ||
}, [node, updateNode]); | ||
|
||
return ( | ||
<PersistentPanelBody title={__("Step Details", "post-expirator")}> | ||
<PanelRow> | ||
<Text | ||
name="label" | ||
label={__("Step Label", "post-expirator")} | ||
defaultValue={node.data.label || ''} | ||
settings={{ | ||
placeholder: nodeType.label, | ||
}} | ||
onChange={onChangeLabel} | ||
description={__("This is the label that will be displayed in the workflow editor.", "post-expirator")} | ||
/> | ||
</PanelRow> | ||
</PersistentPanelBody> | ||
); | ||
}; | ||
|
||
export default NodeDetailsPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.