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>
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
// @flow
|
|
import { formatLbryChannelName } from 'util/url';
|
|
import LivestreamChatLayout from 'component/livestreamChatLayout';
|
|
import Page from 'component/page';
|
|
import React from 'react';
|
|
|
|
type Props = {
|
|
claim: StreamClaim,
|
|
uri: string,
|
|
doCommentSocketConnectAsCommenter: (string, string, string) => void,
|
|
doCommentSocketDisconnectAsCommenter: (string, string) => void,
|
|
doResolveUri: (string, boolean) => void,
|
|
};
|
|
|
|
export default function PopoutChatPage(props: Props) {
|
|
const { claim, uri, doCommentSocketConnectAsCommenter, doCommentSocketDisconnectAsCommenter, doResolveUri } = props;
|
|
|
|
React.useEffect(() => {
|
|
if (!claim) doResolveUri(uri, true);
|
|
}, [claim, doResolveUri, uri]);
|
|
|
|
React.useEffect(() => {
|
|
if (!claim) return;
|
|
|
|
const { claim_id: claimId, signing_channel: channelClaim } = claim;
|
|
const channelName = channelClaim && formatLbryChannelName(channelClaim.canonical_url);
|
|
|
|
if (claimId && channelName) doCommentSocketConnectAsCommenter(uri, channelName, claimId);
|
|
|
|
return () => {
|
|
if (claimId && channelName) doCommentSocketDisconnectAsCommenter(claimId, channelName);
|
|
};
|
|
}, [claim, doCommentSocketConnectAsCommenter, doCommentSocketDisconnectAsCommenter, uri]);
|
|
|
|
return (
|
|
<Page noSideNavigation noFooter noHeader isPopoutWindow>
|
|
<LivestreamChatLayout uri={uri} isPopoutWindow />
|
|
</Page>
|
|
);
|
|
}
|