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 {trackAnalytics} from 'sentry/utils/analytics'; import useOrganization from 'sentry/utils/useOrganization'; import {useReleaseSelection} from 'sentry/views/insights/common/queries/useReleases'; import {EventSamples} from 'sentry/views/insights/mobile/appStarts/components/eventSamples'; import {SpanOpSelector} from 'sentry/views/insights/mobile/appStarts/components/spanOpSelector'; import {SpanOperationTable} from 'sentry/views/insights/mobile/appStarts/components/tables/spanOperationTable'; import {DeviceClassSelector} from 'sentry/views/insights/mobile/common/components/deviceClassSelector'; import { MobileCursors, MobileSortKeys, } from 'sentry/views/insights/mobile/screenload/constants'; import {ModuleName} from 'sentry/views/insights/types'; const EVENT = 'event'; const SPANS = 'spans'; export function SamplesTables({transactionName}) { const [sampleType, setSampleType] = useState(SPANS); const {primaryRelease, secondaryRelease} = useReleaseSelection(); const organization = useOrganization(); const content = useMemo(() => { if (sampleType === EVENT) { return (
); } return ( ); }, [primaryRelease, sampleType, secondaryRelease, transactionName]); return (
{sampleType === SPANS && ( )} { trackAnalytics('insight.app_start.spans.toggle_sample_type', { organization, type: value, }); setSampleType(value); }} defaultValue={SPANS} aria-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; `;