diff --git a/app/src/components/ExampleStory.js b/app/src/components/ExampleStory.js
index cddde83..71752e9 100644
--- a/app/src/components/ExampleStory.js
+++ b/app/src/components/ExampleStory.js
@@ -61,18 +61,41 @@ class ExampleStory extends Component {
let last_item = {};
let content = this.props.content;
+ let new_content = [];
+ let index = 0;
for (let i = 0, size = content.length; i < size; i++) {
- if (last_item.type === "utter") {
- content[i] = { ...content[i], sequence: true };
+
+ if (content[i].type === "checkpoint"){
+ let checkpoint = content[i].content;
+ for (let i = 0, size = checkpoint.length; i < size; i++) {
+
+ if (last_item.type === "utter") {
+ new_content[index] = { ...checkpoint[i], sequence: true };
+ } else {
+ new_content[index] = { ...checkpoint[i], sequence: false};
+ }
+ last_item = new_content[index];
+ index++;
+ }
+ } else if (last_item.type === "utter") {
+ new_content[index] = { ...content[i], sequence: true };
+ last_item = new_content[index];
+ index++;
} else if (content[i].sequence) {
- content[i].sequence = false;
+ new_content[index].sequence = false;
+ last_item = new_content[index];
+ index++;
+ } else {
+ new_content[index] = content[i];
+ last_item = new_content[index];
+ index++;
}
- last_item = content[i];
+
}
- return content.map((item, index) => {
+ return new_content.map((item, index) => {
let element;
if (item.type === "intent") { element = this.exampleIntent(item, index) }
else if (item.sequence) { element = this.exampleSimpleUtter(item, index) }
@@ -94,4 +117,4 @@ class ExampleStory extends Component {
}
const mapStateToProps = state => { return { ...state.story } };
-export default connect(mapStateToProps)(ExampleStory);
\ No newline at end of file
+export default connect(mapStateToProps)(ExampleStory);
diff --git a/app/src/components/StoryCard.js b/app/src/components/StoryCard.js
index 0f784d5..d1db0fb 100644
--- a/app/src/components/StoryCard.js
+++ b/app/src/components/StoryCard.js
@@ -3,6 +3,7 @@ import React, { Component } from "react";
import { Card } from '@material-ui/core';
import UtterIcon from '../icons/UtterIcon';
import IntentIcon from '../icons/IntentIcon';
+import CheckpointIcon from '../icons/CheckpointIcon';
import Typography from '@material-ui/core/Typography';
import { setHighlight } from "../utils/utils";
@@ -44,14 +45,20 @@ export default class StoryCard extends Component {
{setHighlight(item.name, this.props.highlighted_text)}
)
- }
- else {
+ } else if (item.type === "utter") {
return (
{setHighlight(item.name, this.props.highlighted_text)}
)
+ } else if (item.type === "checkpoint") {
+ return (
+
+
+ {setHighlight(item.name, this.props.highlighted_text)}
+
+ )
}
})
return list;
diff --git a/app/src/components/StoryList.js b/app/src/components/StoryList.js
index e77ba31..fd189f5 100644
--- a/app/src/components/StoryList.js
+++ b/app/src/components/StoryList.js
@@ -4,6 +4,7 @@ import { bindActionCreators } from 'redux';
import UtterIcon from '../icons/UtterIcon';
import { message } from "../utils/messages";
import IntentIcon from '../icons/IntentIcon';
+import CheckpointIcon from '../icons/CheckpointIcon';
import { Grid, Card } from '@material-ui/core';
import DeleteIcon from '@material-ui/icons/Delete';
import IconButton from '@material-ui/core/IconButton';
@@ -76,7 +77,12 @@ class StoryList extends Component {
}
getIcon(type) {
- return type === "intent" ? :
+ if(type === "intent")
+ return
+ else if (type === "utter")
+ return
+ else
+ return
}
onDragEnd(result) {
diff --git a/app/src/components/ToolbarName.js b/app/src/components/ToolbarName.js
index 3ccb835..572b061 100644
--- a/app/src/components/ToolbarName.js
+++ b/app/src/components/ToolbarName.js
@@ -10,6 +10,8 @@ import IconButton from '@material-ui/core/IconButton';
import MoreVertIcon from '@material-ui/icons/MoreVert';
import InfoIcon from '@material-ui/icons/InfoOutlined';
import Tooltip from '@material-ui/core/Tooltip';
+import FormControlLabel from '@material-ui/core/FormControlLabel'
+import Checkbox from '@material-ui/core/Checkbox'
const style = {
toolbar: {
@@ -92,12 +94,26 @@ export default class ToolbarName extends Component {
}
}
+ handleCheckbox(event){
+ this.props.setCheckpoint(event.target.checked);
+ }
+
render() {
return (
- {this.props.story ? null : (
+ {this.props.story ?
+ this.handleCheckbox(e)}
+ />
+ }
+ label="Checkpoint"
+ />
+ : (
)}
-
+
@@ -156,13 +157,22 @@ class StoryEditPage extends Component {
}
- isSelected={this.isSelected}
- content={this.props.content}
highlighted_text={this.state.value}
actionOnClick={this.props.addUtter}
items={this.filterItems(this.props.utters)}
selected_item_position={this.props.selected_item_position}
/>
+
+ Checkpoints
+
+ }
+ highlighted_text={this.state.value}
+ actionOnClick={this.props.addCheckpoint}
+ items={this.props.checkpoints}
+ selected_item_position={this.props.selected_item_position}
+ />
@@ -186,7 +196,8 @@ class StoryEditPage extends Component {
is_enabled={this.isButtonEnabled()}
saveData={this.props.saveData}
deleteItem={() => this.changeStatusDialog(true)}
- item={new Story(this.props.story_id, this.props.content, this.props.name)}
+ item={new Story(this.props.story_id, this.props.content, this.props.name, this.props.is_checkpoint)}
+ setCheckpoint={this.props.setCheckpoint}
/>