File tree Expand file tree Collapse file tree 5 files changed +34
-35
lines changed
pages/browser/components/stream-details/StreamDetails Expand file tree Collapse file tree 5 files changed +34
-35
lines changed Original file line number Diff line number Diff line change @@ -157,8 +157,24 @@ const RangeFilter = (props: Props) => {
157
157
< div className = { styles . slider } >
158
158
< div className = { styles . sliderTrack } />
159
159
< div ref = { range } className = { styles . sliderRange } >
160
- < div className = { styles . sliderLeftValue } > { getFormatTime ( start ?. toString ( ) ) } </ div >
161
- < div className = { styles . sliderRightValue } > { getFormatTime ( end ?. toString ( ) ) } </ div >
160
+ < div className = {
161
+ cx ( styles . sliderLeftValue ,
162
+ {
163
+ [ styles . leftPosition ] : max - startVal < ( max - min ) / 2
164
+ } )
165
+ }
166
+ >
167
+ { getFormatTime ( startVal ?. toString ( ) ) }
168
+ </ div >
169
+ < div className = {
170
+ cx ( styles . sliderRightValue ,
171
+ {
172
+ [ styles . rightPosition ] : max - endVal > ( max - min ) / 2
173
+ } )
174
+ }
175
+ >
176
+ { getFormatTime ( endVal ?. toString ( ) ) }
177
+ </ div >
162
178
</ div >
163
179
</ div >
164
180
</ div >
Original file line number Diff line number Diff line change 56
56
margin-top : -30px ;
57
57
}
58
58
59
+ .sliderLeftValue.leftPosition {
60
+ transform : translateX (-100% );
61
+ }
62
+
63
+ .sliderRightValue.rightPosition {
64
+ transform : translateX (100% );
65
+ }
66
+
59
67
.sliderRightValue {
60
68
right : -4px ;
61
69
}
Original file line number Diff line number Diff line change @@ -150,12 +150,18 @@ const StreamDetails = (props: Props) => {
150
150
)
151
151
152
152
useEffect ( ( ) => {
153
+ if ( isNull ( firstEntry ) ) {
154
+ dispatch ( updateStart ( '' ) )
155
+ }
153
156
if ( start === '' && firstEntry ?. id !== '' ) {
154
157
dispatch ( updateStart ( firstEntryTimeStamp . toString ( ) ) )
155
158
}
156
159
} , [ firstEntryTimeStamp ] )
157
160
158
161
useEffect ( ( ) => {
162
+ if ( isNull ( lastEntry ) ) {
163
+ dispatch ( updateEnd ( '' ) )
164
+ }
159
165
if ( end === '' && lastEntry ?. id !== '' ) {
160
166
dispatch ( updateEnd ( lastEntryTimeStamp . toString ( ) ) )
161
167
}
Original file line number Diff line number Diff line change @@ -318,37 +318,6 @@ describe('stream slice', () => {
318
318
} )
319
319
} )
320
320
321
- describe ( 'removeEntriesFromList' , ( ) => {
322
- it ( 'should properly remove entries from list' , ( ) => {
323
- // Arrange
324
- const startState = {
325
- ...initialState ,
326
- data : {
327
- ...mockedData
328
- }
329
- }
330
-
331
- const endState = {
332
- ...initialState ,
333
- loading : false ,
334
- data : {
335
- ...mockedData ,
336
- entries : [ ] ,
337
- total : 0
338
- }
339
- }
340
-
341
- // Act
342
- const nextState = reducer ( startState , removeEntriesFromList ( [ mockedData . entries [ 0 ] . id ] ) )
343
-
344
- // Assert
345
- const rootState = Object . assign ( initialStateDefault , {
346
- browser : { stream : nextState } ,
347
- } )
348
- expect ( streamSelector ( rootState ) ) . toEqual ( endState )
349
- } )
350
- } )
351
-
352
321
describe ( 'updateStart' , ( ) => {
353
322
it ( 'should properly set the state' , ( ) => {
354
323
// Arrange
Original file line number Diff line number Diff line change @@ -8,14 +8,14 @@ export const getTimestampFromId = (id: string = ''): number =>
8
8
parseInt ( id . split ( '-' ) [ 0 ] , 10 )
9
9
10
10
export const getStreamRangeStart = ( start : string , firstEntryId : string ) => {
11
- if ( start === '' || firstEntryId === '' || start === getTimestampFromId ( firstEntryId ) . toString ( ) ) {
11
+ if ( start === '' || ! firstEntryId || start === getTimestampFromId ( firstEntryId ) . toString ( ) ) {
12
12
return SCAN_STREAM_START_DEFAULT
13
13
}
14
14
return start
15
15
}
16
16
17
17
export const getStreamRangeEnd = ( end : string , endEtryId : string ) => {
18
- if ( end === '' || endEtryId === '' || end === getTimestampFromId ( endEtryId ) . toString ( ) ) {
18
+ if ( end === '' || ! endEtryId || end === getTimestampFromId ( endEtryId ) . toString ( ) ) {
19
19
return SCAN_STREAM_END_DEFAULT
20
20
}
21
21
return end
You can’t perform that action at this time.
0 commit comments