|
| 1 | +// This file is part of Invenio |
| 2 | +// Copyright (C) 2022 CERN. |
| 3 | +// |
| 4 | +// Invenio is free software; you can redistribute it and/or modify it under the |
| 5 | +// terms of the MIT License; see LICENSE file for more details. |
| 6 | + |
| 7 | +import { createSearchAppInit } from "@js/invenio_search_ui"; |
| 8 | +import { |
| 9 | + RDMCountComponent, |
| 10 | + RDMEmptyResults, |
| 11 | + RDMErrorComponent, |
| 12 | + RDMRecordResultsGridItem, |
| 13 | + RDMToggleComponent, |
| 14 | +} from "../search/components"; |
| 15 | +import RecordsResultsListItem from "../components/RecordsResultsListItem"; |
| 16 | +import { |
| 17 | + CommunityRecordsSearchAppLayout, |
| 18 | + CommunityRecordsSearchBarElement, |
| 19 | +} from "./components"; |
| 20 | +import { parametrize, overrideStore } from "react-overridable"; |
| 21 | +import { |
| 22 | + ContribSearchAppFacets, |
| 23 | + ContribBucketAggregationElement, |
| 24 | + ContribBucketAggregationValuesElement, |
| 25 | +} from "@js/invenio_search_ui/components"; |
| 26 | + |
| 27 | +const appName = "InvenioCommunities.DetailsSearch"; |
| 28 | + |
| 29 | +const ContribSearchAppFacetsWithConfig = parametrize(ContribSearchAppFacets, { |
| 30 | + toogle: true, |
| 31 | +}); |
| 32 | + |
| 33 | +const CommunityRecordSearchAppLayoutWAppName = parametrize( |
| 34 | + CommunityRecordsSearchAppLayout, |
| 35 | + { |
| 36 | + appName: appName, |
| 37 | + } |
| 38 | +); |
| 39 | + |
| 40 | +const defaultComponents = { |
| 41 | + [`${appName}.BucketAggregation.element`]: ContribBucketAggregationElement, |
| 42 | + [`${appName}.BucketAggregationValues.element`]: ContribBucketAggregationValuesElement, |
| 43 | + [`${appName}.ResultsGrid.item`]: RDMRecordResultsGridItem, |
| 44 | + [`${appName}.EmptyResults.element`]: RDMEmptyResults, |
| 45 | + [`${appName}.ResultsList.item`]: RecordsResultsListItem, |
| 46 | + [`${appName}.SearchApp.facets`]: ContribSearchAppFacetsWithConfig, |
| 47 | + [`${appName}.SearchApp.layout`]: CommunityRecordSearchAppLayoutWAppName, |
| 48 | + [`${appName}.SearchBar.element`]: CommunityRecordsSearchBarElement, |
| 49 | + [`${appName}.Count.element`]: RDMCountComponent, |
| 50 | + [`${appName}.Error.element`]: RDMErrorComponent, |
| 51 | + [`${appName}.SearchFilters.Toggle.element`]: RDMToggleComponent, |
| 52 | +}; |
| 53 | + |
| 54 | +const overriddenComponents = overrideStore.getAll(); |
| 55 | + |
| 56 | +createSearchAppInit( |
| 57 | + { ...defaultComponents, ...overriddenComponents }, |
| 58 | + true, |
| 59 | + "invenio-search-config", |
| 60 | + true |
| 61 | +); |
0 commit comments