@@ -5,13 +5,15 @@ import React, {
55 useMemo ,
66 useState ,
77} from 'react' ;
8- import { Link , useLocation , useParams } from 'react-router-dom' ;
8+ import { Link } from 'react-router-dom' ;
99import { useOnline } from 'rooks' ;
1010import { useStateWithDeps } from 'use-state-with-deps' ;
11+ import { Location , useLocation , useParams } from './App' ;
1112import selfoss from '../selfoss-base' ;
1213import Item from './Item' ;
1314import { FilterType } from '../Filter' ;
1415import * as itemsRequests from '../requests/items' ;
16+ import { EntryStatus } from '../requests/items' ;
1517import * as sourceRequests from '../requests/sources' ;
1618import { LoadingState } from '../requests/LoadingState' ;
1719import { Spinner , SpinnerBig } from './Spinner' ;
@@ -24,7 +26,7 @@ import { autoScroll, Direction } from '../helpers/navigation';
2426import { LocalizationContext } from '../helpers/i18n' ;
2527import { useShouldReload } from '../helpers/hooks' ;
2628import { forceReload , makeEntriesLinkLocation } from '../helpers/uri' ;
27- import { ConfigurationContext } from '../model/Configuration' ;
29+ import { Configuration , ConfigurationContext } from '../model/Configuration' ;
2830import { HttpError } from '../errors' ;
2931
3032function reloadList ( {
@@ -535,18 +537,33 @@ const initialState = {
535537 loadingState : LoadingState . INITIAL ,
536538} ;
537539
540+ type Match = {
541+ params : {
542+ category ?: string ;
543+ filter : FilterType ;
544+ } ;
545+ } ;
546+
538547type StateHolderProps = {
539- configuration : object ;
540- location : object ;
541- match : object ;
548+ configuration : Configuration ;
549+ location : Location ;
550+ match : Match ;
542551 setNavExpanded : React . Dispatch < React . SetStateAction < boolean > > ;
543552 navSourcesExpanded : boolean ;
544553 setGlobalUnreadCount : React . Dispatch < React . SetStateAction < number > > ;
545554 unreadItemsCount : number ;
546555} ;
547556
557+ type Entry = {
558+ id : number ;
559+ unread : boolean ;
560+ starred : boolean ;
561+ tags : string [ ] ;
562+ source : number ;
563+ } ;
564+
548565type StateHolderState = {
549- entries : Array < object > ;
566+ entries : Array < Entry > ;
550567 hasMore : boolean ;
551568 /**
552569 * Currently selected entry.
@@ -691,7 +708,7 @@ export default class StateHolder extends React.Component<
691708 const autoMarkAsRead =
692709 selfoss . isAllowedToWrite ( ) &&
693710 this . props . configuration . autoMarkAsRead &&
694- entry . unread == 1 ;
711+ entry . unread ;
695712 if ( autoMarkAsRead ) {
696713 this . markEntryRead ( id , true ) ;
697714 }
@@ -735,7 +752,7 @@ export default class StateHolder extends React.Component<
735752 ) ;
736753 }
737754
738- refreshEntryStatuses ( entryStatuses ) {
755+ refreshEntryStatuses ( entryStatuses : EntryStatus [ ] ) {
739756 this . state . entries . forEach ( ( entry ) => {
740757 const { id } = entry ;
741758 const newStatus = entryStatuses . find (
@@ -799,9 +816,9 @@ export default class StateHolder extends React.Component<
799816 * Mark all visible items as read
800817 */
801818 markVisibleRead ( ) : void {
802- const ids = [ ] ;
803- const tagUnreadDiff = { } ;
804- const sourceUnreadDiff = { } ;
819+ const ids : number [ ] = [ ] ;
820+ const tagUnreadDiff : { [ index : string ] : number } = { } ;
821+ const sourceUnreadDiff : { [ index : string ] : number } = { } ;
805822
806823 let markedEntries = this . state . entries . map ( ( entry ) => {
807824 if ( ! entry . unread ) {
0 commit comments