From f5983bb9bdb05001f6dea60cc4bae8fd81543cad Mon Sep 17 00:00:00 2001 From: kohei Date: Mon, 19 Nov 2018 18:54:34 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20kaburiActivity=E3=82=92=E5=80=9F?= =?UTF-8?q?=E3=82=8A=E3=81=99=E3=82=8B=E8=B2=AC=E5=8B=99=E3=82=92vad.jsx?= =?UTF-8?q?=E3=81=AB=E7=A7=BB=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/kaburi.jsx | 5 ++--- components/vad.jsx | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/components/kaburi.jsx b/components/kaburi.jsx index dc7b0cf..b8d494f 100644 --- a/components/kaburi.jsx +++ b/components/kaburi.jsx @@ -1,7 +1,6 @@ export default ({ activity }) => { - const kaburiActivity = activity.filter(a => a.ch === "kaburi"); - const count = kaburiActivity.length; - const time = kaburiActivity + const count = activity.length; + const time = activity .map(a => a.endTime - a.startTime) .reduce((a, c) => a + c, 0); diff --git a/components/vad.jsx b/components/vad.jsx index c1de31f..257444e 100644 --- a/components/vad.jsx +++ b/components/vad.jsx @@ -9,7 +9,8 @@ export default class extends Component { audioStream: null, left: null, right: null, - activity: [] + activity: [], + kaburiActivity: [] }; componentDidMount() { @@ -30,10 +31,9 @@ export default class extends Component { const putKaburi = () => { if (this.state.left !== null && this.state.right !== null) { this.setState({ - activity: [ - ...this.state.activity, + kaburiActivity: [ + ...this.state.kaburiActivity, { - ch: "kaburi", startTime: Math.max(this.state.left, this.state.right), endTime: new Date().getTime() } @@ -111,7 +111,7 @@ export default class extends Component {
{this.state.right && "発話中..."}
- + ); }