diff --git a/frontend/common/hooks/useOverflowVisibleCount.ts b/frontend/common/hooks/useOverflowVisibleCount.ts index 171d8a4d14d1..faadeb0fb24c 100644 --- a/frontend/common/hooks/useOverflowVisibleCount.ts +++ b/frontend/common/hooks/useOverflowVisibleCount.ts @@ -68,7 +68,14 @@ export const useOverflowVisibleCount = ({ return totalWidths + totalGaps } - const containerWidth = outerCont.clientWidth + // clientWidth includes the container's horizontal padding, which the items + // can't actually occupy. Subtract it so padded navbars don't over-estimate + // the available width and let items clip off-screen. + const outerStyle = getComputedStyle(outerCont) + const containerWidth = + outerCont.clientWidth - + (parseFloat(outerStyle.paddingLeft) || 0) - + (parseFloat(outerStyle.paddingRight) || 0) // All items fit if (sumWidths(widths.length) <= containerWidth) { setVisibleCount(widths.length) diff --git a/frontend/web/components/navigation/OverflowNav.tsx b/frontend/web/components/navigation/OverflowNav.tsx index 944fb7a6831a..cd3112c0bf38 100644 --- a/frontend/web/components/navigation/OverflowNav.tsx +++ b/frontend/web/components/navigation/OverflowNav.tsx @@ -71,8 +71,15 @@ const OverflowNav: FC = ({ 'd-flex align-items-center', )} > + {/* Wrappers keep DOM children 1:1 with items so measured widths align, + even when an item renders nothing or multiple elements */} {(isMeasuring ? items : visible).map((child, idx) => ( - {child} +
+ {child} +
))} diff --git a/frontend/web/components/navigation/navbars/OrganisationNavbar.tsx b/frontend/web/components/navigation/navbars/OrganisationNavbar.tsx index 2ba0d7a92f4f..09d630b89570 100644 --- a/frontend/web/components/navigation/navbars/OrganisationNavbar.tsx +++ b/frontend/web/components/navigation/navbars/OrganisationNavbar.tsx @@ -42,28 +42,27 @@ const OrganisationNavbar: FC = ({}) => { Usage )} - {AccountStore.isAdmin() && ( - <> - {Utils.getFlagsmithHasFeature('organisation_integrations') && ( - } - id='integrations-link' - to={`/organisation/${ - AccountStore.getOrganisation().id - }/integrations`} - > - Organisation Integrations - - )} + {AccountStore.isAdmin() && + Utils.getFlagsmithHasFeature('organisation_integrations') && ( } - id='org-settings-link' - data-test='org-settings-link' - to={`/organisation/${AccountStore.getOrganisation().id}/settings`} + icon={} + id='integrations-link' + to={`/organisation/${ + AccountStore.getOrganisation().id + }/integrations`} > - Organisation Settings + Organisation Integrations - + )} + {AccountStore.isAdmin() && ( + } + id='org-settings-link' + data-test='org-settings-link' + to={`/organisation/${AccountStore.getOrganisation().id}/settings`} + > + Organisation Settings + )} ) diff --git a/frontend/web/components/navigation/navbars/ProjectNavbar.tsx b/frontend/web/components/navigation/navbars/ProjectNavbar.tsx index 3c66eb25e0cd..d0e7f4d7ba7e 100644 --- a/frontend/web/components/navigation/navbars/ProjectNavbar.tsx +++ b/frontend/web/components/navigation/navbars/ProjectNavbar.tsx @@ -60,7 +60,7 @@ const ProjectNavbar: FC = ({ environmentId, projectId }) => { location.pathname.startsWith(`/project/${projectId}/lifecycle`) } > - Feature Lifecycle + Lifecycle )} = ({ environmentId, projectId }) => { > Compare + {projectAdmin && Utils.getFlagsmithHasFeature('release_pipelines') && ( + } + id='release-pipelines-link' + to={`/project/${projectId}/release-pipelines`} + > + Pipelines + + )} {projectAdmin && ( - <> - {Utils.getFlagsmithHasFeature('release_pipelines') && ( - } - id='release-pipelines-link' - to={`/project/${projectId}/release-pipelines`} - > - Release Pipelines - - )} - } - id='project-settings-link' - to={`/project/${projectId}/settings`} - > - Project Settings - - + } + id='project-settings-link' + to={`/project/${projectId}/settings`} + > + Project Settings + )} )