new design
This commit is contained in:
2
web/.gitignore
vendored
2
web/.gitignore
vendored
@@ -19,3 +19,5 @@
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
|
src/**/*.css
|
||||||
|
|||||||
@@ -3,14 +3,23 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^16.1.1",
|
"react": "^16.2.0",
|
||||||
"react-dom": "^16.1.1",
|
"react-dom": "^16.2.0",
|
||||||
|
"react-md": "^1.2.8",
|
||||||
"react-scripts": "1.0.17"
|
"react-scripts": "1.0.17"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"build-css": "node-sass-chokidar --include-path ./node_modules src/ -o src/",
|
||||||
|
"watch-css-mine": "npm run build-css && npm run build-css --watch --recursive",
|
||||||
|
"watch-css": "nodemon -e scss -x \"npm run watch-css-mine\"",
|
||||||
|
"start-js": "react-scripts start",
|
||||||
|
"start": "npm-run-all -p watch-css start-js",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test --env=jsdom",
|
"test": "react-scripts test --env=jsdom",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"node-sass": "^4.7.2",
|
||||||
|
"nodemon": "^1.12.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ class App extends Component {
|
|||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state={allIntents:[], selectedIntent: {questions:[''],answer:''}};
|
this.state={allIntents:[], selectedIntent: {questions:[''],answer:''}, selectedIndex:-1};
|
||||||
|
|
||||||
getAllIntents().then(l=> l.text()).then(result=>{
|
getAllIntents().then(l=> l.text()).then(result=>{
|
||||||
this.setState({allIntents: JSON.parse(result), selectedIntent: this.state.selectedIntent})
|
this.setState({allIntents: JSON.parse(result), selectedIntent: this.state.selectedIntent})
|
||||||
@@ -30,7 +30,8 @@ class App extends Component {
|
|||||||
</div>
|
</div>
|
||||||
<IntentList allIntents={this.state.allIntents}
|
<IntentList allIntents={this.state.allIntents}
|
||||||
onIntentClick={this.handleIntentClick}
|
onIntentClick={this.handleIntentClick}
|
||||||
onAddIntentClick={this.handleAddIntentClick}>
|
onAddIntentClick={this.handleAddIntentClick}
|
||||||
|
selectedIndex={this.state.selectedIndex}>
|
||||||
</IntentList>
|
</IntentList>
|
||||||
<IntentDetails selectedIntent={this.state.selectedIntent}
|
<IntentDetails selectedIntent={this.state.selectedIntent}
|
||||||
onDeleteIntentClick={this.handleDeleteIntentClick}
|
onDeleteIntentClick={this.handleDeleteIntentClick}
|
||||||
@@ -40,8 +41,8 @@ class App extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleIntentClick(selectedIntent){
|
handleIntentClick(selectedIntent, index){
|
||||||
this.setState({selectedIntent:selectedIntent});
|
this.setState({selectedIntent:selectedIntent, selectedIndex: index});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDeleteIntentClick(selectedIntent){
|
handleDeleteIntentClick(selectedIntent){
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import {Button, SVGIcon, TextField} from 'react-md';
|
||||||
import '../css/Intent.css'
|
import '../css/Intent.css'
|
||||||
|
|
||||||
class IntentDetails extends Component {
|
class IntentDetails extends Component {
|
||||||
@@ -18,26 +19,41 @@ class IntentDetails extends Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="IntentDetails">
|
<div className="IntentDetails">
|
||||||
<p> Questions </p>
|
<h5 style={{marginTop:'20px', marginLeft: '30px', float: 'left'}}>Questions</h5>
|
||||||
{
|
{
|
||||||
this.state.intent.questions.map((question, index)=>{
|
this.state.intent.questions.map((question, index)=>{
|
||||||
return (
|
return (
|
||||||
<div key={index} className="QuestionBox">
|
<div key={index} className="QuestionBox">
|
||||||
<input value={question}></input>
|
<TextField
|
||||||
<button onClick={()=>{this.deleteQuestion(question)}}>Del</button>
|
id="floating-center-title"
|
||||||
|
lineDirection="center"
|
||||||
|
placeholder="Question"
|
||||||
|
className="md-cell md-cell--bottom"
|
||||||
|
style={{width:'60%'}}
|
||||||
|
rightIcon={<SVGIcon onClick={()=>{this.deleteQuestion(question)}}> <path fill="#000000" d="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z"/> </SVGIcon>}
|
||||||
|
value={question}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
<p> Answer </p>
|
<br></br>
|
||||||
{
|
{
|
||||||
<input value={this.state.intent.answer}></input>
|
<div className="QuestionBox">
|
||||||
|
<TextField
|
||||||
|
id="floating-center-title"
|
||||||
|
lineDirection="center"
|
||||||
|
label="Answer"
|
||||||
|
placeholder="Answer"
|
||||||
|
style={{width:'60%'}}
|
||||||
|
className="md-cell md-cell--bottom"
|
||||||
|
value={this.state.intent.answer}/>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
<br></br>
|
<br></br>
|
||||||
<br></br>
|
<br></br>
|
||||||
<button onClick={this.addQuestion}>Add question</button>
|
<Button style={{float:'left', marginLeft: '25px'}} flat primary onClick={()=>{this.props.onDeleteIntentClick(this.state.intent)}}>Delete intent</Button>
|
||||||
<button onClick={()=>{this.props.onDeleteIntentClick(this.state.intent)}}>Delete</button>
|
<Button style={{float:'left', marginLeft: '22%'}} flat primary swapTheming onClick={this.addQuestion}>Add question</Button>
|
||||||
<button onClick={()=>{this.props.onSaveIntentClick(this.state.intent)}}>Save</button>
|
<Button style={{float:'left', marginLeft: '20px'}} flat primary swapTheming onClick={()=>{this.props.onSaveIntentClick(this.state.intent)}}>Save</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import {Button} from 'react-md';
|
||||||
import '../css/Intent.css'
|
import '../css/Intent.css'
|
||||||
|
|
||||||
class IntentItem extends Component {
|
class IntentItem extends Component {
|
||||||
@@ -10,10 +11,21 @@ class IntentItem extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
/*
|
||||||
<div className={false ? 'IntentItem-selected' : 'IntentItem'} onClick={()=>{this.state.onClick(this.state.intent)}}>
|
<div className={this.props.selectedIndex===this.state.index ? 'IntentItem-selected' : 'IntentItem'} onClick={()=>{this.state.onClick(this.state.intent,this.state.index)}}>
|
||||||
|
<Button className={"IntentItem"} flat swapTheming>OK</Button>
|
||||||
<p> {this.state.index+1}. {this.state.intent.questions[0]} </p>
|
<p> {this.state.index+1}. {this.state.intent.questions[0]} </p>
|
||||||
</div>
|
</div>
|
||||||
|
*/
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Button className={this.props.selectedIndex===this.state.index ? 'IntentItem-selected' : 'IntentItem'}
|
||||||
|
onClick={()=>{this.state.onClick(this.state.intent,this.state.index)}}
|
||||||
|
flat>
|
||||||
|
{this.state.index+1}. {this.state.intent.questions[0]}
|
||||||
|
</Button>
|
||||||
|
<br></br>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,36 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import QuestionItem from './IntentItem';
|
import {Button} from 'react-md';
|
||||||
|
import IntentItem from './IntentItem';
|
||||||
import '../css/Intent.css'
|
import '../css/Intent.css'
|
||||||
|
|
||||||
class IntentList extends Component {
|
class IntentList extends Component {
|
||||||
constructor (props){
|
constructor (props){
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {intents: props.allIntents, selected:0, onIntentClick:props.onIntentClick};
|
this.state = {intents: props.allIntents, selectedIndex:props.selectedIndex, onIntentClick:props.onIntentClick};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(props){
|
componentWillReceiveProps(props){
|
||||||
this.setState({intents: props.allIntents});
|
this.setState({intents: props.allIntents, selectedIndex: props.selectedIndex, onIntentClick: props.onIntentClick});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="IntentList">
|
<div className="IntentList">
|
||||||
<div className="IntentList-title">
|
<div className="IntentList-title">
|
||||||
<p>Intents</p>
|
<h3>Intents</h3>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
this.state.intents.map((intent,index)=>{
|
this.state.intents.map((intent,index)=>{
|
||||||
return <QuestionItem
|
return <IntentItem
|
||||||
key={index} intent={intent} index={index}
|
key={index} intent={intent} index={index}
|
||||||
|
selectedIndex={this.props.selectedIndex}
|
||||||
onClick={this.state.onIntentClick}>
|
onClick={this.state.onIntentClick}>
|
||||||
</QuestionItem>
|
</IntentItem>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
<br></br>
|
<br></br>
|
||||||
<button onClick={this.props.handleAddIntentClick}>Add intent</button>
|
<Button className={"AddIntent"} flat primary swapTheming onClick={this.props.handleAddIntentClick}>Add intent</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,13 @@
|
|||||||
.App {
|
.App {
|
||||||
text-align: center;
|
text-align: center; }
|
||||||
}
|
|
||||||
|
|
||||||
.App-logo {
|
|
||||||
animation: App-logo-spin infinite 20s linear;
|
|
||||||
height: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.App-header {
|
.App-header {
|
||||||
background-color: #222;
|
background-color: white;
|
||||||
height: 150px;
|
height: 80px;
|
||||||
padding: 20px;
|
padding: 20px; }
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.App-title {
|
.App-title {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em; }
|
||||||
}
|
|
||||||
|
|
||||||
.App-intro {
|
.App-intro {
|
||||||
font-size: large;
|
font-size: large; }
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes App-logo-spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
|
|||||||
17
web/src/css/App.scss
Normal file
17
web/src/css/App.scss
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
.App {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-header {
|
||||||
|
background-color:white;
|
||||||
|
height: 80px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-title {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-intro {
|
||||||
|
font-size: large;
|
||||||
|
}
|
||||||
@@ -1,35 +1,44 @@
|
|||||||
/*IntentList and IntentItem CSS*/
|
/*IntentList and IntentItem CSS*/
|
||||||
|
|
||||||
.IntentList {
|
.IntentList {
|
||||||
max-width: 300px;
|
|
||||||
width: 30%;
|
width: 30%;
|
||||||
border: 2px solid black;
|
min-height: 9999px;
|
||||||
|
height: 9999px;
|
||||||
float: left;
|
float: left;
|
||||||
background-color: gray;
|
background-color: #d5dae2; }
|
||||||
}
|
|
||||||
|
|
||||||
.IntentList-title {
|
.IntentList-title {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
height: 70px;
|
||||||
|
padding: 20px;
|
||||||
|
text-align: left; }
|
||||||
|
|
||||||
|
.AddIntent {
|
||||||
|
float: right;
|
||||||
|
margin: 12px; }
|
||||||
|
|
||||||
.IntentItem {
|
.IntentItem {
|
||||||
margin-top: 1px;
|
margin-top: 2px;
|
||||||
margin-bottom: 1px;
|
margin-bottom: 2px;
|
||||||
background-color: blue;
|
height: 50px;
|
||||||
}
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
background-color: #adb0b5; }
|
||||||
|
|
||||||
.IntentItem-selected {
|
.IntentItem-selected {
|
||||||
background-color: yellow;
|
margin-top: 2px;
|
||||||
}
|
margin-bottom: 2px;
|
||||||
|
height: 50px;
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
background-color: #e8ecf2; }
|
||||||
|
|
||||||
/*IntentDetails CSS*/
|
/*IntentDetails CSS*/
|
||||||
|
|
||||||
.IntentDetails {
|
.IntentDetails {
|
||||||
border: 2px solid blue;
|
|
||||||
float: left;
|
float: left;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
|
min-height: 9999px;
|
||||||
|
height: 9999px;
|
||||||
|
background-color: #e8ecf2; }
|
||||||
|
|
||||||
|
.QuestionBox {
|
||||||
}
|
margin: 25px; }
|
||||||
|
|||||||
54
web/src/css/Intent.scss
Normal file
54
web/src/css/Intent.scss
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*IntentList and IntentItem CSS*/
|
||||||
|
|
||||||
|
.IntentList{
|
||||||
|
width: 30%;
|
||||||
|
min-height:9999px;
|
||||||
|
height:9999px;
|
||||||
|
float:left;
|
||||||
|
background-color: #d5dae2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.IntentList-title{
|
||||||
|
font-size: 1.5em;
|
||||||
|
height: 70px;
|
||||||
|
padding: 20px;
|
||||||
|
text-align:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.AddIntent{
|
||||||
|
float: right;
|
||||||
|
margin: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.IntentItem{
|
||||||
|
margin-top: 2px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
height: 50px;
|
||||||
|
width:100%;
|
||||||
|
text-align:left;
|
||||||
|
background-color: #adb0b5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.IntentItem-selected{
|
||||||
|
margin-top: 2px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
height: 50px;
|
||||||
|
width:100%;
|
||||||
|
text-align:left;
|
||||||
|
background-color:#e8ecf2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*IntentDetails CSS*/
|
||||||
|
|
||||||
|
.IntentDetails{
|
||||||
|
float: left;
|
||||||
|
width: 70%;
|
||||||
|
min-height:9999px;
|
||||||
|
height:9999px;
|
||||||
|
background-color:#e8ecf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.QuestionBox{
|
||||||
|
margin:25px;
|
||||||
|
}
|
||||||
5
web/src/css/_globals.scss
Normal file
5
web/src/css/_globals.scss
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
@import 'react-md/src/scss/react-md';
|
||||||
|
|
||||||
|
// Any variable overrides. The following just changes the default theme to use teal and purple.
|
||||||
|
$md-primary-color: $md-teal-500;
|
||||||
|
$md-secondary-color: $md-purple-a-400;
|
||||||
File diff suppressed because it is too large
Load Diff
9
web/src/css/index.scss
Normal file
9
web/src/css/index.scss
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
@import 'globals';
|
||||||
|
|
||||||
|
@include react-md-everything;
|
||||||
|
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
@@ -4,5 +4,13 @@ import './css/index.css';
|
|||||||
import App from './App';
|
import App from './App';
|
||||||
import registerServiceWorker from './registerServiceWorker';
|
import registerServiceWorker from './registerServiceWorker';
|
||||||
|
|
||||||
|
import WebFontLoader from 'webfontloader';
|
||||||
|
|
||||||
|
WebFontLoader.load({
|
||||||
|
google: {
|
||||||
|
families: ['Roboto:300,400,500,700', 'Material Icons'],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
ReactDOM.render(<App />, document.getElementById('root'));
|
ReactDOM.render(<App />, document.getElementById('root'));
|
||||||
registerServiceWorker();
|
registerServiceWorker();
|
||||||
|
|||||||
Reference in New Issue
Block a user