diff --git a/static/app/components/events/interfaces/spans/measurementsPanel.tsx b/static/app/components/events/interfaces/spans/measurementsPanel.tsx index 885e64c2f637e7..9b9e2fcb383d76 100644 --- a/static/app/components/events/interfaces/spans/measurementsPanel.tsx +++ b/static/app/components/events/interfaces/spans/measurementsPanel.tsx @@ -22,6 +22,11 @@ type Props = { generateBounds: (bounds: SpanBoundsType) => SpanGeneratedBoundsType; }; +type VitalLabel = { + isPoorValue: boolean; + vital: Vital; +}; + function MeasurementsPanel(props: Props) { const {event, generateBounds, dividerPosition} = props; const measurements = getMeasurements(event, generateBounds); @@ -44,20 +49,17 @@ function MeasurementsPanel(props: Props) { return null; } - // Measurements are referred to by their full name `measurements.` - // here but are stored using their abbreviated name ``. Make sure - // to convert it appropriately. - const vitals: Vital[] = Object.keys(verticalMark.marks).map( - name => WEB_VITAL_DETAILS[`measurements.${name}`] - ); + const vitalLabels: VitalLabel[] = Object.keys(verticalMark.marks).map(name => ({ + vital: WEB_VITAL_DETAILS[`measurements.${name}`], + isPoorValue: verticalMark.marks[name].failedThreshold, + })); - if (vitals.length > 1) { + if (vitalLabels.length > 1) { return ( ); } @@ -65,9 +67,8 @@ function MeasurementsPanel(props: Props) { return ( ); })} @@ -123,9 +124,8 @@ const Label = styled('div')<{ export default MeasurementsPanel; type LabelContainerProps = { - failedThreshold: boolean; left: string; - vital: Vital; + vitalLabel: VitalLabel; }; type LabelContainerState = { @@ -149,7 +149,7 @@ class LabelContainer extends Component { elementDOMRef = createRef(); render() { - const {left, failedThreshold, vital} = this.props; + const {left, vitalLabel} = this.props; return ( { left: `clamp(calc(0.5 * ${this.state.width}px), ${left}, calc(100% - 0.5 * ${this.state.width}px))`, }} > - @@ -168,8 +172,9 @@ class LabelContainer extends Component { } } -type MultiLabelContainerProps = Omit & { - vitals: Vital[]; +type MultiLabelContainerProps = { + left: string; + vitalLabels: VitalLabel[]; }; class MultiLabelContainer extends Component { @@ -190,7 +195,7 @@ class MultiLabelContainer extends Component { elementDOMRef = createRef(); render() { - const {left, failedThreshold, vitals} = this.props; + const {left, vitalLabels} = this.props; return ( { left: `clamp(calc(0.5 * ${this.state.width}px), ${left}, calc(100% - 0.5 * ${this.state.width}px))`, }} > - {vitals.map(vital => ( -