diff --git a/static/app/views/insights/common/viewTrendsButton.tsx b/static/app/views/insights/common/viewTrendsButton.tsx new file mode 100644 index 00000000000000..5c546ac467ab46 --- /dev/null +++ b/static/app/views/insights/common/viewTrendsButton.tsx @@ -0,0 +1,27 @@ +import {Button} from 'sentry/components/button'; +import {t} from 'sentry/locale'; +import {useLocation} from 'sentry/utils/useLocation'; +import {useNavigate} from 'sentry/utils/useNavigate'; +import useOrganization from 'sentry/utils/useOrganization'; +import {trendsTargetRoute} from 'sentry/views/performance/utils'; + +export function ViewTrendsButton() { + const location = useLocation(); + const organization = useOrganization(); + const navigate = useNavigate(); + + const handleTrendsClick = () => { + const target = trendsTargetRoute({organization, location}); + navigate(target); + }; + return ( + + ); +} diff --git a/static/app/views/insights/mobile/screens/views/screenDetailsPage.tsx b/static/app/views/insights/mobile/screens/views/screenDetailsPage.tsx index 83cd48d72a003c..fba18d214fb99c 100644 --- a/static/app/views/insights/mobile/screens/views/screenDetailsPage.tsx +++ b/static/app/views/insights/mobile/screens/views/screenDetailsPage.tsx @@ -99,6 +99,21 @@ export function ScreenDetailsPage() { }); } + const tabList = ( + + {tabs.map(tab => { + const visible = + tab.feature === undefined || organization.features?.includes(tab.feature); + return ( + + ); + })} + + ); + return ( @@ -116,47 +131,17 @@ export function ScreenDetailsPage() { {isProjectCrossPlatform && } - - - {tabs.map(tab => { - const visible = - tab.feature === undefined || - organization.features?.includes(tab.feature); - return ( - - ); - })} - + {tabList} )} {isInDomainView && ( - - - - - {isProjectCrossPlatform && } - - - - {/* TODO - There's two sets of tabs here, we'll have to do some UI work here */} - - {tabs.map(tab => { - const visible = - tab.feature === undefined || - organization.features?.includes(tab.feature); - return ( - - ); - })} - - + } + /> )} diff --git a/static/app/views/insights/mobile/screens/views/screensLandingPage.tsx b/static/app/views/insights/mobile/screens/views/screensLandingPage.tsx index 22c5b37f779672..cd0dc9e594aac6 100644 --- a/static/app/views/insights/mobile/screens/views/screensLandingPage.tsx +++ b/static/app/views/insights/mobile/screens/views/screensLandingPage.tsx @@ -314,11 +314,7 @@ export function ScreensLandingPage() { )} - {isInDomainView && ( - - - - )} + {isInDomainView && } diff --git a/static/app/views/insights/pages/mobile/mobileOverviewPage.tsx b/static/app/views/insights/pages/mobile/mobileOverviewPage.tsx index 0e9b4ba933504d..cc3c1cbd34ff9c 100644 --- a/static/app/views/insights/pages/mobile/mobileOverviewPage.tsx +++ b/static/app/views/insights/pages/mobile/mobileOverviewPage.tsx @@ -22,6 +22,7 @@ import useProjects from 'sentry/utils/useProjects'; import * as ModuleLayout from 'sentry/views/insights/common/components/moduleLayout'; import {ToolRibbon} from 'sentry/views/insights/common/components/ribbon'; import {useOnboardingProject} from 'sentry/views/insights/common/queries/useOnboardingProject'; +import {ViewTrendsButton} from 'sentry/views/insights/common/viewTrendsButton'; import {MobileHeader} from 'sentry/views/insights/pages/mobile/mobilePageHeader'; import {OVERVIEW_PAGE_TITLE} from 'sentry/views/insights/pages/settings'; import { @@ -169,9 +170,7 @@ function MobileOverviewPage() { organization={organization} renderDisabled={NoAccess} > - - - + } /> diff --git a/static/app/views/insights/pages/mobile/mobilePageHeader.tsx b/static/app/views/insights/pages/mobile/mobilePageHeader.tsx index 1e5f7805c1441f..02969b3f704de8 100644 --- a/static/app/views/insights/pages/mobile/mobilePageHeader.tsx +++ b/static/app/views/insights/pages/mobile/mobilePageHeader.tsx @@ -25,12 +25,14 @@ import {MODULE_TITLES} from 'sentry/views/insights/settings'; import {ModuleName} from 'sentry/views/insights/types'; type Props = { - hideTabs?: boolean; + headerActions?: React.ReactNode; + hideDefaultTabs?: boolean; module?: ModuleName; + tabs?: {onTabChange: (key: string) => void; tabList: React.ReactNode; value: string}; }; // TODO - add props to append to breadcrumbs and change title -export function MobileHeader({module, hideTabs}: Props) { +export function MobileHeader({module, hideDefaultTabs, headerActions, tabs}: Props) { const navigate = useNavigate(); const {slug} = useOrganization(); const moduleURLBuilder = useModuleURLBuilder(); @@ -57,7 +59,7 @@ export function MobileHeader({module, hideTabs}: Props) { }, ]; - const handleTabChange = (key: ModuleName | typeof OVERVIEW_PAGE_TITLE) => { + const defaultHandleTabChange = (key: ModuleName | typeof OVERVIEW_PAGE_TITLE) => { if (key === module || (key === OVERVIEW_PAGE_TITLE && !module)) { return; } @@ -71,27 +73,37 @@ export function MobileHeader({module, hideTabs}: Props) { navigate(`${moduleURLBuilder(key as RoutableModuleNames)}/`); }; + const tabValue = + hideDefaultTabs && tabs?.value ? tabs.value : module ?? OVERVIEW_PAGE_TITLE; + + const handleTabChange = + hideDefaultTabs && tabs ? tabs.onTabChange : defaultHandleTabChange; + return ( - - - + + + + - {MOBILE_LANDING_TITLE} - - - - - - - {!hideTabs && ( - - {OVERVIEW_PAGE_TITLE} - - {MODULE_TITLES[ModuleName.MOBILE_SCREENS]} - - - )} + {MOBILE_LANDING_TITLE} + + + + {headerActions} + + + + {!hideDefaultTabs && ( + + {OVERVIEW_PAGE_TITLE} + + {MODULE_TITLES[ModuleName.MOBILE_SCREENS]} + + + )} + {hideDefaultTabs && tabs && tabs.tabList} + );