8 import NotesList from './NotesList'; |
8 import NotesList from './NotesList'; |
9 import SessionForm from './SessionForm'; |
9 import SessionForm from './SessionForm'; |
10 import SessionSummary from './SessionSummary'; |
10 import SessionSummary from './SessionSummary'; |
11 import * as sessionsActions from '../actions/sessionsActions'; |
11 import * as sessionsActions from '../actions/sessionsActions'; |
12 import * as notesActions from '../actions/notesActions'; |
12 import * as notesActions from '../actions/notesActions'; |
|
13 import * as userActions from '../actions/userActions'; |
13 |
14 |
14 class Session extends Component { |
15 class Session extends Component { |
15 render() { |
16 render() { |
16 return ( |
17 return ( |
17 <div> |
18 <div> |
22 <SessionSummary notes={this.props.notes} /> |
23 <SessionSummary notes={this.props.notes} /> |
23 </div> |
24 </div> |
24 <div className="notes-list"> |
25 <div className="notes-list"> |
25 <SessionForm session={this.props.currentSession} /> |
26 <SessionForm session={this.props.currentSession} /> |
26 <hr /> |
27 <hr /> |
27 <NotesList notes={this.props.notes} /> |
28 <NotesList |
|
29 notes={this.props.notes} |
|
30 deleteNote={this.props.notesActions.deleteNote} |
|
31 updateNote={this.props.notesActions.updateNote} |
|
32 /> |
28 </div> |
33 </div> |
29 </div> |
34 </div> |
30 <section className="editor-fixed"> |
35 <section className="editor-fixed"> |
31 <Grid fluid> |
36 <Grid fluid> |
32 <Row> |
37 <Row> |
33 <Col md={9} mdOffset={3}> |
38 <Col md={9} mdOffset={3}> |
34 <NoteInput session={this.props.currentSession} addNote={this.props.notesActions.addNote} /> |
39 <NoteInput |
|
40 session={this.props.currentSession} |
|
41 autoSubmit={this.props.autoSubmit} |
|
42 addNote={this.props.notesActions.addNote} |
|
43 setAutoSubmit={this.props.userActions.setAutoSubmit} /> |
35 </Col> |
44 </Col> |
36 </Row> |
45 </Row> |
37 </Grid> |
46 </Grid> |
38 </section> |
47 </section> |
39 </div> |
48 </div> |
46 |
55 |
47 const sessionId = props.match.params.id; |
56 const sessionId = props.match.params.id; |
48 |
57 |
49 const sessions = state['sessions']; |
58 const sessions = state['sessions']; |
50 const notes = state['notes']; |
59 const notes = state['notes']; |
|
60 const autoSubmit = state['autoSubmit']; |
51 |
61 |
52 const currentSession = sessions.find(session => session._id === sessionId); |
62 const currentSession = sessions.find(session => session._id === sessionId); |
53 const currentNotes = notes.filter(note => { |
63 const currentNotes = notes.filter(note => { |
54 return note.session === sessionId; |
64 return (note.session === sessionId && !note.deleted); |
55 }).sortBy( n => n.get('startedAt') ); |
65 }).sortBy( n => n.get('startedAt') ); |
56 |
66 |
57 return { |
67 return { |
58 currentSession, |
68 currentSession, |
59 sessions, |
69 sessions, |
60 notes: currentNotes, |
70 notes: currentNotes, |
|
71 autoSubmit |
61 }; |
72 }; |
62 } |
73 } |
63 |
74 |
64 function mapDispatchToProps(dispatch) { |
75 function mapDispatchToProps(dispatch) { |
65 return { |
76 return { |
66 sessionsActions: bindActionCreators(sessionsActions, dispatch), |
77 sessionsActions: bindActionCreators(sessionsActions, dispatch), |
67 notesActions: bindActionCreators(notesActions, dispatch), |
78 notesActions: bindActionCreators(notesActions, dispatch), |
|
79 userActions: bindActionCreators(userActions, dispatch) |
68 } |
80 } |
69 } |
81 } |
70 |
82 |
71 export default connect(mapStateToProps, mapDispatchToProps)(Session); |
83 export default connect(mapStateToProps, mapDispatchToProps)(Session); |