Commit f74a78ae authored by Elisabeth Reuhl's avatar Elisabeth Reuhl
Browse files

Add entity type choice to filters (issue #81)

parent ad59df7f
......@@ -44,7 +44,29 @@ const initialInput = {
areaA: 1,
areaB: 0,
bigTileArea: "",
arachneTypes: ["Einzelobjekte", "Topographien", "Bilder"]
arachneTypesChoices: [ //todo: welche davon sollen angeboten werden? einige gibt es gar nicht für SPP/Afrika nehme ich an.
{"label": "Einzelobjekte", "id": "Einzelobjekte"},
{"label": "Mehrteilige Denkmäler", "id": "MehrteiligeDenkmaeler"},
{"label": "Bauwerke", "id": "Bauwerke"},
{"label": "Bauwerksteile", "id": "Bauwerksteile"},
{"label": "Bilder", "id": "Bilder"},
{"label": "Bücher", "id": "Buecher"},
{"label": "Buchseiten", "id": "Buchseiten"},
{"label": "Einzelmotive", "id": "Einzelmotive"},
{"label": "Gruppierungen", "id": "Gruppierungen"},
{"label": "Inschriften", "id": "Inschriften"},
{"label": "Literatur", "id": "Literatur"},
{"label": "Orte", "id": "Orte"},
{"label": "Reproduktionen", "id": "Reproduktionen"},
{"label": "Personen", "id": "Personen"},
{"label": "Rezeptionen", "id": "Rezeptionen"},
{"label": "Sammlungen", "id": "Sammlungen"},
{"label": "Szenen", "id": "Szenen"},
{"label": "Topographien", "id": "Topographien"},
{"label": "Typen", "id": "Typen"},
{"label": "3D-Modelle", "id": "dreiDModelle"}],
arachneTypesCheckedIds: ["Bilder", "Einzelobjekte", "Topographien"],
arachneTypesCheckedLabels: ["Bilder", "Einzelobjekte", "Topographien"],
};
......@@ -121,7 +143,7 @@ export const AppContent = () => {
? input.boundingBoxCorner1.concat(input.boundingBoxCorner2)
: [],
periodTerm: input.chronOntologyTerm,
entityTypes: input.arachneTypes
entityTypes: input.arachneTypesCheckedIds
}
}
: {variables: {searchTerm: "", catalogIds: [], bbox: [], periodTerm: "", entityTypes: []}});
......@@ -198,7 +220,7 @@ export const AppContent = () => {
console.log("rerender dataObjects --> dataObjects: ", dataObjects);
console.log("rerender dataObjects --> input:", input);
}
}, [dataObjects, input.showSearchResults, debouncedSearchStr, input.checkedCatalogIds, input.chronOntologyTerm, input.boundingBoxCorner1, input.boundingBoxCorner2, input.mode]);
}, [dataObjects, input.showSearchResults, debouncedSearchStr, input.checkedCatalogIds, input.chronOntologyTerm, input.boundingBoxCorner1, input.boundingBoxCorner2, input.mode, input.arachneTypesCheckedIds]);
useEffect( () => {
if (dataArchaeoSites && input.showArchaeoSites && input.mode === "archaeoSites" && input.sitesMode!=="region" && (debouncedSearchStr || (input.boundingBoxCorner1.length!==0 && input.boundingBoxCorner2.length!==0))) {
......
......@@ -19,6 +19,10 @@ export const CollapsedFilters = (props) => {
: "Objects"}
/>
{/*Chip for entity types*/}
{input.arachneTypesCheckedLabels.length !== 0
&& <Chip variant="outlined" label={`Entity types: ${input.arachneTypesCheckedLabels}`}/>}
{/*Chip for for string query*/}
{input.searchStr !== ""
&& <Chip variant="outlined" label={`Search term: ${input.searchStr}`}/>}
......
......@@ -52,6 +52,46 @@ export const Filters = (props) => {
</FormGroup>
</Grid>}
{/*checkboxes for filter by entity type; only active in object search mode*/
!input.showArchaeoSites && <Grid item>
<FormGroup>
<FormLabel component="legend" disabled={input.showArchaeoSites}>Filter by Arachne entity type</FormLabel>
{input.arachneTypesChoices && input.arachneTypesChoices.map(type => {
return (type.id
&& <FormControlLabel
key={type.id}
control={
<Checkbox
checked={input.arachneTypesCheckedIds.includes(type.id)}
onChange={() => {
dispatch({
type: input.arachneTypesCheckedIds.includes(type.id)
? "UNCHECK_ITEM"
: "CHECK_ITEM",
payload: {field: "arachneTypesCheckedIds", toggledItem: type.id}
});
dispatch({
type: "UPDATE_INPUT",
payload: {
field: "arachneTypesCheckedLabels",
value: input.arachneTypesCheckedLabels.includes(type.label)
? [...input.arachneTypesCheckedLabels.filter(label => label !== type.label)]
: [...input.arachneTypesCheckedLabels, type.label]
}
})
}}
name={String(type.id)}
key={type.id}
disabled={input.showArchaeoSites}
/>
}
label={type.label}
/>
)
})}
</FormGroup>
</Grid>}
{/*input field for string query*/
<Grid item>
<FormGroup>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment