File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/shared/containers/timeline-wall Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,11 @@ function TimelineWallContainer(props) {
77
77
} , [ pendingApprovals ] ) ;
78
78
79
79
useEffect ( ( ) => {
80
- const target = document . getElementById ( `${ selectedFilterValue . year } -${ selectedFilterValue . month } ` ) ;
80
+ const target = document . getElementById ( `${ selectedFilterValue . year } -${ ( selectedFilterValue . month + 1 ) . toString ( ) . padStart ( 2 , '0' ) } ` ) ;
81
81
if ( target ) {
82
- target . scrollIntoView ( { behavior : 'smooth' } , true ) ;
82
+ const yOffset = - 10 ;
83
+ const coordinate = target . getBoundingClientRect ( ) . top + window . pageYOffset + yOffset ;
84
+ window . scrollTo ( { top : coordinate , behavior : 'smooth' } ) ;
83
85
} else {
84
86
window . scrollTo ( { top : 0 , behavior : 'smooth' } ) ;
85
87
}
@@ -104,6 +106,8 @@ function TimelineWallContainer(props) {
104
106
} ) ;
105
107
} ;
106
108
109
+ const sortedEvents = _ . orderBy ( events , [ 'eventDate' ] , [ 'desc' ] ) ;
110
+
107
111
return (
108
112
< div styleName = "container" >
109
113
< div styleName = { isAdmin ? 'header header-admin' : 'header' } >
@@ -153,7 +157,7 @@ function TimelineWallContainer(props) {
153
157
< TimelineEvents
154
158
isAuthenticated = { ! ! authToken }
155
159
isAdmin = { isAdmin }
156
- events = { events }
160
+ events = { sortedEvents }
157
161
styleName = { cn ( 'tab-content' , { hide : tab === 1 , 'is-admin' : role === 'Admin user' } ) }
158
162
removeEvent = { removeEvent }
159
163
showRightFilterMobile = { showRightFilterMobile }
You can’t perform that action at this time.
0 commit comments