diff --git a/invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/CommunityProfileForm.js b/invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/CommunityProfileForm.js index 9aeef6fe2..d965591b1 100644 --- a/invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/CommunityProfileForm.js +++ b/invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/CommunityProfileForm.js @@ -42,6 +42,7 @@ import { CustomFieldSerializer } from "./CustomFieldSerializer"; import PropTypes from "prop-types"; import { default as DangerZone } from "./DangerZone"; import { default as LogoUploader } from "./LogoUploader"; +import Overridable from 'react-overridable'; const COMMUNITY_VALIDATION_SCHEMA = Yup.object({ metadata: Yup.object({ @@ -377,178 +378,191 @@ class CommunityProfileForm extends Component { /> } /> - - } - fluid - /> - - } - options={types.map((ct) => { - return { - value: ct.id, - text: ct?.title_l10n ?? ct.id, - }; - })} - /> - - } - fluid - /> - - _map(organizations, (organization) => { - // eslint-disable-next-line no-prototype-builtins - const isKnownOrg = this.knownOrganizations.hasOwnProperty( - organization.name - ); - if (!isKnownOrg) { - this.knownOrganizations = { - ...this.knownOrganizations, - [organization.name]: organization.id, - }; - } + + + } + fluid + /> + + + + + } + options={types.map((ct) => { return { - text: organization.name, - value: organization.name, - key: organization.name, + value: ct.id, + text: ct?.title_l10n ?? ct.id, }; - }) - } - label={ - - } - noQueryMessage={i18next.t("Search for organizations...")} - allowAdditions - search={(filteredOptions, searchQuery) => filteredOptions} - /> + })} + /> + + + + + } + fluid + /> + + + + + _map(organizations, (organization) => { + // eslint-disable-next-line no-prototype-builtins + const isKnownOrg = this.knownOrganizations.hasOwnProperty( + organization.name + ); + if (!isKnownOrg) { + this.knownOrganizations = { + ...this.knownOrganizations, + [organization.name]: organization.id, + }; + } + return { + text: organization.name, + value: organization.name, + key: organization.name, + }; + }) + } + label={ + + } + noQueryMessage={i18next.t("Search for organizations...")} + allowAdditions + search={(filteredOptions, searchQuery) => filteredOptions} + /> + - -
- + +
+ { - return { - title: award.title_l10n, - pid: award.pid, - number: award.number, - funder: award.funder ?? "", - id: award.id, - ...(award.identifiers && { - identifiers: award.identifiers, - }), - ...(award.acronym && { acronym: award.acronym }), - }; - }} - deserializeFunder={(funder) => { - return { - id: funder.id, - name: funder.name, - ...(funder.title_l10n && { title: funder.title_l10n }), - ...(funder.pid && { pid: funder.pid }), - ...(funder.country && { country: funder.country }), - ...(funder.identifiers && { - identifiers: funder.identifiers, - }), - }; - }} - computeFundingContents={(funding) => { - let headerContent, - descriptionContent = ""; - let awardOrFunder = "award"; - if (funding.award) { - headerContent = funding.award.title; - } - - if (funding.funder) { - const funderName = - funding.funder?.name ?? - funding.funder?.title ?? - funding.funder?.id ?? - ""; - descriptionContent = funderName; - if (!headerContent) { - awardOrFunder = "funder"; - headerContent = funderName; + initialQueryState: { + sortBy: "bestmatch", + sortOrder: "asc", + layout: "list", + page: 1, + size: 5, + }, + }} + label={i18next.t("Awards")} + labelIcon="money bill alternate outline" + deserializeAward={(award) => { + return { + title: award.title_l10n, + pid: award.pid, + number: award.number, + funder: award.funder ?? "", + id: award.id, + ...(award.identifiers && { + identifiers: award.identifiers, + }), + ...(award.acronym && { acronym: award.acronym }), + }; + }} + deserializeFunder={(funder) => { + return { + id: funder.id, + name: funder.name, + ...(funder.title_l10n && { title: funder.title_l10n }), + ...(funder.pid && { pid: funder.pid }), + ...(funder.country && { country: funder.country }), + ...(funder.identifiers && { + identifiers: funder.identifiers, + }), + }; + }} + computeFundingContents={(funding) => { + let headerContent, descriptionContent = ""; + let awardOrFunder = "award"; + if (funding.award) { + headerContent = funding.award.title; } - } - return { - headerContent, - descriptionContent, - awardOrFunder, - }; - }} - /> -
-
+ if (funding.funder) { + const funderName = + funding.funder?.name ?? + funding.funder?.title ?? + funding.funder?.id ?? + ""; + descriptionContent = funderName; + if (!headerContent) { + awardOrFunder = "funder"; + headerContent = funderName; + descriptionContent = ""; + } + } + + return { + headerContent, + descriptionContent, + awardOrFunder, + }; + }} + /> +
+
+ {!_isEmpty(customFields.ui) && ( - - - - - - + + + + + + + + + + )} diff --git a/invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/index.js b/invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/index.js index 04820474e..1f28a3793 100644 --- a/invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/index.js +++ b/invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/index.js @@ -10,6 +10,7 @@ import React from "react"; import ReactDOM from "react-dom"; import { default as CommunityProfileForm } from "./CommunityProfileForm"; +import { OverridableContext, overrideStore } from "react-overridable"; const domContainer = document.getElementById("app"); const community = JSON.parse(domContainer.dataset.community); @@ -18,16 +19,19 @@ const types = JSON.parse(domContainer.dataset.types); const logoMaxSize = JSON.parse(domContainer.dataset.logoMaxSize); const customFields = JSON.parse(domContainer.dataset.customFields); const permissions = JSON.parse(domContainer.dataset.permissions); +const overriddenComponents = overrideStore.getAll(); ReactDOM.render( - , + + + , domContainer );