fix ad areas and drivers

This commit is contained in:
zeppi 2021-01-26 18:45:34 -05:00 committed by jessopb
parent 6ee0f13383
commit d04b0f09ba
6 changed files with 18 additions and 9 deletions

View file

@ -4,14 +4,12 @@ import { doSearch } from 'redux/actions/search';
import { makeSelectRecommendedContentForUri, selectIsSearching } from 'redux/selectors/search'; import { makeSelectRecommendedContentForUri, selectIsSearching } from 'redux/selectors/search';
import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectUserVerifiedEmail } from 'redux/selectors/user';
import RecommendedVideos from './view'; import RecommendedVideos from './view';
import { selectTheme } from 'redux/selectors/settings';
const select = (state, props) => ({ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state),
mature: makeSelectClaimIsNsfw(props.uri)(state), mature: makeSelectClaimIsNsfw(props.uri)(state),
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state), recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
isSearching: selectIsSearching(state), isSearching: selectIsSearching(state),
theme: selectTheme(state),
isAuthenticated: selectUserVerifiedEmail(state), isAuthenticated: selectUserVerifiedEmail(state),
}); });

View file

@ -19,11 +19,10 @@ type Props = {
search: (string, Options) => void, search: (string, Options) => void,
mature: boolean, mature: boolean,
isAuthenticated: boolean, isAuthenticated: boolean,
theme: string,
}; };
export default function RecommendedContent(props: Props) { export default function RecommendedContent(props: Props) {
const { uri, claim, search, mature, recommendedContent, isSearching, isAuthenticated, theme } = props; const { uri, claim, search, mature, recommendedContent, isSearching, isAuthenticated } = props;
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const isMedium = useIsMediumScreen(); const isMedium = useIsMediumScreen();
@ -62,9 +61,9 @@ export default function RecommendedContent(props: Props) {
injectedItem={ injectedItem={
SHOW_ADS && IS_WEB ? ( SHOW_ADS && IS_WEB ? (
SIMPLE_SITE ? ( SIMPLE_SITE ? (
<Ads small type={'google'} theme={theme} /> <Ads small type={'google'} />
) : ( ) : (
!isAuthenticated && <Ads small type={'video'} theme={theme} /> !isAuthenticated && <Ads small type={'video'} />
) )
) : ( ) : (
false false

View file

@ -1,5 +1,5 @@
// @flow // @flow
import { SHOW_ADS, DOMAIN } from 'config'; import { SHOW_ADS, DOMAIN, SIMPLE_SITE } from 'config';
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import React, { useRef } from 'react'; import React, { useRef } from 'react';
import Page from 'component/page'; import Page from 'component/page';
@ -104,7 +104,9 @@ function DiscoverPage(props: Props) {
tags={tags} tags={tags}
hiddenNsfwMessage={<HiddenNsfw type="page" />} hiddenNsfwMessage={<HiddenNsfw type="page" />}
repostedClaimId={repostedClaim ? repostedClaim.claim_id : null} repostedClaimId={repostedClaim ? repostedClaim.claim_id : null}
injectedItem={SHOW_ADS && !isAuthenticated && IS_WEB && <Ads type="video" />} injectedItem={
SHOW_ADS && IS_WEB ? (SIMPLE_SITE ? false : !isAuthenticated && <Ads small type={'video'} />) : false
}
channelIds={ channelIds={
(dynamicRouteProps && dynamicRouteProps.options && dynamicRouteProps.options.channelIds) || undefined (dynamicRouteProps && dynamicRouteProps.options && dynamicRouteProps.options.channelIds) || undefined
} }

View file

@ -101,7 +101,9 @@ export default function SearchPage(props: Props) {
uris={uris} uris={uris}
loading={isSearching} loading={isSearching}
header={!SIMPLE_SITE && <SearchOptions additionalOptions={additionalOptions} />} header={!SIMPLE_SITE && <SearchOptions additionalOptions={additionalOptions} />}
injectedItem={SHOW_ADS && !isAuthenticated && IS_WEB && <Ads type="video" />} injectedItem={
SHOW_ADS && IS_WEB ? (SIMPLE_SITE ? false : !isAuthenticated && <Ads small type={'video'} />) : false
}
headerAltControls={ headerAltControls={
<> <>
<span>{__('Find what you were looking for?')}</span> <span>{__('Find what you were looking for?')}</span>

View file

@ -0,0 +1,8 @@
import { connect } from 'react-redux';
import { selectTheme } from 'redux/selectors/settings';
import Ads from './view';
const select = state => ({
theme: selectTheme(state),
});
export default connect(select)(Ads);