Skip to content

Commit

Permalink
address review comments #1237
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadkitenge committed Jan 13, 2025
1 parent 7c55d94 commit c886478
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/admin/adminLayout.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,21 @@ export const useGetAdminPageName = (): string | null => {
}, [location.pathname]);
};

const adminBreadCrumbsTrails: { [key: string]: [string, string] } = {
['units']: ['units', 'Units'],
['usage-statuses']: ['usage-statuses', 'Usage statuses'],
const adminBreadCrumbsTrails: { [key: string]: BreadcrumbsInfo['trail'] } = {
['units']: [['units', 'Units']],
['usage-statuses']: [['usage-statuses', 'Usage statuses']],
};

function AdminLayout() {
const adminPageName = useGetAdminPageName();

const adminBreadCrumbs: BreadcrumbsInfo | undefined = adminPageName
? {
trail: adminBreadCrumbsTrails[adminPageName]
? [adminBreadCrumbsTrails[adminPageName]]
: [],
full_trail: true,
}
: undefined;
const adminBreadCrumbs: BreadcrumbsInfo | undefined =
adminPageName && adminPageName in adminBreadCrumbsTrails
? {
trail: adminBreadCrumbsTrails[adminPageName],
full_trail: true,
}
: undefined;

return (
<BaseLayoutHeader homeLocation="Admin" breadcrumbsInfo={adminBreadCrumbs}>
Expand Down

0 comments on commit c886478

Please sign in to comment.