-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 5271 indemnité de licenciement créer un questionnaire spécifique (
#5287) Co-authored-by: Martial Maillot <[email protected]> Co-authored-by: Victor Zeinstra <[email protected]> Co-authored-by: Maxime Golfier <[email protected]>
- Loading branch information
1 parent
399b2e7
commit 969c330
Showing
22 changed files
with
959 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
packages/code-du-travail-frontend/src/outils/common/Feedback/Questionnaire.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import styled from "styled-components"; | ||
import { Button, Heading } from "@socialgouv/cdtn-ui"; | ||
|
||
import { QuestionnaireItem, Status } from "./QuestionnaireItem"; | ||
import { trackFeedback, EVENT_ACTION, FEEDBACK_RESULT } from "./tracking"; | ||
import { useState } from "react"; | ||
|
||
type QuestionnaireProps = { | ||
onClick: () => void; | ||
}; | ||
|
||
export const Questionnaire = ({ onClick }: QuestionnaireProps): JSX.Element => { | ||
const [status, setStatus] = useState<FEEDBACK_RESULT>(); | ||
const [displayError, setDisplayError] = useState(false); | ||
return ( | ||
<> | ||
<StyledHeading variant="primary" stripe="left"> | ||
Comment s'est passée cette simulation pour vous ? | ||
</StyledHeading> | ||
<StyledQuestionnaireItem | ||
badEventValue={FEEDBACK_RESULT.NOT_GOOD} | ||
averageEventValue={FEEDBACK_RESULT.AVERAGE} | ||
goodEventValue={FEEDBACK_RESULT.GOOD} | ||
badText="Pas bien" | ||
onChange={(status: FEEDBACK_RESULT) => { | ||
setStatus(status); | ||
setDisplayError(false); | ||
}} | ||
displayError={displayError} | ||
/> | ||
<StyledButton | ||
onClick={() => { | ||
if (!status) { | ||
setDisplayError(true); | ||
} else { | ||
trackFeedback(EVENT_ACTION.GLOBAL, status); | ||
onClick(); | ||
} | ||
}} | ||
variant="primary" | ||
> | ||
Envoyer | ||
</StyledButton> | ||
</> | ||
); | ||
}; | ||
|
||
const StyledHeading = styled(Heading)` | ||
margin-left: 0; | ||
margin-bottom: 0; | ||
padding-top: 6px; | ||
`; | ||
|
||
const StyledButton = styled(Button)` | ||
margin: 12px auto 24px 24px; | ||
`; | ||
|
||
const StyledQuestionnaireItem = styled(QuestionnaireItem)` | ||
padding: 24px; | ||
`; |
115 changes: 115 additions & 0 deletions
115
packages/code-du-travail-frontend/src/outils/common/Feedback/QuestionnaireAdvanced.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import { Button, Heading } from "@socialgouv/cdtn-ui"; | ||
import { QuestionnaireItem } from "./QuestionnaireItem"; | ||
import { QuestionnaireText } from "./QuestionnaireText"; | ||
import styled from "styled-components"; | ||
import { useState } from "react"; | ||
import { | ||
trackFeedback, | ||
trackFeedbackText, | ||
FEEDBACK_RESULT, | ||
EVENT_ACTION, | ||
} from "./tracking"; | ||
import { useRouter } from "next/router"; | ||
|
||
type QuestionnaireAdvancedProps = { | ||
onClick: () => void; | ||
}; | ||
|
||
export const QuestionnaireAdvanced = ({ | ||
onClick, | ||
}: QuestionnaireAdvancedProps): React.ReactElement => { | ||
const router = useRouter(); | ||
const [statusSimulator, setStatusSimulator] = useState<FEEDBACK_RESULT>(); | ||
const [statusQuestion, setStatusQuestion] = useState<FEEDBACK_RESULT>(); | ||
const [statusExplanation, setStatusExplanation] = useState<FEEDBACK_RESULT>(); | ||
const [feedbackText, setFeedbackText] = useState<string>(); | ||
return ( | ||
<> | ||
<StyledHeading variant="primary" stripe="left"> | ||
Merci pour votre aide ! Pouvez-vous nous en dire plus ? | ||
</StyledHeading> | ||
<FormContainer> | ||
<StyledQuestionnaireItem | ||
badEventValue={FEEDBACK_RESULT.NOT_AT_ALL} | ||
averageEventValue={FEEDBACK_RESULT.AVERAGE} | ||
goodEventValue={FEEDBACK_RESULT.EASY} | ||
title="Le simulateur était-il facile à utiliser ?" | ||
badText="Pas du tout" | ||
goodText="Facile" | ||
onChange={(status) => { | ||
setStatusSimulator(status); | ||
}} | ||
dataTestId="simulator" | ||
/> | ||
<StyledQuestionnaireItem | ||
badEventValue={FEEDBACK_RESULT.NOT_AT_ALL} | ||
averageEventValue={FEEDBACK_RESULT.AVERAGE} | ||
goodEventValue={FEEDBACK_RESULT.YES} | ||
title="Les questions étaient-elles claires et compréhensibles ?" | ||
badText="Pas du tout" | ||
goodText="Oui" | ||
onChange={(status) => { | ||
setStatusQuestion(status); | ||
}} | ||
dataTestId="questionClarity" | ||
/> | ||
<StyledQuestionnaireItem | ||
badEventValue={FEEDBACK_RESULT.NOT_AT_ALL} | ||
averageEventValue={FEEDBACK_RESULT.AVERAGE} | ||
goodEventValue={FEEDBACK_RESULT.YES} | ||
title="Les explications du résultat obtenu étaient-elles claires et compréhensibles ?" | ||
badText="Pas du tout" | ||
goodText="Oui" | ||
onChange={(status) => { | ||
setStatusExplanation(status); | ||
}} | ||
dataTestId="resultClarity" | ||
/> | ||
<QuestionnaireText | ||
title="Vous souhaitez nous en dire davantage ?" | ||
placeholder="ex: la question sur la date de début du contrat n'est pas claire" | ||
onChange={setFeedbackText} | ||
dataTestId="more-input" | ||
/> | ||
</FormContainer> | ||
<StyledButton | ||
variant="primary" | ||
onClick={() => { | ||
if (statusSimulator) { | ||
trackFeedback(EVENT_ACTION.EASINESS, statusSimulator); | ||
} | ||
if (statusQuestion) { | ||
trackFeedback(EVENT_ACTION.QUESTION_CLARITY, statusQuestion); | ||
} | ||
if (statusExplanation) { | ||
trackFeedback(EVENT_ACTION.RESULT_CLARITY, statusExplanation); | ||
} | ||
if (feedbackText) { | ||
trackFeedbackText(feedbackText, router.asPath); | ||
} | ||
onClick(); | ||
}} | ||
> | ||
Envoyer | ||
</StyledButton> | ||
</> | ||
); | ||
}; | ||
|
||
const StyledHeading = styled(Heading)` | ||
margin-left: 0; | ||
margin-bottom: 0; | ||
padding-top: 6px; | ||
`; | ||
|
||
const StyledButton = styled(Button)` | ||
margin: 12px auto 24px 24px; | ||
`; | ||
|
||
const FormContainer = styled.div` | ||
padding: 0 24px; | ||
`; | ||
|
||
const StyledQuestionnaireItem = styled(QuestionnaireItem)` | ||
margin: 24px 0; | ||
`; |
24 changes: 24 additions & 0 deletions
24
packages/code-du-travail-frontend/src/outils/common/Feedback/QuestionnaireEnd.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Heading } from "@socialgouv/cdtn-ui"; | ||
import styled from "styled-components"; | ||
|
||
export const QuestionnaireEnd = (): JSX.Element => { | ||
return ( | ||
<> | ||
<StyledHeading variant="primary" stripe="left"> | ||
Merci pour votre aide ! | ||
</StyledHeading> | ||
<StyledText> | ||
Votre évaluation sera étudiée au plus vite par nos équipes | ||
</StyledText> | ||
</> | ||
); | ||
}; | ||
|
||
const StyledHeading = styled(Heading)` | ||
margin-left: 0; | ||
padding-top: 6px; | ||
`; | ||
|
||
const StyledText = styled.span` | ||
margin: 12px auto 24px 24px; | ||
`; |
Oops, something went wrong.