client/src/components/Session.js
changeset 165 62e5be0df812
parent 162 1fd73fdaf4c6
child 168 ea92f4fe783d
equal deleted inserted replaced
164:30a5baa31314 165:62e5be0df812
    16 import { getAutoSubmit } from '../selectors/authSelectors';
    16 import { getAutoSubmit } from '../selectors/authSelectors';
    17 import { extractAnnotationCategories, defaultAnnotationsCategories } from '../constants';
    17 import { extractAnnotationCategories, defaultAnnotationsCategories } from '../constants';
    18 
    18 
    19 class Session extends Component {
    19 class Session extends Component {
    20 
    20 
       
    21   state = {
       
    22     screenSummary: 0,
       
    23   }
       
    24 
    21   onClickReadOnly = (e) => {
    25   onClickReadOnly = (e) => {
    22     e.preventDefault();
    26     e.preventDefault();
    23     this.props.history.push('/read-only/' + this.props.match.params.id);
    27     this.props.history.push('/read-only/' + this.props.match.params.id);
       
    28   }
       
    29 
       
    30   toggleScreenSummary = (e) => {
       
    31     if (this.state.screenSummary === 0) {
       
    32       e.preventDefault()
       
    33       this.setState({screenSummary: 1})
       
    34     }
       
    35 
       
    36     if (this.state.screenSummary === 1) {
       
    37       e.preventDefault()
       
    38       this.setState({screenSummary: 0})
       
    39     }
       
    40   }
       
    41 
       
    42   screenSummary = () => {
       
    43 
       
    44     if (this.state.screenSummary === 0) {
       
    45       return (
       
    46         <div>
       
    47         <a onClick={this.toggleScreenSummary} className ="text-primary">Afficher le protocole d'annotation</a>
       
    48        <SessionSummary notes={this.props.notes} />
       
    49        </div>
       
    50       );
       
    51     }
       
    52 
       
    53     if (this.state.screenSummary === 1) {
       
    54       return (
       
    55       <div>
       
    56       <a onClick={this.toggleScreenSummary} className ="text-primary">Afficher le résumé de la session</a>
       
    57       <ProtocolSummary />
       
    58       </div>
       
    59       );
       
    60     }
    24   }
    61   }
    25 
    62 
    26   render() {
    63   render() {
    27 
    64 
    28     return (
    65     return (
    30         <Navbar history={this.props.history} />
    67         <Navbar history={this.props.history} />
    31         <div className="session-container">
    68         <div className="session-container">
    32           <div className="session-notes">
    69           <div className="session-notes">
    33           <div className="notes-affix">
    70           <div className="notes-affix">
    34             <a onClick={this.onClickReadOnly} href="/read-only"><span className="material-icons text-primary">remove_red_eye</span></a>
    71             <a onClick={this.onClickReadOnly} href="/read-only"><span className="material-icons text-primary">remove_red_eye</span></a>
    35             <SessionSummary notes={this.props.notes} />
    72               {this.screenSummary()}
    36           </div>
    73           </div>
    37             <div className="notes-list">
    74             <div className="notes-list">
    38               <SessionForm session={this.props.currentSession} />
    75               <SessionForm session={this.props.currentSession} />
    39               <NotesList
    76               <NotesList
    40                 notes={this.props.notes}
    77                 notes={this.props.notes}