@@ -51,6 +51,7 @@ import EditorContractors from "./EditorContractors";
5151import EditorDate from "./EditorDate" ;
5252import EditorDescriptionInput from "./EditorDescriptionInput" ;
5353import EditorFeatures from "./EditorFeatures" ;
54+ import EditorFundedBy from "./EditorFundedBy" ;
5455import EditorInput from "./EditorInput" ;
5556import EditorMultiselect from "./EditorMultiselect" ;
5657import EditorRadio from "./EditorRadio" ;
@@ -95,7 +96,7 @@ const checkWarnings = async (values: PublicCode) => {
9596} ;
9697
9798const resolver : Resolver < PublicCode | PublicCodeWithDeprecatedFields > = async (
98- values ,
99+ values
99100) => {
100101 console . log ( values ) ;
101102
@@ -130,7 +131,7 @@ const defaultValues = {
130131 localisation : { availableLanguages : [ ] } ,
131132 maintenance : { contacts : undefined , contractors : undefined } ,
132133 platforms : [ ] ,
133- categories : [ ] ,
134+ categories : undefined ,
134135 description : { } ,
135136 it : defaultItaly ,
136137} ;
@@ -164,7 +165,7 @@ export default function Editor() {
164165 useITCountrySpecific ( ) ;
165166 const getNestedValue = (
166167 obj : PublicCodeWithDeprecatedFields ,
167- path : string ,
168+ path : string
168169 ) => {
169170 return path . split ( "." ) . reduce ( ( acc , key ) => ( acc as never ) ?. [ key ] , obj ) ;
170171 } ;
@@ -197,6 +198,19 @@ export default function Editor() {
197198 } = getValues ( ) as PublicCode ;
198199 return type === "internal" || type === "community" ;
199200 } ;
201+ const isConformeVisible = ( ) => {
202+ const values = getValues ( ) as PublicCode ;
203+ if ( ! values ?. it ?. conforme ) {
204+ return false ;
205+ }
206+ const conforme = values . it . conforme ;
207+ return (
208+ conforme . lineeGuidaDesign !== undefined ||
209+ conforme . modelloInteroperabilita !== undefined ||
210+ conforme . misureMinimeSicurezza !== undefined ||
211+ conforme . gdpr !== undefined
212+ ) ;
213+ } ;
200214 //#endregion
201215
202216 //#region form definition
@@ -223,15 +237,15 @@ export default function Editor() {
223237 const { countryExtensionVersion } = it ;
224238 const isCountryExtensionVersionDefined = Boolean ( countryExtensionVersion ) ;
225239 const isDifferentFromSpecificDefinedValue = Boolean (
226- IT_COUNTRY_EXTENSION_VERSION !== countryExtensionVersion ,
240+ IT_COUNTRY_EXTENSION_VERSION !== countryExtensionVersion
227241 ) ;
228242
229243 const countryExtensionVersionVisible =
230244 isCountryExtensionVersionDefined && isDifferentFromSpecificDefinedValue ;
231245
232246 setShowCountryExtensionVersion ( countryExtensionVersionVisible ) ;
233247 } ,
234- [ ] ,
248+ [ ]
235249 ) ;
236250
237251 useFormPersist ( "form-values" , {
@@ -243,7 +257,7 @@ export default function Editor() {
243257 checkPubliccodeYmlVersion ( pc ) ;
244258 checkItCountryExtensionVersion ( pc ) ;
245259 } ,
246- [ setLanguages ] ,
260+ [ setLanguages ]
247261 ) ,
248262 storage : window ?. localStorage , // default window.sessionStorage
249263 exclude : [ ] ,
@@ -266,7 +280,7 @@ export default function Editor() {
266280 setValue ( "maintenance.contacts" , undefined ) ;
267281 }
268282 } ,
269- [ setValue ] ,
283+ [ setValue ]
270284 ) ;
271285
272286 useEffect ( ( ) => {
@@ -290,13 +304,13 @@ export default function Editor() {
290304 {
291305 dismissable : true ,
292306 state : "success" ,
293- } ,
307+ }
294308 ) ;
295309 }
296310 } ,
297311 ( e : FieldErrors < PublicCode > ) => {
298312 const genericErrors = Object . entries ( e ) . filter ( ( [ key ] ) =>
299- key . startsWith ( "GenericError" ) ,
313+ key . startsWith ( "GenericError" )
300314 ) ;
301315
302316 const body = genericErrors . length ? (
@@ -318,7 +332,7 @@ export default function Editor() {
318332 state : "error" ,
319333 } ) ;
320334 console . error ( "Errors:" , e ) ;
321- } ,
335+ }
322336 ) ;
323337
324338 const resetFormHandler = ( ) => {
@@ -332,7 +346,7 @@ export default function Editor() {
332346 } ;
333347
334348 const setFormDataAfterImport = async (
335- fetchData : ( ) => Promise < PublicCode | null > ,
349+ fetchData : ( ) => Promise < PublicCode | null >
336350 ) => {
337351 try {
338352 const publicCode = await fetchData ( ) . then ( ( publicCode ) => {
@@ -364,7 +378,7 @@ export default function Editor() {
364378 Array . from ( res . warnings ) . map ( ( [ key , { message } ] ) => ( {
365379 key,
366380 message,
367- } ) ) ,
381+ } ) )
368382 ) ;
369383 } catch ( error : unknown ) {
370384 notify ( "Import error" , ( error as Error ) . message , {
@@ -487,7 +501,7 @@ export default function Editor() {
487501 </ div >
488502 < div >
489503 { isDeprecatedFieldVisible (
490- `description.${ lang } .genericName` as never ,
504+ `description.${ lang } .genericName` as never
491505 ) && (
492506 < span >
493507 < EditorDescriptionInput < "genericName" >
@@ -565,6 +579,12 @@ export default function Editor() {
565579 < span >
566580 < EditorInput < "isBasedOn" > fieldName = "isBasedOn" />
567581 </ span >
582+ < span >
583+ < EditorInput < "organisation.uri" > fieldName = "organisation.uri" />
584+ </ span >
585+ < div className = "mt-4 mb-4" >
586+ < EditorFundedBy />
587+ </ div >
568588 < span >
569589 < EditorInput < "softwareVersion" > fieldName = "softwareVersion" />
570590 </ span >
@@ -631,7 +651,6 @@ export default function Editor() {
631651 < EditorMultiselect < "categories" >
632652 fieldName = "categories"
633653 data = { categories . map ( ( e ) => ( { text : e , value : e } ) ) }
634- required
635654 filter = "contains"
636655 />
637656 </ span >
@@ -715,25 +734,39 @@ export default function Editor() {
715734 </ div >
716735 </ div >
717736 ) }
718- < div className = "mt-4" >
719- < h5 > { t ( "publiccodeyml.it.conforme.label" ) } </ h5 >
720- < div className = "row" >
721- < div className = "col-md-6" >
722- < EditorBoolean < "it.conforme.lineeGuidaDesign" > fieldName = "it.conforme.lineeGuidaDesign" />
737+ { isConformeVisible ( ) && (
738+ < div className = "mt-4" >
739+ < h5 > { t ( "publiccodeyml.it.conforme.label" ) } </ h5 >
740+ < div className = "row" >
741+ < div className = "col-md-6" >
742+ < EditorBoolean < "it.conforme.lineeGuidaDesign" >
743+ fieldName = "it.conforme.lineeGuidaDesign"
744+ deprecated
745+ />
746+ </ div >
747+ < div className = "col-md-6" >
748+ < EditorBoolean < "it.conforme.modelloInteroperabilita" >
749+ fieldName = "it.conforme.modelloInteroperabilita"
750+ deprecated
751+ />
752+ </ div >
723753 </ div >
724- < div className = "col-md-6" >
725- < EditorBoolean < "it.conforme.modelloInteroperabilita" > fieldName = "it.conforme.modelloInteroperabilita" />
754+ < div className = "row" >
755+ < div className = "col-md-6" >
756+ < EditorBoolean < "it.conforme.misureMinimeSicurezza" >
757+ fieldName = "it.conforme.misureMinimeSicurezza"
758+ deprecated
759+ />
760+ </ div >
761+ < div className = "col-md-6" >
762+ < EditorBoolean < "it.conforme.gdpr" >
763+ fieldName = "it.conforme.gdpr"
764+ deprecated
765+ />
766+ </ div >
726767 </ div >
727768 </ div >
728- < div className = "row" >
729- < div className = "col-md-6" >
730- < EditorBoolean < "it.conforme.misureMinimeSicurezza" > fieldName = "it.conforme.misureMinimeSicurezza" />
731- </ div >
732- < div className = "col-md-6" >
733- < EditorBoolean < "it.conforme.gdpr" > fieldName = "it.conforme.gdpr" />
734- </ div >
735- </ div >
736- </ div >
769+ ) }
737770 < div className = "mt-4" >
738771 < h5 > { t ( "publiccodeyml.it.piattaforme.label" ) } </ h5 >
739772 < div className = "row" >
@@ -758,10 +791,13 @@ export default function Editor() {
758791 </ div >
759792 </ div >
760793 </ div >
761- < div className = "mt-4" >
794+ < div className = "mt-4 mb-4 " >
762795 < h5 > { t ( "publiccodeyml.it.riuso.label" ) } </ h5 >
763796 < div >
764- < EditorInput < "it.riuso.codiceIPA" > fieldName = "it.riuso.codiceIPA" />
797+ < EditorInput < "it.riuso.codiceIPA" >
798+ fieldName = "it.riuso.codiceIPA"
799+ deprecated
800+ />
765801 </ div >
766802 </ div >
767803 </ div >
0 commit comments