Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const AppNavigation = () => {
const { t } = useTranslation();
return (
<Nav id="flightclt-nav" theme="dark">
<NavList id="flightclt-navlist">
<NavList id="flightclt-navlist" style={{ padding: 0 }}>
{getAppRoutes(t)
.filter((route) => route.showInNav)
.map((route) => {
Expand Down
16 changes: 14 additions & 2 deletions apps/standalone/src/app/components/AppLayout/AppToolbar.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
.fctl-app_toolbar {
justify-content: end;
.fctl-app_toolbar,
.fctl-subnav_toolbar {
justify-content: flex-end;
}

/* Extra navigation bar for global actions (organization switcher, copy login command, etc.) */
/* We make it as tall as the navigation menu items on the left */
#global-actions-masthead {
padding: 0;
--pf-v5-c-masthead--m-display-inline__content--MinHeight: 3.5rem;
}

#global-actions-masthead .fctl-subnav_toolbar {
--pf-v5-c-toolbar--BackgroundColor: var(--pf-v5-global--BackgroundColor--dark-300);
}
42 changes: 23 additions & 19 deletions libs/ui-components/src/components/common/PageNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
Dropdown,
DropdownItem,
DropdownList,
Masthead,
MastheadContent,
MenuToggle,
MenuToggleElement,
PageSection,
Expand Down Expand Up @@ -44,6 +46,7 @@ const OrganizationDropdown = ({ organizationName, onSwitchOrganization }: Organi
{organizationName}
</MenuToggle>
)}
popperProps={{ position: 'right' }}
>
<DropdownList>
<DropdownItem onClick={onSwitchOrganization}>{t('Change Organization')}</DropdownItem>
Expand All @@ -52,14 +55,12 @@ const OrganizationDropdown = ({ organizationName, onSwitchOrganization }: Organi
);
};

const PageNavigation = ({ children }: React.PropsWithChildren) => {
const PageNavigation = () => {
const { currentOrganization, availableOrganizations } = useOrganizationGuardContext();
const [showOrganizationModal, setShowOrganizationModal] = React.useState(false);

const showOrganizationSelection = availableOrganizations.length > 1;
const hasChildren = React.Children.count(children) > 0;

if (!showOrganizationSelection && !hasChildren) {
if (!showOrganizationSelection) {
return null;
}

Expand All @@ -68,21 +69,24 @@ const PageNavigation = ({ children }: React.PropsWithChildren) => {
return (
<>
<PageSection variant="light" padding={{ default: 'noPadding' }}>
<Toolbar isFullHeight isStatic className="fctl-app_toolbar">
<ToolbarContent>
{hasChildren && <ToolbarItem>{children}</ToolbarItem>}
{showOrganizationSelection && (
<ToolbarItem>
<OrganizationDropdown
organizationName={currentOrgDisplayName}
onSwitchOrganization={() => {
setShowOrganizationModal(true);
}}
/>
</ToolbarItem>
)}
</ToolbarContent>
</Toolbar>
<Masthead id="global-actions-masthead">
<MastheadContent>
<Toolbar isFullHeight isStatic className="fctl-subnav_toolbar">
<ToolbarContent>
{showOrganizationSelection && (
<ToolbarItem>
<OrganizationDropdown
organizationName={currentOrgDisplayName}
onSwitchOrganization={() => {
setShowOrganizationModal(true);
}}
/>
</ToolbarItem>
)}
</ToolbarContent>
</Toolbar>
</MastheadContent>
</Masthead>
</PageSection>

{showOrganizationModal && (
Expand Down