ea9c7a4a27
* Refactor CommentBadge * Refactor livestreamComment component * Refactor and split livestreamComment CSS * Refactor livestreamComments component * Refactor and split livestreamComments CSS * Remove never used spinner * Refactor livestream Page * Refactor page component * Refactor livestreamLayout component * Break apart livestreamComments into separate sibling components - This helps separating LivestreamComments to deal with only the comments, and the LivestreamLayout to be used for its own Page as a Popout option, and also for a layered approach for mobile * Create Popout Chat Page, Add Popout Chat Menu Option * Add Hide Chat option * sockety improvements * Websocket changes Co-authored-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
98 lines
3 KiB
JavaScript
98 lines
3 KiB
JavaScript
// @flow
|
|
import { lazyImport } from 'util/lazyImport';
|
|
import { LIVESTREAM_EMBED_URL } from 'constants/livestream';
|
|
import { useIsMobile } from 'effects/use-screensize';
|
|
import classnames from 'classnames';
|
|
import FileTitleSection from 'component/fileTitleSection';
|
|
import LivestreamLink from 'component/livestreamLink';
|
|
import LivestreamScheduledInfo from 'component/livestreamScheduledInfo';
|
|
import React from 'react';
|
|
|
|
const LivestreamChatLayout = lazyImport(() => import('component/livestreamChatLayout' /* webpackChunkName: "chat" */));
|
|
|
|
type Props = {
|
|
activeStreamUri: boolean | string,
|
|
claim: ?StreamClaim,
|
|
hideComments: boolean,
|
|
isCurrentClaimLive: boolean,
|
|
release: any,
|
|
showLivestream: boolean,
|
|
showScheduledInfo: boolean,
|
|
uri: string,
|
|
};
|
|
|
|
export default function LivestreamLayout(props: Props) {
|
|
const {
|
|
activeStreamUri,
|
|
claim,
|
|
hideComments,
|
|
isCurrentClaimLive,
|
|
release,
|
|
showLivestream,
|
|
showScheduledInfo,
|
|
uri,
|
|
} = props;
|
|
|
|
const isMobile = useIsMobile();
|
|
|
|
if (!claim || !claim.signing_channel) return null;
|
|
|
|
const { name: channelName, claim_id: channelClaimId } = claim.signing_channel;
|
|
|
|
return (
|
|
<>
|
|
<div className="section card-stack">
|
|
<div
|
|
className={classnames('file-render file-render--video livestream', {
|
|
'file-render--scheduledLivestream': !showLivestream,
|
|
})}
|
|
>
|
|
<div className="file-viewer">
|
|
{showLivestream && (
|
|
<iframe
|
|
src={`${LIVESTREAM_EMBED_URL}/${channelClaimId}?skin=odysee&autoplay=1`}
|
|
scrolling="no"
|
|
allowFullScreen
|
|
/>
|
|
)}
|
|
|
|
{showScheduledInfo && <LivestreamScheduledInfo release={release} />}
|
|
</div>
|
|
</div>
|
|
|
|
{hideComments && !showScheduledInfo && (
|
|
<div className="help--notice">
|
|
{channelName
|
|
? __('%channel% has disabled chat for this stream. Enjoy the stream!', { channel: channelName })
|
|
: __('This channel has disabled chat for this stream. Enjoy the stream!')}
|
|
</div>
|
|
)}
|
|
|
|
{!activeStreamUri && !showScheduledInfo && !isCurrentClaimLive && (
|
|
<div className="help--notice">
|
|
{channelName
|
|
? __("%channelName% isn't live right now, but the chat is! Check back later to watch the stream.", {
|
|
channelName,
|
|
})
|
|
: __("This channel isn't live right now, but the chat is! Check back later to watch the stream.")}
|
|
</div>
|
|
)}
|
|
|
|
{activeStreamUri && (
|
|
<LivestreamLink
|
|
title={__("Click here to access the stream that's currently active")}
|
|
claimUri={activeStreamUri}
|
|
/>
|
|
)}
|
|
|
|
{isMobile && !hideComments && (
|
|
<React.Suspense fallback={null}>
|
|
<LivestreamChatLayout uri={uri} />
|
|
</React.Suspense>
|
|
)}
|
|
|
|
<FileTitleSection uri={uri} livestream isLive={showLivestream} />
|
|
</div>
|
|
</>
|
|
);
|
|
}
|