import * as React from 'react'; import { databind, SearchBox, DetailLayout } from 'solrkit'; import { AppDataStore } from './data/AppDataStore'; import { Document } from './data/Document'; import { Dropdown } from 'semantic-ui-react'; import { get } from 'lodash'; function hrefs(links: string[]) { return links.map( (link) => (

{link}

) ); } const train1options = [ { key: 'Transom', text: 'Transom' }, { key: 'Rose', text: 'Rose' }, { key: 'Arched', text: 'Arched' } ]; const train2options = [ { key: 'Tiffany', text: 'Tiffany' }, { key: 'Meyer', text: 'Zettler' }, { key: 'Boos', text: 'Boos' }, { key: 'D\'Ascenzo', text: 'D\'Ascenzo' }, { key: 'Ballano', text: 'Ballano' } ]; class DocumentDetails extends React.Component { constructor() { super(); this.setValue = this.setValue.bind(this); } setValue(attr: string) { const self = this; return function(event: React.SyntheticEvent<{}>) { dataStore.windows.doUpdate( self.props.id, attr, get(event, 'currentTarget.textContent', '') ); event.stopPropagation(); }; } render() { // [[214, 269, 250, 233], [262, 305, 298, 269]] const rects = JSON.parse(this.props.faces).map( ([top, right, bottom, left]) => (
) ); return (
{rects}
URL: {this.props.url}
Width: {this.props.width}
Height: {this.props.height}
Aspect: {this.props.aspect / 100.0}
Faces: {this.props.face_count}
Tags (ResNet 50): {(this.props.resnet50_tags || []).join(', ')}
Tags (Google Vision): {(this.props.gv_labels || []).join(', ')}
Job: {this.props.place}
Inscription (Google Vision): {(this.props.gv_inscription || []).join(', ')}
Full Matching Images (Google Vision): {hrefs(this.props.gv_full_matching_images || [])}
Partial Matching Images (Google Vision): {hrefs(this.props.gv_partial_matching_images || [])}
Pages matching Images (Google Vision): {hrefs(this.props.gv_pages_matching_images || [])}
Train 1:
Prediction 1: {this.props.prediction_1} {this.props.confidence_1}%
{this.props.train_1} Train 2: {this.props.train_2}
Prediction 2: {this.props.prediction_2} {this.props.confidence_2}%
Train 3: {this.props.train_3}
Prediction 3: {this.props.prediction_3} {this.props.confidence_3}%
Train 4: {this.props.train_4}
Prediction 4: {this.props.prediction_4} {this.props.confidence_4}%
Train 5: {this.props.train_5}
Prediction 5: {this.props.prediction_5} {this.props.confidence_5}%
); } } interface DetailAppProps { id: string; } const dataStore = new AppDataStore(); class DetailPageApp extends React.Component { private left: () => JSX.Element; private right: () => JSX.Element; private header: () => JSX.Element; constructor() { super(); this.left = databind( dataStore.windows.onGet, dataStore.windows, (talk: Document) => ( ) ); this.header = databind( dataStore.windows.onGet, dataStore.windows, (talk: Document) => ( ) ); } init() { dataStore.windows.doGet(this.props.id.replace(/_/g, '/')); } componentWillReceiveProps() { this.init(); } componentDidMount() { this.init(); } componentWillUnmount() { //dataStore.clearEvents(); } render() { return ( ); } } export { DetailPageApp };