Skip to content

Commit

Permalink
fix(wording): rename answer type on contribution page (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolineBda authored Oct 6, 2023
1 parent 195dc17 commit 2a0ace5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
12 changes: 9 additions & 3 deletions targets/frontend/src/components/contributions/answers/Answer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -185,9 +194,6 @@ export const ContributionsAnswer = ({
name="content"
disabled={isNotEditable(answer)}
control={control}
rules={{
required: answer && answer.contentType === "ANSWER",
}}
/>
</FormControl>
{answer && (
Expand Down
8 changes: 7 additions & 1 deletion targets/frontend/src/components/contributions/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 7 additions & 8 deletions targets/frontend/src/components/forms/RadioGroup/index.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -34,10 +34,9 @@ export const FormRadioGroup = ({
name={name}
control={control}
rules={rules}
render={({ field: { onChange, value }, fieldState: { error } }) => {
return (
<FormControl fullWidth={fullWidth} error={!!error}>
<FormLabel>{label}</FormLabel>
render={({ field: { onChange, value }, fieldState: { error } }) => (
<FormControl fullWidth={fullWidth} error={!!error}>
<TitleBox title={label} disabled={disabled}>
<RadioGroup
value={value}
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
Expand All @@ -54,9 +53,9 @@ export const FormRadioGroup = ({
/>
))}
</RadioGroup>
</FormControl>
);
}}
</TitleBox>
</FormControl>
)}
/>
);
};

0 comments on commit 2a0ace5

Please sign in to comment.