-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 5271 indemnité de licenciement créer un questionnaire spécifique #5287
Merged
maxgfr
merged 16 commits into
dev
from
5271-indemnité-de-licenciement-créer-un-questionnaire-spécifique
Aug 3, 2023
The head ref may contain hidden characters: "5271-indemnit\u00E9-de-licenciement-cr\u00E9er-un-questionnaire-sp\u00E9cifique"
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0fbd052
feat: ajout du feedback indemnite licenciement
07a15b7
feat: questionnaire
394b93f
chore: move folder
b8e61e3
chore: review
8893c26
chore: review
c8187ff
chore: ajout TU
627df84
chore: ortho
7a244e1
chore: ortho
d5aa0e5
feat: add scroll to top
7fb640b
Update packages/code-du-travail-frontend/src/outils/IndemniteLicencie…
maxgfr 8bffc63
Update packages/code-du-travail-frontend/src/outils/common/Feedback/Q…
maxgfr 285a5a4
Update packages/code-du-travail-frontend/src/outils/common/Feedback/Q…
maxgfr cb1c7eb
Update packages/code-du-travail-frontend/src/outils/common/Feedback/Q…
maxgfr 5610c89
Update packages/code-du-travail-frontend/src/outils/common/Feedback/Q…
maxgfr 252e6da
Update packages/code-du-travail-frontend/src/outils/common/Feedback/Q…
maxgfr e73f37a
fix: retours
maxgfr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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; | ||
maxgfr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
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} | ||
Comment on lines
+45
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On ne pourrait pas mettre des valeurs par défaut ici ? |
||
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
peut être faire un array pour éviter d'avoir une url statique dans le code en mode
MY_ARRAY.includes(router.asPath)