feat(views): Add url result on create election success view

pull/2/head
Clement G 5 years ago
parent 0812f2dda0
commit 17f03a478d

@ -11,22 +11,30 @@ class UnknownView extends Component {
constructor(props) {
super(props);
this.state = {
urlOfVote:"http://localhost",
urlOfVote:"http://localhost/vote",
urlOfResult:"http://localhost/result"
};
this.urlField = React.createRef();
this.urlVoteField = React.createRef();
this.urlResultField = React.createRef();
}
handleClickOnUrl=(event)=>{
handleClickOnField=(event)=>{
event.target.focus();
event.target.select();
};
handleClickOnCopy=(event)=>{
const input = this.urlField.current;
handleClickOnCopyVote=(event)=>{
const input = this.urlVoteField.current;
input.focus();
input.select();
document.execCommand("copy");
};
handleClickOnCopyResult=(event)=>{
const input = this.urlResultField.current;
input.focus();
input.select();
document.execCommand("copy");
};
render(){
@ -37,25 +45,44 @@ class UnknownView extends Component {
</Row>
<Row className="mt-4">
<Col className="text-center offset-lg-3" lg="6"><h2>Vote créé avec succès !</h2>
<p>Vous pouvez maintenant partager le lien du vote aux participants :</p>
<p className="mt-4 mb-1">Vous pouvez maintenant partager le lien du vote aux participants :</p>
<div className="input-group ">
<input type="text" className="form-control" ref={this.urlField}
value={this.state.urlOfVote} readOnly onClick={this.handleClickOnUrl} />
<input type="text" className="form-control" ref={this.urlVoteField}
value={this.state.urlOfVote} readOnly onClick={this.handleClickOnField} />
<div className="input-group-append">
<Button className="btn btn-outline-light" onClick={this.handleClickOnCopy}
<Button className="btn btn-outline-light" onClick={this.handleClickOnCopyVote}
type="button">
<FontAwesomeIcon icon={faCopy} className="mr-2"/>Copier</Button>
</div>
</div>
<small className="text-white">Pensez a enregistrer ce lien dans les favoris de votre
navigateur !</small>
<p className="mt-4 mb-1">Voici le lien vers les résultats du vote en temps réel :</p>
<div className="input-group ">
<input type="text" className="form-control" ref={this.urlResultField}
value={this.state.urlOfResult} readOnly onClick={this.handleClickOnField} />
<div className="input-group-append">
<Button className="btn btn-outline-light" onClick={this.handleClickOnCopyResult}
type="button">
<FontAwesomeIcon icon={faCopy} className="mr-2"/>Copier</Button>
</div>
</div>
</Col>
</Row>
<Row className="mt-4 mb-4" >
<Col >
<div className=" bg-warning text-white p-2 "><p className="m-0 p-0 text-center">Conservez ces liens précieusements !</p>
<p className="small m-2 p-0"><b>ATTENTION</b> : Vous ne les retrouverez pas ailleurs et nous ne serons pas capable de vous les communiquer. Vous pouvez par exemple les enregistrer dans les favoris de votre
navigateur.</p></div>
</Col>
</Row>
<Row className="mt-4 mb-4" >
<Col className="text-center">

Loading…
Cancel
Save