mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 12:58:35 +03:00
Merge pull request #160 from forensic-architecture/topic/rm-search
remove unused search
This commit is contained in:
@@ -19,7 +19,6 @@ The URLs for these endpoints, as well as other configurable settings in your tim
|
||||
| MAP_ANCHOR | Geographic coordinates for original map anchor | Array of numbers | No |
|
||||
| MAPBOX_TOKEN | Access token for Mapbox satellite imagery | String | No |
|
||||
| features.USE_ASSOCIATIONS | Enable / Disable filters | boolean | No |
|
||||
| features.USE_SEARCH | Enable / Disable search | boolean | No |
|
||||
| features.USE_SITES | Enable / Disable sites | boolean | No |
|
||||
|
||||
In this configuration file you'll need to add your Mapbox token (see [here for more info](https://www.mapbox.com/help/define-access-token/)). Additionally, you'll need to replace the required endpoints by functioning ones. Finally, you'll want to initialize your application set in `MAP_ANCHOR`, as a (lat, long) pair, which determines the specific location at which the application will center itself on start.
|
||||
|
||||
@@ -26,7 +26,6 @@ module.exports = {
|
||||
USE_ASSOCIATIONS: true,
|
||||
USE_SOURCES: true,
|
||||
USE_COVER: true,
|
||||
USE_SEARCH: false,
|
||||
USE_SITES: false,
|
||||
USE_SHAPES: false,
|
||||
GRAPH_NONLOCATED: false,
|
||||
|
||||
@@ -5,7 +5,6 @@ import * as actions from '../../actions'
|
||||
import * as selectors from '../../selectors'
|
||||
|
||||
import { Tabs, TabPanel } from 'react-tabs'
|
||||
import Search from './Search'
|
||||
import FilterListPanel from './FilterListPanel'
|
||||
import CategoriesListPanel from './CategoriesListPanel'
|
||||
import BottomActions from './BottomActions'
|
||||
@@ -31,23 +30,6 @@ class Toolbar extends React.Component {
|
||||
)
|
||||
}
|
||||
|
||||
renderSearch () {
|
||||
if (this.props.features.USE_SEARCH) {
|
||||
return (
|
||||
<TabPanel>
|
||||
<Search
|
||||
language={this.props.language}
|
||||
filters={this.props.filters}
|
||||
categories={this.props.categories}
|
||||
filterFilters={this.props.filterFilters}
|
||||
categoryFilters={this.props.categoryFilters}
|
||||
filter={this.props.filter}
|
||||
/>
|
||||
</TabPanel>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
goToNarrative (narrative) {
|
||||
this.selectTab(-1) // set all unselected within this component
|
||||
this.props.methods.onSelectNarrative(narrative)
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/* global fetch */
|
||||
import React from 'react'
|
||||
import copy from '../../common/data/copy.json'
|
||||
import SelectFilter from './SelectFilter'
|
||||
|
||||
export default class Search extends React.Component {
|
||||
constructor (props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
searchValue: undefined,
|
||||
searchResults: []
|
||||
}
|
||||
|
||||
this.handleSearchChange = this.handleSearchChange.bind(this)
|
||||
this.handleSearchSubmit = this.handleSearchSubmit.bind(this)
|
||||
}
|
||||
|
||||
handleSearchSubmit (e) {
|
||||
e.preventDefault()
|
||||
fetch(`api/search/${this.state.searchValue}`)
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
this.setState({
|
||||
searchResults: json.filters
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
handleSearchChange (event) {
|
||||
this.setState({ searchValue: event.target.value })
|
||||
}
|
||||
|
||||
renderSearchResults () {
|
||||
return (
|
||||
this.state.searchResults.map(filter => {
|
||||
return (
|
||||
<SelectFilter
|
||||
isShowTree
|
||||
filters={this.props.filters}
|
||||
categories={this.props.categories}
|
||||
filterFilters={this.props.filterFilters}
|
||||
categoryFilters={this.props.categoryFilters}
|
||||
filter={this.props.filter}
|
||||
isCategory={this.props.isCategory}
|
||||
/>
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<div className='search-content'>
|
||||
<h2>{copy[this.props.language].toolbar.panels.search.title}</h2>
|
||||
<form onSubmit={this.handleSearchSubmit}>
|
||||
<input
|
||||
value={this.state.searchValue}
|
||||
onChange={this.handleSearchChange}
|
||||
autoFocus
|
||||
type='text'
|
||||
name='search-input'
|
||||
placeholder={copy[this.props.language].toolbar.panels.search.placeholder}
|
||||
/>
|
||||
</form>
|
||||
<ul>
|
||||
{this.renderSearchResults()}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,6 @@ const initial = {
|
||||
features: {
|
||||
USE_COVER: false,
|
||||
USE_ASSOCIATIONS: false,
|
||||
USE_SEARCH: false,
|
||||
USE_SITES: false,
|
||||
USE_SOURCES: false,
|
||||
USE_SHAPES: false,
|
||||
|
||||
Reference in New Issue
Block a user