blob: 2b223a469accf0a1ae512dc85f10516e40c046e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
import React, { Component } from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { courtesyS } from '../util'
import * as actions from './faceSearch.actions'
class FaceSearchResult extends Component {
render() {
const { dataset } = this.props.payload
const { distances, results } = this.props.result
if (!results) {
return (
<div className='result'></div>
)
}
if (!this.props.result.results.length) {
return (
<div className='result'>No results</div>
)
}
const els = results.map((result, i) => {
const distance = distances[i]
const { uuid } = result.uuid
const { fullname, gender, description, images } = result.identity
return (
<div>
<img src={'https://megapixels.nyc3.digitaloceanspaces.com/v1/media/' + dataset + '/' + uuid + '.jpg'} />
{fullname} {'('}{gender}{')'}<br/>
{description}<br/>
{courtesyS(images, 'image')}<br />
{distance}
</div>
)
})
return (
<div className='result'>
<div class='results'>
{els}
</div>
</div>
)
}
}
const mapStateToProps = state => ({
query: state.faceSearch.query,
result: state.faceSearch.result,
options: state.faceSearch.options,
})
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators({ ...actions }, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(FaceSearchResult)
|