-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from speak/feature/call-rating
Post call rating system
- Loading branch information
Showing
6 changed files
with
69 additions
and
4 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,52 @@ | ||
var React = require('react'); | ||
var Rating = require('react-icon-rating'); | ||
var Analytics = require('../libs/analytics'); | ||
|
||
var CallCompleted = React.createClass({ | ||
|
||
getInitialState: function() { | ||
return { | ||
rated: false | ||
} | ||
}, | ||
|
||
handleRating: function(number) { | ||
Analytics.track('channel.rating', { | ||
id: this.props.channel.id, | ||
rating: number | ||
}); | ||
|
||
this.setState({rated: number}); | ||
}, | ||
|
||
getContent: function() { | ||
if (this.state.rated === false) { | ||
return <div> | ||
<h2>How was the call?</h2> | ||
<p>Help us improve Speak by rating the quality of <br/>your call, or <a href="mailto:[email protected]">send us an email</a> with feedback!</p> | ||
<Rating className="rating" onChange={this.handleRating} toggledClassName="icon icon-star" untoggledClassName="icon icon-star-empty"/> | ||
</div>; | ||
} else if (this.state.rated < 3) { | ||
return <div> | ||
<h2>That's not good</h2> | ||
<p>Consider <a href="mailto:[email protected]">dropping us a line</a> to let us know about the problems you had?</p> | ||
</div>; | ||
} else if (this.state.rated < 5) { | ||
return <div> | ||
<h2>Thanks for rating</h2> | ||
<p>We hope you enjoyed using Speak, if you have ideas for improvements be sure to <a href="mailto:[email protected]">let us know</a>.</p> | ||
</div>; | ||
} else { | ||
return <div> | ||
<h2>A perfect call!</h2> | ||
<p>Wow, you're just emitting positivity! Consider letting someone know about your Speak experience?</p> | ||
</div>; | ||
} | ||
}, | ||
|
||
render: function() { | ||
return <div id="call-completed"> | ||
<h2>Oh, everyone left.</h2> | ||
<p>It looks like the call is over. Have you tried our <br/><a href="https://speak.io/download">Speak desktop app</a> yet? It's pretty neat!</p> | ||
{this.getContent()} | ||
</div>; | ||
} | ||
}); | ||
|
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,23 @@ | ||
@import "elements.css.less"; | ||
|
||
.rating { | ||
margin-top: 10px; | ||
|
||
.icon { | ||
background-repeat: no-repeat; | ||
background-size: 30px 30px; | ||
display: inline-block; | ||
width: 30px; | ||
height: 30px; | ||
margin: 2px; | ||
} | ||
|
||
.icon-star { | ||
background-image: url('../images/icons/star.png'); | ||
} | ||
|
||
.icon-star-empty { | ||
background-image: url('../images/icons/star-empty.png'); | ||
.opacity(0.7); | ||
} | ||
} |