Add "Go Live" to mobile (#183)

* Add "Go Live" button to mobile menu

* Move "Go Live" all the way to the top
This commit is contained in:
infinite-persistence 2021-10-29 21:04:43 +08:00 committed by GitHub
parent 11bbd58e33
commit 08c6df434e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View file

@ -1,4 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectActiveChannelStakedLevel } from 'redux/selectors/app';
import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { selectSubscriptions } from 'redux/selectors/subscriptions';
import { doClearPurchasedUriSuccess } from 'redux/actions/file'; import { doClearPurchasedUriSuccess } from 'redux/actions/file';
import { selectFollowedTags } from 'redux/selectors/tags'; import { selectFollowedTags } from 'redux/selectors/tags';
@ -19,6 +20,7 @@ const select = (state) => ({
unseenCount: selectUnseenNotificationCount(state), unseenCount: selectUnseenNotificationCount(state),
user: selectUser(state), user: selectUser(state),
homepageData: selectHomepageData(state), homepageData: selectHomepageData(state),
activeChannelStakedLevel: selectActiveChannelStakedLevel(state),
}); });
export default connect(select, { export default connect(select, {

View file

@ -11,7 +11,13 @@ import NotificationBubble from 'component/notificationBubble';
import I18nMessage from 'component/i18nMessage'; import I18nMessage from 'component/i18nMessage';
import ChannelThumbnail from 'component/channelThumbnail'; import ChannelThumbnail from 'component/channelThumbnail';
import { GetLinksData } from 'util/buildHomepage'; import { GetLinksData } from 'util/buildHomepage';
import { SIMPLE_SITE, DOMAIN, ENABLE_UI_NOTIFICATIONS } from 'config'; import {
SIMPLE_SITE,
DOMAIN,
ENABLE_UI_NOTIFICATIONS,
ENABLE_NO_SOURCE_CLAIMS,
CHANNEL_STAKED_LEVEL_LIVESTREAM,
} from 'config';
// @if TARGET='app' // @if TARGET='app'
import { IS_MAC } from 'component/app/view'; import { IS_MAC } from 'component/app/view';
// @endif // @endif
@ -46,6 +52,7 @@ type Props = {
doClearPurchasedUriSuccess: () => void, doClearPurchasedUriSuccess: () => void,
user: ?User, user: ?User,
homepageData: any, homepageData: any,
activeChannelStakedLevel: number,
}; };
type SideNavLink = { type SideNavLink = {
@ -73,6 +80,7 @@ function SideNavigation(props: Props) {
homepageData, homepageData,
user, user,
followedTags, followedTags,
activeChannelStakedLevel,
} = props; } = props;
const EXTRA_SIDEBAR_LINKS = GetLinksData(homepageData).map(({ pinnedUrls, ...theRest }) => theRest); const EXTRA_SIDEBAR_LINKS = GetLinksData(homepageData).map(({ pinnedUrls, ...theRest }) => theRest);
@ -235,6 +243,13 @@ function SideNavigation(props: Props) {
SIDE_LINKS.push(WILD_WEST); SIDE_LINKS.push(WILD_WEST);
} }
const livestreamEnabled = Boolean(
ENABLE_NO_SOURCE_CLAIMS &&
user &&
!user.odysee_live_disabled &&
(activeChannelStakedLevel >= CHANNEL_STAKED_LEVEL_LIVESTREAM || user.odysee_live_enabled)
);
const [pulseLibrary, setPulseLibrary] = React.useState(false); const [pulseLibrary, setPulseLibrary] = React.useState(false);
const isPersonalized = !IS_WEB || isAuthenticated; const isPersonalized = !IS_WEB || isAuthenticated;
const isAbsolute = isOnFilePage || isMediumScreen; const isAbsolute = isOnFilePage || isMediumScreen;
@ -392,6 +407,20 @@ function SideNavigation(props: Props) {
})} })}
> >
<div> <div>
<ul className="navigation-links--absolute mobile-only">
{email && livestreamEnabled && (
<li key={'Go Live'} className="mobile-only">
<Button
icon={ICONS.VIDEO}
navigate={`/$/${PAGES.LIVESTREAM}`}
label={__('Go Live')}
title={__('Go Live')}
className="navigation-link"
activeClass="navigation-link--active"
/>
</li>
)}
</ul>
<ul className="navigation-links--absolute"> <ul className="navigation-links--absolute">
{SIDE_LINKS.map((linkProps) => { {SIDE_LINKS.map((linkProps) => {
// $FlowFixMe // $FlowFixMe