From 392ea8d0ba2fdc713ae156517b0575e8219b9f1c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 13 Feb 2019 13:58:11 +0100 Subject: adding geocode client --- scraper/client/search/browse.component.js | 77 +++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 scraper/client/search/browse.component.js (limited to 'scraper/client/search/browse.component.js') diff --git a/scraper/client/search/browse.component.js b/scraper/client/search/browse.component.js new file mode 100644 index 00000000..e9ddb04e --- /dev/null +++ b/scraper/client/search/browse.component.js @@ -0,0 +1,77 @@ +import React, { Component } from 'react' +import { Link, withRouter } from 'react-router-dom' +import { bindActionCreators } from 'redux' +import { connect } from 'react-redux' + +import { Loader, Keyframes, Video } from '../common' +// import { Coco } from '../metadata' +import * as searchActions from './search.actions' +import * as metadataActions from '../metadata/metadata.actions' +import SearchMeta from './search.meta' + +class Browse extends Component { + componentDidMount() { + this.browse() + } + + componentDidUpdate(prevProps) { + if (prevProps.match.params !== this.props.match.params) { + this.browse() + } + } + + browse() { + const { hash } = this.props.match.params + if (hash) { + this.props.searchActions.browse(hash) + } + if (hash) { + this.props.metadataActions.fetchMetadata(hash) + } + } + + render() { + const { browse, options } = this.props + console.log('browse', browse) + + if (!browse || browse.reset || browse.loading) { + return

Loading keyframes...

+ } + return ( +
+

Video Preview

+
+ ) + } +} + +const mapStateToProps = state => ({ + browse: state.search.browse, + options: state.search.options, + metadata: state.metadata, +}) + +const mapDispatchToProps = dispatch => ({ + searchActions: bindActionCreators({ ...searchActions }, dispatch), + metadataActions: bindActionCreators({ ...metadataActions }, dispatch), +}) + +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Browse)) -- cgit v1.2.3-70-g09d2