import {useState} from 'react'; import {InjectedRouter} from 'react-router'; import styled from '@emotion/styled'; import * as Layout from 'sentry/components/layouts/thirds'; import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip'; import {TabList, Tabs} from 'sentry/components/tabs'; import {Tooltip} from 'sentry/components/tooltip'; import {SLOW_TOOLTIP_DELAY} from 'sentry/constants'; import {t} from 'sentry/locale'; import {normalizeUrl} from 'sentry/utils/withDomainRequired'; import {MONITOR_PATH, THRESHOLDS_PATH} from '../utils/constants'; type Props = { hasV2ReleaseUIEnabled: boolean; router: InjectedRouter; }; function Header({router, hasV2ReleaseUIEnabled}: Props) { const [selected, setSelected] = useState(router.location.pathname); const location = router.location; const { cursor: _cursor, page: _page, view: _view, ...queryParams } = location?.query ?? {}; const tabs = hasV2ReleaseUIEnabled ? [ { key: MONITOR_PATH, label: t('Monitor'), description: '', path: MONITOR_PATH, }, { key: THRESHOLDS_PATH, label: t('Thresholds'), description: 'thresholds represent action alerts that will trigger once a threshold has been breached', path: THRESHOLDS_PATH, }, ] : []; const onTabSelect = key => { setSelected(key); }; return ( {t('Releases')} {tabs.map(({key, label, description, path}) => { const to_url = normalizeUrl({ query: { ...queryParams, }, pathname: path, }); return ( {label} ); })} ); } export default Header; const StyledTabs = styled(Tabs)` grid-column: 1/-1; `;