equal
deleted
inserted
replaced
1 import React, { Component } from 'react'; |
1 import React from 'react'; |
2 import { connect } from 'react-redux'; |
|
3 import { ListGroup, ListGroupItem } from 'react-bootstrap'; |
2 import { ListGroup, ListGroupItem } from 'react-bootstrap'; |
4 import _ from 'lodash'; |
3 import _ from 'lodash'; |
5 import '../App.css'; |
4 import '../App.css'; |
6 import {formatTimestamp} from '../utils'; |
5 import {formatTimestamp} from '../utils'; |
7 |
6 |
8 class SessionSummary extends Component { |
7 const SessionSummary = ({notes}) => ( |
9 render() { |
8 <ListGroup> |
10 return ( |
9 {notes.map((note) => |
11 <ListGroup> |
10 <ListGroupItem key={note.get('_id')}> |
12 {this.props.notes.map((note) => |
11 <a href={'#note-' + note.get('_id')}> |
13 <ListGroupItem key={note.get('_id')}> |
12 <span className="text-muted">{formatTimestamp(note.startedAt)} → {formatTimestamp(note.finishedAt)}</span> |
14 <a href={'#note-' + note.get('_id')}> |
13 <span className="pull-right">{_.words(note.plain).length} words</span> |
15 <span className="text-muted">{formatTimestamp(note.startedAt)} → {formatTimestamp(note.finishedAt)}</span> |
14 </a> |
16 <span className="pull-right">{_.words(note.plain).length} words</span> |
15 </ListGroupItem> |
17 </a> |
16 )} |
18 </ListGroupItem> |
17 </ListGroup> |
19 )} |
18 ) |
20 </ListGroup> |
|
21 ); |
|
22 } |
|
23 } |
|
24 |
19 |
25 function mapStateToProps(state, props) { |
20 export default SessionSummary; |
26 return { |
|
27 ...props, |
|
28 notes : props.notes.filter(note => !note.deleted) |
|
29 }; |
|
30 } |
|
31 |
|
32 export default connect(mapStateToProps)(SessionSummary); |
|