equal
deleted
inserted
replaced
1 import React, { Component } from 'react'; |
1 import React, { Component } from 'react'; |
2 import { connect } from 'react-redux'; |
2 import { connect } from 'react-redux'; |
3 import { bindActionCreators } from 'redux'; |
3 import { bindActionCreators } from 'redux'; |
4 import { Form, FormControl, Label } from 'react-bootstrap'; |
4 import { Form, FormControl, Button } from 'react-bootstrap'; |
5 import moment from 'moment'; |
|
6 |
5 |
7 import PropTypes from 'prop-types'; |
6 import PropTypes from 'prop-types'; |
8 import SlateEditor from './SlateEditor'; |
7 import SlateEditor from './SlateEditor'; |
9 import * as notesActions from '../actions/notesActions'; |
8 import * as notesActions from '../actions/notesActions'; |
10 import * as userActions from '../actions/userActions'; |
9 import * as userActions from '../actions/userActions'; |
|
10 import { now } from '../utils'; |
|
11 |
11 |
12 |
12 class NoteInput extends Component { |
13 class NoteInput extends Component { |
13 |
14 |
14 state = { |
15 state = { |
15 buttonDisabled: false, |
16 buttonDisabled: false, |
36 plain: plain, |
37 plain: plain, |
37 raw: raw, |
38 raw: raw, |
38 html: html, |
39 html: html, |
39 |
40 |
40 startedAt: this.state.startedAt, |
41 startedAt: this.state.startedAt, |
41 finishedAt: moment().format('H:mm:ss'), |
42 finishedAt: now(), |
42 categories: categories, |
43 categories: categories, |
43 }); |
44 }); |
44 |
45 |
45 this.refs.editor.clear(); |
46 this.refs.editor.clear(); |
46 setTimeout(() => this.refs.editor.focus(), 250); |
47 setTimeout(() => this.refs.editor.focus(), 250); |
51 } |
52 } |
52 |
53 |
53 componentDidMount() { |
54 componentDidMount() { |
54 const text = this.refs.editor.asPlain(); |
55 const text = this.refs.editor.asPlain(); |
55 this.setState({ buttonDisabled: text.length === 0 }); |
56 this.setState({ buttonDisabled: text.length === 0 }); |
56 } |
|
57 |
|
58 renderTiming() { |
|
59 if (this.state.startedAt && this.state.finishedAt) { |
|
60 return ( |
|
61 <span> |
|
62 <Label>{this.state.startedAt}</Label> ⇒ <Label>{this.state.finishedAt}</Label> |
|
63 </span> |
|
64 ) |
|
65 } else { |
|
66 return ( |
|
67 <span>No timing</span> |
|
68 ) |
|
69 } |
|
70 } |
57 } |
71 |
58 |
72 render() { |
59 render() { |
73 return ( |
60 return ( |
74 <Form> |
61 <Form> |