From 2a0ace55918f3bda72a34ae9ce8b81b92fdd5a16 Mon Sep 17 00:00:00 2001 From: Caroline <4971715+carolineBda@users.noreply.github.com> Date: Fri, 6 Oct 2023 11:06:28 +0200 Subject: [PATCH] fix(wording): rename answer type on contribution page (#1052) --- .../components/contributions/answers/Answer.tsx | 12 +++++++++--- .../frontend/src/components/contributions/type.ts | 8 +++++++- .../src/components/forms/RadioGroup/index.tsx | 15 +++++++-------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/targets/frontend/src/components/contributions/answers/Answer.tsx b/targets/frontend/src/components/contributions/answers/Answer.tsx index 323ae46fa..aaf1c478a 100644 --- a/targets/frontend/src/components/contributions/answers/Answer.tsx +++ b/targets/frontend/src/components/contributions/answers/Answer.tsx @@ -120,6 +120,15 @@ export const ContributionsAnswer = ({ label: "La convention collective ne prévoit rien", value: "NOTHING", }, + { + label: "La convention collective renvoie au Code du Travail", + value: "CDT", + }, + { + label: + "La convention collective intégralement moins favorable que le CDT", + value: "UNFAVOURABLE", + }, { label: "Nous n'avons pas la réponse", value: "UNKNOWN", @@ -185,9 +194,6 @@ export const ContributionsAnswer = ({ name="content" disabled={isNotEditable(answer)} control={control} - rules={{ - required: answer && answer.contentType === "ANSWER", - }} /> {answer && ( diff --git a/targets/frontend/src/components/contributions/type.ts b/targets/frontend/src/components/contributions/type.ts index 7726baf2c..fc320a9b8 100644 --- a/targets/frontend/src/components/contributions/type.ts +++ b/targets/frontend/src/components/contributions/type.ts @@ -91,7 +91,13 @@ export type CdtnReference = { document: Document; }; -export type ContentType = "ANSWER" | "NOTHING" | "UNKNOWN" | "SP"; +export type ContentType = + | "ANSWER" + | "NOTHING" + | "CDT" + | "UNFAVOURABLE" + | "UNKNOWN" + | "SP"; export type Answer = { id: string; diff --git a/targets/frontend/src/components/forms/RadioGroup/index.tsx b/targets/frontend/src/components/forms/RadioGroup/index.tsx index 0ce5a688e..aa5457e71 100644 --- a/targets/frontend/src/components/forms/RadioGroup/index.tsx +++ b/targets/frontend/src/components/forms/RadioGroup/index.tsx @@ -1,13 +1,13 @@ import { FormControl, FormControlLabel, - FormLabel, Radio, RadioGroup, } from "@mui/material"; import React, { PropsWithChildren } from "react"; import { Controller } from "react-hook-form"; import { CommonFormProps } from "../type"; +import { TitleBox } from "../TitleBox"; type OptionProps = { label: string; @@ -34,10 +34,9 @@ export const FormRadioGroup = ({ name={name} control={control} rules={rules} - render={({ field: { onChange, value }, fieldState: { error } }) => { - return ( - - {label} + render={({ field: { onChange, value }, fieldState: { error } }) => ( + + ) => @@ -54,9 +53,9 @@ export const FormRadioGroup = ({ /> ))} - - ); - }} + + + )} /> ); };