Skip to content

Commit

Permalink
feat(admin): conditionally display NoticeAppSettings based on pathname
Browse files Browse the repository at this point in the history
- Added logic to conditionally render the NoticeAppSettings component depending on the current pathname.
- This ensures that NoticeAppSettings is only displayed when pathname is "/agencies-settings"
  • Loading branch information
ThomasDos committed Aug 29, 2024
1 parent b6ef3f8 commit d0e390f
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { usePathname } from "next/navigation";
import { useAuth } from "../auth/auth";
import { useKeycloakContext } from "../auth/keycloakContext";
import { useFeatureflipping } from "../feature-flipping/featureFlipping";
Expand All @@ -14,7 +15,7 @@ export const LayoutNotice = () => {
const { isGestionnaireMaisonMereAAP, isAdmin, isOrganism } = useAuth();
const { isFeatureActive } = useFeatureflipping();
const { isVisibleInSearchResults } = useAAPVisibilityCheck();

const pathname = usePathname();
const isFeatureAapCguActive = isFeatureActive("AAP_CGU");
const isFeaturNoticeAlertFundingLimitActive = isFeatureActive(
"NOTICE_ALERT_FUNDING_LIMIT",
Expand All @@ -32,6 +33,8 @@ export const LayoutNotice = () => {

const canSeeNoticeAlertFundingLimit = isFeaturNoticeAlertFundingLimitActive;

const canSeeNoticeAapSettings = pathname === "/agencies-settings/";

if (canSeeAapCgu) {
return <AapCgu />;
}
Expand All @@ -44,8 +47,12 @@ export const LayoutNotice = () => {
return <AlertFundingLimit />;
}

return CustomInfoNotice({
title:
"Bon à savoir : paramétrer votre compte vous permet d'apparaître dans les recherches des candidats.",
});
if (canSeeNoticeAapSettings) {
return CustomInfoNotice({
title:
"Bon à savoir : paramétrer votre compte vous permet d'apparaître dans les recherches des candidats.",
});
}

return null;
};

0 comments on commit d0e390f

Please sign in to comment.