client/src/components/SessionSummary.js
author ymh <ymh.work@gmail.com>
Thu, 22 Jun 2017 12:09:48 +0200
changeset 74 043477fd5c5c
parent 73 7e8cdc74d86f
child 77 cd27d9fc1c73
permissions -rw-r--r--
add api call to save notes. internally use ts for time data for notes and session

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

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

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

export default connect(mapStateToProps)(SessionSummary);