10 import SessionForm from './SessionForm'; |
10 import SessionForm from './SessionForm'; |
11 import SessionSummary from './SessionSummary'; |
11 import SessionSummary from './SessionSummary'; |
12 import ProtocolSummary from './ProtocolSummary'; |
12 import ProtocolSummary from './ProtocolSummary'; |
13 import * as sessionsActions from '../actions/sessionsActions'; |
13 import * as sessionsActions from '../actions/sessionsActions'; |
14 import * as notesActions from '../actions/notesActions'; |
14 import * as notesActions from '../actions/notesActions'; |
15 import * as userActions from '../actions/userActions'; |
|
16 import { getSession, getSessionNotes } from '../selectors/coreSelectors'; |
15 import { getSession, getSessionNotes } from '../selectors/coreSelectors'; |
17 import { getAutoSubmit } from '../selectors/authSelectors'; |
|
18 import { extractAnnotationCategories, defaultAnnotationsCategories } from '../constants'; |
16 import { extractAnnotationCategories, defaultAnnotationsCategories } from '../constants'; |
19 |
17 |
20 class Session extends Component { |
18 class Session extends Component { |
21 |
19 |
22 state = { |
20 state = { |
86 <div className="container-fluid"> |
84 <div className="container-fluid"> |
87 <div className="row"> |
85 <div className="row"> |
88 <div className="col-lg-10 offset-md-2"> |
86 <div className="col-lg-10 offset-md-2"> |
89 <NoteInput |
87 <NoteInput |
90 session={this.props.currentSession} |
88 session={this.props.currentSession} |
91 autoSubmit={this.props.autoSubmit} |
|
92 addNote={this.props.notesActions.addNote} |
89 addNote={this.props.notesActions.addNote} |
93 setAutoSubmit={this.props.userActions.setAutoSubmit} |
|
94 annotationCategories={this.props.annotationCategories}/> |
90 annotationCategories={this.props.annotationCategories}/> |
95 </div> |
91 </div> |
96 </div> |
92 </div> |
97 </div> |
93 </div> |
98 </section> |
94 </section> |
104 |
100 |
105 function mapStateToProps(state, props) { |
101 function mapStateToProps(state, props) { |
106 |
102 |
107 const sessionId = props.match.params.id; |
103 const sessionId = props.match.params.id; |
108 |
104 |
109 const autoSubmit = getAutoSubmit(state); |
|
110 const currentSession = getSession(sessionId, state); |
105 const currentSession = getSession(sessionId, state); |
111 const currentNotes = getSessionNotes(sessionId, state); |
106 const currentNotes = getSessionNotes(sessionId, state); |
112 const annotationCategories = currentSession?extractAnnotationCategories(currentSession.protocol):defaultAnnotationsCategories; |
107 const annotationCategories = currentSession?extractAnnotationCategories(currentSession.protocol):defaultAnnotationsCategories; |
113 |
108 |
114 return { |
109 return { |
115 currentSession, |
110 currentSession, |
116 notes: currentNotes, |
111 notes: currentNotes, |
117 autoSubmit, |
|
118 annotationCategories |
112 annotationCategories |
119 }; |
113 }; |
120 } |
114 } |
121 |
115 |
122 function mapDispatchToProps(dispatch) { |
116 function mapDispatchToProps(dispatch) { |
123 return { |
117 return { |
124 sessionsActions: bindActionCreators(sessionsActions, dispatch), |
118 sessionsActions: bindActionCreators(sessionsActions, dispatch), |
125 notesActions: bindActionCreators(notesActions, dispatch), |
119 notesActions: bindActionCreators(notesActions, dispatch) |
126 userActions: bindActionCreators(userActions, dispatch) |
|
127 } |
120 } |
128 } |
121 } |
129 |
122 |
130 export default connect(mapStateToProps, mapDispatchToProps)(Session); |
123 export default connect(mapStateToProps, mapDispatchToProps)(Session); |