Fix ContentState type

This commit is contained in:
infinite-persistence 2022-05-18 14:31:49 +08:00
parent 1d61d80009
commit 96e704e5d9
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
3 changed files with 12 additions and 5 deletions

14
flow-typed/content.js vendored
View file

@ -2,13 +2,19 @@
declare type ContentState = {
primaryUri: ?string,
playingUri: {}, // Someone please fill in.
playingUri: { uri?: string },
positions: { [string]: { [string]: number } }, // claimId: { outpoint: position }
history: Array<WatchHistory>,
recommendationId: { [string]: string }, // claimId: recommendationId
recommendationParentId: { [string]: string}, // claimId: referrerId
recommendationUrls: { [string]: Array<string>}, // claimId: [lbryUrls...]
recommendationClicks: { [string]: Array<number>}, // "claimId": [clicked indices...]
recommendationParentId: { [string]: string }, // claimId: referrerId
recommendationUrls: { [string]: Array<string> }, // claimId: [lbryUrls...]
recommendationClicks: { [string]: Array<number> }, // "claimId": [clicked indices...]
loopList?: { collectionId: string, loop: boolean },
shuffleList?: { collectionId: string, newUrls: Array<string> | boolean },
// TODO: it's confusing for newUrls to be a boolean --------- ^^^
// It can/should be '?Array<string>` instead -- set it to null, then clients
// can cast it to a boolean. That, or rename the variable to `shuffle` if you
// don't care about the URLs.
};
declare type WatchHistory = {

View file

@ -12,6 +12,7 @@ const defaultState: ContentState = {
recommendationParentId: {},
recommendationUrls: {},
recommendationClicks: {},
loopList: undefined,
};
reducers[ACTIONS.SET_PRIMARY_URI] = (state, action) =>

View file

@ -18,7 +18,7 @@ import { FORCE_CONTENT_TYPE_PLAYER, FORCE_CONTENT_TYPE_COMIC } from 'constants/c
const RECENT_HISTORY_AMOUNT = 10;
const HISTORY_ITEMS_PER_PAGE = 50;
type State = { claims: any, content: any, user: UserState };
type State = { claims: any, content: ContentState, user: UserState };
export const selectState = (state: State) => state.content || {};