alignment with odysee branch

This commit is contained in:
Sean Yesmunt 2020-10-05 13:38:40 -04:00
parent 61dfc2f74a
commit 489a4855e9
7 changed files with 129 additions and 103 deletions

View file

@ -191,9 +191,9 @@
"three": "^0.93.0",
"three-full": "^17.1.0",
"tiny-relative-date": "^1.3.0",
"uuid": "^8.3.0",
"tree-kill": "^1.1.0",
"unist-util-visit": "^1.4.1",
"uuid": "^8.3.0",
"video.js": "7.8.4",
"videojs-event-tracking": "^1.0.1",
"villain-react": "^1.0.9",

View file

@ -26,7 +26,6 @@ import OpenInAppLink from 'web/component/openInAppLink';
import YoutubeWelcome from 'web/component/youtubeReferralWelcome';
import NagDegradedPerformance from 'web/component/nag-degraded-performance';
import NagDataCollection from 'web/component/nag-data-collection';
import {
useDegradedPerformance,
STATUS_OK,

View file

@ -20,6 +20,7 @@ type Props = {
// claim search options are below
tags: Array<string>,
hiddenUris: Array<string>,
claimIds?: Array<string>,
channelIds?: Array<string>,
notChannelIds?: Array<string>,
pageSize: number,
@ -42,6 +43,7 @@ function ClaimTilesDiscover(props: Props) {
// Below are options to pass that are forwarded to claim_search
tags,
channelIds,
claimIds,
notChannelIds,
orderBy,
pageSize = 8,
@ -63,7 +65,7 @@ function ClaimTilesDiscover(props: Props) {
no_totals: boolean,
any_tags: Array<string>,
channel_ids: Array<string>,
channel_ids: Array<string>,
claim_ids?: Array<string>,
not_channel_ids: Array<string>,
not_tags: Array<string>,
order_by: Array<string>,
@ -73,6 +75,7 @@ function ClaimTilesDiscover(props: Props) {
timestamp?: string,
fee_amount?: string,
limit_claims_per_channel?: number,
stream_types?: Array<string>,
} = {
page_size: pageSize,
claim_type: claimType || undefined,
@ -119,6 +122,10 @@ function ClaimTilesDiscover(props: Props) {
options.timestamp = timestamp;
}
if (claimIds) {
options.claim_ids = claimIds;
}
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
const uris = (prefixUris || []).concat(claimSearchByQuery[claimSearchCacheQuery] || []);
// Don't use the query from createNormalizedClaimSearchKey for the effect since that doesn't include page & release_time

View file

@ -149,8 +149,10 @@ function FileActions(props: Props) {
} else {
return (
<div className="media__actions">
<div className="section__actions section__actions--no-margin">{lhsSection}</div>
<div className="section__actions section__actions--no-margin">{rhsSection}</div>
<div className="section__actions section__actions--no-margin">
{lhsSection}
{rhsSection}
</div>
</div>
);
}

View file

@ -1,6 +1,6 @@
import * as MODALS from 'constants/modal_types';
import { connect } from 'react-redux';
import { selectBalance, formatCredits, SETTINGS } from 'lbry-redux';
import { selectBalance, formatCredits, selectMyChannelClaims, SETTINGS } from 'lbry-redux';
import { selectGetSyncErrorMessage } from 'lbryinc';
import { selectUserVerifiedEmail, selectUserEmail, selectEmailToVerify, selectUser } from 'redux/selectors/user';
import { doClearEmailEntry, doClearPasswordEntry } from 'redux/actions/user';
@ -23,6 +23,7 @@ const select = state => ({
emailToVerify: selectEmailToVerify(state),
hasNavigated: selectHasNavigated(state),
user: selectUser(state),
myChannels: selectMyChannelClaims(state),
});
const perform = dispatch => ({

View file

@ -15,7 +15,7 @@ import { LOGO_TITLE } from 'config';
import { useIsMobile } from 'effects/use-screensize';
import NotificationBubble from 'component/notificationBubble';
import NotificationHeaderButton from 'component/notificationHeaderButton';
import ChannelThumbnail from 'component/channelThumbnail';
// @if TARGET='app'
import { remote } from 'electron';
import { IS_MAC } from 'component/app/view';
@ -59,6 +59,8 @@ type Props = {
sidebarOpen: boolean,
setSidebarOpen: boolean => void,
isAbsoluteSideNavHidden: boolean,
hideCancel: boolean,
myChannels: ?Array<ChannelClaim>,
};
const Header = (props: Props) => {
@ -83,6 +85,8 @@ const Header = (props: Props) => {
setSidebarOpen,
isAbsoluteSideNavHidden,
user,
hideCancel,
myChannels,
} = props;
const isMobile = useIsMobile();
// on the verify page don't let anyone escape other than by closing the tab to keep session data consistent
@ -93,7 +97,11 @@ const Header = (props: Props) => {
const hasBackout = Boolean(backout);
const { backLabel, backNavDefault, title: backTitle, simpleTitle: simpleBackTitle } = backout || {};
const notificationsEnabled = user && user.experimental_ui;
let channelUrl;
if (myChannels && myChannels.length === 1) {
const channel = myChannels[0];
channelUrl = channel.permanent_url || channel.canonical_url;
}
// Sign out if they click the "x" when they are on the password prompt
const authHeaderAction = syncError ? { onClick: signOut } : { navigate: '/' };
const homeButtonNavigationProps = isVerifyPage ? {} : authHeader ? authHeaderAction : { navigate: '/' };
@ -242,89 +250,34 @@ const Header = (props: Props) => {
{!authHeader && <WunderBar />}
<div className="header__buttons mobile-hidden">
<Menu>
<MenuButton
aria-label={__('Publish a file, or create a channel')}
title={__('Publish a file, or create a channel')}
className="header__navigation-item menu__title header__navigation-item--icon"
// @if TARGET='app'
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
>
<Icon size={18} icon={ICONS.PUBLISH} aria-hidden />
</MenuButton>
{notificationsEnabled && <NotificationHeaderButton />}
<MenuList className="menu__list--header">
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.UPLOAD}`)}>
<Icon aria-hidden icon={ICONS.PUBLISH} />
{__('Upload')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CHANNEL_NEW}`)}>
<Icon aria-hidden icon={ICONS.CHANNEL} />
{__('New Channel')}
</MenuItem>
</MenuList>
</Menu>
<Menu>
<MenuButton
aria-label={__('Your account')}
title={__('Your account')}
className="header__navigation-item menu__title header__navigation-item--icon"
// @if TARGET='app'
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
>
<Icon size={18} icon={ICONS.ACCOUNT} aria-hidden />
</MenuButton>
<MenuList className="menu__list--header">
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.UPLOADS}`)}>
<Icon aria-hidden icon={ICONS.PUBLISH} />
{__('Uploads')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CHANNELS}`)}>
<Icon aria-hidden icon={ICONS.CHANNEL} />
{__('Channels')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CREATOR_DASHBOARD}`)}>
<Icon aria-hidden icon={ICONS.ANALYTICS} />
{__('Creator Analytics')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.REWARDS}`)}>
<Icon aria-hidden icon={ICONS.REWARDS} />
{__('Rewards')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.INVITE}`)}>
<Icon aria-hidden icon={ICONS.INVITE} />
{__('Invites')}
</MenuItem>
{authenticated ? (
<MenuItem onSelect={IS_WEB ? signOut : openSignOutModal}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.SIGN_OUT} />
{__('Sign Out')}
</div>
<span className="menu__link-help">{email}</span>
{(authenticated || !IS_WEB) && (
<Menu>
<MenuButton
aria-label={__('Publish a file, or create a channel')}
title={__('Publish a file, or create a channel')}
className="header__navigation-item menu__title header__navigation-item--icon"
// @if TARGET='app'
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
>
<Icon size={18} icon={ICONS.PUBLISH} aria-hidden />
</MenuButton>
{notificationsEnabled && <NotificationHeaderButton />}
<MenuList className="menu__list--header">
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.UPLOAD}`)}>
<Icon aria-hidden icon={ICONS.PUBLISH} />
{__('Upload')}
</MenuItem>
) : !IS_WEB ? (
<>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH}`)}>
<Icon aria-hidden icon={ICONS.SIGN_UP} />
{__('Sign Up')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH_SIGNIN}`)}>
<Icon aria-hidden icon={ICONS.SIGN_IN} />
{__('Sign In')}
</MenuItem>
</>
) : null}
</MenuList>
</Menu>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CHANNEL_NEW}`)}>
<Icon aria-hidden icon={ICONS.CHANNEL} />
{__('New Channel')}
</MenuItem>
</MenuList>
</Menu>
)}
<Menu>
<MenuButton
aria-label={__('Settings')}
@ -353,6 +306,73 @@ const Header = (props: Props) => {
</MenuItem>
</MenuList>
</Menu>
{(authenticated || !IS_WEB) && (
<Menu>
<MenuButton
aria-label={__('Your account')}
title={__('Your account')}
className="header__navigation-item menu__title header__navigation-item--icon"
// @if TARGET='app'
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
>
{channelUrl ? (
<ChannelThumbnail uri={channelUrl} />
) : (
<Icon size={18} icon={ICONS.ACCOUNT} aria-hidden />
)}
</MenuButton>
<MenuList className="menu__list--header">
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.UPLOADS}`)}>
<Icon aria-hidden icon={ICONS.PUBLISH} />
{__('Uploads')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CHANNELS}`)}>
<Icon aria-hidden icon={ICONS.CHANNEL} />
{__('Channels')}
</MenuItem>
<MenuItem
className="menu__link"
onSelect={() => history.push(`/$/${PAGES.CREATOR_DASHBOARD}`)}
>
<Icon aria-hidden icon={ICONS.ANALYTICS} />
{__('Creator Analytics')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.REWARDS}`)}>
<Icon aria-hidden icon={ICONS.REWARDS} />
{__('Rewards')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.INVITE}`)}>
<Icon aria-hidden icon={ICONS.INVITE} />
{__('Invites')}
</MenuItem>
{authenticated ? (
<MenuItem onSelect={IS_WEB ? signOut : openSignOutModal}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.SIGN_OUT} />
{__('Sign Out')}
</div>
<span className="menu__link-help">{email}</span>
</MenuItem>
) : !IS_WEB ? (
<>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH}`)}>
<Icon aria-hidden icon={ICONS.SIGN_UP} />
{__('Sign Up')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH_SIGNIN}`)}>
<Icon aria-hidden icon={ICONS.SIGN_IN} />
{__('Sign In')}
</MenuItem>
</>
) : null}
</MenuList>
</Menu>
)}
</div>
</div>
)}
@ -362,11 +382,13 @@ const Header = (props: Props) => {
<div className={classnames('header__menu', { 'header__menu--with-balance': !IS_WEB || authenticated })}>
{(!IS_WEB || authenticated) && (
<Button
button="link"
aria-label={__('Your wallet')}
navigate={`/$/${PAGES.WALLET}`}
className="header__navigation-item menu__title header__navigation-item--balance"
label={getWalletTitle()}
icon={ICONS.LBC}
iconSize={20}
// @if TARGET='app'
onDoubleClick={e => {
e.stopPropagation();
@ -377,13 +399,19 @@ const Header = (props: Props) => {
{IS_WEB && !authenticated && (
<div className="header__auth-buttons">
<Button navigate={`/$/${PAGES.AUTH_SIGNIN}`} button="link" label={__('Log In')} />
<Button
navigate={`/$/${PAGES.AUTH_SIGNIN}`}
button="link"
label={__('Log In')}
className="mobile-hidden"
/>
<Button navigate={`/$/${PAGES.AUTH}`} button="primary" label={__('Sign Up')} />
</div>
)}
</div>
) : (
!isVerifyPage && (
!isVerifyPage &&
!hideCancel && (
<div className="header__menu">
{/* Add an empty span here so we can use the same style as above */}
{/* This pushes the close button to the right side */}

View file

@ -93,17 +93,6 @@ function InviteNew(props: Props) {
injected={[referralCode]}
/>
)}
<p className="help">
<I18nMessage
tokens={{
rewards_link: <Button button="link" navigate="/$/rewards" label={__('rewards')} />,
referral_faq_link: <Button button="link" label={__('FAQ')} href="https://lbry.com/faq/referrals" />,
}}
>
Read our %referral_faq_link% to learn more about rewards.
</I18nMessage>
</p>
</React.Fragment>
}
/>