Skip to content

Commit

Permalink
chore(admin): added prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
fbonniec committed Nov 28, 2024
1 parent 4ca5d56 commit 7444d25
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 29 deletions.
12 changes: 11 additions & 1 deletion packages/reva-admin-react/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"extends": ["next/core-web-vitals", "next/typescript", "prettier"],
"extends": [
"next/core-web-vitals",
"next/typescript",
"plugin:prettier/recommended"
],
"rules": {
"react/no-unescaped-entities": "off",
"@typescript-eslint/no-unused-vars": [
Expand All @@ -9,6 +13,12 @@
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
}
}
1 change: 1 addition & 0 deletions packages/reva-admin-react/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/graphql/generated
4 changes: 4 additions & 0 deletions packages/reva-admin-react/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": true,
"singleQuote": false
}
77 changes: 77 additions & 0 deletions packages/reva-admin-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/reva-admin-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"eslint": "^8",
"eslint-config-next": "14.2.16",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"postcss": "^8",
"prettier": "^3.3.3",
"start-server-and-test": "^2.0.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ const CandidacyUnarchiveComponent = ({
}: {
candidacy: NonNullable<CandidacyForUnarchive>;
}) => {
const { canBeRestored } =
useCandidacyStatus(candidacy);
const { canBeRestored } = useCandidacyStatus(candidacy);

if (!canBeRestored) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export const useCertificationsPage = ({
.sort((c) =>
certificationAuthority?.certificationAuthorityStructure?.certifications.some(
(ca) => ca.id === c.id,
) ? -1 : 1,
)
? -1
: 1,
),
[
certificationAuthority?.certificationAuthorityStructure?.certifications,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,16 @@ export const useCertificationsPage = ({

const certifications = useMemo(
() =>
getCertificationAuthorityStructureAndCertificationsResponse?.searchCertificationsForAdmin?.rows.map(
(c) => ({
getCertificationAuthorityStructureAndCertificationsResponse?.searchCertificationsForAdmin?.rows
.map((c) => ({
id: c.id,
label: `${c.codeRncp} - ${c.label}`,
selected:
certificationAuthorityStructure?.certifications.some(
(cert) => cert.id === c.id,
) || false,
}),
).sort((a, b) => (b.selected ? 1 : 0) - (a.selected ? 1 : 0)),
}))
.sort((a, b) => (b.selected ? 1 : 0) - (a.selected ? 1 : 0)),
[
certificationAuthorityStructure?.certifications,
getCertificationAuthorityStructureAndCertificationsResponse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use client";

import { useParams } from "next/navigation";
import {
useCertificationsPage,
} from "./certifications.hooks";
import { useCertificationsPage } from "./certifications.hooks";
import { graphqlErrorToast, successToast } from "@/components/toast/toast";
import { CertificationAuthorityStructureBreadcrumb } from "../_components/certification-authority-structure-breadcrumb/CertificationAuthorityStructureBreadcrumb";
import { CertificationsForm } from "@/components/certifications-form/CertificationsForm";
Expand All @@ -21,20 +19,25 @@ const CertificationAuthorityStructureCertificationsPage = () => {
updateCertificationAuthorityStructureCertifications,
} = useCertificationsPage({ certificationAuthorityStructureId });


const handleFormSubmit = useCallback(async (data: CertificationsFormData) => {
try {
await updateCertificationAuthorityStructureCertifications.mutateAsync({
certificationAuthorityStructureId,
certificationIds: data.certifications
.filter((c) => c.selected)
.map((c) => c.id),
});
successToast("Modifications enregistrées");
} catch (e) {
graphqlErrorToast(e);
}
}, [updateCertificationAuthorityStructureCertifications, certificationAuthorityStructureId]);
const handleFormSubmit = useCallback(
async (data: CertificationsFormData) => {
try {
await updateCertificationAuthorityStructureCertifications.mutateAsync({
certificationAuthorityStructureId,
certificationIds: data.certifications
.filter((c) => c.selected)
.map((c) => c.id),
});
successToast("Modifications enregistrées");
} catch (e) {
graphqlErrorToast(e);
}
},
[
updateCertificationAuthorityStructureCertifications,
certificationAuthorityStructureId,
],
);

if (!certificationAuthorityStructure) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const useUpdateMaisonMereAAPLegalValidationDecision = (
useMutation({
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ["getMaisonMereAAP", maisonMereAAPId]
})
queryKey: ["getMaisonMereAAP", maisonMereAAPId],
});
},
mutationKey: [
"updateMaisonMereAAPLegalValidationStatus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const CandidacyBackButton = ({
}: {
candidacyId: string;
}) => {

return (
<Button
className="mb-6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export const TreeSelect = (props: Props): JSX.Element => {
};

return (
<div className={`flex-1 flex flex-col gap-2 ${fullWidth ? "w-full" : "max-w-[450px]"}`}>
<div
className={`flex-1 flex flex-col gap-2 ${fullWidth ? "w-full" : "max-w-[450px]"}`}
>
{title && <div>{title}</div>}
<SearchBar
renderInput={({ className, id, placeholder, type }) => (
Expand Down

0 comments on commit 7444d25

Please sign in to comment.