equal
deleted
inserted
replaced
|
1 import React, { Component } from 'react'; |
|
2 import { connect } from 'react-redux'; |
|
3 import Note from './Note'; |
|
4 import Navbar from './Navbar'; |
|
5 import SessionForm from './SessionForm'; |
|
6 import { getSession, getSessionNotes } from '../selectors/coreSelectors'; |
|
7 import './ReadOnlySession.css'; |
|
8 |
|
9 |
|
10 |
|
11 class ReadOnlySession extends Component { |
|
12 |
|
13 onClickSession = (e) => { |
|
14 e.preventDefault(); |
|
15 this.props.history.push('/sessions/' + this.props.match.params.id) |
|
16 } |
|
17 |
|
18 render() { |
|
19 |
|
20 return ( |
|
21 <div> |
|
22 <Navbar history={this.props.history} /> |
|
23 <div className="ml-4"> |
|
24 <SessionForm session={this.props.currentSession} /> |
|
25 <a className="text-primary font-weight-bold float-left" onClick={this.onClickSession} href="/sessions">Atteindre la session</a> |
|
26 <div> |
|
27 {this.props.notes.map((note) => |
|
28 <Note |
|
29 note={ note } |
|
30 key={ note._id} |
|
31 annotationCategories={this.props.annotationCategories} /> |
|
32 )} |
|
33 </div> |
|
34 </div> |
|
35 </div> |
|
36 ); |
|
37 } |
|
38 }; |
|
39 |
|
40 |
|
41 function mapStateToProps(state, props) { |
|
42 |
|
43 const sessionId = props.match.params.id; |
|
44 |
|
45 const currentSession = getSession(sessionId, state); |
|
46 const currentNotes = getSessionNotes(sessionId, state); |
|
47 |
|
48 return { |
|
49 currentSession, |
|
50 notes: currentNotes, |
|
51 }; |
|
52 } |
|
53 |
|
54 export default connect(mapStateToProps)(ReadOnlySession); |
|
55 |
|
56 |