# HG changeset patch # User salimr # Date 1539075143 -7200 # Node ID 1fd73fdaf4c66b2ea17a6a3535f119b871bc06ef # Parent a642639dbc072f46700a388b03c1e07813aeba83 Add ReadOnlySession component and message when session list is empty diff -r a642639dbc07 -r 1fd73fdaf4c6 client/src/components/ReadOnlySession.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/components/ReadOnlySession.js Tue Oct 09 10:52:23 2018 +0200 @@ -0,0 +1,56 @@ +import React, { Component } from 'react'; +import { connect } from 'react-redux'; +import Note from './Note'; +import Navbar from './Navbar'; +import SessionForm from './SessionForm'; +import { getSession, getSessionNotes } from '../selectors/coreSelectors'; +import './ReadOnlySession.css'; + + + +class ReadOnlySession extends Component { + + onClickSession = (e) => { + e.preventDefault(); + this.props.history.push('/sessions/' + this.props.match.params.id) + } + + render() { + + return ( +
+ +
+ + Atteindre la session +
+ {this.props.notes.map((note) => + + )} +
+
+
+ ); + } +}; + + +function mapStateToProps(state, props) { + + const sessionId = props.match.params.id; + + const currentSession = getSession(sessionId, state); + const currentNotes = getSessionNotes(sessionId, state); + + return { + currentSession, + notes: currentNotes, + }; +} + +export default connect(mapStateToProps)(ReadOnlySession); + + diff -r a642639dbc07 -r 1fd73fdaf4c6 client/src/components/Session.js --- a/client/src/components/Session.js Mon Oct 08 04:09:19 2018 +0200 +++ b/client/src/components/Session.js Tue Oct 09 10:52:23 2018 +0200 @@ -8,6 +8,7 @@ import NotesList from './NotesList'; import SessionForm from './SessionForm'; import SessionSummary from './SessionSummary'; +import ProtocolSummary from './ProtocolSummary'; import * as sessionsActions from '../actions/sessionsActions'; import * as notesActions from '../actions/notesActions'; import * as userActions from '../actions/userActions'; @@ -16,13 +17,21 @@ import { extractAnnotationCategories, defaultAnnotationsCategories } from '../constants'; class Session extends Component { + + onClickReadOnly = (e) => { + e.preventDefault(); + this.props.history.push('/read-only/' + this.props.match.params.id); + } + render() { + return (
diff -r a642639dbc07 -r 1fd73fdaf4c6 client/src/components/SessionList.js --- a/client/src/components/SessionList.js Mon Oct 08 04:09:19 2018 +0200 +++ b/client/src/components/SessionList.js Tue Oct 09 10:52:23 2018 +0200 @@ -55,14 +55,23 @@ showSessionsNumber = () => { if (this.props.sessions.size === 1) return ( - {this.props.sessions.size} session + {this.props.sessions.size} session ); return ( - {this.props.sessions.size} sessions + {this.props.sessions.size} sessions ) } + emptyListMessage = () => { + + if (this.props.sessions.size === 0) { + return ( +

vous n'avez créé aucune session pour le moment

+ ); + } + } + deleteSession = () => { const { sessionToDelete } = this.state; @@ -81,11 +90,12 @@
{this.showSessionsNumber()} + {this.emptyListMessage()}
-
+
{this.props.sessions.map((session) => -