import {Fragment} from 'react'; import * as qs from 'query-string'; import Link from 'sentry/components/links/link'; import {t} from 'sentry/locale'; import type {TableData} from 'sentry/utils/discover/discoverQuery'; import type EventView from 'sentry/utils/discover/eventView'; import {decodeScalar} from 'sentry/utils/queryString'; import {useLocation} from 'sentry/utils/useLocation'; import TopResultsIndicator from 'sentry/views/discover/table/topResultsIndicator'; import {COLD_START_COLOR, WARM_START_COLOR} from 'sentry/views/insights/colors'; import { PRIMARY_RELEASE_ALIAS, SECONDARY_RELEASE_ALIAS, } from 'sentry/views/insights/common/components/releaseSelector'; import {useReleaseSelection} from 'sentry/views/insights/common/queries/useReleases'; import {useModuleURL} from 'sentry/views/insights/common/utils/useModuleURL'; import Breakdown from 'sentry/views/insights/mobile/appStarts/components/breakdown'; import {COLD_START_TYPE} from 'sentry/views/insights/mobile/appStarts/components/startTypeSelector'; import {ScreensTable} from 'sentry/views/insights/mobile/common/components/tables/screensTable'; import {TOP_SCREENS} from 'sentry/views/insights/mobile/constants'; import {ModuleName, SpanMetricsField} from 'sentry/views/insights/types'; type Props = { data: TableData | undefined; eventView: EventView; isLoading: boolean; pageLinks: string | undefined; }; export function AppStartScreens({data, eventView, isLoading, pageLinks}: Props) { const moduleURL = useModuleURL('app_start'); const location = useLocation(); const {primaryRelease, secondaryRelease} = useReleaseSelection(); const startType = decodeScalar(location.query[SpanMetricsField.APP_START_TYPE]) ?? COLD_START_TYPE; const columnNameMap = { transaction: t('Screen'), [`avg_if(measurements.app_start_cold,release,${primaryRelease})`]: t( 'Avg Cold Start (%s)', PRIMARY_RELEASE_ALIAS ), [`avg_if(measurements.app_start_cold,release,${secondaryRelease})`]: t( 'Avg Cold Start (%s)', SECONDARY_RELEASE_ALIAS ), [`avg_if(measurements.app_start_warm,release,${primaryRelease})`]: t( 'Avg Warm Start (%s)', PRIMARY_RELEASE_ALIAS ), [`avg_if(measurements.app_start_warm,release,${secondaryRelease})`]: t( 'Avg Warm Start (%s)', SECONDARY_RELEASE_ALIAS ), [`avg_compare(measurements.app_start_cold,release,${primaryRelease},${secondaryRelease})`]: t('Change'), [`avg_compare(measurements.app_start_warm,release,${primaryRelease},${secondaryRelease})`]: t('Change'), app_start_breakdown: t('Type Breakdown'), 'count_starts(measurements.app_start_cold)': t('Cold Start Count'), 'count_starts(measurements.app_start_warm)': t('Warm Start Count'), }; function renderBodyCell(column, row): React.ReactNode { if (!data) { return null; } const index = data.data.indexOf(row); const field = String(column.key); if (field === 'transaction') { return ( {row.transaction} ); } if (field === 'app_start_breakdown') { return ( ); } return null; } return ( ); }