|
| 1 | +"use client"; |
| 2 | +import { useEffect } from "react"; |
| 3 | +import { usePathname, useSearchParams, useRouter } from "next/navigation"; |
| 4 | +import Image from "next/image"; |
| 5 | +import Button from "@codegouvfr/react-dsfr/Button"; |
| 6 | + |
| 7 | +const NoCertificationsToValidate = () => { |
| 8 | + return ( |
| 9 | + <div className="grid grid-cols-3 grid-rows-1 w-11/12 m-auto"> |
| 10 | + <div className="col-span-2 m-auto"> |
| 11 | + <h1 className="">Aucune certification à valider</h1> |
| 12 | + <p className="text-lg"> |
| 13 | + Pour le moment, vous n’avez rien à valider. Si vous avez demandé |
| 14 | + l’ajout d’une ou de plusieurs certifications, elles s’afficheront ici |
| 15 | + très prochainement ! |
| 16 | + </p> |
| 17 | + </div> |
| 18 | + <div className="m-auto"> |
| 19 | + <Image |
| 20 | + src="/admin2/components/information.svg" |
| 21 | + alt="Success pictogram" |
| 22 | + width={282} |
| 23 | + height={319} |
| 24 | + /> |
| 25 | + </div> |
| 26 | + </div> |
| 27 | + ); |
| 28 | +}; |
| 29 | + |
| 30 | +const NoVisibleCertifications = () => { |
| 31 | + return ( |
| 32 | + <div className="grid grid-cols-3 grid-rows-1 w-11/12 m-auto"> |
| 33 | + <div className="col-span-2 m-auto"> |
| 34 | + <h1 className="">Aucune certification visible</h1> |
| 35 | + <p className="text-lg mb-0"> |
| 36 | + Pour être visible, la certification doit être validée par vos soins et |
| 37 | + active sur France compétences. |
| 38 | + </p> |
| 39 | + <Button |
| 40 | + linkProps={{ |
| 41 | + href: "/responsable-certifications/certifications?CATEGORY=TO_VALIDATE", |
| 42 | + }} |
| 43 | + priority="tertiary" |
| 44 | + className="mt-10" |
| 45 | + > |
| 46 | + Voir les certifications à valider |
| 47 | + </Button> |
| 48 | + </div> |
| 49 | + <div className="m-auto"> |
| 50 | + <Image |
| 51 | + src="/admin2/components/warning.svg" |
| 52 | + alt="Success pictogram" |
| 53 | + width={282} |
| 54 | + height={319} |
| 55 | + /> |
| 56 | + </div> |
| 57 | + </div> |
| 58 | + ); |
| 59 | +}; |
| 60 | + |
| 61 | +const NoInisibleCertifications = () => { |
| 62 | + return ( |
| 63 | + <div className="grid grid-cols-3 grid-rows-1 w-11/12 m-auto"> |
| 64 | + <div className="col-span-2 m-auto"> |
| 65 | + <h1 className="">Aucune certification invisible</h1> |
| 66 | + <p className="text-lg mb-0"> |
| 67 | + Retrouvez ici les certifications qui ne sont pas ou plus visibles sur |
| 68 | + la plateforme France VAE. |
| 69 | + </p> |
| 70 | + </div> |
| 71 | + <div className="m-auto"> |
| 72 | + <Image |
| 73 | + src="/admin2/components/information.svg" |
| 74 | + alt="Success pictogram" |
| 75 | + width={282} |
| 76 | + height={319} |
| 77 | + /> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + ); |
| 81 | +}; |
| 82 | + |
1 | 83 | export default function RegistryManagerHomepage() {
|
| 84 | + const searchParams = useSearchParams(); |
| 85 | + const currentPathname = usePathname(); |
| 86 | + const page = searchParams.get("page"); |
| 87 | + const category = searchParams.get("CATEGORY"); |
| 88 | + |
| 89 | + const { replace } = useRouter(); |
| 90 | + |
| 91 | + useEffect(() => { |
| 92 | + const params = new URLSearchParams(); |
| 93 | + params.set("CATEGORY", category || "TO_VALIDATE"); |
| 94 | + params.set("page", page || "1"); |
| 95 | + |
| 96 | + if (!page || !category) { |
| 97 | + replace(`${currentPathname}?${params.toString()}`); |
| 98 | + } |
| 99 | + }, [replace, page, category, currentPathname]); |
| 100 | + |
| 101 | + if (category === "TO_VALIDATE") { |
| 102 | + return <NoCertificationsToValidate />; |
| 103 | + } |
| 104 | + |
| 105 | + if (category === "VISIBLE") { |
| 106 | + return <NoVisibleCertifications />; |
| 107 | + } |
| 108 | + |
| 109 | + if (category === "INVISIBLE") { |
| 110 | + return <NoInisibleCertifications />; |
| 111 | + } |
| 112 | + |
2 | 113 | return <div>liste</div>;
|
3 | 114 | }
|
0 commit comments