client/src/components/Session.js
changeset 125 c653f49fabfb
parent 76 b4f9114b3a86
child 129 d48946d164c6
--- a/client/src/components/Session.js	Thu Jul 20 11:23:08 2017 +0200
+++ b/client/src/components/Session.js	Thu Jul 20 23:37:58 2017 +0200
@@ -10,6 +10,7 @@
 import SessionSummary from './SessionSummary';
 import * as sessionsActions from '../actions/sessionsActions';
 import * as notesActions from '../actions/notesActions';
+import * as userActions from '../actions/userActions';
 
 class Session extends Component {
   render() {
@@ -24,14 +25,22 @@
             <div className="notes-list">
               <SessionForm session={this.props.currentSession} />
               <hr />
-              <NotesList notes={this.props.notes} />
+              <NotesList
+                notes={this.props.notes}
+                deleteNote={this.props.notesActions.deleteNote}
+                updateNote={this.props.notesActions.updateNote}
+              />
             </div>
           </div>
           <section className="editor-fixed">
             <Grid fluid>
               <Row>
                 <Col md={9} mdOffset={3}>
-                  <NoteInput session={this.props.currentSession} addNote={this.props.notesActions.addNote} />
+                  <NoteInput
+                    session={this.props.currentSession}
+                    autoSubmit={this.props.autoSubmit}
+                    addNote={this.props.notesActions.addNote}
+                    setAutoSubmit={this.props.userActions.setAutoSubmit} />
                 </Col>
               </Row>
             </Grid>
@@ -48,16 +57,18 @@
 
   const sessions = state['sessions'];
   const notes = state['notes'];
+  const autoSubmit = state['autoSubmit'];
 
   const currentSession = sessions.find(session => session._id === sessionId);
   const currentNotes = notes.filter(note => {
-        return note.session === sessionId;
+        return (note.session === sessionId && !note.deleted);
     }).sortBy( n => n.get('startedAt') );
 
   return {
     currentSession,
     sessions,
     notes: currentNotes,
+    autoSubmit
   };
 }
 
@@ -65,6 +76,7 @@
   return {
     sessionsActions: bindActionCreators(sessionsActions, dispatch),
     notesActions: bindActionCreators(notesActions, dispatch),
+    userActions: bindActionCreators(userActions, dispatch)
   }
 }