1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-22 22:16:13 -04:00

Fixed scrolling via jump list on series index

This commit is contained in:
Mark McDowall
2021-04-24 21:57:54 -07:00
parent 56a33e3b4c
commit 5d316ad7dc
4 changed files with 45 additions and 42 deletions
@@ -270,6 +270,7 @@ SeriesIndexOverview.propTypes = {
};
SeriesIndexOverview.defaultProps = {
overview: '',
statistics: {
seasonCount: 0,
episodeCount: 0,
@@ -71,7 +71,6 @@ class SeriesIndexOverviews extends Component {
items,
sortKey,
overviewOptions,
jumpToCharacter,
isSmallScreen
} = this.props;
@@ -96,18 +95,6 @@ class SeriesIndexOverviews extends Component {
// recomputeGridSize also forces Grid to discard its cache of rendered cells
this._grid.recomputeGridSize();
}
if (jumpToCharacter != null && jumpToCharacter !== prevProps.jumpToCharacter) {
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
if (this._grid && index != null) {
this._grid.scrollToCell({
rowIndex: index,
columnIndex: 0
});
}
}
}
//
@@ -201,6 +188,7 @@ class SeriesIndexOverviews extends Component {
const {
scroller,
items,
jumpToCharacter,
isSmallScreen
} = this.props;
@@ -222,6 +210,24 @@ class SeriesIndexOverviews extends Component {
return <div />;
}
let finalScrollTop = scrollTop;
if (jumpToCharacter != null) {
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
if (index != null) {
if (index > 0) {
// Adjust 5px upwards so there is a gap between the bottom
// of the toolbar and top of the poster.
finalScrollTop = rowHeight * index - 5;
} else {
finalScrollTop = 0;
}
}
}
return (
<div ref={registerChild}>
<Grid
@@ -235,7 +241,7 @@ class SeriesIndexOverviews extends Component {
rowHeight={rowHeight}
width={width}
onScroll={onChildScroll}
scrollTop={scrollTop}
scrollTop={finalScrollTop}
overscanRowCount={2}
cellRenderer={this.cellRenderer}
scrollToAlignment={'start'}