diff --git a/src/components/Common/Breadcrumbs.tsx b/src/components/Common/Breadcrumbs.tsx index 3ccc5494f75..5437db0336d 100644 --- a/src/components/Common/Breadcrumbs.tsx +++ b/src/components/Common/Breadcrumbs.tsx @@ -40,7 +40,12 @@ const capitalize = (string: string) => interface BreadcrumbsProps { replacements?: { - [key: string]: { name?: string; uri?: string; style?: string }; + [key: string]: { + name?: string; + uri?: string; + style?: string; + hide?: boolean; + }; }; className?: string; hideBack?: boolean; @@ -62,6 +67,7 @@ export default function Breadcrumbs({ const crumbs = path ?.slice(1) .split("/") + .filter((field) => replacements[field]?.hide !== true) .map((field, i) => ({ name: replacements[field]?.name || MENU_TAGS[field] || capitalize(field), uri: diff --git a/src/components/Common/PageTitle.tsx b/src/components/Common/PageTitle.tsx index 6c7d9abc38d..97fca6ba7e5 100644 --- a/src/components/Common/PageTitle.tsx +++ b/src/components/Common/PageTitle.tsx @@ -11,7 +11,12 @@ export interface PageTitleProps { componentRight?: ReactNode; breadcrumbs?: boolean; crumbsReplacements?: { - [key: string]: { name?: string; uri?: string; style?: string }; + [key: string]: { + name?: string; + uri?: string; + style?: string; + hide?: boolean; + }; }; focusOnLoad?: boolean; isInsidePage?: boolean; diff --git a/src/components/Users/UserHome.tsx b/src/components/Users/UserHome.tsx index 2629f81df34..06d0bdc2555 100644 --- a/src/components/Users/UserHome.tsx +++ b/src/components/Users/UserHome.tsx @@ -88,17 +88,20 @@ export default function UserHome(props: UserHomeProps) { ? `/facility/${props.facilityId}/users/${username}` : `/users/${username}`; + const crumbsReplacements = { + ...(loggedInUser + ? { [username]: { name: "Profile" } } + : { [username]: { name: username } }), + ...(!props.facilityId && { users: { hide: true } }), + }; + return ( <> {