@@ -7,6 +7,8 @@ import React, {
7
7
} from 'react' ;
8
8
import { useDispatch , useSelector } from 'react-redux' ;
9
9
import { SelectProvider } from 'App/SelectContext' ;
10
+ import ArtistAppState , { ArtistIndexAppState } from 'App/State/ArtistAppState' ;
11
+ import ClientSideCollectionAppState from 'App/State/ClientSideCollectionAppState' ;
10
12
import NoArtist from 'Artist/NoArtist' ;
11
13
import { RSS_SYNC } from 'Commands/commandNames' ;
12
14
import LoadingIndicator from 'Components/Loading/LoadingIndicator' ;
@@ -89,16 +91,19 @@ const ArtistIndex = withScrollPosition((props: ArtistIndexProps) => {
89
91
sortKey,
90
92
sortDirection,
91
93
view,
92
- } = useSelector ( createArtistClientSideCollectionItemsSelector ( 'artistIndex' ) ) ;
94
+ } : ArtistAppState & ArtistIndexAppState & ClientSideCollectionAppState =
95
+ useSelector ( createArtistClientSideCollectionItemsSelector ( 'artistIndex' ) ) ;
93
96
94
97
const isRssSyncExecuting = useSelector (
95
98
createCommandExecutingSelector ( RSS_SYNC )
96
99
) ;
97
100
const { isSmallScreen } = useSelector ( createDimensionsSelector ( ) ) ;
98
101
const dispatch = useDispatch ( ) ;
99
- const scrollerRef = useRef < HTMLDivElement > ( ) ;
102
+ const scrollerRef = useRef < HTMLDivElement > ( null ) ;
100
103
const [ isOptionsModalOpen , setIsOptionsModalOpen ] = useState ( false ) ;
101
- const [ jumpToCharacter , setJumpToCharacter ] = useState < string | null > ( null ) ;
104
+ const [ jumpToCharacter , setJumpToCharacter ] = useState < string | undefined > (
105
+ undefined
106
+ ) ;
102
107
const [ isSelectMode , setIsSelectMode ] = useState ( false ) ;
103
108
104
109
useEffect ( ( ) => {
@@ -118,14 +123,14 @@ const ArtistIndex = withScrollPosition((props: ArtistIndexProps) => {
118
123
} , [ isSelectMode , setIsSelectMode ] ) ;
119
124
120
125
const onTableOptionChange = useCallback (
121
- ( payload ) => {
126
+ ( payload : unknown ) => {
122
127
dispatch ( setArtistTableOption ( payload ) ) ;
123
128
} ,
124
129
[ dispatch ]
125
130
) ;
126
131
127
132
const onViewSelect = useCallback (
128
- ( value ) => {
133
+ ( value : string ) => {
129
134
dispatch ( setArtistView ( { view : value } ) ) ;
130
135
131
136
if ( scrollerRef . current ) {
@@ -136,14 +141,14 @@ const ArtistIndex = withScrollPosition((props: ArtistIndexProps) => {
136
141
) ;
137
142
138
143
const onSortSelect = useCallback (
139
- ( value ) => {
144
+ ( value : string ) => {
140
145
dispatch ( setArtistSort ( { sortKey : value } ) ) ;
141
146
} ,
142
147
[ dispatch ]
143
148
) ;
144
149
145
150
const onFilterSelect = useCallback (
146
- ( value ) => {
151
+ ( value : string ) => {
147
152
dispatch ( setArtistFilter ( { selectedFilterKey : value } ) ) ;
148
153
} ,
149
154
[ dispatch ]
@@ -158,15 +163,15 @@ const ArtistIndex = withScrollPosition((props: ArtistIndexProps) => {
158
163
} , [ setIsOptionsModalOpen ] ) ;
159
164
160
165
const onJumpBarItemPress = useCallback (
161
- ( character ) => {
166
+ ( character : string ) => {
162
167
setJumpToCharacter ( character ) ;
163
168
} ,
164
169
[ setJumpToCharacter ]
165
170
) ;
166
171
167
172
const onScroll = useCallback (
168
- ( { scrollTop } ) => {
169
- setJumpToCharacter ( null ) ;
173
+ ( { scrollTop } : { scrollTop : number } ) => {
174
+ setJumpToCharacter ( undefined ) ;
170
175
scrollPositions . artistIndex = scrollTop ;
171
176
} ,
172
177
[ setJumpToCharacter ]
@@ -180,10 +185,10 @@ const ArtistIndex = withScrollPosition((props: ArtistIndexProps) => {
180
185
} ;
181
186
}
182
187
183
- const characters = items . reduce ( ( acc , item ) => {
188
+ const characters = items . reduce ( ( acc : Record < string , number > , item ) => {
184
189
let char = item . sortName . charAt ( 0 ) ;
185
190
186
- if ( ! isNaN ( char ) ) {
191
+ if ( ! isNaN ( Number ( char ) ) ) {
187
192
char = '#' ;
188
193
}
189
194
@@ -300,6 +305,8 @@ const ArtistIndex = withScrollPosition((props: ArtistIndexProps) => {
300
305
< PageContentBody
301
306
ref = { scrollerRef }
302
307
className = { styles . contentBody }
308
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
309
+ // @ts -ignore
303
310
innerClassName = { styles [ `${ view } InnerContentBody` ] }
304
311
initialScrollTop = { props . initialScrollTop }
305
312
onScroll = { onScroll }
0 commit comments