client/src/components/ReadOnlySession.js
changeset 170 7da1d5137b0b
parent 162 1fd73fdaf4c6
equal deleted inserted replaced
169:f98efa1bddd1 170:7da1d5137b0b
     1 import React, { Component } from 'react';
     1 import React, { Component } from 'react';
     2 import { connect } from 'react-redux';
     2 import { connect } from 'react-redux';
     3 import Note from './Note';
     3 import { formatTimestamp } from '../utils';
     4 import Navbar from './Navbar';
     4 import Navbar from './Navbar';
     5 import SessionForm from './SessionForm';
       
     6 import { getSession, getSessionNotes } from '../selectors/coreSelectors';
     5 import { getSession, getSessionNotes } from '../selectors/coreSelectors';
     7 import './ReadOnlySession.css';
       
     8 
     6 
       
     7 const ReadOnlyNote = ({ note }) => {
       
     8   return (
       
     9     <div id={"note-" + note._id} className="note text-sm mr-5 pt-1">
       
    10       <div className="mr-5">
       
    11         <small className="start text-irinotes-time pt-2">{ formatTimestamp(note.startedAt) }</small>
       
    12         <small className="finish text-irinotes-time pb-2">{ formatTimestamp(note.finishedAt) }</small>
       
    13       </div>
       
    14       <div className="note-content w-100 pl-2 pt-2" dangerouslySetInnerHTML={{ __html: note.html }} />
       
    15     </div>
       
    16   );
     9 
    17 
       
    18 }
    10 
    19 
    11 class ReadOnlySession extends Component {
    20 class ReadOnlySession extends Component {
    12 
    21 
    13   onClickSession = (e) => {
    22   onClickSession = (e) => {
    14     e.preventDefault();
    23     e.preventDefault();
    19 
    28 
    20     return (
    29     return (
    21           <div>
    30           <div>
    22             <Navbar history={this.props.history} />
    31             <Navbar history={this.props.history} />
    23             <div className="ml-4">
    32             <div className="ml-4">
    24               <SessionForm session={this.props.currentSession} />
    33               <div className="session-page-panel panel-default sticky-top">
    25               <a className="text-primary font-weight-bold float-left" onClick={this.onClickSession} href="/sessions">Atteindre la session</a>
    34                 <div className="session-page-card card-body bg-secondary pr-5">
       
    35                   <div className='session-page-title border-0 bg-irinotes-headers text-muted ml-3'>
       
    36                     { this.props.currentSession.title || '&nbsp;' }
       
    37                   </div>
       
    38                   <div className="session-page-description border-0 bg-irinotes-headers text-muted ml-3" >
       
    39                     { this.props.currentSession.description || '&nbsp;' }
       
    40                   </div>
       
    41                 </div>
       
    42               </div>
    26               <div>
    43               <div>
    27                 {this.props.notes.map((note) =>
    44                 {
    28                   <Note
    45                   this.props.notes.map((note) =>
    29                     note={ note }
    46                     <ReadOnlyNote note={ note } key={ note._id} />
    30                     key={ note._id}
    47                   )
    31                     annotationCategories={this.props.annotationCategories} />
    48                 }
    32                 )}
       
    33               </div>
    49               </div>
    34             </div>
    50             </div>
    35           </div>
    51           </div>
    36     );
    52     );
    37   }
    53   }