mirror of
https://github.com/kou029w/_.git
synced 2025-01-30 13:58:08 +00:00
refactor: kaburiActivityを借りする責務をvad.jsxに移す
This commit is contained in:
parent
0508d129c7
commit
f5983bb9bd
2 changed files with 7 additions and 8 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 {
|
|||
<dd>{this.state.right && "発話中..."}</dd>
|
||||
</dl>
|
||||
<Percentage activity={this.state.activity} />
|
||||
<Kaburi activity={this.state.activity} />
|
||||
<Kaburi activity={this.state.kaburiActivity} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue