Skip to content

Commit

Permalink
Merge branch 'main' into fix/no-matching-FA
Browse files Browse the repository at this point in the history
  • Loading branch information
elisfainstein authored Dec 26, 2024
2 parents e84be24 + 22431f8 commit dd29424
Show file tree
Hide file tree
Showing 328 changed files with 1,388 additions and 1,607 deletions.
12 changes: 9 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
"enforceBuildableLibDependency": true,
"allowCircularSelfDependency": true,
"banTransitiveDependencies": true,
// Exception due to issue in tailwind alias import with Nx structure
// https://github.com/tailwindlabs/tailwindcss/issues/11097
"allow": ["../ui/src/tailwind-preset"],
"allow": [
// Exception due to issue in tailwind alias import with Nx structure
// https://github.com/tailwindlabs/tailwindcss/issues/11097
"../ui/src/tailwind-preset",

// `@/domain` imports are used as a library but exists inside the `backend` application.
// We explicitely allow our front apps to be allowed to reference it.
"@/domain"
],
"depConstraints": [
{
"sourceTag": "*",
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ storybook-static
**/package.json

# gcloud credentials
backend/src/common/services/keyfile.json
keyfile.json
19 changes: 8 additions & 11 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ node-alpine-with-all-deps:
# Copy shared libraries
COPY $API_DIR $API_DIR
COPY $UI_DIR $UI_DIR
# Temporarily consider the Backend as a shared library.
# The app build needs it to resolve the import of the trpc AppRouter.
# Backend is also used as a shared library
COPY $BACKEND_DIR $BACKEND_DIR


Expand Down Expand Up @@ -347,6 +346,8 @@ front-deps:
# Copy only shared libraries
COPY $API_DIR $API_DIR
COPY $UI_DIR $UI_DIR
# Backend is also used as a shared library
COPY $BACKEND_DIR $BACKEND_DIR

front-deps-builder:
LOCALLY
Expand Down Expand Up @@ -398,11 +399,11 @@ backend-test:

tools-automation-api-docker:
BUILD --pass-args ./apps/tools-automation-api+docker

tools-automation-api-deploy:
ARG --required KOYEB_API_KEY
BUILD --pass-args ./apps/tools-automation-api+deploy

tools-automation-api-test:
BUILD --pass-args ./apps/tools-automation-api+test

Expand Down Expand Up @@ -465,11 +466,9 @@ app-test-build: ## construit une image pour exécuter les tests unitaires de l'a
FROM +front-deps
ENV NEXT_PUBLIC_SUPABASE_URL
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY

# copie les sources du module à tester
COPY $APP_DIR $APP_DIR
COPY $API_DIR $API_DIR
COPY $UI_DIR $UI_DIR
COPY ./vitest.workspace.ts ./

# la commande utilisée pour lancer les tests
CMD pnpm run test:app
Expand All @@ -490,8 +489,7 @@ package-api-test-build: ## construit une image pour exécuter les tests d'intég
ENV SUPABASE_URL
ENV SUPABASE_ANON_KEY
ENV SUPABASE_SERVICE_ROLE_KEY
# copie les sources du module à tester
COPY $API_DIR $API_DIR

# la commande utilisée pour lancer les tests
CMD pnpm run test:api
SAVE IMAGE package-api-test:latest
Expand Down Expand Up @@ -530,8 +528,7 @@ auth-build: ## construit l'image du module d'authentification
EXPOSE $PORT
# copie les sources des modules à construire
COPY $AUTH_DIR $AUTH_DIR
COPY $UI_DIR $UI_DIR
COPY $API_DIR $API_DIR

RUN pnpm run build:auth
CMD ["dumb-init", "./node_modules/.bin/next", "start", "./packages/auth/"]
SAVE IMAGE --cache-from=$AUTH_IMG_NAME --push $AUTH_IMG_NAME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Indicateurs, SharedDomain } from '@/api';
import { Indicateurs } from '@/api';
import { supabaseClient } from '@/app/core-logic/api/supabase';
import { useCollectiviteId } from '@/app/core-logic/hooks/params';
import { Tag } from '@/domain/collectivites';
import { useMutation, useQuery, useQueryClient } from 'react-query';

/** Met à jour les services pilotes d'un indicateur */
Expand All @@ -10,7 +11,7 @@ export const useUpsertIndicateurServices = (indicateurId: number) => {

return useMutation({
mutationKey: 'upsert_indicateur_services',
mutationFn: async (services: SharedDomain.Tag[]) => {
mutationFn: async (services: Tag[]) => {
if (!collectiviteId) return;
return Indicateurs.save.upsertServices(
supabaseClient,
Expand All @@ -19,7 +20,7 @@ export const useUpsertIndicateurServices = (indicateurId: number) => {
services
);
},
onSuccess: (data, variables) => {
onSuccess: () => {
// recharge les infos complémentaires associées à l'indicateur
queryClient.invalidateQueries([
'indicateur_services',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FicheAction } from '@/api/plan-actions';
import { Thematique } from '@/api/shared/domain';
import {
TIndicateurPersoDefinitionWrite,
useInsertIndicateurPersoDefinition,
Expand All @@ -8,6 +7,7 @@ import { makeCollectiviteIndicateursUrl } from '@/app/app/paths';
import { useCollectiviteId } from '@/app/core-logic/hooks/params';
import ThematiquesDropdown from '@/app/ui/dropdownLists/ThematiquesDropdown/ThematiquesDropdown';
import FormikInput from '@/app/ui/shared/form/formik/FormikInput';
import { Thematique } from '@/domain/shared';
import { Alert, Button, Checkbox, Field, FormSectionGrid } from '@/ui';
import { Form, Formik } from 'formik';
import { useRouter } from 'next/navigation';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { SharedDomain } from '@/api';
import { Personne } from '@/api/collectivites';
import { useUpdateIndicateurCard } from '@/app/app/pages/collectivite/Indicateurs/lists/IndicateurCard/IndicateurCardEdit/useUpdateIndicateurCard';
import PersonnesDropdown from '@/app/ui/dropdownLists/PersonnesDropdown/PersonnesDropdown';
import ServicesPilotesDropdown from '@/app/ui/dropdownLists/ServicesPilotesDropdown/ServicesPilotesDropdown';
import ThematiquesDropdown from '@/app/ui/dropdownLists/ThematiquesDropdown/ThematiquesDropdown';
import { Tag } from '@/domain/collectivites';
import { Thematique } from '@/domain/shared';
import { Field, Modal, ModalFooterOKCancel } from '@/ui';
import { OpenState } from '@/ui/utils/types';
import { useEffect, useState } from 'react';
Expand Down Expand Up @@ -37,8 +38,8 @@ const IndicateurCardEditModal = ({

const [state, setState] = useState<{
pilotes: Personne[];
services: SharedDomain.Tag[];
thematiques: SharedDomain.Thematique[];
services: Tag[];
thematiques: Thematique[];
}>(initialState);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useMutation } from 'react-query';

import { Indicateurs } from '@/api';
import { Personne } from '@/api/collectivites';
import { Tag, Thematique } from '@/api/shared/domain';
import { supabaseClient } from '@/app/core-logic/api/supabase';
import { useCollectiviteId } from '@/app/core-logic/hooks/params';
import { Tag } from '@/domain/collectivites';
import { Thematique } from '@/domain/shared';
import { useMutation } from 'react-query';

/** Met à jour les pilotes, les services pilotes, les thématique d'un indicateur */
export const useUpdateIndicateurCard = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const useFilteredIndicateurDefinitions = (
delete options.filtre?.text; // Delete it, search is done locally for now due to backend reasons
}

const { data, error, isLoading } = trpc.indicateurs.filtre.list.useQuery(
const { data, error, isLoading } = trpc.indicateurs.list.useQuery(
{
collectiviteId: collectiviteId!,
filtre: options.filtre ?? {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NiveauPriorite } from '@/api/plan-actions';
import { useCollectiviteId } from '@/app/core-logic/hooks/params';
import PrioritesSelectDropdown from '@/app/ui/dropdownLists/ficheAction/priorites/PrioritesSelectDropdown';
import { Priorite } from '@/domain/plans/fiches';
import { Button, Field, useEventTracker } from '@/ui';
import { OpenState } from '@/ui/utils/types';
import { useState } from 'react';
Expand All @@ -16,7 +16,7 @@ const ModaleEditionPriorite = ({
openState,
selectedIds,
}: ModaleEditionPrioriteProps) => {
const [priorite, setPriorite] = useState<NiveauPriorite>();
const [priorite, setPriorite] = useState<Priorite>();

const collectiviteId = useCollectiviteId()!;
const tracker = useEventTracker('app/actions-groupees-fiches-action');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LibreTag } from '@/api/typeUtils';
import { useCollectiviteId } from '@/app/core-logic/hooks/params';
import TagsSuiviPersoDropdown from '@/app/ui/dropdownLists/TagsSuiviPersoDropdown/TagsSuiviPersoDropdown';
import { Tag } from '@/domain/collectivites';
import { Button, Field, useEventTracker } from '@/ui';
import { OpenState } from '@/ui/utils/types';
import { useState } from 'react';
Expand All @@ -16,7 +16,7 @@ const ModaleEditionTagsLibres = ({
openState,
selectedIds,
}: ModaleEditionTagsLibresProps) => {
const [tags, setTags] = useState<LibreTag[] | null | undefined>();
const [tags, setTags] = useState<Tag[] | null | undefined>();

const collectiviteId = useCollectiviteId()!;
const tracker = useEventTracker('app/actions-groupees-fiches-action');
Expand All @@ -35,14 +35,14 @@ const ModaleEditionTagsLibres = ({
mutation.mutate({
ficheIds: selectedIds,
libreTags: {
add: tags?.map((t) => ({ id: t.id! })) ?? undefined,
add: tags?.map((t) => ({ id: t.id })) ?? undefined,
},
});
}}
>
<Field title="Tags" className="col-span-2">
<TagsSuiviPersoDropdown
values={tags?.map((t) => t.id!)}
values={tags?.map((t) => t.id)}
onChange={({ libresTag }) => setTags(libresTag)}
/>
</Field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Description = ({ fiche }: FicheActionPdfProps) => {
{sousThematiques?.map((ssThematique) => (
<Badge
key={ssThematique.id}
title={ssThematique.sousThematique}
title={ssThematique.nom}
state="info"
/>
))}
Expand All @@ -44,7 +44,7 @@ const Description = ({ fiche }: FicheActionPdfProps) => {
{/* Description */}
<Stack gap={1}>
<Title variant="h5" className="text-grey-1">
Description de l'action :
{"Description de l'action :"}
</Title>
<Paragraph className="text-grey-1">
{description || 'Non renseigné'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const BudgetTab = ({ isReadonly, fiche, updateFiche }: BudgetTabProps) => {
<span className="uppercase text-primary-9 text-sm font-bold leading-7">
Budget prévisionnel total :
</span>
{!!budgetPrevisionnel ? (
{budgetPrevisionnel ? (
<BudgetBadge budgetPrevisionnel={budgetPrevisionnel} />
) : (
<span className="text-sm text-grey-7 leading-7">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Financeur } from '@/api/plan-actions';
import FinanceursDropdown from '@/app/ui/dropdownLists/FinanceursDropdown/FinanceursDropdown';
import { Financeur, FinanceurUpdate } from '@/domain/plans/fiches';
import { Button, Field, Input } from '@/ui';

type FinanceurPartial = Omit<Financeur, 'id' | 'ficheId' | 'financeurTagId'>;

type FinanceursInputProps = {
financeurs: Financeur[] | null | undefined;
onUpdate: (financeurs: Financeur[]) => void;
financeurs: FinanceurUpdate[] | null | undefined;
onUpdate: (financeurs: FinanceurUpdate[]) => void;
};

const FinanceursInput = ({ financeurs, onUpdate }: FinanceursInputProps) => {
Expand All @@ -24,7 +26,7 @@ const FinanceursInput = ({ financeurs, onUpdate }: FinanceursInputProps) => {
: undefined
}
disabled={true}
onChange={() => {}}
onChange={() => ({})}
/>
</Field>
<Field title="Montant engagé" className="col-span-4">
Expand Down Expand Up @@ -80,7 +82,12 @@ const FinanceursInput = ({ financeurs, onUpdate }: FinanceursInputProps) => {
selectedFinanceur &&
onUpdate([
...(financeurs ?? []),
{ financeurTag: selectedFinanceur, montantTtc: null },
{
financeurTag: selectedFinanceur,
financeurTagId: selectedFinanceur.id,
ficheId: financeurs?.[0].ficheId ?? 0,
montantTtc: null,
},
])
}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Financeur } from '@/api/plan-actions';
import { getFormattedNumber } from '@/app/utils/formatUtils';
import { FinanceurUpdate } from '@/domain/plans/fiches';
import { Badge } from '@/ui';

type FinanceursListeProps = {
financeurs?: Financeur[];
financeurs?: FinanceurUpdate[];
};

const FinanceursListe = ({ financeurs }: FinanceursListeProps) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const FicheActionDescription = ({
{sousThematiques?.map((ssThematique) => (
<Badge
key={ssThematique.id}
title={ssThematique.sousThematique}
title={ssThematique.nom}
uppercase={false}
state="info"
/>
Expand All @@ -103,7 +103,7 @@ const FicheActionDescription = ({
{/* Description de l'action */}
<div>
<h6 className="text-lg leading-6 text-grey-1 mb-2">
Description de l'action :
{"Description de l'action :"}
</h6>
<div className="text-base text-grey-1 whitespace-pre-wrap mb-0">
{description ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FicheAction } from '@/api/plan-actions';
import { Thematique } from '@/api/shared/domain';
import { useCurrentCollectivite } from '@/app/core-logic/hooks/useCurrentCollectivite';
import SousThematiquesDropdown from '@/app/ui/dropdownLists/SousThematiquesDropdown/SousThematiquesDropdown';
import TagsSuiviPersoDropdown from '@/app/ui/dropdownLists/TagsSuiviPersoDropdown/TagsSuiviPersoDropdown';
import ThematiquesDropdown from '@/app/ui/dropdownLists/ThematiquesDropdown/ThematiquesDropdown';
import { getMaxLengthMessage } from '@/app/utils/formatUtils';
import { Thematique } from '@/domain/shared';
import {
Button,
Field,
Expand Down Expand Up @@ -99,7 +99,7 @@ const ModaleDescription = ({ fiche, updateFiche }: ModaleDescriptionProps) => {
{/* Dropdown tags personnalisés */}
<Field title="Mes tags de suivi" className="col-span-2">
<TagsSuiviPersoDropdown
values={editedFiche.libresTag?.map((t) => t.id!)}
values={editedFiche.libresTag?.map((t) => t.id)}
onChange={({ libresTag }) =>
setEditedFiche((prevState) => ({ ...prevState, libresTag }))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Axe } from '@/api/plan-actions';
import { makeCollectiviteFichesNonClasseesUrl } from '@/app/app/paths';
import { Axe } from '@/domain/plans/fiches';
import { Breadcrumbs, Button } from '@/ui';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
Expand Down Expand Up @@ -77,9 +77,10 @@ const CheminsFiche = ({ titre, collectiviteId, axes }: CheminsFicheProps) => {
{isOpen && (
<div>
{otherAxes.map(
(axe) =>
(axe, index) =>
axe.id && (
<CheminFiche
key={index}
titre={titre ?? 'Sans titre'}
axeId={axe.id}
collectiviteId={collectiviteId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const ficheResumeFactory = ({
dateFinProvisoire: null,
ameliorationContinue: null,
priorite: null,
plans: axeId ? [{ id: axeId, collectiviteId }] : null,
plans: axeId ? [{ id: axeId, collectiviteId, nom: null }] : null,
statut: null,
titre: '',
restreint: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Statut } from '@/api/plan-actions';
import { Statut } from '@/domain/plans/fiches';
import { preset } from '@/ui';

/** Correspondance entre les statuts et couleurs associées */
Expand Down
Loading

0 comments on commit dd29424

Please sign in to comment.