Skip to content

Commit bb18430

Browse files
committed
feat(admin): added the "responsable des certifications" update certification page skeleton
1 parent 14936ec commit bb18430

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"use client";
2+
import { useParams } from "next/navigation";
3+
import { useUpdateCertificationPage } from "./updateCertification.hook";
4+
5+
type CertificationForPage = Exclude<
6+
ReturnType<typeof useUpdateCertificationPage>["certification"],
7+
undefined
8+
>;
9+
10+
export default function UpdateCertificationForCertificationRegistryManagerPage() {
11+
const { certificationId } = useParams<{
12+
certificationId: string;
13+
}>();
14+
15+
const { certification, getCertificationQueryStatus } =
16+
useUpdateCertificationPage({ certificationId });
17+
return getCertificationQueryStatus === "success" && certification ? (
18+
<PageContent certification={certification} />
19+
) : null;
20+
}
21+
22+
const PageContent = ({
23+
certification,
24+
}: {
25+
certification: CertificationForPage;
26+
}) => {
27+
return (
28+
<div data-test="update-certification-page">
29+
<h1>
30+
{certification.codeRncp} - {certification.label}
31+
</h1>
32+
<p className="mb-12 text-xl">
33+
Relisez, complétez et/ou modifiez les informations récupérées via France
34+
compétences avant de valider la certification. Une fois la certification
35+
validée et visible sur la plateforme, ces informations seront affichées
36+
aux AAP et aux candidats.
37+
</p>
38+
</div>
39+
);
40+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { useGraphQlClient } from "@/components/graphql/graphql-client/GraphqlClient";
2+
import { graphql } from "@/graphql/generated";
3+
import { useQuery } from "@tanstack/react-query";
4+
5+
const getCertificationQuery = graphql(`
6+
query getCertificationForCertificationRegistryManagerUpdateCertificationPage(
7+
$certificationId: ID!
8+
) {
9+
getCertification(certificationId: $certificationId) {
10+
id
11+
label
12+
codeRncp
13+
}
14+
}
15+
`);
16+
17+
export const useUpdateCertificationPage = ({
18+
certificationId,
19+
}: {
20+
certificationId: string;
21+
}) => {
22+
const { graphqlClient } = useGraphQlClient();
23+
24+
const {
25+
data: getCertificationQueryResponse,
26+
status: getCertificationQueryStatus,
27+
} = useQuery({
28+
queryKey: [
29+
certificationId,
30+
"certifications",
31+
"getCertificationForCertificationRegistryManagerUpdateCertificationPage",
32+
],
33+
queryFn: () =>
34+
graphqlClient.request(getCertificationQuery, {
35+
certificationId,
36+
}),
37+
});
38+
39+
const certification = getCertificationQueryResponse?.getCertification;
40+
41+
return {
42+
certification,
43+
getCertificationQueryStatus,
44+
};
45+
};

0 commit comments

Comments
 (0)