Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facility Id in User Profile for Nav User #9857

Merged
merged 7 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/Users/UserHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ export default function UserHome(props: UserHomeProps) {
}

const SelectedTab = TABS[currentTab].body;
const userUrl = props.facilityId
? `/facility/${props.facilityId}/users/${username}`
: `/users/${username}`;

return (
<>
Expand Down Expand Up @@ -120,7 +123,7 @@ export default function UserHome(props: UserHomeProps) {
? "border-b-2 border-primary-500 text-primary-600 hover:border-secondary-300"
: "text-secondary-700 hover:text-secondary-700",
)}
href={`/facility/${props.facilityId}/users/${username}/${p.toLocaleLowerCase()}`}
href={`${userUrl}/${p.toLocaleLowerCase()}`}
>
<div className="px-3 py-1.5" id={p.toLowerCase()}>
{t(`USERMANAGEMENT_TAB__${p}`)}
Expand Down
8 changes: 7 additions & 1 deletion src/components/ui/sidebar/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ export function AppSidebar({
</SidebarContent>

<SidebarFooter>
{(facilitySidebar || selectedOrganization) && <FacilityNavUser />}
{(facilitySidebar || selectedOrganization) && (
<FacilityNavUser
{...(facilitySidebar && {
selectedFacilityId: selectedFacility?.id,
})}
/>
Jacobjeevan marked this conversation as resolved.
Show resolved Hide resolved
)}
{patientSidebar && <PatientNavUser />}
</SidebarFooter>

Expand Down
11 changes: 9 additions & 2 deletions src/components/ui/sidebar/nav-user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import useAuthUser, { useAuthContext } from "@/hooks/useAuthUser";
import { usePatientSignOut } from "@/hooks/usePatientSignOut";
import { usePatientContext } from "@/hooks/usePatientUser";

export function FacilityNavUser() {
export function FacilityNavUser({
selectedFacilityId,
}: {
selectedFacilityId?: string;
Jacobjeevan marked this conversation as resolved.
Show resolved Hide resolved
}) {
const { t } = useTranslation();
const user = useAuthUser();
const { isMobile, open, setOpenMobile } = useSidebar();
Expand Down Expand Up @@ -94,7 +98,10 @@ export function FacilityNavUser() {
<DropdownMenuGroup>
<DropdownMenuItem
onClick={() => {
navigate(`/users/${user.username}`);
const profileUrl = selectedFacilityId
? `/facility/${selectedFacilityId}/users/${user.username}`
: `/users/${user.username}`;
navigate(profileUrl);
if (isMobile) {
setOpenMobile(false);
}
Expand Down
Loading