Skip to content

Commit

Permalink
feat(candidate): added a decision button leading to the drop out deci…
Browse files Browse the repository at this point in the history
…sion page to the drop out warning
  • Loading branch information
agarbe committed Dec 27, 2024
1 parent bf634d4 commit ffadde8
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ context("Candidacy dropout warning", () => {

cy.get('[data-test="drop-out-warning"]').should("exist");
});

it("should let me click the decision button and lead me to the decision page", function () {
interceptCandidacy({ droppedOut: true });
cy.login();
cy.wait("@candidate_login");
cy.wait("@candidate_getCandidateWithCandidacy");
cy.wait("@activeFeaturesForConnectedUser");

cy.get('[data-test="drop-out-warning-decision-button"]').click();
cy.url().should(
"eq",
"http://localhost:3004/candidat/candidacy-dropout-decision/",
);
});
});
context("When the candidacy has not been dropped out", () => {
it("should not show the warning", function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
import { format } from "date-fns";
import fvaeWarning from "./assets/fvae_warning.png";
import Image from "next/image";
import Button from "@codegouvfr/react-dsfr/Button";

export const DropOutWarning = ({
dropOutDate,
className,
onDecisionButtonClick,
}: {
dropOutDate: Date;
className?: string;
onDecisionButtonClick?: () => void;
}) => (
<div
data-test="drop-out-warning"
className={`flex flex-col gap-4 md:gap-0 md:flex-row items-center min-h-[160px] ${className || ""}`}
className={`flex flex-col ${className || ""}`}
>
<Image
className="z-10"
alt="main levée devant un panneau d'interdiction"
style={{
width: "132px",
height: "154px",
}}
src={fvaeWarning}
/>
<div className="md:-ml-16 p-6 md:pl-24 border-b-4 border-fvae-hard-red shadow-[0px_6px_18px_0px_rgba(0,0,18,0.16)]">
Votre accompagnateur a déclaré l’abandon de votre parcours VAE le{" "}
{format(dropOutDate, "dd/MM/yyyy")}. Vous avez 6 mois pour enregistrer
votre décision : accepter l’abandon ou continuer votre parcours.
<div className="flex flex-col gap-4 md:gap-0 md:flex-row items-center min-h-[160px]">
<Image
className="z-10"
alt="main levée devant un panneau d'interdiction"
style={{
width: "132px",
height: "154px",
}}
src={fvaeWarning}
/>
<div className="md:-ml-16 p-6 md:pl-24 border-b-4 border-fvae-hard-red shadow-[0px_6px_18px_0px_rgba(0,0,18,0.16)]">
Votre accompagnateur a déclaré l’abandon de votre parcours VAE le{" "}
{format(dropOutDate, "dd/MM/yyyy")}. Vous avez 6 mois pour enregistrer
votre décision : accepter l’abandon ou continuer votre parcours.
</div>
</div>
<Button
data-test="drop-out-warning-decision-button"
className="ml-auto -mt-3"
onClick={onDecisionButtonClick}
>
Enregistrer ma décision
</Button>
</div>
);
3 changes: 3 additions & 0 deletions packages/reva-candidate/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export default function Home() {
<DropOutWarning
className="mb-16"
dropOutDate={new Date(candidacy.candidacyDropOut.createdAt)}
onDecisionButtonClick={() =>
router.push("/candidacy-dropout-decision")
}
/>
)}
{!candidacy.candidacyDropOut && <CandidacyBanner />}
Expand Down

0 comments on commit ffadde8

Please sign in to comment.