Discover: fetch livestreams "per-language", if enabled.
Fetch it using the same language parameters for claim_search that is used in the embedded ClaimListDiscover.
This commit is contained in:
parent
a14239a9dc
commit
99d8d0dbee
2 changed files with 13 additions and 7 deletions
|
@ -8,7 +8,7 @@ import { selectActiveLivestreams } from 'redux/selectors/livestream';
|
||||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||||
import { selectFollowedTags } from 'redux/selectors/tags';
|
import { selectFollowedTags } from 'redux/selectors/tags';
|
||||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||||
import { selectClientSetting } from 'redux/selectors/settings';
|
import { selectClientSetting, selectLanguage } from 'redux/selectors/settings';
|
||||||
import Tags from './view';
|
import Tags from './view';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
|
@ -23,6 +23,8 @@ const select = (state, props) => {
|
||||||
isAuthenticated: selectUserVerifiedEmail(state),
|
isAuthenticated: selectUserVerifiedEmail(state),
|
||||||
tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT),
|
tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT),
|
||||||
activeLivestreams: selectActiveLivestreams(state),
|
activeLivestreams: selectActiveLivestreams(state),
|
||||||
|
languageSetting: selectLanguage(state),
|
||||||
|
searchInLanguage: selectClientSetting(state, SETTINGS.SEARCH_IN_LANGUAGE),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import Ads, { injectAd } from 'web/component/ads';
|
||||||
import LbcSymbol from 'component/common/lbc-symbol';
|
import LbcSymbol from 'component/common/lbc-symbol';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { resolveLangForClaimSearch } from 'util/default-languages';
|
||||||
import { getLivestreamUris } from 'util/livestream';
|
import { getLivestreamUris } from 'util/livestream';
|
||||||
|
|
||||||
const DEFAULT_LIVESTREAM_TILE_LIMIT = 8;
|
const DEFAULT_LIVESTREAM_TILE_LIMIT = 8;
|
||||||
|
@ -29,12 +30,14 @@ type Props = {
|
||||||
followedTags: Array<Tag>,
|
followedTags: Array<Tag>,
|
||||||
repostedUri: string,
|
repostedUri: string,
|
||||||
repostedClaim: ?GenericClaim,
|
repostedClaim: ?GenericClaim,
|
||||||
|
languageSetting: string,
|
||||||
|
searchInLanguage: boolean,
|
||||||
doToggleTagFollowDesktop: (string) => void,
|
doToggleTagFollowDesktop: (string) => void,
|
||||||
doResolveUri: (string) => void,
|
doResolveUri: (string) => void,
|
||||||
isAuthenticated: boolean,
|
isAuthenticated: boolean,
|
||||||
tileLayout: boolean,
|
tileLayout: boolean,
|
||||||
activeLivestreams: ?LivestreamInfo,
|
activeLivestreams: ?LivestreamInfo,
|
||||||
doFetchActiveLivestreams: (orderBy?: Array<string>) => void,
|
doFetchActiveLivestreams: (orderBy: ?Array<string>, lang: ?Array<string>) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
function DiscoverPage(props: Props) {
|
function DiscoverPage(props: Props) {
|
||||||
|
@ -43,6 +46,8 @@ function DiscoverPage(props: Props) {
|
||||||
followedTags,
|
followedTags,
|
||||||
repostedClaim,
|
repostedClaim,
|
||||||
repostedUri,
|
repostedUri,
|
||||||
|
languageSetting,
|
||||||
|
searchInLanguage,
|
||||||
doToggleTagFollowDesktop,
|
doToggleTagFollowDesktop,
|
||||||
doResolveUri,
|
doResolveUri,
|
||||||
isAuthenticated,
|
isAuthenticated,
|
||||||
|
@ -61,6 +66,7 @@ function DiscoverPage(props: Props) {
|
||||||
const isLargeScreen = useIsLargeScreen();
|
const isLargeScreen = useIsLargeScreen();
|
||||||
|
|
||||||
const urlParams = new URLSearchParams(search);
|
const urlParams = new URLSearchParams(search);
|
||||||
|
const langParam = urlParams.get(CS.LANGUAGE_KEY) || null;
|
||||||
const claimType = urlParams.get('claim_type');
|
const claimType = urlParams.get('claim_type');
|
||||||
const tagsQuery = urlParams.get('t') || null;
|
const tagsQuery = urlParams.get('t') || null;
|
||||||
const tags = tagsQuery ? tagsQuery.split(',') : null;
|
const tags = tagsQuery ? tagsQuery.split(',') : null;
|
||||||
|
@ -202,11 +208,9 @@ function DiscoverPage(props: Props) {
|
||||||
|
|
||||||
// Fetch active livestreams on mount
|
// Fetch active livestreams on mount
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (liveSection === SECTION.LESS) {
|
const langCsv = resolveLangForClaimSearch(languageSetting, searchInLanguage, langParam);
|
||||||
doFetchActiveLivestreams(CS.ORDER_BY_TRENDING_VALUE);
|
const lang = langCsv ? langCsv.split(',') : null;
|
||||||
} else {
|
doFetchActiveLivestreams(CS.ORDER_BY_NEW_VALUE, lang);
|
||||||
doFetchActiveLivestreams();
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps, (on mount only)
|
// eslint-disable-next-line react-hooks/exhaustive-deps, (on mount only)
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue