prune some isAuthenticated

This commit is contained in:
zeppi 2022-06-27 14:44:17 -04:00
parent 0105f2516f
commit 2ca26c9332
14 changed files with 5 additions and 171 deletions

View file

@ -11,7 +11,7 @@ import {
import { doSetDaemonSetting, doClearDaemonSetting, doFindFFmpeg } from 'redux/actions/settings'; import { doSetDaemonSetting, doClearDaemonSetting, doFindFFmpeg } from 'redux/actions/settings';
import { selectAllowAnalytics } from 'redux/selectors/app'; import { selectAllowAnalytics } from 'redux/selectors/app';
import { selectDaemonSettings, selectFfmpegStatus, selectFindingFFmpeg } from 'redux/selectors/settings'; import { selectDaemonSettings, selectFfmpegStatus, selectFindingFFmpeg } from 'redux/selectors/settings';
import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectUserVerifiedEmail } from 'redux/selectors/user'; // here
import SettingSystem from './view'; import SettingSystem from './view';

View file

@ -6,15 +6,13 @@ import * as KEYCODES from 'constants/keycodes';
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import classnames from 'classnames'; import classnames from 'classnames';
import Icon from 'component/common/icon';
import NotificationBubble from 'component/notificationBubble'; import NotificationBubble from 'component/notificationBubble';
import DebouncedInput from 'component/common/debounced-input'; import DebouncedInput from 'component/common/debounced-input';
import I18nMessage from 'component/i18nMessage';
import ChannelThumbnail from 'component/channelThumbnail'; import ChannelThumbnail from 'component/channelThumbnail';
import { useIsMobile, isTouch } from 'effects/use-screensize'; import { useIsMobile, isTouch } from 'effects/use-screensize';
import { IS_MAC } from 'component/app/view'; import { IS_MAC } from 'component/app/view';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import { DOMAIN, ENABLE_UI_NOTIFICATIONS } from 'config'; import { ENABLE_UI_NOTIFICATIONS } from 'config';
const FOLLOWED_ITEM_INITIAL_LIMIT = 10; const FOLLOWED_ITEM_INITIAL_LIMIT = 10;
const touch = isTouch(); const touch = isTouch();
@ -184,7 +182,6 @@ function SideNavigation(props: Props) {
]; ];
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui); const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
const isAuthenticated = Boolean(email);
const [pulseLibrary, setPulseLibrary] = React.useState(false); const [pulseLibrary, setPulseLibrary] = React.useState(false);
const [expandSubscriptions, setExpandSubscriptions] = React.useState(false); const [expandSubscriptions, setExpandSubscriptions] = React.useState(false);
@ -357,23 +354,6 @@ function SideNavigation(props: Props) {
return () => window.removeEventListener('keydown', handleKeydown); return () => window.removeEventListener('keydown', handleKeydown);
}, [sidebarOpen, setSidebarOpen, isAbsolute]); }, [sidebarOpen, setSidebarOpen, isAbsolute]);
const unAuthNudge =
DOMAIN === 'lbry.tv' ? null : (
<div className="navigation__auth-nudge">
<span>
<I18nMessage tokens={{ lbc: <Icon icon={ICONS.LBC} /> }}>
Sign up to earn %lbc% for you and your favorite creators.
</I18nMessage>
</span>
<Button
button="secondary"
label={__('Sign Up')}
navigate={`/$/${PAGES.AUTH}?src=sidenav_nudge`}
disabled={user === null}
/>{' '}
</div>
);
const helpLinks = ( const helpLinks = (
<ul className="navigation__tertiary navigation-links--small"> <ul className="navigation__tertiary navigation-links--small">
<li className="navigation-link"> <li className="navigation-link">
@ -437,7 +417,6 @@ function SideNavigation(props: Props) {
{getSubscriptionSection()} {getSubscriptionSection()}
{getFollowedTagsSection()} {getFollowedTagsSection()}
{!isAuthenticated && sidebarOpen && unAuthNudge}
</div> </div>
)} )}
{(!canDisposeMenu || sidebarOpen) && shouldRenderLargeMenu && helpLinks} {(!canDisposeMenu || sidebarOpen) && shouldRenderLargeMenu && helpLinks}

View file

@ -3,7 +3,6 @@ import { connect } from 'react-redux';
import { doResolveUri } from 'redux/actions/claims'; import { doResolveUri } from 'redux/actions/claims';
import { selectClaimForUri } from 'redux/selectors/claims'; import { selectClaimForUri } from 'redux/selectors/claims';
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';
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 { makeSelectClientSetting } from 'redux/selectors/settings'; import { makeSelectClientSetting } from 'redux/selectors/settings';
@ -18,7 +17,6 @@ const select = (state, props) => {
followedTags: selectFollowedTags(state), followedTags: selectFollowedTags(state),
repostedUri: repostedUri, repostedUri: repostedUri,
repostedClaim: repostedUri ? selectClaimForUri(state, repostedUri) : null, repostedClaim: repostedUri ? selectClaimForUri(state, repostedUri) : null,
isAuthenticated: selectUserVerifiedEmail(state),
tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state), tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state),
}; };
}; };

View file

@ -24,7 +24,6 @@ type Props = {
repostedClaim: ?GenericClaim, repostedClaim: ?GenericClaim,
doToggleTagFollowDesktop: (string) => void, doToggleTagFollowDesktop: (string) => void,
doResolveUri: (string) => void, doResolveUri: (string) => void,
isAuthenticated: boolean,
dynamicRouteProps: RowDataItem, dynamicRouteProps: RowDataItem,
tileLayout: boolean, tileLayout: boolean,
}; };

View file

@ -1,6 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectFollowedTags } from 'redux/selectors/tags'; import { selectFollowedTags } from 'redux/selectors/tags';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { selectSubscriptions } from 'redux/selectors/subscriptions';
import { selectShowMatureContent, selectHomepageData } from 'redux/selectors/settings'; import { selectShowMatureContent, selectHomepageData } from 'redux/selectors/settings';
@ -9,7 +8,6 @@ import DiscoverPage from './view';
const select = (state) => ({ const select = (state) => ({
followedTags: selectFollowedTags(state), followedTags: selectFollowedTags(state),
subscribedChannels: selectSubscriptions(state), subscribedChannels: selectSubscriptions(state),
authenticated: selectUserVerifiedEmail(state),
showNsfw: selectShowMatureContent(state), showNsfw: selectShowMatureContent(state),
homepageData: selectHomepageData(state), homepageData: selectHomepageData(state),
}); });

View file

@ -21,7 +21,7 @@ type Props = {
}; };
function HomePage(props: Props) { function HomePage(props: Props) {
const { followedTags, subscribedChannels, authenticated, showNsfw, homepageData } = props; const { followedTags, subscribedChannels, showNsfw, homepageData } = props;
const showPersonalizedChannels = subscribedChannels && subscribedChannels.length > 0; const showPersonalizedChannels = subscribedChannels && subscribedChannels.length > 0;
const showPersonalizedTags = followedTags && followedTags.length > 0; const showPersonalizedTags = followedTags && followedTags.length > 0;
const showIndividualTags = showPersonalizedTags && followedTags.length < 5; const showIndividualTags = showPersonalizedTags && followedTags.length < 5;
@ -31,7 +31,6 @@ function HomePage(props: Props) {
homepageData, homepageData,
isLargeScreen, isLargeScreen,
true, true,
authenticated,
showPersonalizedChannels, showPersonalizedChannels,
showPersonalizedTags, showPersonalizedTags,
subscribedChannels, subscribedChannels,

View file

@ -1,25 +0,0 @@
import * as SETTINGS from 'constants/settings';
import { connect } from 'react-redux';
import {
selectUserInviteStatusFailed,
selectUserInviteStatusIsPending,
selectUserVerifiedEmail,
} from 'redux/selectors/user';
// import { doFetchInviteStatus } from 'redux/actions/user';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { doSetClientSetting } from 'redux/actions/settings';
import InvitePage from './view';
const select = (state) => ({
isFailed: selectUserInviteStatusFailed(state),
isPending: selectUserInviteStatusIsPending(state),
inviteAcknowledged: makeSelectClientSetting(SETTINGS.INVITE_ACKNOWLEDGED)(state),
authenticated: selectUserVerifiedEmail(state),
});
const perform = (dispatch) => ({
// fetchInviteStatus: () => dispatch(doFetchInviteStatus()),
acknowledgeInivte: () => dispatch(doSetClientSetting(SETTINGS.INVITE_ACKNOWLEDGED, true)),
});
export default connect(select, perform)(InvitePage);

View file

@ -1,55 +0,0 @@
// @flow
import { SITE_NAME } from 'config';
import React from 'react';
import BusyIndicator from 'component/common/busy-indicator';
import InviteNew from 'component/inviteNew';
import InviteList from 'component/inviteList';
import Page from 'component/page';
import RewardAuthIntro from 'component/rewardAuthIntro';
type Props = {
isPending: boolean,
isFailed: boolean,
inviteAcknowledged: boolean,
authenticated: boolean,
acknowledgeInivte: () => void,
fetchInviteStatus: () => void,
};
class InvitePage extends React.PureComponent<Props> {
componentDidMount() {
const { fetchInviteStatus, inviteAcknowledged, acknowledgeInivte } = this.props;
fetchInviteStatus();
if (!inviteAcknowledged) {
acknowledgeInivte();
}
}
render() {
const { isPending, isFailed, authenticated } = this.props;
return (
<Page>
{!authenticated ? (
<RewardAuthIntro
title={__('Log in to %SITE_NAME% to earn rewards From Inviting Your Friends', { SITE_NAME })}
/>
) : (
<React.Fragment>
{isPending && <BusyIndicator message={__('Checking your invite status')} />}
{!isPending && isFailed && <span className="empty">{__('Failed to retrieve invite status.')}</span>}
{!isPending && !isFailed && (
<React.Fragment>
<InviteNew />
<InviteList />
</React.Fragment>
)}
</React.Fragment>
)}
</Page>
);
}
}
export default InvitePage;

View file

@ -1,19 +0,0 @@
import { connect } from 'react-redux';
import InvitedPage from './view';
import { makeSelectPermanentUrlForUri } from 'redux/selectors/claims';
import { withRouter } from 'react-router';
const select = (state, props) => {
const { match } = props;
const { params } = match;
const { referrer } = params;
const sanitizedReferrer = referrer ? referrer.replace(':', '#') : '';
const uri = `lbry://${sanitizedReferrer}`;
return {
fullUri: makeSelectPermanentUrlForUri(uri)(state),
referrer: referrer,
};
};
const perform = () => ({});
export default withRouter(connect(select, perform)(InvitedPage));

View file

@ -1,18 +0,0 @@
// @flow
import React from 'react';
import Page from 'component/page';
import Invited from 'component/invited';
type Props = {
fullUri: string,
referrer: string,
};
export default function ReferredPage(props: Props) {
const { fullUri, referrer } = props;
return (
<Page authPage>
<Invited fullUri={fullUri} referrer={referrer} />
</Page>
);
}

View file

@ -8,7 +8,6 @@ import {
makeSelectHasReachedMaxResultsLength, makeSelectHasReachedMaxResultsLength,
} from 'redux/selectors/search'; } from 'redux/selectors/search';
import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectShowMatureContent } from 'redux/selectors/settings';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { getSearchQueryString } from 'util/query-params'; import { getSearchQueryString } from 'util/query-params';
import SearchPage from './view'; import SearchPage from './view';
@ -36,7 +35,6 @@ const select = (state, props) => {
searchOptions, searchOptions,
isSearching: selectIsSearching(state), isSearching: selectIsSearching(state),
uris: uris, uris: uris,
isAuthenticated: selectUserVerifiedEmail(state),
hasReachedMaxResultsLength: hasReachedMaxResultsLength, hasReachedMaxResultsLength: hasReachedMaxResultsLength,
}; };
}; };

View file

@ -16,7 +16,6 @@ type Props = {
search: (string, SearchOptions) => void, search: (string, SearchOptions) => void,
isSearching: boolean, isSearching: boolean,
uris: Array<string>, uris: Array<string>,
isAuthenticated: boolean,
hasReachedMaxResultsLength: boolean, hasReachedMaxResultsLength: boolean,
}; };

View file

@ -1,6 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectFollowedTags } from 'redux/selectors/tags'; import { selectFollowedTags } from 'redux/selectors/tags';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { selectSubscriptions } from 'redux/selectors/subscriptions';
import DiscoverPage from './view'; import DiscoverPage from './view';
import { makeSelectClientSetting } from 'redux/selectors/settings'; import { makeSelectClientSetting } from 'redux/selectors/settings';
@ -9,7 +8,6 @@ import * as SETTINGS from 'constants/settings';
const select = (state) => ({ const select = (state) => ({
followedTags: selectFollowedTags(state), followedTags: selectFollowedTags(state),
subscribedChannels: selectSubscriptions(state), subscribedChannels: selectSubscriptions(state),
email: selectUserVerifiedEmail(state),
tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state), tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state),
}); });

View file

@ -128,7 +128,6 @@ export function GetLinksData(
all: any, // HomepageData type? all: any, // HomepageData type?
isLargeScreen: boolean, isLargeScreen: boolean,
isHomepage?: boolean = false, isHomepage?: boolean = false,
authenticated?: boolean,
showPersonalizedChannels?: boolean, showPersonalizedChannels?: boolean,
showPersonalizedTags?: boolean, showPersonalizedTags?: boolean,
subscribedChannels?: Array<Subscription>, subscribedChannels?: Array<Subscription>,
@ -170,6 +169,7 @@ export function GetLinksData(
// ************************************************************************** // **************************************************************************
// @if CUSTOM_HOMEPAGE='false' // @if CUSTOM_HOMEPAGE='false'
/*
const YOUTUBER_CHANNEL_IDS = [ const YOUTUBER_CHANNEL_IDS = [
'fb364ef587872515f545a5b4b3182b58073f230f', 'fb364ef587872515f545a5b4b3182b58073f230f',
'589276465a23c589801d874f484cc39f307d7ec7', '589276465a23c589801d874f484cc39f307d7ec7',
@ -253,21 +253,7 @@ export function GetLinksData(
'ff80e24f41a2d706c70df9779542cba4715216c9', 'ff80e24f41a2d706c70df9779542cba4715216c9',
'e8f68563d242f6ac9784dcbc41dd86c28a9391d6', 'e8f68563d242f6ac9784dcbc41dd86c28a9391d6',
]; ];
*/
const YOUTUBE_CREATOR_ROW = {
title: __('CableTube Escape Artists'),
link: `/$/${PAGES.DISCOVER}?${CS.CLAIM_TYPE}=${CS.CLAIM_STREAM}&${CS.CHANNEL_IDS_KEY}=${YOUTUBER_CHANNEL_IDS.join(
','
)}`,
options: {
claimType: ['stream'],
orderBy: CS.ORDER_BY_NEW_VALUE,
pageSize: getPageSize(12),
channelIds: YOUTUBER_CHANNEL_IDS,
limitClaimsPerChannel: 1,
releaseTime: `>${Math.floor(moment().subtract(1, 'months').startOf('week').unix())}`,
},
};
const TOP_CONTENT_TODAY = { const TOP_CONTENT_TODAY = {
title: __('Top Content from Today'), title: __('Top Content from Today'),
@ -351,9 +337,6 @@ export function GetLinksData(
} }
if (!CUSTOM_HOMEPAGE) { if (!CUSTOM_HOMEPAGE) {
if (!authenticated) {
rowData.push(YOUTUBE_CREATOR_ROW);
}
rowData.push(TOP_CONTENT_TODAY); rowData.push(TOP_CONTENT_TODAY);
if (language !== 'en') { if (language !== 'en') {
rowData.push(LANGUAGE_CATEGORY); rowData.push(LANGUAGE_CATEGORY);