diff --git a/static/app/components/checkInTimeline/checkInTimeline.tsx b/static/app/components/checkInTimeline/checkInTimeline.tsx index 8ba293508e188a..a192c564a0b367 100644 --- a/static/app/components/checkInTimeline/checkInTimeline.tsx +++ b/static/app/components/checkInTimeline/checkInTimeline.tsx @@ -44,15 +44,6 @@ interface CheckInTimelineProps makeUnit?: (count: number) => React.ReactNode; } -function getBucketedCheckInsPosition( - timestamp: number, - timelineStart: Date, - msPerPixel: number -) { - const elapsedSinceStart = new Date(timestamp).getTime() - timelineStart.getTime(); - return elapsedSinceStart / msPerPixel; -} - export function CheckInTimeline({ bucketedData, timeWindowConfig, @@ -109,21 +100,31 @@ interface MockCheckInTimelineProps status: Status; } +function getBucketedCheckInsPosition( + timestamp: number, + timelineStart: Date, + msPerPixel: number +) { + const elapsedSinceStart = new Date(timestamp).getTime() - timelineStart.getTime(); + return elapsedSinceStart / msPerPixel; +} + export function MockCheckInTimeline({ mockTimestamps, timeWindowConfig, status, statusStyle, }: MockCheckInTimelineProps) { - const {start, end} = timeWindowConfig; - const elapsedMs = end.getTime() - start.getTime(); - const msPerPixel = elapsedMs / timeWindowConfig.timelineWidth; + const {periodStart, elapsedMinutes, timelineWidth, rollupConfig} = timeWindowConfig; + const msPerPixel = (elapsedMinutes * 60 * 1000) / timelineWidth; + const startOffset = rollupConfig.timelineUnderscanWidth; return ( {mockTimestamps.map(ts => { const timestampMs = ts.getTime(); - const left = getBucketedCheckInsPosition(timestampMs, start, msPerPixel); + const left = + startOffset + getBucketedCheckInsPosition(timestampMs, periodStart, msPerPixel); return (