diff --git a/lib/modules/scaffolding-react/index.js b/lib/modules/scaffolding-react/index.js index 9ba57a0ed..e594e6bb7 100644 --- a/lib/modules/scaffolding-react/index.js +++ b/lib/modules/scaffolding-react/index.js @@ -26,16 +26,25 @@ class ScaffoldingReact { fs.writeFileSync(filePath, result); } + _buildHTML(contract){ + const filename = contract.className.toLowerCase(); + this._generateFile(contract, 'index.html.tpl', 'html', + { + 'title': contract.className, + 'filename': filename + }); + } + build(contract){ + this._buildHTML(contract); + const filename = contract.className.toLowerCase(); - this._generateFile(contract, 'index.html.tpl', 'html', - { - 'title': contract.className, - 'filename': filename - }); - - this._generateFile(contract, 'dapp.js.tpl', 'js', {}); + this._generateFile(contract, 'dapp.js.tpl', 'js', + { + 'title': contract.className + ' autogenerated UI', + 'contractName': contract.className + }); // Update config const contents = fs.readFileSync("./embark.json"); diff --git a/lib/modules/scaffolding-react/templates/dapp.js.tpl b/lib/modules/scaffolding-react/templates/dapp.js.tpl index c6b8f74ae..3140fff49 100644 --- a/lib/modules/scaffolding-react/templates/dapp.js.tpl +++ b/lib/modules/scaffolding-react/templates/dapp.js.tpl @@ -1,9 +1,26 @@ +import EmbarkJS from 'Embark/EmbarkJS'; +import {{contractName}} from 'Embark/contracts/{{contractName}}'; + import React from 'react'; import ReactDOM from 'react-dom'; import { Tabs, Tab } from 'react-bootstrap'; +class {{contractName}}UI extends React.Component { + constructor (props) { + super(props); + this.state = { + }; + } + + render(){ + return (