Skip to content

Commit

Permalink
fix : n'affiche plus le bandeau "rejoindre une collectivite" sur la r…
Browse files Browse the repository at this point in the history
…echerche de collectivité lorsque l'utilisateur fait déjà parti d'une collectivité
  • Loading branch information
cparthur committed Oct 30, 2024
1 parent fc0ebc1 commit 11bd812
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import {Route} from 'react-router-dom';
import {Button, Card} from '@tet/ui';
import {getRejoindreCollectivitePath} from '@tet/api';
import {useSansCollectivite} from 'core-logic/hooks/useOwnedCollectivites';
import { Route } from 'react-router-dom';
import { Button, Card } from '@tet/ui';
import { getRejoindreCollectivitePath } from '@tet/api';
import DecouvrirLesCollectivites from './DecouvrirLesCollectivites';
import {ReactComponent as PictoCarte} from './carte.svg';
import { ReactComponent as PictoCarte } from './carte.svg';
import {
finaliserMonInscriptionUrl,
recherchesCollectivitesUrl,
recherchesPath,
} from 'app/paths';

const CollectivitesEngagees = () => {
const sansCollectivite = useSansCollectivite();

return (
<>
<Route path={finaliserMonInscriptionUrl}>
<FinaliserMonInscription />
</Route>
<Route path={recherchesPath}>
<DecouvrirLesCollectivites sansCollectivite={sansCollectivite} />
<DecouvrirLesCollectivites />
</Route>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import { useSearchParams } from 'core-logic/hooks/query';
import { CollectiviteEngagee } from '@tet/api';
import { recherchesCollectivitesUrl, recherchesPlansUrl } from 'app/paths';
import { initialFilters, nameToShortNames } from './data/filters';
import { useSansCollectivite } from 'core-logic/hooks/useOwnedCollectivites';

type Props = {
sansCollectivite: boolean;
};

const DecouvrirLesCollectivites = ({ sansCollectivite }: Props) => {
const DecouvrirLesCollectivites = () => {
const auth = useAuth();
const { isConnected } = auth;

const sansCollectivite = useSansCollectivite();

/** Filters */
const [filters, setFilters] = useSearchParams<CollectiviteEngagee.Filters>(
'',
Expand All @@ -28,7 +27,7 @@ const DecouvrirLesCollectivites = ({ sansCollectivite }: Props) => {

return (
<div className="bg-primary-1 -mb-8">
{sansCollectivite && <AssocierCollectiviteBandeau />}
{!!sansCollectivite && <AssocierCollectiviteBandeau />}
<div
data-test="ToutesLesCollectivites"
className="app fr-container py-16"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const useSansCollectivite = () => {
return count === null ? null : count === 0;
}
);
return sansCollectivite ?? true;
return sansCollectivite;
};

// une variante qui renvoi aussi les plans d'actions pilotables de la 1ère collectivité
Expand Down

0 comments on commit 11bd812

Please sign in to comment.