diff --git a/invenio_communities/assets/semantic-ui/js/invenio_communities/community/searchComponents/CommunitiesStatusFilter.js b/invenio_communities/assets/semantic-ui/js/invenio_communities/community/searchComponents/CommunitiesStatusFilter.js new file mode 100644 index 000000000..3a9ac6773 --- /dev/null +++ b/invenio_communities/assets/semantic-ui/js/invenio_communities/community/searchComponents/CommunitiesStatusFilter.js @@ -0,0 +1,57 @@ +import { i18next } from "@translations/invenio_rdm_records/i18next"; + +import React, { Component } from "react"; + +import { Menu } from "semantic-ui-react"; +import PropTypes from "prop-types"; + +export class CommunitiesStatusFilter extends Component { + render() { + const { + myCommunitiesOnClick, + allCommunitiesOnClick, + appID, + allCommunitiesSelected, + } = this.props; + + return ( +
+ ); + } +} + +CommunitiesStatusFilter.propTypes = { + allCommunitiesOnClick: PropTypes.func.isRequired, + myCommunitiesOnClick: PropTypes.func.isRequired, + allCommunitiesSelected: PropTypes.bool, + appID: PropTypes.string.isRequired, +}; + +CommunitiesStatusFilter.defaultProps = { + allCommunitiesSelected: true, +}; diff --git a/invenio_communities/assets/semantic-ui/js/invenio_communities/community/searchComponents/CommunitySelectionSearch.js b/invenio_communities/assets/semantic-ui/js/invenio_communities/community/searchComponents/CommunitySelectionSearch.js index 79161e4e5..f18850083 100644 --- a/invenio_communities/assets/semantic-ui/js/invenio_communities/community/searchComponents/CommunitySelectionSearch.js +++ b/invenio_communities/assets/semantic-ui/js/invenio_communities/community/searchComponents/CommunitySelectionSearch.js @@ -1,4 +1,4 @@ -// This file is part of Invenio-RDM-Records +// This file is part of Invenio-RDM // Copyright (C) 2024 CERN. // // Invenio-communities is free software; you can redistribute it and/or modify it @@ -16,6 +16,7 @@ import { SearchAppResultsPane, } from "@js/invenio_search_ui/components"; import { GridResponsiveSidebarColumn, InvenioPopup } from "react-invenio-forms"; +import { CommunitiesStatusFilter } from "./CommunitiesStatusFilter"; export class CommunitySelectionSearch extends Component { constructor(props) { @@ -30,6 +31,11 @@ export class CommunitySelectionSearch extends Component { }; } + /** + * Namespaces each component object with the specified appID. + * This is needed since the `CommunitySelectionSearch` component + * uses two search applications with distinct configs (e.g. to search in "All" or "My" communities) + */ prefixAppID(components, appID) { // iterate components and prefix them with ".appID" return Object.fromEntries( @@ -57,7 +63,6 @@ export class CommunitySelectionSearch extends Component { } = this.props; const searchApi = new InvenioSearchApi(selectedSearchApi); - console.log(selectedSearchApi); const validatedComponents = this.prefixAppID(overriddenComponents, selectedAppId); @@ -85,7 +90,7 @@ export class CommunitySelectionSearch extends Component { >