import {useMemo, useState} from 'react'; import styled from '@emotion/styled'; import ErrorBoundary from 'sentry/components/errorBoundary'; import {SegmentedControl} from 'sentry/components/segmentedControl'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {SpanOpSelector} from 'sentry/views/performance/mobile/appStarts/screenSummary/spanOpSelector'; import {DeviceClassSelector} from 'sentry/views/performance/mobile/screenload/screenLoadSpans/deviceClassSelector'; import { MobileCursors, MobileSortKeys, } from 'sentry/views/performance/mobile/screenload/screens/constants'; import {useReleaseSelection} from 'sentry/views/starfish/queries/useReleases'; const EVENT = 'event'; const SPANS = 'spans'; interface EventSamplesProps { cursorName: string; footerAlignedPagination: boolean; sortKey: string; transaction: string; release?: string; } export interface SpanOperationTableProps { transaction: string; primaryRelease?: string; secondaryRelease?: string; } interface SamplesTablesProps { EventSamples: React.ComponentType; SpanOperationTable: React.ComponentType; transactionName: string; } export function SamplesTables({ transactionName, EventSamples, SpanOperationTable, }: SamplesTablesProps) { const [sampleType, setSampleType] = useState(SPANS); const {primaryRelease, secondaryRelease} = useReleaseSelection(); const content = useMemo(() => { if (sampleType === EVENT) { return ( ); } return ( ); }, [ EventSamples, SpanOperationTable, primaryRelease, sampleType, secondaryRelease, transactionName, ]); return (
{sampleType === SPANS && ( )} setSampleType(value)} defaultValue={SPANS} label={t('Sample Type Selection')} > {t('By Spans')} {t('By Event')} {content}
); } const EventSplitContainer = styled('div')` display: grid; grid-template-columns: 1fr 1fr; gap: ${space(1.5)}; `; const Controls = styled('div')` display: flex; justify-content: space-between; align-items: center; margin-bottom: ${space(1)}; `; const FiltersContainer = styled('div')` display: flex; gap: ${space(1)}; align-items: center; `;