1
+ import styled from '@emotion/styled' ;
2
+
1
3
import { Button } from 'sentry/components/core/button' ;
2
4
import { CompositeSelect } from 'sentry/components/core/compactSelect/composite' ;
5
+ import { Flex } from 'sentry/components/core/layout' ;
3
6
import { useReplayContext } from 'sentry/components/replays/replayContext' ;
4
7
import { IconSettings } from 'sentry/icons' ;
5
8
import { t } from 'sentry/locale' ;
@@ -23,9 +26,14 @@ export default function ReplayPreferenceDropdown({
23
26
24
27
const SKIP_OPTION_VALUE = 'skip' ;
25
28
26
- // Calculate adjusted duration for each speed (rounded up)
29
+ // Calculate adjusted duration for each speed, rounded up to the nearest second.
30
+ // Returns in seconds
27
31
const calculateAdjustedDuration = ( originalDurationMs : number , speed : number ) => {
28
- return Math . ceil ( originalDurationMs / speed ) ;
32
+ if ( speed === 1 ) {
33
+ return originalDurationMs / 1000 ;
34
+ }
35
+
36
+ return Math . ceil ( originalDurationMs / speed / 1000 ) ;
29
37
} ;
30
38
31
39
// Check if we should show duration (data is loaded and duration is available)
@@ -58,12 +66,17 @@ export default function ReplayPreferenceDropdown({
58
66
option
59
67
) ;
60
68
const durationDisplay = formatDuration ( {
61
- duration : [ adjustedDurationMs , 'ms ' ] ,
69
+ duration : [ adjustedDurationMs , 'sec ' ] ,
62
70
precision : 'sec' ,
63
71
style : 'h:mm:ss' ,
64
72
} ) ;
65
73
return {
66
- label : `${ baseLabel } (${ durationDisplay } )` ,
74
+ label : (
75
+ < Flex justify = "space-between" >
76
+ < span > { baseLabel } </ span >
77
+ < DurationDisplay > { durationDisplay } </ DurationDisplay >
78
+ </ Flex >
79
+ ) ,
67
80
value : option ,
68
81
} ;
69
82
}
@@ -100,3 +113,7 @@ export default function ReplayPreferenceDropdown({
100
113
</ CompositeSelect >
101
114
) ;
102
115
}
116
+
117
+ const DurationDisplay = styled ( 'span' ) `
118
+ color: ${ p => p . theme . gray300 } ;
119
+ ` ;
0 commit comments