Newer
Older
import React from 'react'
import PropTypes from 'prop-types'
import Perspective1 from './Perspective1'
import Perspective2 from './Perspective2'
import Perspective3 from './Perspective3'
import EmloActors from './EmloActors'
/**
* A component for creating a faceted search perspective for a semantic portal.
*/
const FacetedSearchPerspective = props => {
const renderPerspective = () => {
let perspectiveElement = null
switch (props.perspective.id) {
case 'perspective1':
perspectiveElement =
<Perspective1
facetResults={props.facetResults}
placesResults={props.placesResults}
leafletMapLayers={props.leafletMap}
facetData={props.facetData}
facetDataConstrainSelf={props.facetDataConstrainSelf}
fetchPaginatedResults={props.fetchPaginatedResults}
fetchResults={props.fetchResults}
fetchFacetConstrainSelf={props.fetchFacetConstrainSelf}
fetchGeoJSONLayers={props.fetchGeoJSONLayers}
fetchGeoJSONLayersBackend={props.fetchGeoJSONLayersBackend}
clearGeoJSONLayers={props.clearGeoJSONLayers}
fetchByURI={props.fetchByURI}
updatePage={props.updatePage}
updateRowsPerPage={props.updateRowsPerPage}
updateFacetOption={props.updateFacetOption}
sortResults={props.sortResults}
routeProps={props.routeProps}
perspective={props.perspective}
animationValue={props.animationValue}
animateMap={props.animateMap}
screenSize={props.screenSize}
rootUrl={props.rootUrl}
/>
break
case 'perspective2':
perspectiveElement =
<Perspective2
facetResults={props.facetResults}
placesResults={props.placesResults}
leafletMapLayers={props.leafletMap}
facetData={props.facetData}
facetDataConstrainSelf={props.facetDataConstrainSelf}
fetchPaginatedResults={props.fetchPaginatedResults}
fetchResults={props.fetchResults}
fetchFacetConstrainSelf={props.fetchFacetConstrainSelf}
fetchGeoJSONLayers={props.fetchGeoJSONLayers}
fetchGeoJSONLayersBackend={props.fetchGeoJSONLayersBackend}
clearGeoJSONLayers={props.clearGeoJSONLayers}
fetchByURI={props.fetchByURI}
updatePage={props.updatePage}
updateRowsPerPage={props.updateRowsPerPage}
updateFacetOption={props.updateFacetOption}
sortResults={props.sortResults}
routeProps={props.routeProps}
perspective={props.perspective}
animationValue={props.animationValue}
animateMap={props.animateMap}
screenSize={props.screenSize}
rootUrl={props.rootUrl}
/>
break
case 'perspective3':
perspectiveElement =
<Perspective3
facetResults={props.facetResults}
placesResults={props.placesResults}
leafletMapLayers={props.leafletMap}
facetData={props.facetData}
facetDataConstrainSelf={props.facetDataConstrainSelf}
fetchPaginatedResults={props.fetchPaginatedResults}
fetchResults={props.fetchResults}
fetchFacetConstrainSelf={props.fetchFacetConstrainSelf}
fetchGeoJSONLayers={props.fetchGeoJSONLayers}
fetchGeoJSONLayersBackend={props.fetchGeoJSONLayersBackend}
clearGeoJSONLayers={props.clearGeoJSONLayers}
fetchByURI={props.fetchByURI}
updatePage={props.updatePage}
updateRowsPerPage={props.updateRowsPerPage}
updateFacetOption={props.updateFacetOption}
sortResults={props.sortResults}
routeProps={props.routeProps}
perspective={props.perspective}
animationValue={props.animationValue}
animateMap={props.animateMap}
screenSize={props.screenSize}
rootUrl={props.rootUrl}
/>
break
case 'finds':
perspectiveElement =
<Finds
facetResults={props.facetResults}
placesResults={props.placesResults}
leafletMapLayers={props.leafletMap}
facetData={props.facetData}
facetDataConstrainSelf={props.facetDataConstrainSelf}
fetchPaginatedResults={props.fetchPaginatedResults}
fetchResults={props.fetchResults}
fetchFacetConstrainSelf={props.fetchFacetConstrainSelf}
fetchGeoJSONLayers={props.fetchGeoJSONLayers}
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
fetchGeoJSONLayersBackend={props.fetchGeoJSONLayersBackend}
clearGeoJSONLayers={props.clearGeoJSONLayers}
fetchByURI={props.fetchByURI}
updatePage={props.updatePage}
updateRowsPerPage={props.updateRowsPerPage}
updateFacetOption={props.updateFacetOption}
sortResults={props.sortResults}
showError={props.showError}
routeProps={props.routeProps}
perspective={props.perspective}
animationValue={props.animationValue}
animateMap={props.animateMap}
screenSize={props.screenSize}
rootUrl={props.rootUrl}
/>
break
case 'emloActors':
perspectiveElement =
<EmloActors
facetResults={props.facetResults}
placesResults={props.placesResults}
leafletMapLayers={props.leafletMap}
facetData={props.facetData}
facetDataConstrainSelf={props.facetDataConstrainSelf}
fetchPaginatedResults={props.fetchPaginatedResults}
fetchResults={props.fetchResults}
fetchFacetConstrainSelf={props.fetchFacetConstrainSelf}
fetchGeoJSONLayers={props.fetchGeoJSONLayers}
fetchGeoJSONLayersBackend={props.fetchGeoJSONLayersBackend}
clearGeoJSONLayers={props.clearGeoJSONLayers}
fetchByURI={props.fetchByURI}
updatePage={props.updatePage}
updateRowsPerPage={props.updateRowsPerPage}
updateFacetOption={props.updateFacetOption}
sortResults={props.sortResults}
showError={props.showError}
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
routeProps={props.routeProps}
perspective={props.perspective}
animationValue={props.animationValue}
animateMap={props.animateMap}
screenSize={props.screenSize}
rootUrl={props.rootUrl}
/>
break
case 'hellerau':
perspectiveElement =
<Hellerau
facetResults={props.facetResults}
placesResults={props.placesResults}
leafletMapLayers={props.leafletMap}
facetData={props.facetData}
facetDataConstrainSelf={props.facetDataConstrainSelf}
fetchPaginatedResults={props.fetchPaginatedResults}
fetchResults={props.fetchResults}
fetchFacetConstrainSelf={props.fetchFacetConstrainSelf}
fetchGeoJSONLayers={props.fetchGeoJSONLayers}
fetchGeoJSONLayersBackend={props.fetchGeoJSONLayersBackend}
clearGeoJSONLayers={props.clearGeoJSONLayers}
fetchByURI={props.fetchByURI}
updatePage={props.updatePage}
updateRowsPerPage={props.updateRowsPerPage}
updateFacetOption={props.updateFacetOption}
sortResults={props.sortResults}
showError={props.showError}
routeProps={props.routeProps}
perspective={props.perspective}
animationValue={props.animationValue}
animateMap={props.animateMap}
screenSize={props.screenSize}
rootUrl={props.rootUrl}
/>
break
default:
perspectiveElement = <div />
break
}
return perspectiveElement
}
return (
<>
{renderPerspective()}
</>
)
}
FacetedSearchPerspective.propTypes = {
/**
* Faceted search configs and results of this perspective.
*/
facetResults: PropTypes.object.isRequired,
/**
* Faceted search configs and results of places related to this perspective.
*/
placesResults: PropTypes.object.isRequired,
/**
* Facet configs and values.
*/
facetData: PropTypes.object.isRequired,
/**
* Facet values where facets constrain themselves, used for statistics.
*/
facetDataConstrainSelf: PropTypes.object.isRequired,
/**
* Leaflet map config and external layers.
*/
leafletMap: PropTypes.object.isRequired,
/**
* Redux action for fetching paginated results.
*/
fetchPaginatedResults: PropTypes.func.isRequired,
/**
* Redux action for fetching all results.
*/
fetchResults: PropTypes.func.isRequired,
/**
* Redux action for fetching facet values for statistics.
*/
fetchFacetConstrainSelf: PropTypes.func.isRequired,
/**
* Redux action for loading external GeoJSON layers.
*/
fetchGeoJSONLayers: PropTypes.func.isRequired,
/**
* Redux action for loading external GeoJSON layers via backend.
*/
fetchGeoJSONLayersBackend: PropTypes.func.isRequired,
/**
* Redux action for clearing external GeoJSON layers.
*/
clearGeoJSONLayers: PropTypes.func.isRequired,
/**
* Redux action for fetching information about a single entity.
*/
fetchByURI: PropTypes.func.isRequired,
/**
* Redux action for updating the page of paginated results.
*/
updatePage: PropTypes.func.isRequired,
/**
* Redux action for updating the rows per page of paginated results.
*/
updateRowsPerPage: PropTypes.func.isRequired,
/**
* Redux action for sorting the paginated results.
*/
sortResults: PropTypes.func.isRequired,
/**
* Redux action for updating the active selection or config of a facet.
*/
showError: PropTypes.func.isRequired,
/**
* Redux action for showing an error
*/
updateFacetOption: PropTypes.func.isRequired,
/**
* Routing information from React Router.
*/
routeProps: PropTypes.object.isRequired,
perspective: PropTypes.object.isRequired,
/**
* State of the animation, used by TemporalMap.
*/
animationValue: PropTypes.array.isRequired,
/**
* Redux action for animating TemporalMap.
*/
animateMap: PropTypes.func.isRequired,
screenSize: PropTypes.string.isRequired,
/**
* Root url of the application.
*/