1+ import { Fragment } from 'react' ;
12import styled from '@emotion/styled' ;
23
34import * as Layout from 'sentry/components/layouts/thirds' ;
5+ import { useRoutes } from 'sentry/utils/useRoutes' ;
46import { TopBar } from 'sentry/views/navigation/topBar' ;
57import { useHasPageFrameFeature } from 'sentry/views/navigation/useHasPageFrameFeature' ;
8+ import { BreadcrumbTitle } from 'sentry/views/settings/components/settingsBreadcrumb/breadcrumbTitle' ;
69
710type Props = {
811 /**
@@ -42,12 +45,27 @@ function UnstyledSettingsPageHeader({
4245 noTitleStyles = false ,
4346 ...props
4447} : Props ) {
48+ const routes = useRoutes ( ) ;
4549 const hasPageFrame = useHasPageFrameFeature ( ) ;
4650 // If Header is narrow, use align-items to center <Action>.
4751 // Otherwise, use a fixed margin to prevent an odd alignment.
4852 // This is needed as Actions could be a button or a dropdown.
4953 const isNarrow = ! subtitle ;
5054
55+ // In page frame mode the breadcrumb in the TopBar serves as the page title.
56+ // Sync the last breadcrumb label with the actual page title and skip
57+ // rendering the title heading so it doesn't appear twice.
58+ if ( hasPageFrame ) {
59+ return (
60+ < Fragment >
61+ { typeof title === 'string' && < BreadcrumbTitle routes = { routes } title = { title } /> }
62+ { action && < TopBar . Slot name = "actions" > { action } </ TopBar . Slot > }
63+ { body && < BodyWrapper > { body } </ BodyWrapper > }
64+ { tabs && < TabsWrapper > { tabs } </ TabsWrapper > }
65+ </ Fragment >
66+ ) ;
67+ }
68+
5169 return (
5270 < div { ...props } >
5371 < TitleAndActions isNarrow = { isNarrow } >
@@ -60,13 +78,7 @@ function UnstyledSettingsPageHeader({
6078 </ Title >
6179 ) }
6280 </ TitleWrapper >
63- { action ? (
64- hasPageFrame ? (
65- < TopBar . Slot name = "actions" > { action } </ TopBar . Slot >
66- ) : (
67- < Action isNarrow = { isNarrow } > { action } </ Action >
68- )
69- ) : null }
81+ { action && < Action isNarrow = { isNarrow } > { action } </ Action > }
7082 </ TitleAndActions >
7183
7284 { body && < BodyWrapper > { body } </ BodyWrapper > }
0 commit comments