import styled from '@emotion/styled'; import {SectionHeading} from 'sentry/components/charts/styles'; import Count from 'sentry/components/count'; import PerformanceDuration from 'sentry/components/performanceDuration'; import {t, tct} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {defined} from 'sentry/utils'; import {formatMetricUsingUnit} from 'sentry/utils/metrics/formatters'; import {DataTitles} from 'sentry/views/insights/common/views/spans/types'; type Props = { avgDuration: number | undefined; spanCount: number | undefined; spanDescription: string | undefined; spanOp: string | undefined; timeSpent: number | undefined; }; export default function SpanSummaryHeader(props: Props) { const {spanOp, spanDescription, avgDuration, timeSpent, spanCount} = props; return ( {t('Span')} {spanDescription ? spanDescription : emptyValue} {spanOp ? spanOp : emptyValue} {DataTitles.avg} {defined(avgDuration) ? formatMetricUsingUnit(avgDuration, 'milliseconds') : '\u2014'} {DataTitles.timeSpent} {defined(timeSpent) ? ( ) : ( '\u2014' )} {defined(spanCount) ? tct('[spanCount] spans', {spanCount: }) : '\u2014'} ); } const ContentHeader = styled('div')` display: grid; grid-template-columns: 1fr; gap: ${space(4)}; margin-bottom: ${space(2)}; @media (min-width: ${p => p.theme.breakpoints.medium}) { grid-template-columns: 1fr repeat(3, max-content); } `; const HeaderInfo = styled('div')` ${p => p.theme.overflowEllipsis}; height: 78px; `; const StyledSectionHeading = styled(SectionHeading)` margin: 0; `; const NumericSectionWrapper = styled('div')` text-align: right; `; const SectionBody = styled('div')<{overflowEllipsis?: boolean}>` font-size: ${p => p.theme.fontSizeExtraLarge}; padding: ${space(0.5)} 0; max-height: 32px; `; const SectionSubtext = styled('div')` color: ${p => p.theme.subText}; font-size: ${p => p.theme.fontSizeMedium}; `; export const SpanLabelContainer = styled('div')` ${p => p.theme.overflowEllipsis}; `; const EmptyValueContainer = styled('span')` color: ${p => p.theme.gray300}; `; const emptyValue = {'\u2014'};