diff --git a/package.json b/package.json index 9cee99db0..e0ed7a1f5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "homepage": "https://xxx.yy/sill", "name": "sill-web", - "version": "1.39.2", + "version": "1.40.0", "license": "MIT", "scripts": { "start": "react-app-rewired start", @@ -20,7 +20,7 @@ }, "dependencies": { "@codegouvfr/react-dsfr": "^1.0.0", - "@codegouvfr/sill": "^1.18.13", + "@codegouvfr/sill": "^1.19.0", "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@mui/icons-material": "^5.0.4", diff --git a/src/core/usecases/softwareCatalog/state.ts b/src/core/usecases/softwareCatalog/state.ts index ba972d36d..71dafe447 100644 --- a/src/core/usecases/softwareCatalog/state.ts +++ b/src/core/usecases/softwareCatalog/state.ts @@ -4,6 +4,8 @@ import { } from "redux-clean-architecture"; import type { ApiTypes } from "@codegouvfr/sill"; +type OmitFromExisting = Omit; + export const name = "softwareCatalog" as const; export type State = { @@ -48,13 +50,15 @@ export namespace State { | "android" | "ios"; - export type Prerogative = - | "isPresentInSupportContract" - | "isFromFrenchPublicServices" - | "doRespectRgaa" - | "isInstallableOnUserComputer" - | "isAvailableAsMobileApp" - | "isTestable"; + type Prerogatives = { + isPresentInSupportContract: boolean; + isFromFrenchPublicServices: boolean; + doRespectRgaa: boolean | null; + isInstallableOnUserComputer: boolean; + isAvailableAsMobileApp: boolean; + isTestable: boolean; + }; + export type Prerogative = keyof Prerogatives; export namespace Software { type Common = { @@ -85,7 +89,7 @@ export namespace State { }; export type External = Common & { - prerogatives: Record; + prerogatives: Prerogatives; searchHighlight: | { searchChars: string[]; @@ -99,14 +103,9 @@ export namespace State { updateTime: number; categories: string[]; organizations: string[]; - prerogatives: Record< - Exclude< - Prerogative, - | "isInstallableOnUserComputer" - | "isTestable" - | "isAvailableAsMobileApp" - >, - boolean + prerogatives: OmitFromExisting< + Prerogatives, + "isInstallableOnUserComputer" | "isTestable" | "isAvailableAsMobileApp" >; softwareType: ApiTypes.SoftwareType; search: string; diff --git a/src/core/usecases/softwareDetails/thunks.ts b/src/core/usecases/softwareDetails/thunks.ts index 8e26334dd..ff901603b 100644 --- a/src/core/usecases/softwareDetails/thunks.ts +++ b/src/core/usecases/softwareDetails/thunks.ts @@ -317,7 +317,7 @@ function apiSoftwareToSoftware(params: { (softwareType.os.android || softwareType.os.ios), "isPresentInSupportContract": prerogatives.isPresentInSupportContract, "isFromFrenchPublicServices": prerogatives.isFromFrenchPublicServices, - "doRespectRgaa": prerogatives.doRespectRgaa + "doRespectRgaa": prerogatives.doRespectRgaa ?? undefined }, comptoirDuLibreServiceProviderCount, testUrl, diff --git a/src/core/usecases/softwareForm/state.ts b/src/core/usecases/softwareForm/state.ts index e99d5eac7..248aa22c5 100644 --- a/src/core/usecases/softwareForm/state.ts +++ b/src/core/usecases/softwareForm/state.ts @@ -39,7 +39,7 @@ export type FormData = { step3: { isPresentInSupportContract: boolean | undefined; isFromFrenchPublicService: boolean; - doRespectRgaa: boolean | undefined; + doRespectRgaa: boolean | null; }; step4: { similarSoftwares: { diff --git a/src/core/usecases/softwareForm/thunks.ts b/src/core/usecases/softwareForm/thunks.ts index 218375e05..18ac0a4bd 100644 --- a/src/core/usecases/softwareForm/thunks.ts +++ b/src/core/usecases/softwareForm/thunks.ts @@ -216,7 +216,7 @@ export const thunks = { "softwareMinimalVersion": step2.softwareMinimalVersion, "isPresentInSupportContract": step3.isPresentInSupportContract ?? false, "isFromFrenchPublicService": step3.isFromFrenchPublicService, - "doRespectRgaa": step3.doRespectRgaa ?? false, + "doRespectRgaa": step3.doRespectRgaa, "similarSoftwareWikidataIds": formDataStep4.similarSoftwares.map( ({ wikidataId }) => wikidataId ), diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 7ba568507..b6b814eeb 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -187,6 +187,7 @@ const useStyles = tss export const { i18n } = declareComponentKeys< | "yes" | "no" + | "not applicable" | "previous" | "next" | "add software" diff --git a/src/ui/i18n/i18n.tsx b/src/ui/i18n/i18n.tsx index fa5b1f276..67bef4a50 100644 --- a/src/ui/i18n/i18n.tsx +++ b/src/ui/i18n/i18n.tsx @@ -61,6 +61,7 @@ const { "App": { "yes": "Yes", "no": "No", + "not applicable": "Not applicable", "previous": "Previous", "next": "Next", "add software": "Add Software", @@ -745,6 +746,7 @@ const { "App": { "yes": "Oui", "no": "Non", + "not applicable": "Non applicable", "previous": "Précédent", "next": "Suivant", "add software": "Ajouter un logiciel", diff --git a/src/ui/pages/softwareDetails/SoftwareDetails.tsx b/src/ui/pages/softwareDetails/SoftwareDetails.tsx index 81d15fd51..772dc59c1 100644 --- a/src/ui/pages/softwareDetails/SoftwareDetails.tsx +++ b/src/ui/pages/softwareDetails/SoftwareDetails.tsx @@ -359,7 +359,7 @@ const ServiceProviderRow = ({ )}{" "} {cdlUrl && ( - + Comptoir du libre )}{" "} diff --git a/src/ui/pages/softwareForm/SoftwareForm.tsx b/src/ui/pages/softwareForm/SoftwareForm.tsx index 51f041448..7f0d800be 100644 --- a/src/ui/pages/softwareForm/SoftwareForm.tsx +++ b/src/ui/pages/softwareForm/SoftwareForm.tsx @@ -182,11 +182,12 @@ export default function SoftwareForm(props: Props) { + onSubmit={formData => { + console.log("formData : ", formData); softwareForm.setStep3Data({ "formDataStep3": formData - }) - } + }); + }} isCloudNativeSoftware={formData.step1?.softwareType.type === "cloud"} evtActionSubmit={evtActionSubmitStep.pipe(() => step === 3)} /> diff --git a/src/ui/pages/softwareForm/Step3.tsx b/src/ui/pages/softwareForm/Step3.tsx index 4ef85b378..28d7d6c84 100644 --- a/src/ui/pages/softwareForm/Step3.tsx +++ b/src/ui/pages/softwareForm/Step3.tsx @@ -15,6 +15,8 @@ export type Step2Props = { evtActionSubmit: NonPostableEvt; }; +type DoRespectRgaaInputValue = "true" | "false" | "not applicable"; + export function SoftwareFormStep3(props: Step2Props) { const { className, initialFormData, onSubmit, evtActionSubmit } = props; @@ -27,7 +29,7 @@ export function SoftwareFormStep3(props: Step2Props) { formState: { errors } } = useForm<{ isPresentInSupportContractInputValue: "true" | "false" | undefined; - doRespectRgaaInputValue: "true" | "false" | undefined; + doRespectRgaaInputValue: DoRespectRgaaInputValue; isFromFrenchPublicServiceInputValue: "true" | "false"; isPublicInstanceInputValue: "true" | "false"; targetAudience: string; @@ -50,12 +52,10 @@ export function SoftwareFormStep3(props: Step2Props) { : isPresentInSupportContract ? "true" : "false", - "doRespectRgaaInputValue": - doRespectRgaa === undefined - ? undefined - : doRespectRgaa - ? "true" - : "false", + "doRespectRgaaInputValue": ((): DoRespectRgaaInputValue => { + if (doRespectRgaa === null) return "not applicable"; + return doRespectRgaa ? "true" : "false"; + })(), "isFromFrenchPublicServiceInputValue": isFromFrenchPublicService === undefined ? undefined @@ -102,8 +102,8 @@ export function SoftwareFormStep3(props: Step2Props) { })(), "doRespectRgaa": (() => { switch (doRespectRgaaInputValue) { - case undefined: - return undefined; + case "not applicable": + return null; case "true": return true; case "false": @@ -185,6 +185,13 @@ export function SoftwareFormStep3(props: Step2Props) { ...register("doRespectRgaaInputValue"), "value": "false" } + }, + { + "label": tCommon("not applicable"), + "nativeInputProps": { + ...register("doRespectRgaaInputValue"), + "value": "not applicable" + } } ]} /> diff --git a/yarn.lock b/yarn.lock index 1ffe6888d..7525c9fd7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1232,10 +1232,10 @@ dependencies: tsafe "^1.6.3" -"@codegouvfr/sill@^1.18.13": - version "1.18.13" - resolved "https://registry.yarnpkg.com/@codegouvfr/sill/-/sill-1.18.13.tgz#ad393f9db1b01754a5b47017239faf8c4be4bdde" - integrity sha512-/deEiocHQmGCWoYgaO2g35kr8rkN84Bf6+WbrWqVSAntWYP3/wdW3LKpmP0Mbdo5CF7BGJxcS/RAYmHO8vAwuQ== +"@codegouvfr/sill@^1.19.0": + version "1.19.0" + resolved "https://registry.yarnpkg.com/@codegouvfr/sill/-/sill-1.19.0.tgz#eec603f499b1865a3ca17e67a81a94ba0fa5c487" + integrity sha512-yal1d/gHOBQ+XkGll89PrrPBSdwCzf2G0MATLjMyC8+qMUs5DyDrU8nSBFBd+yXvssihDnS6pdPQbh4un3o46g== dependencies: "@octokit/graphql" "^7.0.2" "@trpc/server" "^10.18.0"