client/src/components/Session.js
changeset 165 62e5be0df812
parent 162 1fd73fdaf4c6
child 168 ea92f4fe783d
--- a/client/src/components/Session.js	Tue Oct 09 18:54:42 2018 +0200
+++ b/client/src/components/Session.js	Tue Oct 09 18:59:20 2018 +0200
@@ -18,11 +18,48 @@
 
 class Session extends Component {
 
+  state = {
+    screenSummary: 0,
+  }
+
   onClickReadOnly = (e) => {
     e.preventDefault();
     this.props.history.push('/read-only/' + this.props.match.params.id);
   }
 
+  toggleScreenSummary = (e) => {
+    if (this.state.screenSummary === 0) {
+      e.preventDefault()
+      this.setState({screenSummary: 1})
+    }
+
+    if (this.state.screenSummary === 1) {
+      e.preventDefault()
+      this.setState({screenSummary: 0})
+    }
+  }
+
+  screenSummary = () => {
+
+    if (this.state.screenSummary === 0) {
+      return (
+        <div>
+        <a onClick={this.toggleScreenSummary} className ="text-primary">Afficher le protocole d'annotation</a>
+       <SessionSummary notes={this.props.notes} />
+       </div>
+      );
+    }
+
+    if (this.state.screenSummary === 1) {
+      return (
+      <div>
+      <a onClick={this.toggleScreenSummary} className ="text-primary">Afficher le résumé de la session</a>
+      <ProtocolSummary />
+      </div>
+      );
+    }
+  }
+
   render() {
 
     return (
@@ -32,7 +69,7 @@
           <div className="session-notes">
           <div className="notes-affix">
             <a onClick={this.onClickReadOnly} href="/read-only"><span className="material-icons text-primary">remove_red_eye</span></a>
-            <SessionSummary notes={this.props.notes} />
+              {this.screenSummary()}
           </div>
             <div className="notes-list">
               <SessionForm session={this.props.currentSession} />