client/src/components/SessionSummary.js
author Alexandre Segura <mex.zktk@gmail.com>
Tue, 20 Jun 2017 16:08:12 +0200
changeset 63 4088f8dc6b52
child 73 7e8cdc74d86f
permissions -rw-r--r--
Improve session page layout, introduce summary.

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Panel, ListGroup, ListGroupItem } from 'react-bootstrap';
import _ from 'lodash';
import '../App.css';

class SessionSummary extends Component {
  render() {
    return (
      <Panel>
        <ListGroup>
          {this.props.notes.map((note) =>
            <ListGroupItem key={note.get('_id')}>
              <a href={'#note-' + note.get('_id')}>
                <span className="text-muted">{note.startedAt}  {note.finishedAt}</span>
                <span className="pull-right">{_.words(note.plain).length} words</span>
              </a>
            </ListGroupItem>
          )}
        </ListGroup>
      </Panel>
    );
  }
}

function mapStateToProps(state, props) {
  return props;
}

export default connect(mapStateToProps)(SessionSummary);