import {useContext, useEffect, useMemo, useState} from 'react'; import styled from '@emotion/styled'; import debounce from 'lodash/debounce'; import {Button} from 'sentry/components/button'; import ButtonBar from 'sentry/components/buttonBar'; import {TEMPORARY_TAB_KEY} from 'sentry/components/draggableTabs/draggableTabList'; import GlobalEventProcessingAlert from 'sentry/components/globalEventProcessingAlert'; import * as Layout from 'sentry/components/layouts/thirds'; import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse'; import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip'; import {Tabs, TabsContext} from 'sentry/components/tabs'; import {IconMegaphone, IconPause, IconPlay} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {InjectedRouter} from 'sentry/types/legacyReactRouter'; import type {Organization} from 'sentry/types/organization'; import {trackAnalytics} from 'sentry/utils/analytics'; import normalizeUrl from 'sentry/utils/url/normalizeUrl'; import {useEffectAfterFirstRender} from 'sentry/utils/useEffectAfterFirstRender'; import {useFeedbackForm} from 'sentry/utils/useFeedbackForm'; import {useLocation} from 'sentry/utils/useLocation'; import {useNavigate} from 'sentry/utils/useNavigate'; import usePageFilters from 'sentry/utils/usePageFilters'; import useProjects from 'sentry/utils/useProjects'; import { DraggableTabBar, type Tab, } from 'sentry/views/issueList/groupSearchViewTabs/draggableTabBar'; import {useUpdateGroupSearchViews} from 'sentry/views/issueList/mutations/useUpdateGroupSearchViews'; import {useFetchGroupSearchViews} from 'sentry/views/issueList/queries/useFetchGroupSearchViews'; import type {UpdateGroupSearchViewPayload} from 'sentry/views/issueList/types'; import {NewTabContext} from 'sentry/views/issueList/utils/newTabContext'; import {IssueSortOptions} from './utils'; type CustomViewsIssueListHeaderProps = { onRealtimeChange: (realtime: boolean) => void; organization: Organization; realtimeActive: boolean; router: InjectedRouter; selectedProjectIds: number[]; }; type CustomViewsIssueListHeaderTabsContentProps = { organization: Organization; router: InjectedRouter; views: UpdateGroupSearchViewPayload[]; }; function CustomViewsIssueListHeader({ selectedProjectIds, realtimeActive, onRealtimeChange, ...props }: CustomViewsIssueListHeaderProps) { const {projects} = useProjects(); const selectedProjects = projects.filter(({id}) => selectedProjectIds.includes(Number(id)) ); const {data: groupSearchViews} = useFetchGroupSearchViews({ orgSlug: props.organization.slug, }); const realtimeTitle = realtimeActive ? t('Pause real-time updates') : t('Enable real-time updates'); const {newViewActive} = useContext(NewTabContext); const openForm = useFeedbackForm(); const hasNewLayout = props.organization.features.includes('issue-stream-table-layout'); return ( {t('Issues')} {openForm && hasNewLayout && ( )} {!newViewActive && (