mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
Naomi comment websockets increase slow mode time to 5 seconds fix to prevent duplicate comments update livestream details fix channel pin electron boom fix rebase prune unused icons updating meme updating meme update livestream for naomi fix rebase DigitalCashNetwork remove electroboom pin Slavguns Joel So he can edit his claims add streamTypes param to claimTilesDiscover so following section can search for all types of content fix typo update meme fixes publish page fixes pending fix notifications fix comments finally fix claim preview no mature for simplesite Revert "no mature for simplesite" This reverts commit 9f89242d85e0cacf44cbf0a683bebbe50840c466. fix livestream preview click no mature on simple site try fixing invite page crash probably needs more changes.
133 lines
3.7 KiB
JavaScript
133 lines
3.7 KiB
JavaScript
// @flow
|
|
import type { Node } from 'react';
|
|
import * as PAGES from 'constants/pages';
|
|
import React, { Fragment } from 'react';
|
|
import classnames from 'classnames';
|
|
import SideNavigation from 'component/sideNavigation';
|
|
import Header from 'component/header';
|
|
import Footer from 'web/component/footer';
|
|
/* @if TARGET='app' */
|
|
import StatusBar from 'component/common/status-bar';
|
|
/* @endif */
|
|
import usePersistedState from 'effects/use-persisted-state';
|
|
import { useHistory } from 'react-router';
|
|
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
|
import { parseURI } from 'lbry-redux';
|
|
|
|
export const MAIN_CLASS = 'main';
|
|
type Props = {
|
|
children: Node | Array<Node>,
|
|
className: ?string,
|
|
autoUpdateDownloaded: boolean,
|
|
isUpgradeAvailable: boolean,
|
|
authPage: boolean,
|
|
filePage: boolean,
|
|
noHeader: boolean,
|
|
noFooter: boolean,
|
|
noSideNavigation: boolean,
|
|
fullWidthPage: boolean,
|
|
videoTheaterMode: boolean,
|
|
isMarkdown?: boolean,
|
|
livestream?: boolean,
|
|
backout: {
|
|
backLabel?: string,
|
|
backNavDefault?: string,
|
|
title: string,
|
|
simpleTitle: string, // Just use the same value as `title` if `title` is already short (~< 10 chars), unless you have a better idea for title overlfow on mobile
|
|
},
|
|
};
|
|
|
|
function Page(props: Props) {
|
|
const {
|
|
children,
|
|
className,
|
|
filePage = false,
|
|
authPage = false,
|
|
fullWidthPage = false,
|
|
noHeader = false,
|
|
noFooter = false,
|
|
noSideNavigation = false,
|
|
backout,
|
|
videoTheaterMode,
|
|
isMarkdown = false,
|
|
livestream,
|
|
} = props;
|
|
|
|
const {
|
|
location: { pathname },
|
|
} = useHistory();
|
|
const [sidebarOpen, setSidebarOpen] = usePersistedState('sidebar', false);
|
|
const isMediumScreen = useIsMediumScreen();
|
|
const isMobile = useIsMobile();
|
|
|
|
let isOnFilePage = false;
|
|
try {
|
|
if (pathname.includes(`/$/${PAGES.LIVESTREAM}`)) {
|
|
isOnFilePage = true;
|
|
} else {
|
|
const url = pathname.slice(1).replace(/:/g, '#');
|
|
const { isChannel } = parseURI(url);
|
|
if (!isChannel) {
|
|
isOnFilePage = true;
|
|
}
|
|
}
|
|
} catch (e) {}
|
|
|
|
const isAbsoluteSideNavHidden = (isOnFilePage || isMobile) && !sidebarOpen;
|
|
|
|
React.useEffect(() => {
|
|
if (isOnFilePage || isMediumScreen) {
|
|
setSidebarOpen(false);
|
|
}
|
|
// TODO: make sure setState callback for usePersistedState uses useCallback to it doesn't cause effect to re-run
|
|
}, [isOnFilePage, isMediumScreen]);
|
|
|
|
return (
|
|
<Fragment>
|
|
{!noHeader && (
|
|
<Header
|
|
authHeader={authPage}
|
|
backout={backout}
|
|
sidebarOpen={sidebarOpen}
|
|
isAbsoluteSideNavHidden={isAbsoluteSideNavHidden}
|
|
setSidebarOpen={setSidebarOpen}
|
|
/>
|
|
)}
|
|
<div
|
|
className={classnames('main-wrapper__inner', {
|
|
'main-wrapper__inner--filepage': isOnFilePage,
|
|
'main-wrapper__inner--theater-mode': isOnFilePage && videoTheaterMode,
|
|
})}
|
|
>
|
|
{!authPage && !noSideNavigation && (
|
|
<SideNavigation
|
|
sidebarOpen={sidebarOpen}
|
|
setSidebarOpen={setSidebarOpen}
|
|
isMediumScreen={isMediumScreen}
|
|
isOnFilePage={isOnFilePage}
|
|
/>
|
|
)}
|
|
<main
|
|
className={classnames(MAIN_CLASS, className, {
|
|
'main--full-width': fullWidthPage,
|
|
'main--auth-page': authPage,
|
|
'main--file-page': filePage,
|
|
'main--markdown': isMarkdown,
|
|
'main--theater-mode': isOnFilePage && videoTheaterMode && !livestream,
|
|
'main--livestream': livestream,
|
|
})}
|
|
>
|
|
{children}
|
|
</main>
|
|
{/* @if TARGET='app' */}
|
|
<StatusBar />
|
|
{/* @endif */}
|
|
</div>
|
|
{/* @if TARGET='web' */}
|
|
{!noFooter && <Footer />}
|
|
{/* @endif */}
|
|
</Fragment>
|
|
);
|
|
}
|
|
|
|
export default Page;
|