diff --git a/.env-example b/.env-example index f3358c26..bc1ae261 100644 --- a/.env-example +++ b/.env-example @@ -1 +1,7 @@ -ELASTIC_URL=http://localhost:9200/indicepa_pec/_search +# Comma separated Country-Specific sections (https://yml.publiccode.tools/country.html) +# to display by default when the editor is loaded. +# +# Valid identifiers: "all", "none" or "italy" +# +# (default: "none") +DEFAULT_COUNTRY_SECTIONS=none diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7cae5934..4a6f8ed4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,6 +14,7 @@ jobs: - run: npm ci - run: npm run build env: + DEFAULT_COUNTRY_SECTION: italy ELASTIC_URL: "https://elasticsearch.developers.italia.it/indicepa_pec/_search" VALIDATOR_URL: "https://publiccode-validator.developers.italia.it/pc/validate" VALIDATOR_REMOTE_URL: "https://publiccode-validator.developers.italia.it/pc/validateURL" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b159acf0..2bdbf092 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,4 +21,5 @@ jobs: - run: npm ci - run: npm run release --ci --no-increment env: + DEFAULT_COUNTRY_SECTIONS: italy GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/app/components/Editor.tsx b/src/app/components/Editor.tsx index b0a720f3..44b55f63 100644 --- a/src/app/components/Editor.tsx +++ b/src/app/components/Editor.tsx @@ -6,6 +6,7 @@ import { useAppSelector } from "../store"; import { YamlModal } from "./YamlModal"; import InfoBox from "./InfoBox"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; import { Footer } from "./Foot"; import { validator } from "../validator"; import { set } from "lodash"; @@ -14,7 +15,9 @@ import EditorInput from "./EditorInput"; import developmentStatus from "../contents/developmentStatus"; import EditorBoolean from "./EditorBoolean"; import EditorMultiselect from "./EditorMultiselect"; +import { DEFAULT_COUNTRY_SECTIONS } from "../contents/constants"; import categories from "../contents/categories"; +import * as countrySection from "../contents/countrySpecificSection"; import platforms from "../contents/platforms"; import EditorRadio from "./EditorRadio"; import softwareTypes from "../contents/softwareTypes"; @@ -67,9 +70,11 @@ export default function Editor() { defaultValues, resolver, }); + const { t } = useTranslation(); const { getValues, handleSubmit } = methods; const languages = useAppSelector((state) => state.language.languages); + const configCountrySections = countrySection.parse(DEFAULT_COUNTRY_SECTIONS); const [isYamlModalVisible, setYamlModalVisibility] = useState(false); @@ -215,24 +220,25 @@ export default function Editor() {
- -

Italia

- - fieldName="it.conforme.lineeGuidaDesign" /> - fieldName="it.conforme.modelloInteroperabilita" /> - fieldName="it.conforme.misureMinimeSicurezza" /> - fieldName="it.conforme.gdpr" /> - fieldName="it.riuso.codiceIPA" /> - - -

Piattaforme

- fieldName="it.piattaforme.spid" /> - fieldName="it.piattaforme.cie" /> - fieldName="it.piattaforme.anpr" /> - fieldName="it.piattaforme.pagopa" /> - fieldName="it.piattaforme.io" /> - -
+ {countrySection.isVisible(configCountrySections, "italy") && ( + +

{t('countrySpecificSection.italy')}

+ + fieldName="it.conforme.lineeGuidaDesign" /> + fieldName="it.conforme.modelloInteroperabilita" /> + fieldName="it.conforme.misureMinimeSicurezza" /> + fieldName="it.conforme.gdpr" /> + fieldName="it.riuso.codiceIPA" /> + + + fieldName="it.piattaforme.spid" /> + fieldName="it.piattaforme.cie" /> + fieldName="it.piattaforme.anpr" /> + fieldName="it.piattaforme.pagopa" /> + fieldName="it.piattaforme.io" /> + +
+ )}