diff --git a/app.territoiresentransitions.react/src/app/Layout/Header/MenuPrincipal.tsx b/app.territoiresentransitions.react/src/app/Layout/Header/MenuPrincipal.tsx index 7d5c6ee1b6..729099fcaa 100644 --- a/app.territoiresentransitions.react/src/app/Layout/Header/MenuPrincipal.tsx +++ b/app.territoiresentransitions.react/src/app/Layout/Header/MenuPrincipal.tsx @@ -23,6 +23,7 @@ export const MenuPrincipal = (props: HeaderPropsWithModalState) => { const { currentCollectivite, ownedCollectivites, + panierId, modalOpened, setOpenedId, auth, @@ -47,7 +48,7 @@ export const MenuPrincipal = (props: HeaderPropsWithModalState) => { let secondaryItems = [] as TNavItemsList; if (currentCollectivite) { // récupère la liste des items à afficher dans le menu - items = makeNavItems(currentCollectivite, auth.user); + items = makeNavItems(currentCollectivite, auth.user, panierId); secondaryItems = makeSecondaryNavItems(currentCollectivite); } diff --git a/app.territoiresentransitions.react/src/app/Layout/Header/index.tsx b/app.territoiresentransitions.react/src/app/Layout/Header/index.tsx index e652edd745..eaec55e185 100644 --- a/app.territoiresentransitions.react/src/app/Layout/Header/index.tsx +++ b/app.territoiresentransitions.react/src/app/Layout/Header/index.tsx @@ -3,6 +3,7 @@ import { useAuth } from '@/app/core-logic/api/auth/AuthProvider'; import { useCurrentCollectivite } from '@/app/core-logic/hooks/useCurrentCollectivite'; import { useMaintenance } from '../useMaintenance'; +import { useNbActionsDansPanier } from './AccesPanierAction'; import { Header as HeaderBase } from './Header'; /** @@ -11,6 +12,9 @@ import { Header as HeaderBase } from './Header'; const Header = () => { const auth = useAuth(); const currentCollectivite = useCurrentCollectivite(); + const { data: panier } = useNbActionsDansPanier( + currentCollectivite?.collectivite_id! + ); const maintenance = useMaintenance(); return ( @@ -18,6 +22,7 @@ const Header = () => { auth={auth} ownedCollectivites={auth.user?.collectivites ?? []} currentCollectivite={currentCollectivite} + panierId={panier?.panierId} maintenance={maintenance} /> ); diff --git a/app.territoiresentransitions.react/src/app/Layout/Header/makeNavItems.ts b/app.territoiresentransitions.react/src/app/Layout/Header/makeNavItems.ts index 9e723c1775..5da8e4048b 100644 --- a/app.territoiresentransitions.react/src/app/Layout/Header/makeNavItems.ts +++ b/app.territoiresentransitions.react/src/app/Layout/Header/makeNavItems.ts @@ -25,9 +25,10 @@ import { TNavDropdown, TNavItem, TNavItemsList } from './types'; /** Génère les liens de navigation pour une collectivité donnée */ export const makeNavItems = ( collectivite: CurrentCollectivite, - user: UserData | null + user: UserData | null, + panierId: string | undefined ): TNavItemsList => { - return filtreItems(makeNavItemsBase(collectivite, user)); + return filtreItems(makeNavItemsBase(collectivite, user, panierId)); }; const isVisiteur = ({ @@ -43,7 +44,8 @@ const isVisiteur = ({ const makeNavItemsBase = ( collectivite: CurrentCollectivite, - user: UserData | null + user: UserData | null, + panierId: string | undefined ): TNavItemsList => { const collectiviteId = collectivite.collectivite_id; const confidentiel = @@ -58,10 +60,11 @@ const makeNavItemsBase = ( dataTest: 'nav-home', }, { + confidentiel, label: 'Actions à Impact', - dataTest: 'pa-actions-impact', to: makeCollectivitePanierUrl({ collectiviteId, + panierId, }), }, { diff --git a/app.territoiresentransitions.react/src/app/Layout/Header/types.ts b/app.territoiresentransitions.react/src/app/Layout/Header/types.ts index 0f95003a67..515a565c57 100644 --- a/app.territoiresentransitions.react/src/app/Layout/Header/types.ts +++ b/app.territoiresentransitions.react/src/app/Layout/Header/types.ts @@ -32,6 +32,7 @@ export type HeaderProps = { auth: TAuthContext; currentCollectivite: CurrentCollectivite | null; ownedCollectivites: TMesCollectivites; + panierId: string | undefined; maintenance: Maintenance; };