diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-03 16:34:09 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-03 16:34:09 +0200 |
| commit | 3fbc033e37476ff03fc4ad93145976faeea47934 (patch) | |
| tree | d6472eadb3abad48711730ce8b5cc816c61c6769 /app/client/dataset/dataset.new.js | |
| parent | 70551b5c0d32effb316a75d6bbe3c6807f8b4d05 (diff) | |
reload the whole page. easier
Diffstat (limited to 'app/client/dataset/dataset.new.js')
| -rw-r--r-- | app/client/dataset/dataset.new.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/client/dataset/dataset.new.js b/app/client/dataset/dataset.new.js new file mode 100644 index 0000000..16ee8c1 --- /dev/null +++ b/app/client/dataset/dataset.new.js @@ -0,0 +1,43 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import * as datasetActions from './dataset.actions' + +import TextInput from '../common/textInput.component' + +function NewDatasetForm (props) { + const { loading, status, error, history, actions, module } = props + if (loading) return <span>Loading...</span> + console.log(props) + return ( + <div class='opaque'> + <div class='heading'> + <h2>Create a new dataset</h2> + </div> + <div class='params'> + <TextInput + autofocus + title={'Name your dataset'} + onSave={(name) => { + actions.createFolder(module, name) + .then(folder => { + window.location.href = '/samplernn/datasets/' + folder.id + '/' + }) + }} + /> + </div> + </div> + ) +} + +const mapStateToProps = state => { + console.log(state); + return state.dataset +} + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(datasetActions, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(NewDatasetForm) |
