Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2bc7533f1 |
No files matched your search
@@ -37,11 +37,11 @@ This repo contains the UI and front end code that powers Odysee.com.
|
||||
|
||||
## Usage
|
||||
|
||||
Double click the installed application to interact with the LBRY network.
|
||||
Go to the website to interact on this frontend.
|
||||
|
||||
## Running from Source
|
||||
|
||||
You can run the web version (lbry.tv), the electron app, or both at the same time.
|
||||
You can run the web version (odysee.com), via running onto your host machine, or go to the website itself.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
@@ -49,15 +49,15 @@ You can run the web version (lbry.tv), the electron app, or both at the same tim
|
||||
- [Node.js](https://nodejs.org/en/download/) (v14 required)
|
||||
- [Yarn](https://yarnpkg.com/en/docs/install)
|
||||
|
||||
1. Clone (or [fork](https://help.github.com/articles/fork-a-repo/)) this repository: `git clone https://github.com/lbryio/lbry-desktop`
|
||||
2. Change directory into the cloned repository: `cd lbry-desktop`
|
||||
1. Clone (or [fork](https://help.github.com/articles/fork-a-repo/)) this repository: `git clone https://github.com/OdyseeTeam/odysee-frontend`
|
||||
2. Change directory into the cloned repository: `cd odysee-frontend`
|
||||
3. Install the dependencies: `yarn`
|
||||
|
||||
#### Run the web app for development
|
||||
|
||||
`yarn dev:web`
|
||||
|
||||
- This uses webpack-dev-server and includes hot-reloading. If you want to debug the [web server we use in production](https://github.com/lbryio/lbry-desktop/blob/master/web/index.js) you can run `yarn dev:web-server`. This starts a server at `localhost:1337` and does not include hot reloading.
|
||||
- This uses webpack-dev-server and includes hot-reloading. If you want to debug the [web server we use in production](https://github.com/OdyseeTeam/odysee-frontend/blob/master/web/index.js) you can run `yarn dev:web-server`. This starts a server at `localhost:1337` and does not include hot reloading.
|
||||
|
||||
#### Customize the web app
|
||||
|
||||
|
||||
+1
-2
@@ -277,7 +277,6 @@ const analytics: Analytics = {
|
||||
videoType = passedPlayer.currentSource().type;
|
||||
videoPlayer = passedPlayer;
|
||||
bitrateAsBitsPerSecond = videoBitrate;
|
||||
|
||||
sendPromMetric('time_to_start', timeToStartVideo);
|
||||
},
|
||||
error: (message) => {
|
||||
@@ -481,7 +480,7 @@ function sendPromMetric(name: string, value?: number) {
|
||||
let url = new URL(SDK_API_PATH + '/metric/ui');
|
||||
const params = { name: name, value: value ? value.toString() : '' };
|
||||
url.search = new URLSearchParams(params).toString();
|
||||
return fetch(url, { method: 'post' });
|
||||
return fetch(url, { method: 'post' }).catch(function(error) {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -446,7 +446,7 @@ function App(props: Props) {
|
||||
{IS_WEB && lbryTvApiStatus === STATUS_DOWN ? (
|
||||
<Yrbl
|
||||
className="main--empty"
|
||||
title={__('lbry.tv is currently down')}
|
||||
title={__('odysee.com is currently down')}
|
||||
subtitle={__('My wheel broke, but the good news is that someone from LBRY is working on it.')}
|
||||
/>
|
||||
) : (
|
||||
|
||||
@@ -94,7 +94,7 @@ function ChannelAbout(props: Props) {
|
||||
<div className="media__info-text media__info-text--constrained">{claim.claim_id}</div>
|
||||
</div>
|
||||
|
||||
<label>{__('Staked LBRY Credits')}</label>
|
||||
<label>{__('Staked Credits')}</label>
|
||||
<div className="media__info-text">
|
||||
<CreditAmount
|
||||
badge={false}
|
||||
|
||||
@@ -49,7 +49,7 @@ function ChannelThumbnail(props: Props) {
|
||||
ThumbUploadError,
|
||||
} = props;
|
||||
const [thumbLoadError, setThumbLoadError] = React.useState(ThumbUploadError);
|
||||
const shouldResolve = claim === undefined;
|
||||
const shouldResolve = !isResolving && claim === undefined;
|
||||
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
|
||||
const thumbnailPreview = rawThumbnailPreview && rawThumbnailPreview.trim().replace(/^http:\/\//i, 'https://');
|
||||
const defaultAvatar = AVATAR_DEFAULT || Gerbil;
|
||||
|
||||
@@ -112,7 +112,7 @@ class ClaimLink extends React.Component<Props> {
|
||||
) : (
|
||||
<Button
|
||||
button="link"
|
||||
title={SIMPLE_SITE ? __("This channel isn't staking enough LBRY Credits for link previews.") : children}
|
||||
title={SIMPLE_SITE ? __("This channel isn't staking enough Credits for link previews.") : children}
|
||||
label={children}
|
||||
className="button--external-link"
|
||||
navigate={uri}
|
||||
|
||||
@@ -24,6 +24,7 @@ import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import FileWatchLaterLink from 'component/fileWatchLaterLink';
|
||||
import PublishPending from 'component/publishPending';
|
||||
import ClaimMenuList from 'component/claimMenuList';
|
||||
import ClaimPreviewReset from 'component/claimPreviewReset';
|
||||
import ClaimPreviewLoading from './claim-preview-loading';
|
||||
import ClaimPreviewHidden from './claim-preview-no-mature';
|
||||
import ClaimPreviewNoContent from './claim-preview-no-content';
|
||||
@@ -480,6 +481,13 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{claimIsMine && isLivestream && (
|
||||
<div className={'claim-preview__hints'}>
|
||||
<ClaimPreviewReset />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!hideMenu && <ClaimMenuList uri={uri} collectionId={listId} />}
|
||||
</>
|
||||
</WrapperElement>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import ClaimPreviewReset from './view';
|
||||
|
||||
const select = (state) => {
|
||||
const { claim_id: channelId, name: channelName } = selectActiveChannelClaim(state) || {};
|
||||
return {
|
||||
channelName,
|
||||
channelId,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doToast: (props) => dispatch(doToast(props)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ClaimPreviewReset);
|
||||
@@ -0,0 +1,87 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import Lbry from 'lbry';
|
||||
import { LIVESTREAM_KILL } from 'constants/livestream';
|
||||
import { SITE_HELP_EMAIL } from 'config';
|
||||
import { toHex } from 'util/hex';
|
||||
import Button from 'component/button';
|
||||
import 'scss/component/claim-preview-reset.scss';
|
||||
|
||||
// @Todo: move out of component.
|
||||
const getStreamData = async (channelId: string, channelName: string) => {
|
||||
if (!channelId || !channelName) throw new Error('Invalid channel data provided.');
|
||||
|
||||
const channelNameHex = toHex(channelName);
|
||||
let channelSignature;
|
||||
|
||||
try {
|
||||
channelSignature = await Lbry.channel_sign({ channel_id: channelId, hexdata: channelNameHex });
|
||||
if (!channelSignature || !channelSignature.signature || !channelSignature.signing_ts) {
|
||||
throw new Error('Error getting channel signature.');
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return {
|
||||
d: channelNameHex,
|
||||
s: channelSignature.signature,
|
||||
t: channelSignature.signing_ts,
|
||||
};
|
||||
};
|
||||
|
||||
// @Todo: move out of component.
|
||||
const killStream = async (channelId: string, payload: any) => {
|
||||
fetch(`${LIVESTREAM_KILL}/${channelId}`, {
|
||||
method: 'POST',
|
||||
mode: 'no-cors',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: new URLSearchParams(payload),
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res.status === 200) throw new Error('Kill stream API failed.');
|
||||
})
|
||||
.catch((e) => {
|
||||
throw e;
|
||||
});
|
||||
};
|
||||
|
||||
type Props = {
|
||||
channelId: string,
|
||||
channelName: string,
|
||||
doToast: ({ message: string, isError?: boolean }) => void,
|
||||
};
|
||||
|
||||
const ClaimPreviewReset = (props: Props) => {
|
||||
const { channelId, channelName, doToast } = props;
|
||||
|
||||
const handleClick = async () => {
|
||||
try {
|
||||
const streamData = await getStreamData(channelId, channelName);
|
||||
await killStream(channelId, streamData);
|
||||
doToast({ message: __('Live stream successfully reset.'), isError: false });
|
||||
} catch {
|
||||
doToast({ message: __('There was an error resetting the live stream.'), isError: true });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<p className={'claimPreviewReset'}>
|
||||
<span className={'claimPreviewReset__hint'}>
|
||||
{__(
|
||||
"If you're having trouble starting a stream or if your stream shows that you're live but aren't, try a reset. If the problem persists, please reach out at %SITE_HELP_EMAIL%.",
|
||||
{ SITE_HELP_EMAIL }
|
||||
)}
|
||||
</span>
|
||||
<Button
|
||||
button="primary"
|
||||
label={__('Reset stream')}
|
||||
className={'claimPreviewReset__button'}
|
||||
onClick={handleClick}
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
};
|
||||
|
||||
export default ClaimPreviewReset;
|
||||
@@ -5,47 +5,46 @@ import {
|
||||
makeSelectThumbnailForUri,
|
||||
selectMyChannelClaims,
|
||||
} from 'redux/selectors/claims';
|
||||
import { doCommentUpdate, doCommentList } from 'redux/actions/comments';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import {
|
||||
selectLinkedCommentAncestors,
|
||||
selectOthersReactsForComment,
|
||||
makeSelectTotalReplyPagesForParentId,
|
||||
} from 'redux/selectors/comments';
|
||||
import { doCommentUpdate, doCommentList } from 'redux/actions/comments';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import CommentView from './view';
|
||||
import Comment from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { channel_url: authorUri, comment_id: commentId } = props.comment;
|
||||
|
||||
const activeChannelClaim = selectActiveChannelClaim(state);
|
||||
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
||||
const reactionKey = activeChannelId ? `${commentId}:${activeChannelId}` : commentId;
|
||||
const reactionKey = activeChannelId ? `${props.commentId}:${activeChannelId}` : props.commentId;
|
||||
|
||||
return {
|
||||
channelIsBlocked: authorUri && makeSelectChannelIsMuted(authorUri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
linkedCommentAncestors: selectLinkedCommentAncestors(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
thumbnail: props.authorUri && makeSelectThumbnailForUri(props.authorUri)(state),
|
||||
channelIsBlocked: props.authorUri && makeSelectChannelIsMuted(props.authorUri)(state),
|
||||
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
||||
othersReacts: selectOthersReactsForComment(state, reactionKey),
|
||||
activeChannelClaim,
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
playingUri: selectPlayingUri(state),
|
||||
stakedLevel: makeSelectStakedLevelForChannelUri(authorUri)(state),
|
||||
thumbnail: authorUri && makeSelectThumbnailForUri(authorUri)(state),
|
||||
totalReplyPages: makeSelectTotalReplyPagesForParentId(commentId)(state),
|
||||
userCanComment: selectUserVerifiedEmail(state),
|
||||
stakedLevel: makeSelectStakedLevelForChannelUri(props.authorUri)(state),
|
||||
linkedCommentAncestors: selectLinkedCommentAncestors(state),
|
||||
totalReplyPages: makeSelectTotalReplyPagesForParentId(props.commentId)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
const perform = (dispatch) => ({
|
||||
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
|
||||
updateComment: (editedComment) => dispatch(doCommentUpdate(ownProps.comment.comment_id, editedComment)),
|
||||
fetchReplies: (page, pageSize, sortBy) =>
|
||||
dispatch(doCommentList(ownProps.uri, ownProps.comment.comment_id, page, pageSize, sortBy)),
|
||||
updateComment: (commentId, comment) => dispatch(doCommentUpdate(commentId, comment)),
|
||||
fetchReplies: (uri, parentId, page, pageSize, sortBy) =>
|
||||
dispatch(doCommentList(uri, parentId, page, pageSize, sortBy)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CommentView);
|
||||
export default connect(select, perform)(Comment);
|
||||
+265
-171
@@ -1,100 +1,120 @@
|
||||
// @flow
|
||||
import 'scss/component/_comments.scss';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import { Menu, MenuButton } from '@reach/menu-button';
|
||||
import { parseSticker } from 'util/comments';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { SORT_BY, COMMENT_PAGE_SIZE_REPLIES } from 'constants/comment';
|
||||
import { useHistory } from 'react-router';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import { COMMENT_HIGHLIGHTED } from 'constants/classnames';
|
||||
import { SORT_BY, COMMENT_PAGE_SIZE_REPLIES } from 'constants/comment';
|
||||
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
|
||||
import { SITE_NAME, SIMPLE_SITE, ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import DateTime from 'component/dateTime';
|
||||
import Button from 'component/button';
|
||||
import Expandable from 'component/expandable';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { Menu, MenuButton } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
import { FormField, Form } from 'component/common/form';
|
||||
import classnames from 'classnames';
|
||||
import CommentCreate from 'component/commentCreate';
|
||||
import CommentMenuList from 'component/commentMenuList';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import CommentReactions from 'component/commentReactions';
|
||||
import CommentsReplies from 'component/commentsReplies';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import DateTime from 'component/dateTime';
|
||||
import Expandable from 'component/expandable';
|
||||
import Icon from 'component/common/icon';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import { useHistory } from 'react-router';
|
||||
import CommentCreate from 'component/commentCreate';
|
||||
import CommentMenuList from 'component/commentMenuList';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import { parseSticker } from 'util/comments';
|
||||
|
||||
const AUTO_EXPAND_ALL_REPLIES = false;
|
||||
const LENGTH_TO_COLLAPSE = 300;
|
||||
|
||||
type Props = {
|
||||
channelIsBlocked: boolean, // if the channel is blacklisted in the app
|
||||
claim: StreamClaim,
|
||||
claimIsMine: boolean, // if you control the claim which this comment was posted on
|
||||
comment: Comment,
|
||||
commentIdentityChannel: any,
|
||||
hideActions?: boolean,
|
||||
isTopLevel?: boolean,
|
||||
linkedCommentAncestors: { [string]: Array<string> },
|
||||
linkedCommentId?: string,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
othersReacts: ?{ like: number, dislike: number },
|
||||
playingUri: ?PlayingUri,
|
||||
quickReply: any,
|
||||
stakedLevel: number,
|
||||
supportDisabled: boolean,
|
||||
threadDepth: number,
|
||||
totalReplyPages: number,
|
||||
uri: string,
|
||||
userCanComment: boolean,
|
||||
clearPlayingUri: () => void,
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
author: ?string, // LBRY Channel Name, e.g. @channel
|
||||
authorUri: string, // full LBRY Channel URI: lbry://@channel#123...
|
||||
commentId: string, // sha256 digest identifying the comment
|
||||
message: string, // comment body
|
||||
timePosted: number, // Comment timestamp
|
||||
channelIsBlocked: boolean, // if the channel is blacklisted in the app
|
||||
claimIsMine: boolean, // if you control the claim which this comment was posted on
|
||||
commentIsMine: boolean, // if this comment was signed by an owned channel
|
||||
updateComment: (string, string) => void,
|
||||
fetchReplies: (string, string, number, number, number) => void,
|
||||
totalReplyPages: number,
|
||||
commentModBlock: (string) => void,
|
||||
fetchReplies: (number, number, string) => void,
|
||||
linkedCommentId?: string,
|
||||
linkedCommentAncestors: { [string]: Array<string> },
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
commentingEnabled: boolean,
|
||||
doToast: ({ message: string }) => void,
|
||||
isTopLevel?: boolean,
|
||||
threadDepth: number,
|
||||
hideActions?: boolean,
|
||||
isPinned: boolean,
|
||||
othersReacts: ?{
|
||||
like: number,
|
||||
dislike: number,
|
||||
},
|
||||
commentIdentityChannel: any,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
playingUri: ?PlayingUri,
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
numDirectReplies: number,
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
supportDisabled: boolean,
|
||||
setQuickReply: (any) => void,
|
||||
updateComment: (string) => void,
|
||||
quickReply: any,
|
||||
};
|
||||
|
||||
function CommentView(props: Props) {
|
||||
const LENGTH_TO_COLLAPSE = 300;
|
||||
|
||||
function Comment(props: Props) {
|
||||
const {
|
||||
channelIsBlocked,
|
||||
clearPlayingUri,
|
||||
claim,
|
||||
comment,
|
||||
hideActions,
|
||||
isTopLevel,
|
||||
linkedCommentAncestors,
|
||||
uri,
|
||||
author,
|
||||
authorUri,
|
||||
timePosted,
|
||||
message,
|
||||
channelIsBlocked,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
updateComment,
|
||||
fetchReplies,
|
||||
totalReplyPages,
|
||||
linkedCommentId,
|
||||
linkedCommentAncestors,
|
||||
commentingEnabled,
|
||||
myChannels,
|
||||
doToast,
|
||||
isTopLevel,
|
||||
threadDepth,
|
||||
hideActions,
|
||||
isPinned,
|
||||
othersReacts,
|
||||
playingUri,
|
||||
quickReply,
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
numDirectReplies,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
supportDisabled,
|
||||
threadDepth,
|
||||
totalReplyPages,
|
||||
uri,
|
||||
userCanComment,
|
||||
clearPlayingUri,
|
||||
fetchReplies,
|
||||
setQuickReply,
|
||||
updateComment,
|
||||
quickReply,
|
||||
} = props;
|
||||
|
||||
const {
|
||||
channel_id: authorId,
|
||||
channel_url: authorUri,
|
||||
comment_id: commentId,
|
||||
comment: message,
|
||||
is_fiat: isFiat,
|
||||
is_global_mod: isGlobalMod,
|
||||
is_moderator: isModerator,
|
||||
is_pinned: isPinned,
|
||||
replies: numDirectReplies,
|
||||
support_amount: supportAmount,
|
||||
} = comment;
|
||||
const timePosted = comment.timestamp * 1000;
|
||||
const commentIsMine = authorId && myChannels && myChannels.some(({ claim_id }) => claim_id === authorId);
|
||||
|
||||
const {
|
||||
push,
|
||||
replace,
|
||||
location: { pathname, search },
|
||||
} = useHistory();
|
||||
@@ -109,22 +129,79 @@ function CommentView(props: Props) {
|
||||
const [isReplying, setReplying] = React.useState(false);
|
||||
const [isEditing, setEditing] = useState(false);
|
||||
const [editedMessage, setCommentValue] = useState(message);
|
||||
const [charCount, setCharCount] = useState(editedMessage.length);
|
||||
const [showReplies, setShowReplies] = useState(showRepliesOnMount);
|
||||
const [page, setPage] = useState(showRepliesOnMount ? 1 : 0);
|
||||
const [advancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||
const [displayDeadComment, setDisplayDeadComment] = React.useState(false);
|
||||
|
||||
const hasChannels = myChannels && myChannels.length > 0;
|
||||
const likesCount = (othersReacts && othersReacts.like) || 0;
|
||||
const dislikesCount = (othersReacts && othersReacts.dislike) || 0;
|
||||
const totalLikesAndDislikes = likesCount + dislikesCount;
|
||||
const slimedToDeath = totalLikesAndDislikes >= 5 && dislikesCount / totalLikesAndDislikes > 0.8;
|
||||
const commentByContentOwner = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const stickerFromMessage = parseSticker(message);
|
||||
|
||||
let contentOwnerChannel;
|
||||
let channelOwnerOfContent;
|
||||
try {
|
||||
({ channelName: contentOwnerChannel } = parseURI(uri));
|
||||
const { channelName } = parseURI(uri);
|
||||
if (channelName) {
|
||||
channelOwnerOfContent = channelName;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
useEffect(() => {
|
||||
if (isEditing) {
|
||||
setCharCount(editedMessage.length);
|
||||
|
||||
// a user will try and press the escape key to cancel editing their comment
|
||||
const handleEscape = (event) => {
|
||||
if (event.keyCode === KEYCODES.ESCAPE) {
|
||||
setEditing(false);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handleEscape);
|
||||
|
||||
// removes the listener so it doesn't cause problems elsewhere in the app
|
||||
return () => {
|
||||
window.removeEventListener('keydown', handleEscape);
|
||||
};
|
||||
}
|
||||
}, [author, authorUri, editedMessage, isEditing, setEditing]);
|
||||
|
||||
useEffect(() => {
|
||||
if (page > 0) {
|
||||
fetchReplies(uri, commentId, page, COMMENT_PAGE_SIZE_REPLIES, SORT_BY.OLDEST);
|
||||
}
|
||||
}, [page, uri, commentId, fetchReplies]);
|
||||
|
||||
function handleEditMessageChanged(event) {
|
||||
setCommentValue(!SIMPLE_SITE && advancedEditor ? event : event.target.value);
|
||||
}
|
||||
|
||||
function handleEditComment() {
|
||||
if (playingUri && playingUri.source === 'comment') {
|
||||
clearPlayingUri();
|
||||
}
|
||||
setEditing(true);
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
updateComment(commentId, editedMessage);
|
||||
if (setQuickReply) setQuickReply({ ...quickReply, comment_id: commentId, comment: editedMessage });
|
||||
setEditing(false);
|
||||
}
|
||||
|
||||
function handleCommentReply() {
|
||||
if (!hasChannels) {
|
||||
push(`/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`);
|
||||
doToast({ message: __('A channel is required to comment on %SITE_NAME%', { SITE_NAME }) });
|
||||
} else {
|
||||
setReplying(!isReplying);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTimeClick() {
|
||||
const urlParams = new URLSearchParams(search);
|
||||
urlParams.delete('lc');
|
||||
@@ -144,27 +221,10 @@ function CommentView(props: Props) {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (page > 0) fetchReplies(page, COMMENT_PAGE_SIZE_REPLIES, SORT_BY.OLDEST);
|
||||
}, [commentId, fetchReplies, page, uri]);
|
||||
|
||||
const commentBadge = (label: string, className: string, icon: string) => (
|
||||
<Tooltip label={label}>
|
||||
<span className={`comment__badge ${className}`}>
|
||||
<Icon icon={icon} size={20} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
const MarkdownWrapper =
|
||||
editedMessage.length >= LENGTH_TO_COLLAPSE
|
||||
? ({ children }) => <Expandable>{children}</Expandable>
|
||||
: ({ children }) => children;
|
||||
|
||||
return (
|
||||
<li
|
||||
className={classnames('comment', {
|
||||
'comment--topLevel': isTopLevel,
|
||||
'comment--top-level': isTopLevel,
|
||||
'comment--reply': !isTopLevel,
|
||||
'comment--superchat': supportAmount > 0,
|
||||
})}
|
||||
@@ -173,25 +233,48 @@ function CommentView(props: Props) {
|
||||
<div
|
||||
ref={isLinkedComment ? linkedCommentRef : undefined}
|
||||
className={classnames('comment__content', {
|
||||
'comment__content--highlighted': isLinkedComment,
|
||||
'comment__content--slimed': slimedToDeath && !displayDeadComment,
|
||||
[COMMENT_HIGHLIGHTED]: isLinkedComment,
|
||||
'comment--slimed': slimedToDeath && !displayDeadComment,
|
||||
})}
|
||||
>
|
||||
<div className="commentThumbnail__wrapper">
|
||||
<ChannelThumbnail uri={authorUri} obscure={channelIsBlocked} xsmall className="commentAuthor__thumbnail" />
|
||||
<div className="comment__thumbnail-wrapper">
|
||||
{authorUri ? (
|
||||
<ChannelThumbnail uri={authorUri} obscure={channelIsBlocked} xsmall className="comment__author-thumbnail" />
|
||||
) : (
|
||||
<ChannelThumbnail xsmall className="comment__author-thumbnail" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="commentBody__container">
|
||||
<div className="comment__body-container">
|
||||
<div className="comment__meta">
|
||||
<div className="commentMeta__information">
|
||||
{isModerator && commentBadge(__('Moderator'), 'commentBadge__mod', ICONS.BADGE_MOD)}
|
||||
{isGlobalMod && commentBadge(__('Admin'), 'commentBadge__globalMod', ICONS.BADGE_MOD)}
|
||||
<div className="comment__meta-information">
|
||||
{isGlobalMod && (
|
||||
<Tooltip label={__('Admin')}>
|
||||
<span className="comment__badge comment__badge--global-mod">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={20} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
<UriIndicator
|
||||
uri={authorUri}
|
||||
className={classnames('comment__author', { 'comment__author--creator': commentByContentOwner })}
|
||||
link
|
||||
/>
|
||||
{isModerator && (
|
||||
<Tooltip label={__('Moderator')}>
|
||||
<span className="comment__badge comment__badge--mod">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={20} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{!author ? (
|
||||
<span className="comment__author">{__('Anonymous')}</span>
|
||||
) : (
|
||||
<UriIndicator
|
||||
className={classnames('comment__author', {
|
||||
'comment__author--creator': commentByOwnerOfContent,
|
||||
})}
|
||||
link
|
||||
uri={authorUri}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
className="comment__time"
|
||||
onClick={handleTimeClick}
|
||||
@@ -203,8 +286,8 @@ function CommentView(props: Props) {
|
||||
{isPinned && (
|
||||
<span className="comment__pin">
|
||||
<Icon icon={ICONS.PIN} size={14} />
|
||||
{contentOwnerChannel
|
||||
? __('Pinned by @%channel%', { channel: contentOwnerChannel })
|
||||
{channelOwnerOfContent
|
||||
? __('Pinned by @%channel%', { channel: channelOwnerOfContent })
|
||||
: __('Pinned by creator')}
|
||||
</span>
|
||||
)}
|
||||
@@ -221,57 +304,63 @@ function CommentView(props: Props) {
|
||||
commentId={commentId}
|
||||
authorUri={authorUri}
|
||||
commentIsMine={commentIsMine}
|
||||
handleEditComment={() => {
|
||||
if (playingUri && playingUri.source === 'comment') clearPlayingUri();
|
||||
setEditing(true);
|
||||
}}
|
||||
handleEditComment={handleEditComment}
|
||||
supportAmount={supportAmount}
|
||||
setQuickReply={setQuickReply}
|
||||
disableEdit={Boolean(stickerFromMessage)}
|
||||
/>
|
||||
</Menu>
|
||||
</div>
|
||||
</div>
|
||||
<div className="comment__body">
|
||||
<div>
|
||||
{isEditing ? (
|
||||
<CommentCreate
|
||||
isEdit
|
||||
editedMessage={message}
|
||||
onDoneEditing={(editedMessage) => {
|
||||
if (editedMessage) {
|
||||
updateComment(editedMessage);
|
||||
if (setQuickReply) setQuickReply({ ...quickReply, comment_id: commentId, comment: editedMessage });
|
||||
setCommentValue(editedMessage);
|
||||
}
|
||||
setEditing(false);
|
||||
}}
|
||||
supportDisabled
|
||||
/>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<FormField
|
||||
className="comment__edit-input"
|
||||
type={!SIMPLE_SITE && advancedEditor ? 'markdown' : 'textarea'}
|
||||
name="editing_comment"
|
||||
value={editedMessage}
|
||||
charCount={charCount}
|
||||
onChange={handleEditMessageChanged}
|
||||
textAreaMaxLength={FF_MAX_CHARS_IN_COMMENT}
|
||||
/>
|
||||
<div className="section__actions section__actions--no-margin">
|
||||
<Button
|
||||
button="primary"
|
||||
type="submit"
|
||||
label={__('Done')}
|
||||
requiresAuth={IS_WEB}
|
||||
disabled={message === editedMessage}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={() => setEditing(false)} />
|
||||
</div>
|
||||
</Form>
|
||||
) : (
|
||||
<>
|
||||
<div
|
||||
className={classnames('comment__message', {
|
||||
'comment__message--dead': slimedToDeath && !displayDeadComment,
|
||||
'comment__message--sticker': stickerFromMessage,
|
||||
})}
|
||||
onClick={() => slimedToDeath && setDisplayDeadComment(true)}
|
||||
>
|
||||
<div className="comment__message">
|
||||
{slimedToDeath && !displayDeadComment ? (
|
||||
<>
|
||||
{__('This comment was slimed to death.')}
|
||||
<Icon icon={ICONS.SLIME_ACTIVE} />
|
||||
</>
|
||||
<div onClick={() => setDisplayDeadComment(true)} className="comment__dead">
|
||||
{__('This comment was slimed to death.')} <Icon icon={ICONS.SLIME_ACTIVE} />
|
||||
</div>
|
||||
) : stickerFromMessage ? (
|
||||
<OptimizedImage src={stickerFromMessage.url} waitLoad />
|
||||
) : (
|
||||
<MarkdownWrapper>
|
||||
<div className="sticker__comment">
|
||||
<OptimizedImage src={stickerFromMessage.url} waitLoad />
|
||||
</div>
|
||||
) : editedMessage.length >= LENGTH_TO_COLLAPSE ? (
|
||||
<Expandable>
|
||||
<MarkdownPreview
|
||||
content={message}
|
||||
promptLinks
|
||||
parentCommentId={commentId}
|
||||
stakedLevel={stakedLevel}
|
||||
promptLinks
|
||||
/>
|
||||
</MarkdownWrapper>
|
||||
</Expandable>
|
||||
) : (
|
||||
<MarkdownPreview
|
||||
content={message}
|
||||
promptLinks
|
||||
parentCommentId={commentId}
|
||||
stakedLevel={stakedLevel}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -279,10 +368,10 @@ function CommentView(props: Props) {
|
||||
<div className="comment__actions">
|
||||
{threadDepth !== 0 && (
|
||||
<Button
|
||||
requiresAuth
|
||||
label={userCanComment ? __('Reply') : __('Log in to reply')}
|
||||
requiresAuth={IS_WEB}
|
||||
label={commentingEnabled ? __('Reply') : __('Log in to reply')}
|
||||
className="comment__action"
|
||||
onClick={() => setReplying(!isReplying)}
|
||||
onClick={handleCommentReply}
|
||||
icon={ICONS.REPLY}
|
||||
/>
|
||||
)}
|
||||
@@ -290,33 +379,36 @@ function CommentView(props: Props) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{numDirectReplies > 0 &&
|
||||
(!showReplies ? (
|
||||
<div className="comment__actions">
|
||||
<Button
|
||||
label={
|
||||
numDirectReplies < 2
|
||||
? __('Show reply')
|
||||
: __('Show %count% replies', { count: numDirectReplies })
|
||||
{numDirectReplies > 0 && !showReplies && (
|
||||
<div className="comment__actions">
|
||||
<Button
|
||||
label={
|
||||
numDirectReplies < 2
|
||||
? __('Show reply')
|
||||
: __('Show %count% replies', { count: numDirectReplies })
|
||||
}
|
||||
button="link"
|
||||
onClick={() => {
|
||||
setShowReplies(true);
|
||||
if (page === 0) {
|
||||
setPage(1);
|
||||
}
|
||||
button="link"
|
||||
onClick={() => {
|
||||
setShowReplies(true);
|
||||
if (page === 0) setPage(1);
|
||||
}}
|
||||
icon={ICONS.DOWN}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="comment__actions">
|
||||
<Button
|
||||
label={__('Hide replies')}
|
||||
button="link"
|
||||
onClick={() => setShowReplies(false)}
|
||||
icon={ICONS.UP}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
}}
|
||||
icon={ICONS.DOWN}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{numDirectReplies > 0 && showReplies && (
|
||||
<div className="comment__actions">
|
||||
<Button
|
||||
label={__('Hide replies')}
|
||||
button="link"
|
||||
onClick={() => setShowReplies(false)}
|
||||
icon={ICONS.UP}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isReplying && (
|
||||
<CommentCreate
|
||||
@@ -327,7 +419,9 @@ function CommentView(props: Props) {
|
||||
setShowReplies(true);
|
||||
setReplying(false);
|
||||
}}
|
||||
onCancelReplying={() => setReplying(false)}
|
||||
onCancelReplying={() => {
|
||||
setReplying(false);
|
||||
}}
|
||||
supportDisabled={supportDisabled}
|
||||
/>
|
||||
)}
|
||||
@@ -352,4 +446,4 @@ function CommentView(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
export default CommentView;
|
||||
export default Comment;
|
||||
@@ -21,7 +21,7 @@ const select = (state, props) => ({
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
isFetchingChannels: selectFetchingMyChannels(state),
|
||||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
supportDisabled: props.supportDisabled || makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SUPPORT_TAG)(state),
|
||||
supportDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SUPPORT_TAG)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
|
||||
@@ -45,9 +45,7 @@ type Props = {
|
||||
channels: ?Array<ChannelClaim>,
|
||||
claim: StreamClaim,
|
||||
claimIsMine: boolean,
|
||||
editedMessage?: string,
|
||||
embed?: boolean,
|
||||
isEdit?: boolean,
|
||||
isFetchingChannels: boolean,
|
||||
isNested: boolean,
|
||||
isReply: boolean,
|
||||
@@ -62,7 +60,6 @@ type Props = {
|
||||
doToast: ({ message: string }) => void,
|
||||
fetchComment: (commentId: string) => Promise<any>,
|
||||
onCancelReplying?: () => void,
|
||||
onDoneEditing?: (editedMessage?: string) => void,
|
||||
onDoneReplying?: () => void,
|
||||
sendCashTip: (TipParams, UserParams, string, ?string, (any) => void) => string,
|
||||
sendTip: ({}, (any) => void, (any) => void) => void,
|
||||
@@ -77,9 +74,7 @@ export function CommentCreate(props: Props) {
|
||||
channels,
|
||||
claim,
|
||||
claimIsMine,
|
||||
editedMessage,
|
||||
embed,
|
||||
isEdit,
|
||||
isFetchingChannels,
|
||||
isNested,
|
||||
isReply,
|
||||
@@ -96,7 +91,6 @@ export function CommentCreate(props: Props) {
|
||||
onCancelReplying,
|
||||
onDoneReplying,
|
||||
sendCashTip,
|
||||
onDoneEditing,
|
||||
sendTip,
|
||||
setQuickReply,
|
||||
} = props;
|
||||
@@ -120,7 +114,7 @@ export function CommentCreate(props: Props) {
|
||||
const [selectedSticker, setSelectedSticker] = React.useState();
|
||||
const [tipAmount, setTipAmount] = React.useState(1);
|
||||
const [convertedAmount, setConvertedAmount] = React.useState();
|
||||
const [commentValue, setCommentValue] = React.useState(editedMessage || '');
|
||||
const [commentValue, setCommentValue] = React.useState('');
|
||||
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||
const [stickerSelector, setStickerSelector] = React.useState();
|
||||
const [activeTab, setActiveTab] = React.useState('');
|
||||
@@ -274,13 +268,10 @@ export function CommentCreate(props: Props) {
|
||||
}, 1500);
|
||||
|
||||
doToast({
|
||||
message: __(
|
||||
"You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!",
|
||||
{
|
||||
tipAmount: tipAmount, // force show decimal places
|
||||
tipChannelName,
|
||||
}
|
||||
),
|
||||
message: __("You sent %tipAmount% Credits as a tip to %tipChannelName%, I'm sure they appreciate it!", {
|
||||
tipAmount: tipAmount, // force show decimal places
|
||||
tipChannelName,
|
||||
}),
|
||||
});
|
||||
|
||||
setSuccessTip({ txid, tipAmount });
|
||||
@@ -480,18 +471,16 @@ export function CommentCreate(props: Props) {
|
||||
<FormField
|
||||
disabled={isFetchingChannels}
|
||||
type={SIMPLE_SITE ? 'textarea' : advancedEditor && !isReply ? 'markdown' : 'textarea'}
|
||||
name={(isReply && 'content_reply') || (isEdit && 'editing_comment') || 'content_description'}
|
||||
name={isReply ? 'content_reply' : 'content_description'}
|
||||
ref={formFieldRef}
|
||||
className={(isReply && 'content_reply') || (isEdit && 'commentEdit__input') || 'content_comment'}
|
||||
className={isReply ? 'content_reply' : 'content_comment'}
|
||||
label={
|
||||
!isEdit && (
|
||||
<span className="commentCreate__labelWrapper">
|
||||
{!livestream && (
|
||||
<div className="commentCreate__label">{isReply ? __('Replying as ') : __('Comment as ')}</div>
|
||||
)}
|
||||
<SelectChannel tiny />
|
||||
</span>
|
||||
)
|
||||
<span className="commentCreate__labelWrapper">
|
||||
{!livestream && (
|
||||
<div className="commentCreate__label">{isReply ? __('Replying as ') : __('Comment as ')}</div>
|
||||
)}
|
||||
<SelectChannel tiny />
|
||||
</span>
|
||||
}
|
||||
quickActionLabel={
|
||||
!SIMPLE_SITE && (isReply ? undefined : advancedEditor ? __('Simple Editor') : __('Advanced Editor'))
|
||||
@@ -585,17 +574,16 @@ export function CommentCreate(props: Props) {
|
||||
disabled={disabled || stickerSelector}
|
||||
type="submit"
|
||||
label={
|
||||
(isEdit && __('Done')) ||
|
||||
(isSubmitting
|
||||
? (isReply && __('Replying...')) || __('Commenting...')
|
||||
: (isReply && __('Reply')) || __('Comment --[button to submit something]--'))
|
||||
isReply
|
||||
? isSubmitting
|
||||
? __('Replying...')
|
||||
: __('Reply')
|
||||
: isSubmitting
|
||||
? __('Commenting...')
|
||||
: __('Comment --[button to submit something]--')
|
||||
}
|
||||
requiresAuth
|
||||
onClick={() =>
|
||||
activeChannelClaim &&
|
||||
commentValue.length &&
|
||||
(isEdit && editedMessage && onDoneEditing ? onDoneEditing() : handleCreateComment())
|
||||
}
|
||||
onClick={() => activeChannelClaim && commentValue.length && handleCreateComment()}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
@@ -638,8 +626,7 @@ export function CommentCreate(props: Props) {
|
||||
isReviewingSupportComment ||
|
||||
stickerSelector ||
|
||||
isReviewingStickerComment ||
|
||||
(isReply && !minTip) ||
|
||||
isEdit) && (
|
||||
(isReply && !minTip)) && (
|
||||
<Button
|
||||
disabled={isSupportComment && isSubmitting}
|
||||
button="link"
|
||||
@@ -658,8 +645,6 @@ export function CommentCreate(props: Props) {
|
||||
setStickerSelector(false);
|
||||
} else if (isReply && !minTip && onCancelReplying) {
|
||||
onCancelReplying();
|
||||
} else if (isEdit && onDoneEditing) {
|
||||
onDoneEditing();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsMine,
|
||||
selectFetchingMyChannels,
|
||||
selectMyClaimIdsRaw,
|
||||
} from 'redux/selectors/claims';
|
||||
import {
|
||||
selectTopLevelCommentsForUri,
|
||||
makeSelectTopLevelTotalPagesForUri,
|
||||
@@ -13,8 +20,6 @@ import {
|
||||
selectPinnedCommentsForUri,
|
||||
} from 'redux/selectors/comments';
|
||||
import { doCommentReset, doCommentList, doCommentById, doCommentReactList } from 'redux/actions/comments';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsMine, selectFetchingMyChannels } from 'redux/selectors/claims';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import CommentsList from './view';
|
||||
|
||||
@@ -28,31 +33,32 @@ const select = (state, props) => {
|
||||
: [];
|
||||
|
||||
return {
|
||||
activeChannelId: activeChannelClaim && activeChannelClaim.claim_id,
|
||||
topLevelComments,
|
||||
resolvedComments,
|
||||
myChannelIds: selectMyClaimIdsRaw(state),
|
||||
allCommentIds: makeSelectCommentIdsForUri(props.uri)(state),
|
||||
pinnedComments: selectPinnedCommentsForUri(state, props.uri),
|
||||
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(props.uri)(state),
|
||||
totalComments: makeSelectTotalCommentsCountForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
isFetchingComments: selectIsFetchingComments(state),
|
||||
isFetchingCommentsById: selectIsFetchingCommentsById(state),
|
||||
isFetchingReacts: selectIsFetchingReacts(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
myReactsByCommentId: selectMyReacts(state),
|
||||
othersReactsById: selectOthersReacts(state),
|
||||
pinnedComments: selectPinnedCommentsForUri(state, props.uri),
|
||||
resolvedComments,
|
||||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
topLevelComments,
|
||||
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(props.uri)(state),
|
||||
totalComments: makeSelectTotalCommentsCountForUri(props.uri)(state),
|
||||
activeChannelId: activeChannelClaim && activeChannelClaim.claim_id,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
doResolveUris: (uris) => dispatch(doResolveUris(uris, true)),
|
||||
const perform = (dispatch) => ({
|
||||
fetchTopLevelComments: (uri, page, pageSize, sortBy) => dispatch(doCommentList(uri, '', page, pageSize, sortBy)),
|
||||
fetchComment: (commentId) => dispatch(doCommentById(commentId)),
|
||||
fetchReacts: (commentIds) => dispatch(doCommentReactList(commentIds)),
|
||||
fetchTopLevelComments: (page, pageSize, sortBy) => dispatch(doCommentList(ownProps.uri, '', page, pageSize, sortBy)),
|
||||
resetComments: () => ownProps.claim && dispatch(doCommentReset(ownProps.claim.claimId)),
|
||||
resetComments: (claimId) => dispatch(doCommentReset(claimId)),
|
||||
doResolveUris: (uris) => dispatch(doResolveUris(uris, true)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CommentsList);
|
||||
@@ -1,9 +1,7 @@
|
||||
// @flow
|
||||
import 'scss/component/_comments-list.scss';
|
||||
import { COMMENT_PAGE_SIZE_TOP_LEVEL, SORT_BY } from 'constants/comment';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { scaleToDevicePixelRatio } from 'util/scale';
|
||||
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as REACTION_TYPES from 'constants/reactions';
|
||||
@@ -20,57 +18,67 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
|
||||
|
||||
function scaleToDevicePixelRatio(value) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
||||
if (devicePixelRatio < 1.0) {
|
||||
return Math.ceil(value / devicePixelRatio);
|
||||
}
|
||||
return Math.ceil(value * devicePixelRatio);
|
||||
}
|
||||
|
||||
type Props = {
|
||||
activeChannelId: ?string,
|
||||
allCommentIds: any,
|
||||
pinnedComments: Array<Comment>,
|
||||
topLevelComments: Array<Comment>,
|
||||
resolvedComments: Array<Comment>,
|
||||
topLevelTotalPages: number,
|
||||
uri: string,
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
commentsAreExpanded?: boolean,
|
||||
fetchingChannels: boolean,
|
||||
myChannelIds: ?Array<string>,
|
||||
isFetchingComments: boolean,
|
||||
isFetchingCommentsById: boolean,
|
||||
isFetchingReacts: boolean,
|
||||
linkedCommentId?: string,
|
||||
totalComments: number,
|
||||
fetchingChannels: boolean,
|
||||
myReactsByCommentId: ?{ [string]: Array<string> }, // "CommentId:MyChannelId" -> reaction array (note the ID concatenation)
|
||||
othersReactsById: ?{ [string]: { [REACTION_TYPES.LIKE | REACTION_TYPES.DISLIKE]: number } },
|
||||
pinnedComments: Array<Comment>,
|
||||
resolvedComments: Array<Comment>,
|
||||
activeChannelId: ?string,
|
||||
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
||||
topLevelComments: Array<Comment>,
|
||||
topLevelTotalPages: number,
|
||||
totalComments: number,
|
||||
uri: string,
|
||||
doResolveUris: (Array<string>) => void,
|
||||
fetchComment: (string) => void,
|
||||
commentsAreExpanded?: boolean,
|
||||
fetchReacts: (Array<string>) => Promise<any>,
|
||||
fetchTopLevelComments: (number, number, string) => void,
|
||||
resetComments: () => void,
|
||||
doResolveUris: (Array<string>) => void,
|
||||
fetchTopLevelComments: (string, number, number, number) => void,
|
||||
fetchComment: (string) => void,
|
||||
resetComments: (string) => void,
|
||||
};
|
||||
|
||||
function CommentsList(props: Props) {
|
||||
function CommentList(props: Props) {
|
||||
const {
|
||||
activeChannelId,
|
||||
allCommentIds,
|
||||
uri,
|
||||
pinnedComments,
|
||||
topLevelComments,
|
||||
resolvedComments,
|
||||
topLevelTotalPages,
|
||||
claim,
|
||||
claimIsMine,
|
||||
commentsAreExpanded,
|
||||
doResolveUris,
|
||||
fetchingChannels,
|
||||
fetchReacts,
|
||||
myChannelIds,
|
||||
isFetchingComments,
|
||||
isFetchingReacts,
|
||||
linkedCommentId,
|
||||
totalComments,
|
||||
fetchingChannels,
|
||||
myReactsByCommentId,
|
||||
othersReactsById,
|
||||
pinnedComments,
|
||||
resolvedComments,
|
||||
activeChannelId,
|
||||
settingsByChannelId,
|
||||
topLevelComments,
|
||||
topLevelTotalPages,
|
||||
totalComments,
|
||||
uri,
|
||||
fetchComment,
|
||||
commentsAreExpanded,
|
||||
fetchReacts,
|
||||
doResolveUris,
|
||||
fetchTopLevelComments,
|
||||
fetchComment,
|
||||
resetComments,
|
||||
} = props;
|
||||
|
||||
@@ -84,7 +92,6 @@ function CommentsList(props: Props) {
|
||||
const [commentsToDisplay, setCommentsToDisplay] = React.useState(topLevelComments);
|
||||
const hasDefaultExpansion = commentsAreExpanded || desktopView;
|
||||
const [expandedComments, setExpandedComments] = React.useState(hasDefaultExpansion);
|
||||
|
||||
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
||||
const channelId = getChannelIdFromClaim(claim);
|
||||
const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
|
||||
@@ -99,7 +106,7 @@ function CommentsList(props: Props) {
|
||||
Boolean(othersReactsById) || !ENABLE_COMMENT_REACTIONS
|
||||
);
|
||||
|
||||
function changeSort(newSort: string) {
|
||||
function changeSort(newSort) {
|
||||
if (sort !== newSort) {
|
||||
setSort(newSort);
|
||||
setPage(0); // Invalidate existing comments
|
||||
@@ -109,7 +116,9 @@ function CommentsList(props: Props) {
|
||||
// Reset comments
|
||||
useEffect(() => {
|
||||
if (page === 0) {
|
||||
if (claim) resetComments();
|
||||
if (claim) {
|
||||
resetComments(claim.claim_id);
|
||||
}
|
||||
setPage(1);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -122,7 +131,7 @@ function CommentsList(props: Props) {
|
||||
fetchComment(linkedCommentId);
|
||||
}
|
||||
|
||||
fetchTopLevelComments(page, COMMENT_PAGE_SIZE_TOP_LEVEL, sort);
|
||||
fetchTopLevelComments(uri, page, COMMENT_PAGE_SIZE_TOP_LEVEL, sort);
|
||||
}
|
||||
}, [fetchComment, fetchTopLevelComments, linkedCommentId, page, sort, uri]);
|
||||
|
||||
@@ -228,25 +237,37 @@ function CommentsList(props: Props) {
|
||||
if (!topLevelComments || alreadyResolved) return;
|
||||
|
||||
const urisToResolve = [];
|
||||
topLevelComments.forEach(({ channel_url }) => channel_url !== undefined && urisToResolve.push(channel_url));
|
||||
topLevelComments.map(({ channel_url }) => channel_url !== undefined && urisToResolve.push(channel_url));
|
||||
|
||||
if (urisToResolve.length > 0) doResolveUris(urisToResolve);
|
||||
}, [alreadyResolved, doResolveUris, topLevelComments]);
|
||||
|
||||
const getCommentElems = (comments: Array<Comment>) =>
|
||||
comments.map((comment: Comment) => (
|
||||
const getCommentElems = (comments) =>
|
||||
comments.map((comment) => (
|
||||
<CommentView
|
||||
claimIsMine={claimIsMine}
|
||||
comment={comment}
|
||||
isTopLevel
|
||||
key={comment.comment_id}
|
||||
linkedCommentId={linkedCommentId}
|
||||
threadDepth={3}
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
claimId={comment.claim_id}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={comment.channel_id && myChannelIds && myChannelIds.includes(comment.channel_id)}
|
||||
linkedCommentId={linkedCommentId}
|
||||
isPinned={comment.is_pinned}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
));
|
||||
|
||||
const sortButton = (label: string, icon: string, sortOption: string) => (
|
||||
const sortButton = (label, icon, sortOption) => (
|
||||
<Button
|
||||
button="alt"
|
||||
label={label}
|
||||
@@ -288,7 +309,8 @@ function CommentsList(props: Props) {
|
||||
)}
|
||||
|
||||
<ul
|
||||
className={classnames('comments', {
|
||||
className={classnames({
|
||||
comments: desktopView || expandedComments,
|
||||
'comments--contracted': !desktopView && !expandedComments,
|
||||
})}
|
||||
>
|
||||
@@ -328,4 +350,4 @@ function CommentsList(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
export default CommentsList;
|
||||
export default CommentList;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import { makeSelectClaimIsMine, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimIsMine, selectMyChannelClaims, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectIsFetchingCommentsByParentId, selectRepliesForParentId } from 'redux/selectors/comments';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import CommentsReplies from './view';
|
||||
@@ -13,11 +13,12 @@ const select = (state, props) => {
|
||||
: [];
|
||||
|
||||
return {
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
fetchedReplies,
|
||||
isFetchingByParentId: selectIsFetchingCommentsByParentId(state),
|
||||
resolvedReplies,
|
||||
userCanComment: selectUserVerifiedEmail(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
userCanComment: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
isFetchingByParentId: selectIsFetchingCommentsByParentId(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// @flow
|
||||
import 'scss/component/_comments.scss';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import Comment from 'component/comment';
|
||||
@@ -7,43 +6,44 @@ import React from 'react';
|
||||
import Spinner from 'component/spinner';
|
||||
|
||||
type Props = {
|
||||
claimIsMine: boolean,
|
||||
fetchedReplies: Array<Comment>,
|
||||
hasMore: boolean,
|
||||
isFetchingByParentId: { [string]: boolean },
|
||||
linkedCommentId?: string,
|
||||
numDirectReplies: number, // Total replies for parentId as reported by 'comment[replies]'. Includes blocked items.
|
||||
parentId: string,
|
||||
resolvedReplies: Array<Comment>,
|
||||
supportDisabled: boolean,
|
||||
threadDepth: number,
|
||||
uri: string,
|
||||
parentId: string,
|
||||
claimIsMine: boolean,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
linkedCommentId?: string,
|
||||
userCanComment: boolean,
|
||||
threadDepth: number,
|
||||
numDirectReplies: number, // Total replies for parentId as reported by 'comment[replies]'. Includes blocked items.
|
||||
isFetchingByParentId: { [string]: boolean },
|
||||
hasMore: boolean,
|
||||
supportDisabled: boolean,
|
||||
doResolveUris: (Array<string>) => void,
|
||||
onShowMore?: () => void,
|
||||
};
|
||||
|
||||
function CommentsReplies(props: Props) {
|
||||
const {
|
||||
claimIsMine,
|
||||
fetchedReplies,
|
||||
hasMore,
|
||||
isFetchingByParentId,
|
||||
linkedCommentId,
|
||||
numDirectReplies,
|
||||
parentId,
|
||||
resolvedReplies,
|
||||
supportDisabled,
|
||||
threadDepth,
|
||||
uri,
|
||||
parentId,
|
||||
fetchedReplies,
|
||||
resolvedReplies,
|
||||
claimIsMine,
|
||||
myChannels,
|
||||
linkedCommentId,
|
||||
userCanComment,
|
||||
threadDepth,
|
||||
numDirectReplies,
|
||||
isFetchingByParentId,
|
||||
hasMore,
|
||||
supportDisabled,
|
||||
doResolveUris,
|
||||
onShowMore,
|
||||
} = props;
|
||||
|
||||
const [isExpanded, setExpanded] = React.useState(true);
|
||||
const [commentsToDisplay, setCommentsToDisplay] = React.useState(fetchedReplies);
|
||||
|
||||
const isResolvingReplies = fetchedReplies && resolvedReplies.length !== fetchedReplies.length;
|
||||
const alreadyResolved = !isResolvingReplies && resolvedReplies.length !== 0;
|
||||
const canDisplayComments = commentsToDisplay && commentsToDisplay.length === fetchedReplies.length;
|
||||
@@ -53,7 +53,7 @@ function CommentsReplies(props: Props) {
|
||||
if (!fetchedReplies || alreadyResolved) return;
|
||||
|
||||
const urisToResolve = [];
|
||||
fetchedReplies.forEach(({ channel_url }) => channel_url !== undefined && urisToResolve.push(channel_url));
|
||||
fetchedReplies.map(({ channel_url }) => channel_url !== undefined && urisToResolve.push(channel_url));
|
||||
|
||||
if (urisToResolve.length > 0) doResolveUris(urisToResolve);
|
||||
}, [alreadyResolved, doResolveUris, fetchedReplies]);
|
||||
@@ -65,7 +65,7 @@ function CommentsReplies(props: Props) {
|
||||
}, [isResolvingReplies, fetchedReplies]);
|
||||
|
||||
return !numDirectReplies ? null : (
|
||||
<div className="commentReplies__container">
|
||||
<div className="comment__replies-container">
|
||||
{!isExpanded ? (
|
||||
<div className="comment__actions--nested">
|
||||
<Button
|
||||
@@ -83,22 +83,35 @@ function CommentsReplies(props: Props) {
|
||||
{!isResolvingReplies &&
|
||||
commentsToDisplay &&
|
||||
commentsToDisplay.length > 0 &&
|
||||
commentsToDisplay.map((comment: Comment) => (
|
||||
commentsToDisplay.map((comment) => (
|
||||
<Comment
|
||||
claimIsMine={claimIsMine}
|
||||
comment={comment}
|
||||
commentingEnabled={userCanComment}
|
||||
key={comment.comment_id}
|
||||
linkedCommentId={linkedCommentId}
|
||||
supportDisabled={supportDisabled}
|
||||
threadDepth={threadDepth}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
claimId={comment.claim_id}
|
||||
commentId={comment.comment_id}
|
||||
key={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={
|
||||
comment.channel_id &&
|
||||
myChannels &&
|
||||
myChannels.some(({ claim_id }) => claim_id === comment.channel_id)
|
||||
}
|
||||
linkedCommentId={linkedCommentId}
|
||||
commentingEnabled={userCanComment}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
supportDisabled={supportDisabled}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isExpanded && fetchedReplies && hasMore && (
|
||||
<div className="comment__actions--nested">
|
||||
<Button
|
||||
@@ -109,10 +122,11 @@ function CommentsReplies(props: Props) {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(isFetchingByParentId[parentId] || isResolvingReplies || !canDisplayComments) && (
|
||||
<div className="comment__actions--nested">
|
||||
<Spinner type="small" />
|
||||
<div className="comment__replies-container">
|
||||
<div className="comment__actions--nested">
|
||||
<Spinner type="small" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -92,8 +92,8 @@ class CreditAmount extends React.PureComponent<Props> {
|
||||
<span
|
||||
title={fullPrice}
|
||||
className={classnames(className, {
|
||||
superChat: superChat,
|
||||
'superChat--light': superChatLight,
|
||||
'super-chat': superChat,
|
||||
'super-chat--light': superChatLight,
|
||||
})}
|
||||
>
|
||||
<span className="credit-amount">{amountText}</span>
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
// @flow
|
||||
import { scaleToDevicePixelRatio } from 'util/scale';
|
||||
import debounce from 'util/debounce';
|
||||
import React from 'react';
|
||||
import debounce from 'util/debounce';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 50;
|
||||
|
||||
function scaleToDevicePixelRatio(value) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
||||
if (devicePixelRatio < 1.0) {
|
||||
return Math.ceil(value / devicePixelRatio);
|
||||
}
|
||||
return Math.ceil(value * devicePixelRatio);
|
||||
}
|
||||
|
||||
type Props = {
|
||||
children: any,
|
||||
skipWait?: boolean,
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function FileRenderDownload(props: Props) {
|
||||
subtitle={
|
||||
<p>
|
||||
{__(
|
||||
'This content can be downloaded from lbry.tv, but not displayed. It will display in LBRY Desktop, an app for desktop computers.'
|
||||
'This content can be downloaded from odysee.com, but not displayed. It will display in LBRY Desktop, an app for desktop computers.'
|
||||
)}
|
||||
</p>
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class FileValues extends PureComponent<Props> {
|
||||
<td>
|
||||
<div>
|
||||
{__('Total Staked Amount')}
|
||||
<HelpLink href="https://odysee.com/@OdyseeHelp:b/Monetization-of-Content:3" />
|
||||
<HelpLink href="https://odysee.com/@OdyseeHelp:b/trending:50" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@@ -90,7 +90,7 @@ class FileValues extends PureComponent<Props> {
|
||||
<tr>
|
||||
<td>
|
||||
{__('Community Choice?')}
|
||||
<HelpLink href="https://lbry.com/faq/naming" />
|
||||
<HelpLink href="https://odysee.com/@OdyseeHelp:b/trending:50" />
|
||||
</td>
|
||||
<td>
|
||||
<Button
|
||||
|
||||
@@ -5,11 +5,12 @@ import * as SETTINGS from 'constants/settings';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React from 'react';
|
||||
import { withRouter } from 'react-router';
|
||||
import { Link } from 'react-router-dom';
|
||||
import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
import WunderBar from 'component/wunderbar';
|
||||
import Icon from 'component/common/icon';
|
||||
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
|
||||
import { Menu, MenuList, MenuButton, MenuItem, MenuLink } from '@reach/menu-button';
|
||||
import NavigationButton from 'component/navigationButton';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import NotificationBubble from 'component/notificationBubble';
|
||||
@@ -324,26 +325,26 @@ const Header = (props: Props) => {
|
||||
)}
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list--header">
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.UPLOADS}`)}>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.UPLOADS}`}>
|
||||
<Icon aria-hidden icon={ICONS.PUBLISH} />
|
||||
{__('Uploads')}
|
||||
</MenuItem>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CHANNELS}`)}>
|
||||
</MenuLink>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.CHANNELS}`}>
|
||||
<Icon aria-hidden icon={ICONS.CHANNEL} />
|
||||
{__('Channels')}
|
||||
</MenuItem>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CREATOR_DASHBOARD}`)}>
|
||||
</MenuLink>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.CREATOR_DASHBOARD}`}>
|
||||
<Icon aria-hidden icon={ICONS.ANALYTICS} />
|
||||
{__('Creator Analytics')}
|
||||
</MenuItem>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.REWARDS}`)}>
|
||||
</MenuLink>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.REWARDS}`}>
|
||||
<Icon aria-hidden icon={ICONS.REWARDS} />
|
||||
{__('Rewards')}
|
||||
</MenuItem>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.INVITE}`)}>
|
||||
</MenuLink>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.INVITE}`}>
|
||||
<Icon aria-hidden icon={ICONS.INVITE} />
|
||||
{__('Invites')}
|
||||
</MenuItem>
|
||||
</MenuLink>
|
||||
|
||||
{authenticated ? (
|
||||
<MenuItem onSelect={IS_WEB ? signOut : openSignOutModal}>
|
||||
@@ -355,14 +356,14 @@ const Header = (props: Props) => {
|
||||
</MenuItem>
|
||||
) : !IS_WEB ? (
|
||||
<>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH}`)}>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.AUTH}`}>
|
||||
<Icon aria-hidden icon={ICONS.SIGN_UP} />
|
||||
{__('Sign Up')}
|
||||
</MenuItem>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH_SIGNIN}`)}>
|
||||
</MenuLink>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.AUTH_SIGNIN}`}>
|
||||
<Icon aria-hidden icon={ICONS.SIGN_IN} />
|
||||
{__('Sign In')}
|
||||
</MenuItem>
|
||||
</MenuLink>
|
||||
</>
|
||||
) : null}
|
||||
</MenuList>
|
||||
@@ -409,7 +410,7 @@ type HeaderMenuButtonProps = {
|
||||
};
|
||||
|
||||
function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
||||
const { authenticated, notificationsEnabled, history, handleThemeToggle, currentTheme, livestreamEnabled } = props;
|
||||
const { authenticated, notificationsEnabled, handleThemeToggle, currentTheme, livestreamEnabled } = props;
|
||||
|
||||
return (
|
||||
<div className="header__buttons">
|
||||
@@ -429,25 +430,25 @@ function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
||||
</MenuButton>
|
||||
|
||||
<MenuList className="menu__list--header">
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.UPLOAD}`)}>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.UPLOAD}`}>
|
||||
<Icon aria-hidden icon={ICONS.PUBLISH} />
|
||||
{__('Upload')}
|
||||
</MenuItem>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CHANNEL_NEW}`)}>
|
||||
</MenuLink>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.CHANNEL_NEW}`}>
|
||||
<Icon aria-hidden icon={ICONS.CHANNEL} />
|
||||
{__('New Channel')}
|
||||
</MenuItem>
|
||||
</MenuLink>
|
||||
{/* @if TARGET='web' */}
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.YOUTUBE_SYNC}`)}>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.YOUTUBE_SYNC}`}>
|
||||
<Icon aria-hidden icon={ICONS.YOUTUBE} />
|
||||
{__('Sync YouTube Channel')}
|
||||
</MenuItem>
|
||||
</MenuLink>
|
||||
{/* @endif */}
|
||||
{livestreamEnabled && (
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.LIVESTREAM}`)}>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.LIVESTREAM}`}>
|
||||
<Icon aria-hidden icon={ICONS.VIDEO} />
|
||||
{__('Go Live')}
|
||||
</MenuItem>
|
||||
</MenuLink>
|
||||
)}
|
||||
</MenuList>
|
||||
</Menu>
|
||||
@@ -469,14 +470,14 @@ function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
||||
<Icon size={18} icon={ICONS.SETTINGS} aria-hidden />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list--header">
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.SETTINGS}`)}>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.SETTINGS}`}>
|
||||
<Icon aria-hidden tooltip icon={ICONS.SETTINGS} />
|
||||
{__('Settings')}
|
||||
</MenuItem>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.HELP}`)}>
|
||||
</MenuLink>
|
||||
<MenuLink className="menu__link" as={Link} to={`/$/${PAGES.HELP}`}>
|
||||
<Icon aria-hidden icon={ICONS.HELP} />
|
||||
{__('Help')}
|
||||
</MenuItem>
|
||||
</MenuLink>
|
||||
<MenuItem className="menu__link" onSelect={handleThemeToggle}>
|
||||
<Icon icon={currentTheme === 'light' ? ICONS.DARK : ICONS.LIGHT} />
|
||||
{currentTheme === 'light' ? __('Dark') : __('Light')}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectStakedLevelForChannelUri, selectClaimForUri, selectMyChannelClaims } from 'redux/selectors/claims';
|
||||
import { makeSelectStakedLevelForChannelUri, selectClaimForUri } from 'redux/selectors/claims';
|
||||
import LivestreamComment from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: selectClaimForUri(state, props.uri),
|
||||
stakedLevel: makeSelectStakedLevelForChannelUri(props.authorUri)(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
});
|
||||
|
||||
export default connect(select)(LivestreamComment);
|
||||
@@ -1,87 +1,102 @@
|
||||
// @flow
|
||||
import 'scss/component/_livestream-comment.scss';
|
||||
import { Menu, MenuButton } from '@reach/menu-button';
|
||||
import { parseSticker } from 'util/comments';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import React from 'react';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { Menu, MenuButton } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
import classnames from 'classnames';
|
||||
import CommentMenuList from 'component/commentMenuList';
|
||||
import Button from 'component/button';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import Icon from 'component/common/icon';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import React from 'react';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import { parseSticker } from 'util/comments';
|
||||
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
comment: Comment,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
stakedLevel: number,
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
authorUri: string,
|
||||
commentId: string,
|
||||
message: string,
|
||||
commentIsMine: boolean,
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
isPinned: boolean,
|
||||
};
|
||||
|
||||
function LivestreamComment(props: Props) {
|
||||
const { claim, comment, myChannels, stakedLevel, uri } = props;
|
||||
|
||||
const {
|
||||
channel_url: authorUri,
|
||||
channel_id: authorId,
|
||||
comment_id: commentId,
|
||||
comment: message,
|
||||
is_fiat: isFiat,
|
||||
is_global_mod: isGlobalMod,
|
||||
is_moderator: isModerator,
|
||||
is_pinned: isPinned,
|
||||
support_amount: supportAmount,
|
||||
} = comment;
|
||||
const commentIsMine = authorId && myChannels && myChannels.some(({ claim_id }) => claim_id === authorId);
|
||||
claim,
|
||||
uri,
|
||||
authorUri,
|
||||
message,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
isPinned,
|
||||
} = props;
|
||||
|
||||
const commentByContentOwner = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const { claimName } = parseURI(authorUri);
|
||||
const stickerFromMessage = parseSticker(message);
|
||||
let claimName;
|
||||
try {
|
||||
authorUri && ({ claimName } = parseURI(authorUri));
|
||||
} catch (e) {}
|
||||
|
||||
const commentBadge = (label: string, icon: string, className?: string) => (
|
||||
<Tooltip label={label}>
|
||||
<span className={classnames('comment__badge', { className })}>
|
||||
<Icon icon={icon} size={16} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
return (
|
||||
<li
|
||||
className={classnames('livestreamComment', {
|
||||
'livestreamComment--superchat': supportAmount > 0,
|
||||
'livestreamComment--sticker': Boolean(stickerFromMessage),
|
||||
className={classnames('livestream-comment', {
|
||||
'livestream-comment--superchat': supportAmount > 0,
|
||||
'livestream-comment--sticker': Boolean(stickerFromMessage),
|
||||
})}
|
||||
>
|
||||
{supportAmount > 0 && (
|
||||
<div className="superChat livestreamComment__superchatBanner">
|
||||
<div className="livestreamComment__superchatBanner-corner" />
|
||||
<CreditAmount isFiat={isFiat} amount={supportAmount} superChat className="livestreamSuperchat__amount" />
|
||||
<div className="super-chat livestream-superchat__banner">
|
||||
<div className="livestream-superchat__banner-corner" />
|
||||
<CreditAmount isFiat={isFiat} amount={supportAmount} superChat className="livestream-superchat__amount" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="livestreamComment__body">
|
||||
<div className="livestream-comment__body">
|
||||
{(supportAmount > 0 || Boolean(stickerFromMessage)) && <ChannelThumbnail uri={authorUri} xsmall />}
|
||||
<div
|
||||
className={classnames('livestreamComment__info', {
|
||||
'livestreamComment__info--sticker': Boolean(stickerFromMessage),
|
||||
className={classnames('livestream-comment__info', {
|
||||
'livestream-comment__info--sticker': Boolean(stickerFromMessage),
|
||||
})}
|
||||
>
|
||||
{isGlobalMod && commentBadge(__('Admin'), ICONS.BADGE_MOD, 'comment__badge--globalMod')}
|
||||
{isModerator && commentBadge(__('Moderator'), ICONS.BADGE_MOD, 'comment__badge--mod')}
|
||||
{commentByContentOwner && commentBadge(__('Streamer'), ICONS.BADGE_STREAMER)}
|
||||
{isGlobalMod && (
|
||||
<Tooltip label={__('Admin')}>
|
||||
<span className="comment__badge comment__badge--global-mod">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={16} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{isModerator && (
|
||||
<Tooltip label={__('Moderator')}>
|
||||
<span className="comment__badge comment__badge--mod">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={16} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{commentByOwnerOfContent && (
|
||||
<Tooltip label={__('Streamer')}>
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_STREAMER} size={16} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
<Button
|
||||
className={classnames('button--uri-indicator comment__author', {
|
||||
'comment__author--creator': commentByContentOwner,
|
||||
'comment__author--creator': commentByOwnerOfContent,
|
||||
})}
|
||||
target="_blank"
|
||||
navigate={authorUri}
|
||||
@@ -97,18 +112,18 @@ function LivestreamComment(props: Props) {
|
||||
)}
|
||||
|
||||
{stickerFromMessage ? (
|
||||
<div className="comment__message--sticker">
|
||||
<div className="sticker__comment">
|
||||
<OptimizedImage src={stickerFromMessage.url} waitLoad />
|
||||
</div>
|
||||
) : (
|
||||
<div className="livestreamComment__text">
|
||||
<div className="livestream-comment__text">
|
||||
<MarkdownPreview content={message} promptLinks stakedLevel={stakedLevel} disableTimestamps />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="livestreamComment__menu">
|
||||
<div className="livestream-comment__menu">
|
||||
<Menu>
|
||||
<MenuButton className="menu__button">
|
||||
<Icon size={18} icon={ICONS.MORE_VERTICAL} />
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import { selectClaimForUri, selectMyClaimIdsRaw } from 'redux/selectors/claims';
|
||||
import { doCommentSocketConnect, doCommentSocketDisconnect } from 'redux/actions/websocket';
|
||||
import { doCommentList, doSuperChatList } from 'redux/actions/comments';
|
||||
import {
|
||||
selectTopLevelCommentsForUri,
|
||||
selectIsFetchingComments,
|
||||
makeSelectSuperChatsForUri,
|
||||
makeSelectSuperChatTotalAmountForUri,
|
||||
selectSuperChatsForUri,
|
||||
selectSuperChatTotalAmountForUri,
|
||||
selectPinnedCommentsForUri,
|
||||
} from 'redux/selectors/comments';
|
||||
import LivestreamComments from './view';
|
||||
@@ -18,8 +19,9 @@ const select = (state, props) => ({
|
||||
comments: selectTopLevelCommentsForUri(state, props.uri, MAX_LIVESTREAM_COMMENTS),
|
||||
pinnedComments: selectPinnedCommentsForUri(state, props.uri),
|
||||
fetchingComments: selectIsFetchingComments(state),
|
||||
superChats: makeSelectSuperChatsForUri(props.uri)(state),
|
||||
superChatsTotalAmount: makeSelectSuperChatTotalAmountForUri(props.uri)(state),
|
||||
superChats: selectSuperChatsForUri(state, props.uri),
|
||||
superChatsTotalAmount: selectSuperChatTotalAmountForUri(state, props.uri),
|
||||
myChannelIds: selectMyClaimIdsRaw(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
@@ -27,4 +29,5 @@ export default connect(select, {
|
||||
doCommentSocketDisconnect,
|
||||
doCommentList,
|
||||
doSuperChatList,
|
||||
doResolveUris,
|
||||
})(LivestreamComments);
|
||||
@@ -1,51 +1,55 @@
|
||||
// @flow
|
||||
import 'scss/component/_livestream-comments.scss';
|
||||
import { parseSticker } from 'util/comments';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import classnames from 'classnames';
|
||||
import CommentCreate from 'component/commentCreate';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import LivestreamComment from 'component/livestreamComment';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Spinner from 'component/spinner';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import CommentCreate from 'component/commentCreate';
|
||||
import LivestreamComment from 'component/livestreamComment';
|
||||
import Button from 'component/button';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import { parseSticker } from 'util/comments';
|
||||
|
||||
type Props = {
|
||||
activeViewers: number,
|
||||
claim: ?StreamClaim,
|
||||
comments: Array<Comment>,
|
||||
embed?: boolean,
|
||||
fetchingComments: boolean,
|
||||
pinnedComments: Array<Comment>,
|
||||
superChats: Array<Comment>,
|
||||
uri: string,
|
||||
doCommentList: (string, string, number, number) => void,
|
||||
claim: ?StreamClaim,
|
||||
activeViewers: number,
|
||||
embed?: boolean,
|
||||
doCommentSocketConnect: (string, string) => void,
|
||||
doCommentSocketDisconnect: (string) => void,
|
||||
doCommentList: (string, string, number, number) => void,
|
||||
comments: Array<Comment>,
|
||||
pinnedComments: Array<Comment>,
|
||||
fetchingComments: boolean,
|
||||
doSuperChatList: (string) => void,
|
||||
superChats: Array<Comment>,
|
||||
myChannelIds: ?Array<string>,
|
||||
doResolveUris: (Array<string>, boolean) => void,
|
||||
};
|
||||
|
||||
const VIEW_MODE_CHAT = 'view_chat';
|
||||
const VIEW_MODE_SUPER_CHAT = 'view_superchat';
|
||||
const COMMENT_SCROLL_TIMEOUT = 25;
|
||||
const LARGE_SUPER_CHAT_LIST_THRESHOLD = 20;
|
||||
|
||||
export default function LivestreamComments(props: Props) {
|
||||
const {
|
||||
claim,
|
||||
comments: commentsByChronologicalOrder,
|
||||
embed,
|
||||
fetchingComments,
|
||||
pinnedComments,
|
||||
superChats: superChatsByTipAmount,
|
||||
uri,
|
||||
doCommentList,
|
||||
embed,
|
||||
doCommentSocketConnect,
|
||||
doCommentSocketDisconnect,
|
||||
comments: commentsByChronologicalOrder,
|
||||
pinnedComments,
|
||||
doCommentList,
|
||||
fetchingComments,
|
||||
doSuperChatList,
|
||||
myChannelIds,
|
||||
superChats: superChatsByTipAmount,
|
||||
doResolveUris,
|
||||
} = props;
|
||||
|
||||
let superChatsFiatAmount, superChatsLBCAmount, superChatsTotalAmount, hasSuperChats;
|
||||
@@ -54,30 +58,44 @@ export default function LivestreamComments(props: Props) {
|
||||
const [viewMode, setViewMode] = React.useState(VIEW_MODE_CHAT);
|
||||
const [scrollPos, setScrollPos] = React.useState(0);
|
||||
const [showPinned, setShowPinned] = React.useState(true);
|
||||
|
||||
const [resolvingSuperChat, setResolvingSuperChat] = React.useState(false);
|
||||
const claimId = claim && claim.claim_id;
|
||||
const commentsLength = commentsByChronologicalOrder && commentsByChronologicalOrder.length;
|
||||
// which kind of superchat to display, either
|
||||
|
||||
const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? commentsByChronologicalOrder : superChatsByTipAmount;
|
||||
const stickerSuperChats =
|
||||
superChatsByTipAmount && superChatsByTipAmount.filter(({ comment }) => Boolean(parseSticker(comment)));
|
||||
|
||||
const discussionElement = document.querySelector('.livestream__comments');
|
||||
|
||||
const pinnedComment = pinnedComments.length > 0 ? pinnedComments[0] : null;
|
||||
|
||||
let superChatsReversed;
|
||||
// array of superchats organized by fiat or not first, then support amount
|
||||
if (superChatsByTipAmount) {
|
||||
const clonedSuperchats = JSON.parse(JSON.stringify(superChatsByTipAmount));
|
||||
|
||||
// for top to bottom display, oldest superchat on top most recent on bottom
|
||||
superChatsReversed = clonedSuperchats.sort((a, b) => b.timestamp - a.timestamp);
|
||||
}
|
||||
|
||||
const restoreScrollPos = React.useCallback(() => {
|
||||
if (discussionElement) discussionElement.scrollTop = 0;
|
||||
if (discussionElement) {
|
||||
discussionElement.scrollTop = 0;
|
||||
}
|
||||
}, [discussionElement]);
|
||||
|
||||
const superChatTopTen = React.useMemo(() => {
|
||||
return superChatsByTipAmount ? superChatsByTipAmount.slice(0, 10) : superChatsByTipAmount;
|
||||
}, [superChatsByTipAmount]);
|
||||
|
||||
const showMoreSuperChatsButton =
|
||||
superChatTopTen && superChatsByTipAmount && superChatTopTen.length < superChatsByTipAmount.length;
|
||||
|
||||
function resolveSuperChat() {
|
||||
if (superChatsByTipAmount && superChatsByTipAmount.length > 0) {
|
||||
doResolveUris(
|
||||
superChatsByTipAmount.map((comment) => comment.channel_url || '0'),
|
||||
true
|
||||
);
|
||||
|
||||
if (superChatsByTipAmount.length > LARGE_SUPER_CHAT_LIST_THRESHOLD) {
|
||||
setResolvingSuperChat(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (claimId) {
|
||||
doCommentList(uri, '', 1, 75);
|
||||
@@ -126,6 +144,24 @@ export default function LivestreamComments(props: Props) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [commentsLength]); // (Just respond to 'commentsLength' updates and nothing else)
|
||||
|
||||
// Stop spinner for resolving superchats
|
||||
React.useEffect(() => {
|
||||
if (resolvingSuperChat) {
|
||||
// The real solution to the sluggishness is to fix the claim store/selectors
|
||||
// and to paginate the long superchat list. This serves as a band-aid,
|
||||
// showing a spinner while we batch-resolve. The duration is just a rough
|
||||
// estimate -- the lag will handle the remaining time.
|
||||
const timer = setTimeout(() => {
|
||||
setResolvingSuperChat(false);
|
||||
// Scroll to the top:
|
||||
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
||||
const divHeight = livestreamCommentsDiv.scrollHeight;
|
||||
livestreamCommentsDiv.scrollTop = divHeight * -1;
|
||||
}, 1000);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
}, [resolvingSuperChat]);
|
||||
|
||||
// sum total amounts for fiat tips and lbc tips
|
||||
if (superChatsByTipAmount) {
|
||||
let fiatAmount = 0;
|
||||
@@ -144,41 +180,66 @@ export default function LivestreamComments(props: Props) {
|
||||
hasSuperChats = (superChatsTotalAmount || 0) > 0;
|
||||
}
|
||||
|
||||
let superChatsReversed;
|
||||
// array of superchats organized by fiat or not first, then support amount
|
||||
if (superChatsByTipAmount) {
|
||||
const clonedSuperchats = JSON.parse(JSON.stringify(superChatsByTipAmount));
|
||||
|
||||
// for top to bottom display, oldest superchat on top most recent on bottom
|
||||
superChatsReversed = clonedSuperchats.sort((a, b) => {
|
||||
return b.timestamp - a.timestamp;
|
||||
});
|
||||
}
|
||||
|
||||
// todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine
|
||||
function isMyComment(channelId: string) {
|
||||
return myChannelIds ? myChannelIds.includes(channelId) : false;
|
||||
}
|
||||
|
||||
if (!claim) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function getStickerUrl(comment: string) {
|
||||
const stickerFromComment = parseSticker(comment);
|
||||
return stickerFromComment && stickerFromComment.url;
|
||||
}
|
||||
|
||||
const getChatContentToggle = (toggleMode: string, label: any) => (
|
||||
<Button
|
||||
className={classnames('button-toggle', { 'button-toggle--active': viewMode === toggleMode })}
|
||||
label={label}
|
||||
onClick={() => {
|
||||
setViewMode(toggleMode);
|
||||
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
||||
const divHeight = livestreamCommentsDiv.scrollHeight;
|
||||
livestreamCommentsDiv.scrollTop = toggleMode === VIEW_MODE_CHAT ? divHeight : divHeight * -1;
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
return !claim ? null : (
|
||||
return (
|
||||
<div className="card livestream__discussion">
|
||||
<div className="card__header--between livestreamDiscussion__header">
|
||||
<div className="card__title-section--small livestreamDiscussion__title">{__('Live discussion')}</div>
|
||||
<div className="card__header--between livestream-discussion__header">
|
||||
<div className="livestream-discussion__title">{__('Live discussion')}</div>
|
||||
{hasSuperChats && (
|
||||
<div className="recommended-content__toggles">
|
||||
{/* the superchats in chronological order button */}
|
||||
{getChatContentToggle(VIEW_MODE_CHAT, __('Chat'))}
|
||||
<Button
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': viewMode === VIEW_MODE_CHAT,
|
||||
})}
|
||||
label={__('Chat')}
|
||||
onClick={() => {
|
||||
setViewMode(VIEW_MODE_CHAT);
|
||||
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
||||
livestreamCommentsDiv.scrollTop = livestreamCommentsDiv.scrollHeight;
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* the button to show superchats listed by most to least support amount */}
|
||||
{getChatContentToggle(
|
||||
VIEW_MODE_SUPER_CHAT,
|
||||
<>
|
||||
<CreditAmount amount={superChatsTotalAmount || 0} size={8} /> /
|
||||
<CreditAmount amount={superChatsFiatAmount || 0} size={8} isFiat /> {__('Tipped')}
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': viewMode === VIEW_MODE_SUPER_CHAT,
|
||||
})}
|
||||
label={
|
||||
<>
|
||||
<CreditAmount amount={superChatsLBCAmount || 0} size={8} /> /
|
||||
<CreditAmount amount={superChatsFiatAmount || 0} size={8} isFiat /> {__('Tipped')}
|
||||
</>
|
||||
}
|
||||
onClick={() => {
|
||||
resolveSuperChat();
|
||||
setViewMode(VIEW_MODE_SUPER_CHAT);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -188,11 +249,11 @@ export default function LivestreamComments(props: Props) {
|
||||
<Spinner />
|
||||
</div>
|
||||
)}
|
||||
<div ref={commentsRef} className="livestreamComments__wrapper">
|
||||
<div ref={commentsRef} className="livestream__comments-wrapper">
|
||||
{viewMode === VIEW_MODE_CHAT && superChatsByTipAmount && hasSuperChats && (
|
||||
<div className="livestreamSuperchats__wrapper">
|
||||
<div className="livestreamSuperchats__inner">
|
||||
{superChatsByTipAmount.map((superChat: Comment) => {
|
||||
<div className="livestream-superchats__wrapper">
|
||||
<div className="livestream-superchats__inner">
|
||||
{superChatTopTen.map((superChat: Comment) => {
|
||||
const isSticker = stickerSuperChats && stickerSuperChats.includes(superChat);
|
||||
|
||||
const SuperChatWrapper = !isSticker
|
||||
@@ -201,28 +262,28 @@ export default function LivestreamComments(props: Props) {
|
||||
|
||||
return (
|
||||
<SuperChatWrapper key={superChat.comment_id}>
|
||||
<div className="livestreamSuperchat">
|
||||
<div className="livestreamSuperchat__thumbnail">
|
||||
<div className="livestream-superchat">
|
||||
<div className="livestream-superchat__thumbnail">
|
||||
<ChannelThumbnail uri={superChat.channel_url} xsmall />
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={classnames('livestreamSuperchat__info', {
|
||||
'livestreamSuperchat__info--sticker': isSticker,
|
||||
'livestreamSuperchat__info--notSticker': stickerSuperChats && !isSticker,
|
||||
className={classnames('livestream-superchat__info', {
|
||||
'livestream-superchat__info--sticker': isSticker,
|
||||
'livestream-superchat__info--not-sticker': stickerSuperChats && !isSticker,
|
||||
})}
|
||||
>
|
||||
<div className="livestreamSuperchat__info--user">
|
||||
<div className="livestream-superchat__info--user">
|
||||
<UriIndicator uri={superChat.channel_url} link />
|
||||
<CreditAmount
|
||||
size={10}
|
||||
className="livestreamSuperchat__amount-large"
|
||||
className="livestream-superchat__amount-large"
|
||||
amount={superChat.support_amount}
|
||||
isFiat={superChat.is_fiat}
|
||||
/>
|
||||
</div>
|
||||
{stickerSuperChats.includes(superChat) && getStickerUrl(superChat.comment) && (
|
||||
<div className="livestreamSuperchat__info--image">
|
||||
<div className="livestream-superchat__info--image">
|
||||
<OptimizedImage src={getStickerUrl(superChat.comment)} waitLoad />
|
||||
</div>
|
||||
)}
|
||||
@@ -231,13 +292,37 @@ export default function LivestreamComments(props: Props) {
|
||||
</SuperChatWrapper>
|
||||
);
|
||||
})}
|
||||
{showMoreSuperChatsButton && (
|
||||
<Button
|
||||
title={__('Show More...')}
|
||||
button="inverse"
|
||||
className="close-button"
|
||||
onClick={() => {
|
||||
resolveSuperChat();
|
||||
setViewMode(VIEW_MODE_SUPER_CHAT);
|
||||
}}
|
||||
icon={ICONS.MORE}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{pinnedComment && showPinned && viewMode === VIEW_MODE_CHAT && (
|
||||
<div className="livestreamPinned__wrapper">
|
||||
<LivestreamComment key={pinnedComment.comment_id} uri={uri} comment={pinnedComment} />
|
||||
<div className="livestream-pinned__wrapper">
|
||||
<LivestreamComment
|
||||
key={pinnedComment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={pinnedComment.channel_url}
|
||||
commentId={pinnedComment.comment_id}
|
||||
message={pinnedComment.comment}
|
||||
supportAmount={pinnedComment.support_amount}
|
||||
isModerator={pinnedComment.is_moderator}
|
||||
isGlobalMod={pinnedComment.is_global_mod}
|
||||
isFiat={pinnedComment.is_fiat}
|
||||
isPinned={pinnedComment.is_pinned}
|
||||
commentIsMine={pinnedComment.channel_id && isMyComment(pinnedComment.channel_id)}
|
||||
/>
|
||||
<Button
|
||||
title={__('Dismiss pinned comment')}
|
||||
button="inverse"
|
||||
@@ -253,14 +338,42 @@ export default function LivestreamComments(props: Props) {
|
||||
<div className="livestream__comments">
|
||||
{viewMode === VIEW_MODE_CHAT &&
|
||||
commentsToDisplay.map((comment) => (
|
||||
<LivestreamComment key={comment.comment_id} uri={uri} comment={comment} />
|
||||
<LivestreamComment
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
supportAmount={comment.support_amount}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
/>
|
||||
))}
|
||||
|
||||
{/* listing comments on top of eachother */}
|
||||
{viewMode === VIEW_MODE_SUPER_CHAT && resolvingSuperChat && (
|
||||
<div className="main--empty">
|
||||
<Spinner />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{viewMode === VIEW_MODE_SUPER_CHAT &&
|
||||
!resolvingSuperChat &&
|
||||
superChatsReversed &&
|
||||
superChatsReversed.map((comment) => (
|
||||
<LivestreamComment key={comment.comment_id} uri={uri} comment={comment} />
|
||||
<LivestreamComment
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
supportAmount={comment.support_amount}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
@@ -270,14 +383,14 @@ export default function LivestreamComments(props: Props) {
|
||||
{scrollPos < 0 && viewMode === VIEW_MODE_CHAT && (
|
||||
<Button
|
||||
button="secondary"
|
||||
className="livestreamComments__scrollToRecent"
|
||||
className="livestream__comments__scroll-to-recent"
|
||||
label={__('Recent Comments')}
|
||||
onClick={restoreScrollPos}
|
||||
iconRight={ICONS.DOWN}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="livestream__commentCreate">
|
||||
<div className="livestream__comment-create">
|
||||
<CommentCreate livestream bottom embed={embed} uri={uri} onDoneReplying={restoreScrollPos} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
// @flow
|
||||
import { getThumbnailCdnUrl } from 'util/thumbnail';
|
||||
import { scaleToDevicePixelRatio } from 'util/scale';
|
||||
import React from 'react';
|
||||
import { getThumbnailCdnUrl } from 'util/thumbnail';
|
||||
|
||||
function scaleToDevicePixelRatio(value: number, window: any) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
||||
return Math.ceil(value * devicePixelRatio);
|
||||
}
|
||||
|
||||
type Props = {
|
||||
src: string,
|
||||
@@ -36,8 +40,8 @@ function OptimizedImage(props: Props) {
|
||||
let width = elem.parentElement.clientWidth;
|
||||
let height = elem.parentElement.clientHeight;
|
||||
|
||||
width = scaleToDevicePixelRatio(width);
|
||||
height = scaleToDevicePixelRatio(height);
|
||||
width = scaleToDevicePixelRatio(width, window);
|
||||
height = scaleToDevicePixelRatio(height, window);
|
||||
|
||||
// Round to next 100px for better caching
|
||||
width = Math.ceil(width / 100) * 100;
|
||||
|
||||
@@ -96,12 +96,12 @@ function PrivacyAgreement(props: Props) {
|
||||
checked={share === LIMITED}
|
||||
label={
|
||||
<>
|
||||
{__('Yes, but only with LBRY, Inc.')} <span>🙂</span>
|
||||
{__('Yes, but only with Odysee, Inc.')} <span>🙂</span>
|
||||
</>
|
||||
}
|
||||
helper={__(
|
||||
`Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as
|
||||
well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.`
|
||||
`Sharing information with Odysee, Inc. allows us to report to publishers how their content is doing, as
|
||||
well as track basic usage and performance. This is the minimum required to earn rewards from Odysee, Inc.`
|
||||
)}
|
||||
onChange={(e) => setShare(LIMITED)}
|
||||
/>
|
||||
@@ -115,7 +115,7 @@ function PrivacyAgreement(props: Props) {
|
||||
{__('No')} <span>😢</span>
|
||||
</>
|
||||
}
|
||||
helper={__(`No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as
|
||||
helper={__(`No information will be sent directly to Odysee Inc. or third-parties about your usage. Note that as
|
||||
peer-to-peer software, your IP address and potentially other system information can be sent to other
|
||||
users, though this information is not stored permanently.`)}
|
||||
onChange={(e) => setShare(NONE)}
|
||||
@@ -128,7 +128,7 @@ function PrivacyAgreement(props: Props) {
|
||||
signout_button: <Button button="link" label={__('Sign Out')} onClick={signOut} />,
|
||||
}}
|
||||
>
|
||||
You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.
|
||||
You are signed into odysee.com which automatically shares data with LBRY inc. %signout_button%.
|
||||
</I18nMessage>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -52,9 +52,7 @@ function PublishFormErrors(props: Props) {
|
||||
) : (
|
||||
thumbnailError && !thumbnailUploaded && <div>{__('Thumbnail is invalid.')}</div>
|
||||
)}
|
||||
{editingURI && !isStillEditing && !filePath && (
|
||||
<div>{__('Please reselect a file after changing the LBRY URL')}</div>
|
||||
)}
|
||||
{editingURI && !isStillEditing && !filePath && <div>{__('Please reselect a file after changing the URL')}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ export default function SearchTopClaim(props: Props) {
|
||||
<div className="claim-preview__actions--header">
|
||||
<a
|
||||
className="media__uri"
|
||||
href="https://odysee.com/@OdyseeHelp:b/OdyseeBasics:c"
|
||||
title={__('Learn more about LBRY Credits on %DOMAIN%', { DOMAIN })}
|
||||
href="https://odysee.com/@OdyseeHelp:b/trending:50"
|
||||
title={__('Learn more about Credits on %DOMAIN%', { DOMAIN })}
|
||||
>
|
||||
<LbcSymbol prefix={__('Most supported')} />
|
||||
</a>
|
||||
|
||||
@@ -10,7 +10,7 @@ import Card from 'component/common/card';
|
||||
type Props = {
|
||||
cancelButton: Node,
|
||||
email: string,
|
||||
resendVerificationEmail: string => void,
|
||||
resendVerificationEmail: (string) => void,
|
||||
checkEmailVerified: () => void,
|
||||
user: {
|
||||
has_verified_email: boolean,
|
||||
@@ -35,12 +35,12 @@ function UserEmail(props: Props) {
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={__('lbry.tv Account')}
|
||||
title={__('odysee.com Account')}
|
||||
subtitle={
|
||||
isVerified
|
||||
? undefined
|
||||
: __(
|
||||
'Creating a lbry.tv account will allow you to earn rewards, receive content and security updates, and optionally backup your data.'
|
||||
'Creating a odysee.com account will allow you to earn rewards, receive content and security updates, and optionally backup your data.'
|
||||
)
|
||||
}
|
||||
actions={
|
||||
|
||||
@@ -151,7 +151,7 @@ class UserVerify extends React.PureComponent<Props> {
|
||||
<p>{__('You will be asked to provide proof of identity.')}</p>
|
||||
</>
|
||||
}
|
||||
actions={<Button href="https://chat.lbry.com" button="primary" label={__('Join LBRY Chat')} />}
|
||||
actions={<Button href="https://chat.lbry.com" button="primary" label={__('Join the Foundation Chat')} />}
|
||||
/>
|
||||
|
||||
<div className="section__divider">
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
import videojs from 'video.js';
|
||||
|
||||
function hitsFiftyPercent() {
|
||||
// from 0 - 999
|
||||
const rand = Math.floor(Math.random() * (1000 + 1));
|
||||
|
||||
// 499 is 50% chance of running
|
||||
if (rand > 499) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const adTags = {
|
||||
ford: '612fb75a42715a07645a614c',
|
||||
live: '60b354389c7adb506d0bd9a4',
|
||||
};
|
||||
|
||||
// Modified to work with IMA
|
||||
// const vastMacroUrl =
|
||||
// `https://vast.aniview.com/api/adserver61/vast/` +
|
||||
// `?AV_PUBLISHERID=60afcbc58cfdb065440d2426` +
|
||||
// `&AV_CHANNELID=${adTags.ford}` +
|
||||
// `&AV_URL=[URL]` +
|
||||
// `&cb=[CACHEBUSTING]` +
|
||||
// `&AV_WIDTH=[WIDTH]` +
|
||||
// `&AV_HEIGHT=[HEIGHT]` +
|
||||
// // `&AV_SCHAIN=[SCHAIN_MACRO]` +
|
||||
// // `&AV_CCPA=[CCPA_MACRO]` +
|
||||
// // `&AV_GDPR=[GDPR_MACRO]` +
|
||||
// // `&AV_CONSENT=[CONSENT_MACRO]` +
|
||||
// `&skip=true` +
|
||||
// `&skiptimer=5` +
|
||||
// `&logo=true` +
|
||||
// `&usevslot=true` +
|
||||
// `&vastretry=2` +
|
||||
// `&hidecontrols=false`;
|
||||
|
||||
// only run on chrome (brave included) and don't run on mobile for time being
|
||||
const browserIsChrome = videojs.browser.IS_CHROME;
|
||||
const IS_IOS = videojs.browser.IS_IOS;
|
||||
const IS_ANDROID = videojs.browser.IS_ANDROID;
|
||||
const IS_MOBILE = IS_IOS || IS_ANDROID;
|
||||
|
||||
const hitsAtFiftyPercentChance = hitsFiftyPercent();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param internalFeatureEnabled
|
||||
* @param allowPreRoll
|
||||
* @param player
|
||||
*/
|
||||
function runAds(internalFeatureEnabled, allowPreRoll, player) {
|
||||
// current timestamp for vpaid
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
const videoElement = document.getElementsByClassName('vjs-tech')[0];
|
||||
|
||||
// height and width of player
|
||||
const height = videoElement.offsetHeight;
|
||||
const width = videoElement.offsetWidth;
|
||||
|
||||
const vpaidMacroUrl =
|
||||
'https://gov.aniview.com/api/adserver/vast3/' +
|
||||
'?AV_PUBLISHERID=60afcbc58cfdb065440d2426' +
|
||||
`&AV_CHANNELID=${adTags.live}` +
|
||||
`&AV_URL=${encodeURIComponent(window.location.href)}` +
|
||||
`&cb=${encodeURIComponent(timestamp)}` +
|
||||
`&AV_WIDTH=${width}` +
|
||||
`&AV_HEIGHT=${height}` +
|
||||
// '&AV_SCHAIN=[SCHAIN_MACRO]' +
|
||||
// '&AV_CCPA=[CCPA_MACRO]' +
|
||||
// '&AV_GDPR=[GDPR_MACRO]' +
|
||||
// '&AV_CONSENT=[CONSENT_MACRO]' +
|
||||
`&skip=true` +
|
||||
`&skiptimer=5` +
|
||||
`&logo=true` +
|
||||
`&usevslot=true` +
|
||||
`&vastretry=2` +
|
||||
`&hidecontrols=false`;
|
||||
|
||||
// always have ads on if internal feature is on,
|
||||
// otherwise if not authed, roll for 20% to see an ad
|
||||
// allowPreRoll currently means unauthenticated (don't show to logged in users)
|
||||
const shouldShowAnAd = internalFeatureEnabled || (allowPreRoll && hitsAtFiftyPercentChance);
|
||||
|
||||
if (shouldShowAnAd && browserIsChrome && !IS_MOBILE) {
|
||||
// fire up ima integration via module
|
||||
player.ima({
|
||||
adTagUrl: vpaidMacroUrl,
|
||||
vpaidMode: 2, // 2 maps to insecure
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default runAds;
|
||||
@@ -0,0 +1,46 @@
|
||||
// ****************************************************************************
|
||||
// LbryVolumeBarClass
|
||||
// ****************************************************************************
|
||||
|
||||
import videojs from 'video.js';
|
||||
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
|
||||
const VIDEOJS_CONTROL_BAR_CLASS = 'ControlBar';
|
||||
const VIDEOJS_VOLUME_PANEL_CLASS = 'VolumePanel';
|
||||
const VIDEOJS_VOLUME_CONTROL_CLASS = 'VolumeControl';
|
||||
const VIDEOJS_VOLUME_BAR_CLASS = 'VolumeBar';
|
||||
|
||||
class LbryVolumeBarClass extends videojs.getComponent(VIDEOJS_VOLUME_BAR_CLASS) {
|
||||
constructor(player, options = {}) {
|
||||
super(player, options);
|
||||
}
|
||||
|
||||
static replaceExisting(player) {
|
||||
try {
|
||||
const volumeControl = player
|
||||
.getChild(VIDEOJS_CONTROL_BAR_CLASS)
|
||||
.getChild(VIDEOJS_VOLUME_PANEL_CLASS)
|
||||
.getChild(VIDEOJS_VOLUME_CONTROL_CLASS);
|
||||
const volumeBar = volumeControl.getChild(VIDEOJS_VOLUME_BAR_CLASS);
|
||||
volumeControl.removeChild(volumeBar);
|
||||
volumeControl.addChild(new LbryVolumeBarClass(player));
|
||||
} catch (error) {
|
||||
// In case it slips in 'Production', the original volume bar will be used and the site should still be working
|
||||
// (just not exactly the way we want).
|
||||
if (isDev) throw Error('\n\nvideojs.jsx: Volume Panel hierarchy changed?\n\n' + error);
|
||||
}
|
||||
}
|
||||
|
||||
handleMouseDown(event) {
|
||||
super.handleMouseDown(event);
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
handleMouseMove(event) {
|
||||
super.handleMouseMove(event);
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
export default LbryVolumeBarClass;
|
||||
@@ -0,0 +1,218 @@
|
||||
// @flow
|
||||
import { useEffect } from 'react';
|
||||
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
|
||||
const TAP = {
|
||||
NONE: 'NONE',
|
||||
UNMUTE: 'UNMUTE',
|
||||
RETRY: 'RETRY',
|
||||
};
|
||||
|
||||
const setLabel = (controlBar, childName, label) => {
|
||||
const c = controlBar.getChild(childName);
|
||||
if (c) {
|
||||
c.controlText(label);
|
||||
}
|
||||
};
|
||||
|
||||
export default ({ tapToUnmuteRef, tapToRetryRef, setReload, videoTheaterMode,
|
||||
playerRef, autoplaySetting, replay}) => {
|
||||
// Override the player's control text. We override to:
|
||||
// 1. Add keyboard shortcut to the tool-tip.
|
||||
// 2. Override videojs' i18n and use our own (don't want to have 2 systems).
|
||||
//
|
||||
// Notes:
|
||||
// - For dynamic controls (e.g. play/pause), those unfortunately need to be
|
||||
// updated again at their event-listener level (that's just the way videojs
|
||||
// updates the text), hence the need to listen to 'play', 'pause' and 'volumechange'
|
||||
// on top of just 'loadstart'.
|
||||
// - videojs changes the MuteToggle text at 'loadstart', so this was chosen
|
||||
// as the listener to update static texts.
|
||||
|
||||
function resolveCtrlText(e) {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
const ctrlBar = player.getChild('controlBar');
|
||||
switch (e.type) {
|
||||
case 'play':
|
||||
setLabel(ctrlBar, 'PlayToggle', __('Pause (space)'));
|
||||
break;
|
||||
case 'pause':
|
||||
setLabel(ctrlBar, 'PlayToggle', __('Play (space)'));
|
||||
break;
|
||||
case 'volumechange':
|
||||
ctrlBar
|
||||
.getChild('VolumePanel')
|
||||
.getChild('MuteToggle')
|
||||
.controlText(player.muted() || player.volume() === 0 ? __('Unmute (m)') : __('Mute (m)'));
|
||||
break;
|
||||
case 'fullscreenchange':
|
||||
setLabel(
|
||||
ctrlBar,
|
||||
'FullscreenToggle',
|
||||
player.isFullscreen() ? __('Exit Fullscreen (f)') : __('Fullscreen (f)')
|
||||
);
|
||||
break;
|
||||
case 'loadstart':
|
||||
// --- Do everything ---
|
||||
setLabel(ctrlBar, 'PlaybackRateMenuButton', __('Playback Rate (<, >)'));
|
||||
setLabel(ctrlBar, 'QualityButton', __('Quality'));
|
||||
setLabel(ctrlBar, 'PlayNextButton', __('Play Next (SHIFT+N)'));
|
||||
setLabel(ctrlBar, 'PlayPreviousButton', __('Play Previous (SHIFT+P)'));
|
||||
setLabel(ctrlBar, 'TheaterModeButton', videoTheaterMode ? __('Default Mode (t)') : __('Theater Mode (t)'));
|
||||
setLabel(ctrlBar, 'AutoplayNextButton', autoplaySetting ? __('Autoplay Next On') : __('Autoplay Next Off'));
|
||||
|
||||
resolveCtrlText({ type: 'play' });
|
||||
resolveCtrlText({ type: 'pause' });
|
||||
resolveCtrlText({ type: 'volumechange' });
|
||||
resolveCtrlText({ type: 'fullscreenchange' });
|
||||
break;
|
||||
default:
|
||||
if (isDev) throw Error('Unexpected: ' + e.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onInitialPlay() {
|
||||
const player = playerRef.current;
|
||||
if (player && (player.muted() || player.volume() === 0)) {
|
||||
// The css starts as "hidden". We make it visible here without
|
||||
// re-rendering the whole thing.
|
||||
showTapButton(TAP.UNMUTE);
|
||||
} else {
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
function onVolumeChange() {
|
||||
const player = playerRef.current;
|
||||
if (player && !player.muted()) {
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
function onError() {
|
||||
const player = playerRef.current;
|
||||
showTapButton(TAP.RETRY);
|
||||
|
||||
// reattach initial play listener in case we recover from error successfully
|
||||
// $FlowFixMe
|
||||
player.one('play', onInitialPlay);
|
||||
|
||||
if (player && player.loadingSpinner) {
|
||||
player.loadingSpinner.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// const onEnded = React.useCallback(() => {
|
||||
// if (!adUrl) {
|
||||
// showTapButton(TAP.NONE);
|
||||
// }
|
||||
// }, [adUrl]);
|
||||
|
||||
useEffect(() => {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
const controlBar = player.getChild('controlBar');
|
||||
controlBar
|
||||
.getChild('TheaterModeButton')
|
||||
.controlText(videoTheaterMode ? __('Default Mode (t)') : __('Theater Mode (t)'));
|
||||
}
|
||||
}, [videoTheaterMode]);
|
||||
|
||||
// when user clicks 'Unmute' button, turn audio on and hide unmute button
|
||||
function unmuteAndHideHint() {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
player.muted(false);
|
||||
if (player.volume() === 0) {
|
||||
player.volume(1.0);
|
||||
}
|
||||
}
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
|
||||
function retryVideoAfterFailure() {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
setReload(Date.now());
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
function showTapButton(tapButton) {
|
||||
const setButtonVisibility = (theRef, newState) => {
|
||||
// Use the DOM to control the state of the button to prevent re-renders.
|
||||
if (theRef.current) {
|
||||
const curState = theRef.current.style.visibility === 'visible';
|
||||
if (newState !== curState) {
|
||||
theRef.current.style.visibility = newState ? 'visible' : 'hidden';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
switch (tapButton) {
|
||||
case TAP.NONE:
|
||||
setButtonVisibility(tapToUnmuteRef, false);
|
||||
setButtonVisibility(tapToRetryRef, false);
|
||||
break;
|
||||
case TAP.UNMUTE:
|
||||
setButtonVisibility(tapToUnmuteRef, true);
|
||||
setButtonVisibility(tapToRetryRef, false);
|
||||
break;
|
||||
case TAP.RETRY:
|
||||
setButtonVisibility(tapToUnmuteRef, false);
|
||||
setButtonVisibility(tapToRetryRef, true);
|
||||
break;
|
||||
default:
|
||||
if (isDev) throw new Error('showTapButton: unexpected ref');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
const touchOverlay = player.getChild('TouchOverlay');
|
||||
const controlBar = player.getChild('controlBar') || touchOverlay.getChild('controlBar');
|
||||
const autoplayButton = controlBar.getChild('AutoplayNextButton');
|
||||
|
||||
if (autoplayButton) {
|
||||
const title = autoplaySetting ? __('Autoplay Next On') : __('Autoplay Next Off');
|
||||
|
||||
autoplayButton.controlText(title);
|
||||
autoplayButton.setAttribute('aria-label', title);
|
||||
autoplayButton.setAttribute('aria-checked', autoplaySetting);
|
||||
}
|
||||
}
|
||||
}, [autoplaySetting]);
|
||||
|
||||
useEffect(() => {
|
||||
const player = playerRef.current;
|
||||
if (replay && player) {
|
||||
player.play();
|
||||
}
|
||||
}, [replay]);
|
||||
|
||||
function initializeEvents() {
|
||||
const player = playerRef.current;
|
||||
// Add various event listeners to player
|
||||
player.one('play', onInitialPlay);
|
||||
player.on('play', resolveCtrlText);
|
||||
player.on('pause', resolveCtrlText);
|
||||
player.on('loadstart', resolveCtrlText);
|
||||
player.on('fullscreenchange', resolveCtrlText);
|
||||
player.on('volumechange', resolveCtrlText);
|
||||
player.on('volumechange', onVolumeChange);
|
||||
player.on('error', onError);
|
||||
// player.on('ended', onEnded);
|
||||
}
|
||||
|
||||
return {
|
||||
retryVideoAfterFailure,
|
||||
unmuteAndHideHint,
|
||||
initializeEvents,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
// @flow
|
||||
export default ({ source, sourceType, videoJsOptions, isAudio }) => {
|
||||
function detectFileType() {
|
||||
return new Promise(async (res, rej) => {
|
||||
try {
|
||||
const response = await fetch(source, { method: 'HEAD', cache: 'no-store' });
|
||||
|
||||
// Temp variables to hold results
|
||||
let finalType = sourceType;
|
||||
let finalSource = source;
|
||||
|
||||
// override type if we receive an .m3u8 (transcoded mp4)
|
||||
// do we need to check if explicitly redirected
|
||||
// or is checking extension only a safer method
|
||||
if (response && response.redirected && response.url && response.url.endsWith('m3u8')) {
|
||||
finalType = 'application/x-mpegURL';
|
||||
finalSource = response.url;
|
||||
}
|
||||
|
||||
// Modify video source in options
|
||||
videoJsOptions.sources = [
|
||||
{
|
||||
src: finalSource,
|
||||
type: finalType,
|
||||
},
|
||||
];
|
||||
|
||||
return res(videoJsOptions);
|
||||
} catch (error) {
|
||||
return rej(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: can remove this function as well
|
||||
// Create the video DOM element and wrapper
|
||||
function createVideoPlayerDOM(container) {
|
||||
if (!container) return;
|
||||
|
||||
// This seems like a poor way to generate the DOM for video.js
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.setAttribute('data-vjs-player', 'true');
|
||||
const el = document.createElement(isAudio ? 'audio' : 'video');
|
||||
el.className = 'video-js vjs-big-play-centered ';
|
||||
wrapper.appendChild(el);
|
||||
|
||||
container.appendChild(wrapper);
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
return {
|
||||
detectFileType,
|
||||
createVideoPlayerDOM,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,147 @@
|
||||
// @flow
|
||||
import * as OVERLAY from './overlays';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import isUserTyping from 'util/detect-typing';
|
||||
|
||||
const SEEK_STEP_5 = 5;
|
||||
const SEEK_STEP = 10; // time to seek in seconds
|
||||
|
||||
const videoPlaybackRates = [0.25, 0.5, 0.75, 1, 1.1, 1.25, 1.5, 1.75, 2];
|
||||
|
||||
// check if active (clicked) element is part of video div, used for keyboard shortcuts (volume etc)
|
||||
function activeElementIsPartOfVideoElement() {
|
||||
const videoElementParent = document.getElementsByClassName('video-js-parent')[0];
|
||||
const activeElement = document.activeElement;
|
||||
return videoElementParent.contains(activeElement);
|
||||
}
|
||||
|
||||
function volumeUp(event, playerRef) {
|
||||
// dont run if video element is not active element (otherwise runs when scrolling using keypad)
|
||||
const videoElementIsActive = activeElementIsPartOfVideoElement();
|
||||
const player = playerRef.current;
|
||||
if (!player || !videoElementIsActive) return;
|
||||
event.preventDefault();
|
||||
player.volume(player.volume() + 0.05);
|
||||
OVERLAY.showVolumeverlay(player, Math.round(player.volume() * 100));
|
||||
player.userActive(true);
|
||||
}
|
||||
|
||||
function volumeDown(event, playerRef) {
|
||||
// dont run if video element is not active element (otherwise runs when scrolling using keypad)
|
||||
const videoElementIsActive = activeElementIsPartOfVideoElement();
|
||||
const player = playerRef.current;
|
||||
if (!player || !videoElementIsActive) return;
|
||||
event.preventDefault();
|
||||
player.volume(player.volume() - 0.05);
|
||||
OVERLAY.showVolumeverlay(player, Math.round(player.volume() * 100));
|
||||
player.userActive(true);
|
||||
}
|
||||
|
||||
function seekVideo(stepSize: number, playerRef, containerRef) {
|
||||
const player = playerRef.current;
|
||||
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
|
||||
if (!videoNode || !player) return;
|
||||
const duration = videoNode.duration;
|
||||
const currentTime = videoNode.currentTime;
|
||||
const newDuration = currentTime + stepSize;
|
||||
if (newDuration < 0) {
|
||||
videoNode.currentTime = 0;
|
||||
} else if (newDuration > duration) {
|
||||
videoNode.currentTime = duration;
|
||||
} else {
|
||||
videoNode.currentTime = newDuration;
|
||||
}
|
||||
OVERLAY.showSeekedOverlay(player, Math.abs(stepSize), stepSize > 0);
|
||||
player.userActive(true);
|
||||
}
|
||||
|
||||
function toggleFullscreen(playerRef) {
|
||||
const player = playerRef.current;
|
||||
if (!player) return;
|
||||
if (!player.isFullscreen()) {
|
||||
player.requestFullscreen();
|
||||
} else {
|
||||
player.exitFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleMute(containerRef) {
|
||||
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
|
||||
if (!videoNode) return;
|
||||
videoNode.muted = !videoNode.muted;
|
||||
}
|
||||
|
||||
function togglePlay(containerRef) {
|
||||
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
|
||||
if (!videoNode) return;
|
||||
videoNode.paused ? videoNode.play() : videoNode.pause();
|
||||
}
|
||||
|
||||
function changePlaybackSpeed(shouldSpeedUp: boolean, playerRef) {
|
||||
const player = playerRef.current;
|
||||
if (!player) return;
|
||||
const isSpeedUp = shouldSpeedUp;
|
||||
const rate = player.playbackRate();
|
||||
let rateIndex = videoPlaybackRates.findIndex((x) => x === rate);
|
||||
if (rateIndex >= 0) {
|
||||
rateIndex = isSpeedUp ? Math.min(rateIndex + 1, videoPlaybackRates.length - 1) : Math.max(rateIndex - 1, 0);
|
||||
const nextRate = videoPlaybackRates[rateIndex];
|
||||
|
||||
OVERLAY.showPlaybackRateOverlay(player, nextRate, isSpeedUp);
|
||||
player.userActive(true);
|
||||
player.playbackRate(nextRate);
|
||||
}
|
||||
}
|
||||
|
||||
export default ({ playNext, playPrevious, toggleVideoTheaterMode }) => {
|
||||
function toggleTheaterMode(playerRef) {
|
||||
const player = playerRef.current;
|
||||
if (!player) return;
|
||||
// TODO: have to fix this
|
||||
toggleVideoTheaterMode();
|
||||
if (player.isFullscreen()) {
|
||||
player.exitFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
function handleKeyDown(e: KeyboardEvent, playerRef, containerRef) {
|
||||
const player = playerRef.current;
|
||||
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
|
||||
if (!videoNode || !player || isUserTyping()) return;
|
||||
handleSingleKeyActions(e, playerRef, containerRef);
|
||||
handleShiftKeyActions(e, playerRef);
|
||||
}
|
||||
|
||||
function handleShiftKeyActions(e: KeyboardEvent, playerRef) {
|
||||
if (e.altKey || e.ctrlKey || e.metaKey || !e.shiftKey) return;
|
||||
if (e.keyCode === KEYCODES.PERIOD) changePlaybackSpeed(true, playerRef);
|
||||
if (e.keyCode === KEYCODES.COMMA) changePlaybackSpeed(false, playerRef);
|
||||
if (e.keyCode === KEYCODES.N) playNext();
|
||||
if (e.keyCode === KEYCODES.P) playPrevious();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line flowtype/no-types-missing-file-annotation
|
||||
function handleSingleKeyActions(e: KeyboardEvent, playerRef, containerRef) {
|
||||
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
|
||||
if (e.keyCode === KEYCODES.SPACEBAR || e.keyCode === KEYCODES.K) togglePlay(containerRef);
|
||||
if (e.keyCode === KEYCODES.F) toggleFullscreen(playerRef);
|
||||
if (e.keyCode === KEYCODES.M) toggleMute(containerRef);
|
||||
if (e.keyCode === KEYCODES.UP) volumeUp(e, playerRef);
|
||||
if (e.keyCode === KEYCODES.DOWN) volumeDown(e, playerRef);
|
||||
if (e.keyCode === KEYCODES.T) toggleTheaterMode(playerRef);
|
||||
if (e.keyCode === KEYCODES.L) seekVideo(SEEK_STEP, playerRef, containerRef);
|
||||
if (e.keyCode === KEYCODES.J) seekVideo(-SEEK_STEP, playerRef, containerRef);
|
||||
if (e.keyCode === KEYCODES.RIGHT) seekVideo(SEEK_STEP_5, playerRef, containerRef);
|
||||
if (e.keyCode === KEYCODES.LEFT) seekVideo(-SEEK_STEP_5, playerRef, containerRef);
|
||||
}
|
||||
|
||||
var curried_function = function(playerRef, containerRef) {
|
||||
return function curried_func(e) {
|
||||
handleKeyDown(e, playerRef, containerRef);
|
||||
};
|
||||
};
|
||||
|
||||
return {
|
||||
curried_function,
|
||||
};
|
||||
};
|
||||
@@ -3,11 +3,10 @@ import React, { useEffect, useRef, useState } from 'react';
|
||||
// import { SIMPLE_SITE } from 'config';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import classnames from 'classnames';
|
||||
import videojs from 'video.js';
|
||||
import 'videojs-contrib-ads';
|
||||
import 'videojs-ima';
|
||||
import 'videojs-contrib-ads'; // must be loaded in this order
|
||||
import 'videojs-ima'; // loads directly after contrib-ads
|
||||
import 'video.js/dist/alt/video-js-cdn.min.css';
|
||||
import eventTracking from 'videojs-event-tracking';
|
||||
import * as OVERLAY from './overlays';
|
||||
@@ -15,8 +14,11 @@ import './plugins/videojs-mobile-ui/plugin';
|
||||
import hlsQualitySelector from './plugins/videojs-hls-quality-selector/plugin';
|
||||
import recsys from './plugins/videojs-recsys/plugin';
|
||||
import qualityLevels from 'videojs-contrib-quality-levels';
|
||||
import isUserTyping from 'util/detect-typing';
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
import runAds from './ads';
|
||||
import LbryVolumeBarClass from './lbry-volume-bar';
|
||||
import keyboardShorcuts from './videojs-keyboard-shortcuts';
|
||||
import events from './videojs-events';
|
||||
import functions from './videojs-functions';
|
||||
|
||||
export type Player = {
|
||||
on: (string, (any) => void) => void,
|
||||
@@ -67,34 +69,6 @@ type Props = {
|
||||
playPrevious: () => void,
|
||||
};
|
||||
|
||||
// type VideoJSOptions = {
|
||||
// controls: boolean,
|
||||
// preload: string,
|
||||
// playbackRates: Array<number>,
|
||||
// responsive: boolean,
|
||||
// poster?: string,
|
||||
// muted?: boolean,
|
||||
// };
|
||||
|
||||
function hitsFiftyPercent() {
|
||||
// from 0 - 999
|
||||
const rand = Math.floor(Math.random() * (1000 + 1));
|
||||
|
||||
// 499 is 50% chance of running
|
||||
if (rand > 499) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// check if active (clicked) element is part of video div, used for keyboard shortcuts (volume etc)
|
||||
function activeElementIsPartOfVideoElement() {
|
||||
const videoElementParent = document.getElementsByClassName('video-js-parent')[0];
|
||||
const activeElement = document.activeElement;
|
||||
return videoElementParent.contains(activeElement);
|
||||
}
|
||||
|
||||
const videoPlaybackRates = [0.25, 0.5, 0.75, 1, 1.1, 1.25, 1.5, 1.75, 2];
|
||||
|
||||
const IS_IOS =
|
||||
@@ -114,9 +88,6 @@ const VIDEO_JS_OPTIONS = {
|
||||
},
|
||||
};
|
||||
|
||||
const SEEK_STEP_5 = 5;
|
||||
const SEEK_STEP = 10; // time to seek in seconds
|
||||
|
||||
if (!Object.keys(videojs.getPlugins()).includes('eventTracking')) {
|
||||
videojs.registerPlugin('eventTracking', eventTracking);
|
||||
}
|
||||
@@ -133,47 +104,6 @@ if (!Object.keys(videojs.getPlugins()).includes('recsys')) {
|
||||
videojs.registerPlugin('recsys', recsys);
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// LbryVolumeBarClass
|
||||
// ****************************************************************************
|
||||
|
||||
const VIDEOJS_CONTROL_BAR_CLASS = 'ControlBar';
|
||||
const VIDEOJS_VOLUME_PANEL_CLASS = 'VolumePanel';
|
||||
const VIDEOJS_VOLUME_CONTROL_CLASS = 'VolumeControl';
|
||||
const VIDEOJS_VOLUME_BAR_CLASS = 'VolumeBar';
|
||||
|
||||
class LbryVolumeBarClass extends videojs.getComponent(VIDEOJS_VOLUME_BAR_CLASS) {
|
||||
constructor(player, options = {}) {
|
||||
super(player, options);
|
||||
}
|
||||
|
||||
static replaceExisting(player) {
|
||||
try {
|
||||
const volumeControl = player
|
||||
.getChild(VIDEOJS_CONTROL_BAR_CLASS)
|
||||
.getChild(VIDEOJS_VOLUME_PANEL_CLASS)
|
||||
.getChild(VIDEOJS_VOLUME_CONTROL_CLASS);
|
||||
const volumeBar = volumeControl.getChild(VIDEOJS_VOLUME_BAR_CLASS);
|
||||
volumeControl.removeChild(volumeBar);
|
||||
volumeControl.addChild(new LbryVolumeBarClass(player));
|
||||
} catch (error) {
|
||||
// In case it slips in 'Production', the original volume bar will be used and the site should still be working
|
||||
// (just not exactly the way we want).
|
||||
if (isDev) throw Error('\n\nvideojs.jsx: Volume Panel hierarchy changed?\n\n' + error);
|
||||
}
|
||||
}
|
||||
|
||||
handleMouseDown(event) {
|
||||
super.handleMouseDown(event);
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
handleMouseMove(event) {
|
||||
super.handleMouseMove(event);
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// VideoJs
|
||||
// ****************************************************************************
|
||||
@@ -193,7 +123,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
isAudio,
|
||||
onPlayerReady,
|
||||
toggleVideoTheaterMode,
|
||||
adUrl,
|
||||
// adUrl, // TODO: this ad functionality isn't used, can be pulled out
|
||||
claimId,
|
||||
userId,
|
||||
allowPreRoll,
|
||||
@@ -205,9 +135,18 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
playPrevious,
|
||||
} = props;
|
||||
|
||||
const [reload, setReload] = useState('initial');
|
||||
// will later store the videojs player
|
||||
const playerRef = useRef();
|
||||
const containerRef = useRef();
|
||||
|
||||
const tapToUnmuteRef = useRef();
|
||||
const tapToRetryRef = useRef();
|
||||
|
||||
// initiate keyboard shortcuts
|
||||
const { curried_function } = keyboardShorcuts({ toggleVideoTheaterMode, playNext, playPrevious });
|
||||
|
||||
const [reload, setReload] = useState('initial');
|
||||
|
||||
const videoJsOptions = {
|
||||
...VIDEO_JS_OPTIONS,
|
||||
autoplay: autoplay,
|
||||
@@ -230,329 +169,9 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
},
|
||||
};
|
||||
|
||||
const tapToUnmuteRef = useRef();
|
||||
const tapToRetryRef = useRef();
|
||||
const { detectFileType, createVideoPlayerDOM } = functions({ source, sourceType, videoJsOptions, isAudio });
|
||||
|
||||
const TAP = {
|
||||
NONE: 'NONE',
|
||||
UNMUTE: 'UNMUTE',
|
||||
RETRY: 'RETRY',
|
||||
};
|
||||
|
||||
function showTapButton(tapButton) {
|
||||
const setButtonVisibility = (theRef, newState) => {
|
||||
// Use the DOM to control the state of the button to prevent re-renders.
|
||||
if (theRef.current) {
|
||||
const curState = theRef.current.style.visibility === 'visible';
|
||||
if (newState !== curState) {
|
||||
theRef.current.style.visibility = newState ? 'visible' : 'hidden';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
switch (tapButton) {
|
||||
case TAP.NONE:
|
||||
setButtonVisibility(tapToUnmuteRef, false);
|
||||
setButtonVisibility(tapToRetryRef, false);
|
||||
break;
|
||||
case TAP.UNMUTE:
|
||||
setButtonVisibility(tapToUnmuteRef, true);
|
||||
setButtonVisibility(tapToRetryRef, false);
|
||||
break;
|
||||
case TAP.RETRY:
|
||||
setButtonVisibility(tapToUnmuteRef, false);
|
||||
setButtonVisibility(tapToRetryRef, true);
|
||||
break;
|
||||
default:
|
||||
if (isDev) throw new Error('showTapButton: unexpected ref');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function unmuteAndHideHint() {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
player.muted(false);
|
||||
if (player.volume() === 0) {
|
||||
player.volume(1.0);
|
||||
}
|
||||
}
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
|
||||
function retryVideoAfterFailure() {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
setReload(Date.now());
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveCtrlText(e) {
|
||||
// Override the player's control text. We override to:
|
||||
// 1. Add keyboard shortcut to the tool-tip.
|
||||
// 2. Override videojs' i18n and use our own (don't want to have 2 systems).
|
||||
//
|
||||
// Notes:
|
||||
// - For dynamic controls (e.g. play/pause), those unfortunately need to be
|
||||
// updated again at their event-listener level (that's just the way videojs
|
||||
// updates the text), hence the need to listen to 'play', 'pause' and 'volumechange'
|
||||
// on top of just 'loadstart'.
|
||||
// - videojs changes the MuteToggle text at 'loadstart', so this was chosen
|
||||
// as the listener to update static texts.
|
||||
|
||||
const setLabel = (controlBar, childName, label) => {
|
||||
const c = controlBar.getChild(childName);
|
||||
if (c) {
|
||||
c.controlText(label);
|
||||
}
|
||||
};
|
||||
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
const ctrlBar = player.getChild('controlBar');
|
||||
switch (e.type) {
|
||||
case 'play':
|
||||
setLabel(ctrlBar, 'PlayToggle', __('Pause (space)'));
|
||||
break;
|
||||
case 'pause':
|
||||
setLabel(ctrlBar, 'PlayToggle', __('Play (space)'));
|
||||
break;
|
||||
case 'volumechange':
|
||||
ctrlBar
|
||||
.getChild('VolumePanel')
|
||||
.getChild('MuteToggle')
|
||||
.controlText(player.muted() || player.volume() === 0 ? __('Unmute (m)') : __('Mute (m)'));
|
||||
break;
|
||||
case 'fullscreenchange':
|
||||
setLabel(
|
||||
ctrlBar,
|
||||
'FullscreenToggle',
|
||||
player.isFullscreen() ? __('Exit Fullscreen (f)') : __('Fullscreen (f)')
|
||||
);
|
||||
break;
|
||||
case 'loadstart':
|
||||
// --- Do everything ---
|
||||
setLabel(ctrlBar, 'PlaybackRateMenuButton', __('Playback Rate (<, >)'));
|
||||
setLabel(ctrlBar, 'QualityButton', __('Quality'));
|
||||
setLabel(ctrlBar, 'PlayNextButton', __('Play Next (SHIFT+N)'));
|
||||
setLabel(ctrlBar, 'PlayPreviousButton', __('Play Previous (SHIFT+P)'));
|
||||
setLabel(ctrlBar, 'TheaterModeButton', videoTheaterMode ? __('Default Mode (t)') : __('Theater Mode (t)'));
|
||||
setLabel(ctrlBar, 'AutoplayNextButton', autoplaySetting ? __('Autoplay Next On') : __('Autoplay Next Off'));
|
||||
|
||||
resolveCtrlText({ type: 'play' });
|
||||
resolveCtrlText({ type: 'pause' });
|
||||
resolveCtrlText({ type: 'volumechange' });
|
||||
resolveCtrlText({ type: 'fullscreenchange' });
|
||||
break;
|
||||
default:
|
||||
if (isDev) throw Error('Unexpected: ' + e.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onInitialPlay() {
|
||||
const player = playerRef.current;
|
||||
if (player && (player.muted() || player.volume() === 0)) {
|
||||
// The css starts as "hidden". We make it visible here without
|
||||
// re-rendering the whole thing.
|
||||
showTapButton(TAP.UNMUTE);
|
||||
} else {
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
function onVolumeChange() {
|
||||
const player = playerRef.current;
|
||||
if (player && !player.muted()) {
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
function onError() {
|
||||
const player = playerRef.current;
|
||||
showTapButton(TAP.RETRY);
|
||||
|
||||
// reattach initial play listener in case we recover from error successfully
|
||||
// $FlowFixMe
|
||||
player.one('play', onInitialPlay);
|
||||
|
||||
if (player && player.loadingSpinner) {
|
||||
player.loadingSpinner.hide();
|
||||
}
|
||||
}
|
||||
|
||||
const onEnded = React.useCallback(() => {
|
||||
if (!adUrl) {
|
||||
showTapButton(TAP.NONE);
|
||||
}
|
||||
}, [adUrl]);
|
||||
|
||||
function handleKeyDown(e: KeyboardEvent) {
|
||||
const player = playerRef.current;
|
||||
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
|
||||
if (!videoNode || !player || isUserTyping()) return;
|
||||
handleSingleKeyActions(e);
|
||||
handleShiftKeyActions(e);
|
||||
}
|
||||
|
||||
function handleShiftKeyActions(e: KeyboardEvent) {
|
||||
if (e.altKey || e.ctrlKey || e.metaKey || !e.shiftKey) return;
|
||||
if (e.keyCode === KEYCODES.PERIOD) changePlaybackSpeed(true);
|
||||
if (e.keyCode === KEYCODES.COMMA) changePlaybackSpeed(false);
|
||||
if (e.keyCode === KEYCODES.N) playNext();
|
||||
if (e.keyCode === KEYCODES.P) playPrevious();
|
||||
}
|
||||
|
||||
function handleSingleKeyActions(e: KeyboardEvent) {
|
||||
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
|
||||
if (e.keyCode === KEYCODES.SPACEBAR || e.keyCode === KEYCODES.K) togglePlay();
|
||||
if (e.keyCode === KEYCODES.F) toggleFullscreen();
|
||||
if (e.keyCode === KEYCODES.M) toggleMute();
|
||||
if (e.keyCode === KEYCODES.UP) volumeUp(e);
|
||||
if (e.keyCode === KEYCODES.DOWN) volumeDown(e);
|
||||
if (e.keyCode === KEYCODES.T) toggleTheaterMode();
|
||||
if (e.keyCode === KEYCODES.L) seekVideo(SEEK_STEP);
|
||||
if (e.keyCode === KEYCODES.J) seekVideo(-SEEK_STEP);
|
||||
if (e.keyCode === KEYCODES.RIGHT) seekVideo(SEEK_STEP_5);
|
||||
if (e.keyCode === KEYCODES.LEFT) seekVideo(-SEEK_STEP_5);
|
||||
}
|
||||
|
||||
function seekVideo(stepSize: number) {
|
||||
const player = playerRef.current;
|
||||
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
|
||||
if (!videoNode || !player) return;
|
||||
const duration = videoNode.duration;
|
||||
const currentTime = videoNode.currentTime;
|
||||
const newDuration = currentTime + stepSize;
|
||||
if (newDuration < 0) {
|
||||
videoNode.currentTime = 0;
|
||||
} else if (newDuration > duration) {
|
||||
videoNode.currentTime = duration;
|
||||
} else {
|
||||
videoNode.currentTime = newDuration;
|
||||
}
|
||||
OVERLAY.showSeekedOverlay(player, Math.abs(stepSize), stepSize > 0);
|
||||
player.userActive(true);
|
||||
}
|
||||
|
||||
function changePlaybackSpeed(shouldSpeedUp: boolean) {
|
||||
const player = playerRef.current;
|
||||
if (!player) return;
|
||||
const isSpeedUp = shouldSpeedUp;
|
||||
const rate = player.playbackRate();
|
||||
let rateIndex = videoPlaybackRates.findIndex((x) => x === rate);
|
||||
if (rateIndex >= 0) {
|
||||
rateIndex = isSpeedUp ? Math.min(rateIndex + 1, videoPlaybackRates.length - 1) : Math.max(rateIndex - 1, 0);
|
||||
const nextRate = videoPlaybackRates[rateIndex];
|
||||
|
||||
OVERLAY.showPlaybackRateOverlay(player, nextRate, isSpeedUp);
|
||||
player.userActive(true);
|
||||
player.playbackRate(nextRate);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleFullscreen() {
|
||||
const player = playerRef.current;
|
||||
if (!player) return;
|
||||
if (!player.isFullscreen()) {
|
||||
player.requestFullscreen();
|
||||
} else {
|
||||
player.exitFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleTheaterMode() {
|
||||
const player = playerRef.current;
|
||||
if (!player) return;
|
||||
toggleVideoTheaterMode();
|
||||
if (player.isFullscreen()) {
|
||||
player.exitFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleMute() {
|
||||
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
|
||||
if (!videoNode) return;
|
||||
videoNode.muted = !videoNode.muted;
|
||||
}
|
||||
|
||||
function togglePlay() {
|
||||
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
|
||||
if (!videoNode) return;
|
||||
videoNode.paused ? videoNode.play() : videoNode.pause();
|
||||
}
|
||||
|
||||
function volumeUp(event) {
|
||||
// dont run if video element is not active element (otherwise runs when scrolling using keypad)
|
||||
const videoElementIsActive = activeElementIsPartOfVideoElement();
|
||||
const player = playerRef.current;
|
||||
if (!player || !videoElementIsActive) return;
|
||||
event.preventDefault();
|
||||
player.volume(player.volume() + 0.05);
|
||||
OVERLAY.showVolumeverlay(player, Math.round(player.volume() * 100));
|
||||
player.userActive(true);
|
||||
}
|
||||
|
||||
function volumeDown(event) {
|
||||
// dont run if video element is not active element (otherwise runs when scrolling using keypad)
|
||||
const videoElementIsActive = activeElementIsPartOfVideoElement();
|
||||
const player = playerRef.current;
|
||||
if (!player || !videoElementIsActive) return;
|
||||
event.preventDefault();
|
||||
player.volume(player.volume() - 0.05);
|
||||
OVERLAY.showVolumeverlay(player, Math.round(player.volume() * 100));
|
||||
player.userActive(true);
|
||||
}
|
||||
|
||||
// Create the video DOM element and wrapper
|
||||
function createVideoPlayerDOM(container) {
|
||||
if (!container) return;
|
||||
|
||||
// This seems like a poor way to generate the DOM for video.js
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.setAttribute('data-vjs-player', 'true');
|
||||
const el = document.createElement(isAudio ? 'audio' : 'video');
|
||||
el.className = 'video-js vjs-big-play-centered ';
|
||||
wrapper.appendChild(el);
|
||||
|
||||
container.appendChild(wrapper);
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
function detectFileType() {
|
||||
return new Promise(async (res, rej) => {
|
||||
try {
|
||||
const response = await fetch(source, { method: 'HEAD', cache: 'no-store' });
|
||||
|
||||
// Temp variables to hold results
|
||||
let finalType = sourceType;
|
||||
let finalSource = source;
|
||||
|
||||
// override type if we receive an .m3u8 (transcoded mp4)
|
||||
// do we need to check if explicitly redirected
|
||||
// or is checking extension only a safer method
|
||||
if (response && response.redirected && response.url && response.url.endsWith('m3u8')) {
|
||||
finalType = 'application/x-mpegURL';
|
||||
finalSource = response.url;
|
||||
}
|
||||
|
||||
// Modify video source in options
|
||||
videoJsOptions.sources = [
|
||||
{
|
||||
src: finalSource,
|
||||
type: finalType,
|
||||
},
|
||||
];
|
||||
|
||||
return res(videoJsOptions);
|
||||
} catch (error) {
|
||||
return rej(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
const { unmuteAndHideHint, retryVideoAfterFailure, initializeEvents } = events({ tapToUnmuteRef, tapToRetryRef, setReload, videoTheaterMode, playerRef, autoplaySetting, replay });
|
||||
|
||||
// Initialize video.js
|
||||
function initializeVideoPlayer(el) {
|
||||
@@ -564,99 +183,9 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
// this seems like a weird thing to have to check for here
|
||||
if (!player) return;
|
||||
|
||||
// live channel
|
||||
// 60b354389c7adb506d0bd9a4
|
||||
runAds(internalFeatureEnabled, allowPreRoll, player);
|
||||
|
||||
// ford ad
|
||||
// 612fb75a42715a07645a614c
|
||||
|
||||
// Modified to work with IMA
|
||||
// const macroUrl =
|
||||
// `https://vast.aniview.com/api/adserver61/vast/` +
|
||||
// `?AV_PUBLISHERID=60afcbc58cfdb065440d2426` +
|
||||
// `&AV_CHANNELID=60b354389c7adb506d0bd9a4` +
|
||||
// `&AV_URL=[URL]` +
|
||||
// `&cb=[CACHEBUSTING]` +
|
||||
// `&AV_WIDTH=[WIDTH]` +
|
||||
// `&AV_HEIGHT=[HEIGHT]` +
|
||||
// // `&AV_SCHAIN=[SCHAIN_MACRO]` +
|
||||
// // `&AV_CCPA=[CCPA_MACRO]` +
|
||||
// // `&AV_GDPR=[GDPR_MACRO]` +
|
||||
// // `&AV_CONSENT=[CONSENT_MACRO]` +
|
||||
// `&skip=true` +
|
||||
// `&skiptimer=5` +
|
||||
// `&logo=true` +
|
||||
// `&usevslot=true` +
|
||||
// `&vastretry=2` +
|
||||
// `&hidecontrols=false`;
|
||||
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
const videoElement = document.getElementsByClassName('vjs-tech')[0];
|
||||
|
||||
const height = videoElement.offsetHeight;
|
||||
const width = videoElement.offsetWidth;
|
||||
|
||||
// live channel
|
||||
// 60b354389c7adb506d0bd9a4
|
||||
|
||||
// ford ad
|
||||
// 612fb75a42715a07645a614c
|
||||
|
||||
const macroUrl1 =
|
||||
'https://gov.aniview.com/api/adserver/vast3/' +
|
||||
'?AV_PUBLISHERID=60afcbc58cfdb065440d2426' +
|
||||
'&AV_CHANNELID=60b354389c7adb506d0bd9a4' +
|
||||
`&AV_URL=${encodeURIComponent(window.location.href)}` +
|
||||
`&cb=${encodeURIComponent(timestamp)}` +
|
||||
`&AV_WIDTH=${width}` +
|
||||
`&AV_HEIGHT=${height}` +
|
||||
// '&AV_SCHAIN=[SCHAIN_MACRO]' +
|
||||
// '&AV_CCPA=[CCPA_MACRO]' +
|
||||
// '&AV_GDPR=[GDPR_MACRO]' +
|
||||
// '&AV_CONSENT=[CONSENT_MACRO]' +
|
||||
`&skip=true` +
|
||||
`&skiptimer=5` +
|
||||
`&logo=true` +
|
||||
`&usevslot=true` +
|
||||
`&vastretry=2` +
|
||||
`&hidecontrols=false`;
|
||||
|
||||
// always have ads on if internal feature is on,
|
||||
// otherwise if not authed, roll for 20% to see an ad
|
||||
const shouldShowAnAd = internalFeatureEnabled || (allowPreRoll && hitsFiftyPercent());
|
||||
|
||||
// only run on chrome (brave included) and don't run on mobile for time being
|
||||
const browserIsChrome = videojs.browser.IS_CHROME;
|
||||
const IS_IOS = videojs.browser.IS_IOS;
|
||||
const IS_ANDROID = videojs.browser.IS_ANDROID;
|
||||
const IS_MOBILE = IS_IOS || IS_ANDROID;
|
||||
|
||||
if (shouldShowAnAd && browserIsChrome && !IS_MOBILE) {
|
||||
// fire up ima integration via module
|
||||
player.ima({
|
||||
adTagUrl: macroUrl1,
|
||||
vpaidMode: 2,
|
||||
});
|
||||
}
|
||||
|
||||
// kick player in the butt, sometimes it doesn't always autoplay when it should
|
||||
player.on('loadstart', function (event) {
|
||||
if (autoplay) {
|
||||
player.play();
|
||||
}
|
||||
});
|
||||
|
||||
// Add various event listeners to player
|
||||
player.one('play', onInitialPlay);
|
||||
player.on('play', resolveCtrlText);
|
||||
player.on('pause', resolveCtrlText);
|
||||
player.on('loadstart', resolveCtrlText);
|
||||
player.on('fullscreenchange', resolveCtrlText);
|
||||
player.on('volumechange', resolveCtrlText);
|
||||
player.on('volumechange', onVolumeChange);
|
||||
player.on('error', onError);
|
||||
player.on('ended', onEnded);
|
||||
initializeEvents();
|
||||
|
||||
// Replace volume bar with custom LBRY volume bar
|
||||
LbryVolumeBarClass.replaceExisting(player);
|
||||
@@ -682,7 +211,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
}
|
||||
|
||||
// set playsinline for mobile
|
||||
// TODO: make this better
|
||||
player.children_[0].setAttribute('playsinline', '');
|
||||
|
||||
// I think this is a callback function
|
||||
@@ -698,40 +226,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
return vjs;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const player = playerRef.current;
|
||||
if (replay && player) {
|
||||
player.play();
|
||||
}
|
||||
}, [replay]);
|
||||
|
||||
useEffect(() => {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
const controlBar = player.getChild('controlBar');
|
||||
controlBar
|
||||
.getChild('TheaterModeButton')
|
||||
.controlText(videoTheaterMode ? __('Default Mode (t)') : __('Theater Mode (t)'));
|
||||
}
|
||||
}, [videoTheaterMode]);
|
||||
|
||||
useEffect(() => {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
const touchOverlay = player.getChild('TouchOverlay');
|
||||
const controlBar = player.getChild('controlBar') || touchOverlay.getChild('controlBar');
|
||||
const autoplayButton = controlBar.getChild('AutoplayNextButton');
|
||||
|
||||
if (autoplayButton) {
|
||||
const title = autoplaySetting ? __('Autoplay Next On') : __('Autoplay Next Off');
|
||||
|
||||
autoplayButton.controlText(title);
|
||||
autoplayButton.setAttribute('aria-label', title);
|
||||
autoplayButton.setAttribute('aria-checked', autoplaySetting);
|
||||
}
|
||||
}
|
||||
}, [autoplaySetting]);
|
||||
|
||||
/** instantiate videoJS and dispose of it when done with code **/
|
||||
// This lifecycle hook is only called once (on mount), or when `isAudio` or `source` changes.
|
||||
useEffect(() => {
|
||||
const vjsElement = createVideoPlayerDOM(containerRef.current);
|
||||
@@ -747,13 +242,12 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
// Set reference in component state
|
||||
playerRef.current = vjsPlayer;
|
||||
|
||||
// Add event listener for keyboard shortcuts
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
window.addEventListener('keydown', curried_function(playerRef, containerRef));
|
||||
});
|
||||
|
||||
// Cleanup
|
||||
return () => {
|
||||
window.removeEventListener('keydown', handleKeyDown);
|
||||
window.removeEventListener('keydown', curried_function);
|
||||
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
|
||||
@@ -89,9 +89,7 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
<Card
|
||||
title={__('Send Credits')}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>
|
||||
Send LBRY Credits to your friends or favorite creators.
|
||||
</I18nMessage>
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Send Credits to your friends or favorite creators.</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<Formik
|
||||
|
||||
@@ -16,7 +16,7 @@ export const LEVEL_3_STAKED_AMOUNT = 50;
|
||||
export const LEVEL_4_STAKED_AMOUNT = 250;
|
||||
export const LEVEL_5_STAKED_AMOUNT = 1000;
|
||||
export const INVALID_NAME_ERROR =
|
||||
__('LBRY names cannot contain spaces or reserved symbols') + ' ' + '(?$#@;:/\\="<>%{}|^~[]`)';
|
||||
__('names cannot contain spaces or reserved symbols') + ' ' + '(?$#@;:/\\="<>%{}|^~[]`)';
|
||||
|
||||
export const FORCE_CONTENT_TYPE_PLAYER = [
|
||||
'video/quicktime',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export const COMMENT_HIGHLIGHTED = 'comment--highlighted';
|
||||
@@ -1,2 +1,2 @@
|
||||
export const ALREADY_CLAIMED = 'once the invite reward has been claimed the referrer cannot be changed';
|
||||
export const REFERRER_NOT_FOUND = 'A lbry.tv account could not be found for the referrer you provided.';
|
||||
export const REFERRER_NOT_FOUND = 'A odysee account could not be found for the referrer you provided.';
|
||||
@@ -2,3 +2,4 @@ export const LIVESTREAM_EMBED_URL = 'https://player.live.odysee.com/odysee';
|
||||
export const LIVESTREAM_LIVE_API = 'https://api.live.odysee.com/v1/odysee/live';
|
||||
export const LIVESTREAM_REPLAY_API = 'https://api.live.odysee.com/v1/replays/odysee';
|
||||
export const LIVESTREAM_RTMP_URL = 'rtmp://stream.odysee.com/live';
|
||||
export const LIVESTREAM_KILL = 'https://api.stream.odysee.com/stream/kill';
|
||||
@@ -52,7 +52,7 @@ class ModalError extends React.PureComponent<Props> {
|
||||
<Modal isOpen contentLabel={__('Error')} title={__('Error')} className="error-modal" onConfirmed={closeModal}>
|
||||
<p>
|
||||
{__(
|
||||
"We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem."
|
||||
"We're sorry that Odysee has encountered an error. Please try again or reach out to hello@odysee.com with detailed information."
|
||||
)}
|
||||
</p>
|
||||
<ul className="error-modal__error-list ul--no-style">{errorInfoList}</ul>
|
||||
|
||||
@@ -59,7 +59,7 @@ function ModalOpenExternalResource(props: Props) {
|
||||
(path && __('This file has been shared with you by other people.'))}
|
||||
</p>
|
||||
<blockquote>{uri || path}</blockquote>
|
||||
<p>{__('LBRY Inc is not responsible for its content, click continue to proceed at your own risk.')}</p>
|
||||
<p>{__('Odysee is not responsible for its content, click continue to proceed at your own risk.')}</p>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class ModalSetReferrer extends React.PureComponent<Props, State> {
|
||||
title={__('Enter inviter')}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__('Did someone invite you to use lbry.tv? Tell us who and you both get a reward!')}
|
||||
{__('Did someone invite you to use Odysee? Tell us who and you both get a reward!')}
|
||||
<HelpLink href="https://odysee.com/@OdyseeHelp:b/rewards-verification:3" />
|
||||
</React.Fragment>
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ function DiscoverPage(props: Props) {
|
||||
return !dynamicRouteProps ? (
|
||||
<a
|
||||
className="help"
|
||||
href="https://odysee.com/@OdyseeHelp:b/OdyseeBasics:c"
|
||||
title={__('Learn more about LBRY Credits on %DOMAIN%', { DOMAIN })}
|
||||
href="https://odysee.com/@OdyseeHelp:b/trending:50"
|
||||
title={__('Learn more about Credits on %DOMAIN%', { DOMAIN })}
|
||||
>
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
|
||||
@@ -174,7 +174,12 @@ class HelpPage extends React.PureComponent<Props, State> {
|
||||
}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
<Button button="secondary" label={__('Join Our Chat')} icon={ICONS.CHAT} href="https://chat.lbry.com" />
|
||||
<Button
|
||||
button="secondary"
|
||||
label={__('Join the Foundation Chat')}
|
||||
icon={ICONS.CHAT}
|
||||
href="https://chat.lbry.com"
|
||||
/>
|
||||
<Button button="secondary" label={__('Email Us')} icon={ICONS.WEB} href={`mailto:${SITE_HELP_EMAIL}`} />
|
||||
</div>
|
||||
}
|
||||
@@ -184,7 +189,7 @@ class HelpPage extends React.PureComponent<Props, State> {
|
||||
title={__('Report a bug or suggest something')}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__('Did you find something wrong? Think LBRY could add something useful and cool?')}
|
||||
{__('Did you find something wrong? Think Odysee could add something useful and cool?')}
|
||||
</React.Fragment>
|
||||
}
|
||||
actions={
|
||||
|
||||
@@ -108,36 +108,8 @@ function HomePage(props: Props) {
|
||||
doFetchActiveLivestreams();
|
||||
}, []);
|
||||
|
||||
const addItem = (title) => {
|
||||
const idIndex = title.lastIndexOf('#');
|
||||
if (idIndex === -1) {
|
||||
return <li>{title}</li>;
|
||||
}
|
||||
|
||||
return (
|
||||
<li>
|
||||
<Button
|
||||
button="link"
|
||||
label={title}
|
||||
href={`https://github.com/OdyseeTeam/odysee-frontend/issues/${title.substring(idIndex + 1)}`}
|
||||
/>
|
||||
</li>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Page fullWidthPage>
|
||||
{/* <div className="notice-message--loud">
|
||||
<h1 className="section__title">PRs in this dev instance</h1>
|
||||
<p className="section__subtitle">
|
||||
<ul>
|
||||
{addItem('')}
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<br /> */}
|
||||
|
||||
{!SIMPLE_SITE && (authenticated || !IS_WEB) && !subscribedChannels.length && (
|
||||
<div className="notice-message">
|
||||
<h1 className="section__title">
|
||||
|
||||
+10
-10
@@ -1,22 +1,22 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
||||
import { doClaimSearch } from 'redux/actions/claims';
|
||||
import { makeSelectTagInClaimOrChannelForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doUserSetReferrer } from 'redux/actions/user';
|
||||
import { makeSelectTagInClaimOrChannelForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectHasUnclaimedRefereeReward } from 'redux/selectors/rewards';
|
||||
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
||||
import LivestreamPage from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
hasUnclaimedRefereeReward: selectHasUnclaimedRefereeReward(state),
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
channelClaim: makeSelectClaimForUri(props.uri)(state),
|
||||
chatDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
|
||||
doClaimSearch: (options, cb) => dispatch(doClaimSearch(options, cb)),
|
||||
setReferrer: (referrer) => dispatch(doUserSetReferrer(referrer)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(LivestreamPage);
|
||||
export default connect(select, {
|
||||
doSetPlayingUri,
|
||||
doResolveUri,
|
||||
doUserSetReferrer,
|
||||
})(LivestreamPage);
|
||||
+53
-43
@@ -1,81 +1,89 @@
|
||||
// @flow
|
||||
import { LIVESTREAM_LIVE_API } from 'constants/livestream';
|
||||
import analytics from 'analytics';
|
||||
import LivestreamComments from 'component/livestreamComments';
|
||||
import LivestreamLayout from 'component/livestreamLayout';
|
||||
import Page from 'component/page';
|
||||
import React from 'react';
|
||||
|
||||
const STREAMING_POLL_INTERVAL_IN_MS = 10000;
|
||||
const LIVESTREAM_CLAIM_POLL_IN_MS = 60000;
|
||||
import Page from 'component/page';
|
||||
import LivestreamLayout from 'component/livestreamLayout';
|
||||
import LivestreamComments from 'component/livestreamComments';
|
||||
import analytics from 'analytics';
|
||||
import Lbry from 'lbry';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
doSetPlayingUri: ({ uri: ?string }) => void,
|
||||
isAuthenticated: boolean,
|
||||
doUserSetReferrer: (string) => void,
|
||||
channelClaim: ChannelClaim,
|
||||
chatDisabled: boolean,
|
||||
claim: StreamClaim,
|
||||
isAuthenticated: boolean,
|
||||
uri: string,
|
||||
clearPlayingUri: () => void,
|
||||
doClaimSearch: (any, (ClaimSearchResponse) => void) => void,
|
||||
setReferrer: (string) => void,
|
||||
};
|
||||
|
||||
export default function LivestreamPage(props: Props) {
|
||||
const {
|
||||
channelClaim,
|
||||
chatDisabled,
|
||||
claim,
|
||||
isAuthenticated,
|
||||
uri,
|
||||
clearPlayingUri,
|
||||
doClaimSearch,
|
||||
setReferrer,
|
||||
} = props;
|
||||
|
||||
const { uri, claim, doSetPlayingUri, isAuthenticated, doUserSetReferrer, channelClaim, chatDisabled } = props;
|
||||
const [isLive, setIsLive] = React.useState(false);
|
||||
const livestreamChannelId = channelClaim && channelClaim.signing_channel && channelClaim.signing_channel.claim_id;
|
||||
const [hasLivestreamClaim, setHasLivestreamClaim] = React.useState(false);
|
||||
|
||||
const livestreamChannelId = channelClaim && channelClaim.signing_channel && channelClaim.signing_channel.claim_id;
|
||||
const stringifiedClaim = JSON.stringify(claim);
|
||||
const STREAMING_POLL_INTERVAL_IN_MS = 10000;
|
||||
const LIVESTREAM_CLAIM_POLL_IN_MS = 60000;
|
||||
|
||||
React.useEffect(() => {
|
||||
let checkClaimsInterval;
|
||||
|
||||
function checkHasLivestreamClaim() {
|
||||
doClaimSearch({ channel_ids: [livestreamChannelId], has_no_source: true, claim_type: ['stream'] }, (data) =>
|
||||
data && data.items && data.items.length > 0 ? setHasLivestreamClaim(true) : undefined
|
||||
);
|
||||
Lbry.claim_search({
|
||||
channel_ids: [livestreamChannelId],
|
||||
has_no_source: true,
|
||||
claim_type: ['stream'],
|
||||
})
|
||||
.then((res) => {
|
||||
if (res && res.items && res.items.length > 0) {
|
||||
setHasLivestreamClaim(true);
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
if (livestreamChannelId && !isLive) {
|
||||
if (!checkClaimsInterval) checkHasLivestreamClaim();
|
||||
checkClaimsInterval = setInterval(checkHasLivestreamClaim, LIVESTREAM_CLAIM_POLL_IN_MS);
|
||||
|
||||
return () => (checkClaimsInterval ? clearInterval(checkClaimsInterval) : undefined);
|
||||
return () => {
|
||||
if (checkClaimsInterval) {
|
||||
clearInterval(checkClaimsInterval);
|
||||
}
|
||||
};
|
||||
}
|
||||
}, [livestreamChannelId, isLive, doClaimSearch]);
|
||||
}, [livestreamChannelId, isLive]);
|
||||
|
||||
React.useEffect(() => {
|
||||
let interval;
|
||||
|
||||
function checkIsLive() {
|
||||
// TODO: duplicate code below
|
||||
// $FlowFixMe livestream API can handle garbage
|
||||
fetch(`${LIVESTREAM_LIVE_API}/${livestreamChannelId}`)
|
||||
.then((res) => res.json())
|
||||
.then((res) =>
|
||||
!res || !res.data ? setIsLive(false) : res.data.hasOwnProperty('live') && setIsLive(res.data.live)
|
||||
);
|
||||
}
|
||||
.then((res) => {
|
||||
if (!res || !res.data) {
|
||||
setIsLive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.data.hasOwnProperty('live')) {
|
||||
setIsLive(res.data.live);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (livestreamChannelId && hasLivestreamClaim) {
|
||||
if (!interval) checkIsLive();
|
||||
interval = setInterval(checkIsLive, STREAMING_POLL_INTERVAL_IN_MS);
|
||||
|
||||
return () => (interval ? clearInterval(interval) : undefined);
|
||||
return () => {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
}
|
||||
}, [livestreamChannelId, hasLivestreamClaim]);
|
||||
|
||||
const stringifiedClaim = JSON.stringify(claim);
|
||||
React.useEffect(() => {
|
||||
if (uri && stringifiedClaim) {
|
||||
const jsonClaim = JSON.parse(stringifiedClaim);
|
||||
@@ -89,16 +97,18 @@ export default function LivestreamPage(props: Props) {
|
||||
|
||||
if (!isAuthenticated) {
|
||||
const uri = jsonClaim.signing_channel && jsonClaim.signing_channel.permanent_url;
|
||||
if (uri) setReferrer(uri.replace('lbry://', ''));
|
||||
if (uri) {
|
||||
doUserSetReferrer(uri.replace('lbry://', ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [uri, stringifiedClaim, isAuthenticated, setReferrer]);
|
||||
}, [uri, stringifiedClaim, isAuthenticated]);
|
||||
|
||||
React.useEffect(() => {
|
||||
// Set playing uri to null so the popout player doesnt start playing the dummy claim if a user navigates back
|
||||
// This can be removed when we start using the app video player, not a LIVESTREAM iframe
|
||||
clearPlayingUri();
|
||||
}, [clearPlayingUri]);
|
||||
doSetPlayingUri({ uri: null });
|
||||
}, [doSetPlayingUri]);
|
||||
|
||||
return (
|
||||
<Page
|
||||
|
||||
@@ -242,7 +242,7 @@ export default function LivestreamSetupPage(props: Props) {
|
||||
className="livestream__publish-intro"
|
||||
title={__('No livestream publishes found')}
|
||||
subtitle={__(
|
||||
'You need to upload your livestream details before you can go live. If you already created one in this channel, it should appear soon.'
|
||||
'You need to upload your livestream details before you can go live. Please note: Replays must be published manually after your stream via the Update button on the livestream.'
|
||||
)}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doCommentListOwn, doCommentReset } from 'redux/actions/comments';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import {
|
||||
selectIsFetchingComments,
|
||||
selectCommentsForUri,
|
||||
makeSelectTotalCommentsCountForUri,
|
||||
makeSelectTopLevelTotalPagesForUri,
|
||||
} from 'redux/selectors/comments';
|
||||
import { doCommentListOwn, doCommentReset } from 'redux/actions/comments';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectClaimsById } from 'redux/selectors/claims';
|
||||
|
||||
import OwnComments from './view';
|
||||
|
||||
const select = (state) => {
|
||||
@@ -17,16 +18,16 @@ const select = (state) => {
|
||||
return {
|
||||
activeChannelClaim,
|
||||
allComments: selectCommentsForUri(state, uri),
|
||||
claimsById: selectClaimsById(state),
|
||||
isFetchingComments: selectIsFetchingComments(state),
|
||||
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(uri)(state),
|
||||
totalComments: makeSelectTotalCommentsCountForUri(uri)(state),
|
||||
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(uri)(state),
|
||||
isFetchingComments: selectIsFetchingComments(state),
|
||||
claimsById: selectClaimsById(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doCommentListOwn: (channelId, page, pageSize) => dispatch(doCommentListOwn(channelId, page, pageSize)),
|
||||
doCommentReset: (claimId) => dispatch(doCommentReset(claimId)),
|
||||
doCommentReset: (a) => dispatch(doCommentReset(a)),
|
||||
doCommentListOwn: (a, b, c) => dispatch(doCommentListOwn(a, b, c)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(OwnComments);
|
||||
@@ -1,20 +1,25 @@
|
||||
// @flow
|
||||
import 'scss/component/_comments-list.scss';
|
||||
import 'scss/component/_comments-own.scss';
|
||||
import { COMMENT_PAGE_SIZE_TOP_LEVEL } from 'constants/comment';
|
||||
import { scaleToDevicePixelRatio } from 'util/scale';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import ChannelSelector from 'component/channelSelector';
|
||||
import ClaimPreview from 'component/claimPreview';
|
||||
import Comment from 'component/comment';
|
||||
import debounce from 'util/debounce';
|
||||
import Card from 'component/common/card';
|
||||
import Empty from 'component/common/empty';
|
||||
import Page from 'component/page';
|
||||
import React from 'react';
|
||||
import Spinner from 'component/spinner';
|
||||
import { COMMENT_PAGE_SIZE_TOP_LEVEL } from 'constants/comment';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import useFetched from 'effects/use-fetched';
|
||||
import debounce from 'util/debounce';
|
||||
|
||||
function scaleToDevicePixelRatio(value) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
||||
if (devicePixelRatio < 1.0) {
|
||||
return Math.ceil(value / devicePixelRatio);
|
||||
}
|
||||
return Math.ceil(value * devicePixelRatio);
|
||||
}
|
||||
|
||||
type Props = {
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
@@ -37,7 +42,6 @@ export default function OwnComments(props: Props) {
|
||||
doCommentReset,
|
||||
doCommentListOwn,
|
||||
} = props;
|
||||
|
||||
const spinnerRef = React.useRef();
|
||||
const [page, setPage] = React.useState(0);
|
||||
const [activeChannelId, setActiveChannelId] = React.useState('');
|
||||
@@ -49,6 +53,51 @@ export default function OwnComments(props: Props) {
|
||||
const totalPages = Math.ceil(totalComments / COMMENT_PAGE_SIZE_TOP_LEVEL);
|
||||
const moreBelow = page < totalPages;
|
||||
|
||||
function getCommentsElem(comments) {
|
||||
return comments.map((comment) => {
|
||||
const contentClaim = claimsById[comment.claim_id];
|
||||
const isChannel = contentClaim && contentClaim.value_type === 'channel';
|
||||
const isLivestream = Boolean(contentClaim && contentClaim.value_type === 'stream' && !contentClaim.value.source);
|
||||
|
||||
return (
|
||||
<div key={comment.comment_id} className="comments-own card__main-actions">
|
||||
<div className="section__actions">
|
||||
<div className="comments-own--claim">
|
||||
{contentClaim && (
|
||||
<ClaimPreview
|
||||
uri={contentClaim.canonical_url}
|
||||
searchParams={{
|
||||
...(isChannel ? { view: 'discussion' } : {}),
|
||||
...(isLivestream ? {} : { lc: comment.comment_id }),
|
||||
}}
|
||||
hideActions
|
||||
hideMenu
|
||||
properties={() => null}
|
||||
/>
|
||||
)}
|
||||
{!contentClaim && <Empty text={__('Content or channel was deleted.')} />}
|
||||
</div>
|
||||
<Comment
|
||||
isTopLevel
|
||||
hideActions
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
commentIsMine
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={0} // Don't show replies here
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Active channel changed
|
||||
React.useEffect(() => {
|
||||
if (activeChannelClaim && activeChannelClaim.claim_id !== activeChannelId) {
|
||||
@@ -117,49 +166,34 @@ export default function OwnComments(props: Props) {
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
const getCommentsElem = (comments: Array<Comment>) =>
|
||||
comments.map((comment: Comment) => {
|
||||
const contentClaim = claimsById[comment.claim_id];
|
||||
const isChannel = contentClaim && contentClaim.value_type === 'channel';
|
||||
const isLivestream = Boolean(contentClaim && contentClaim.value_type === 'stream' && !contentClaim.value.source);
|
||||
if (!activeChannelClaim) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={comment.comment_id} className="comments--own card__main-actions">
|
||||
<div className="section__actions">
|
||||
<div className="comments--own__claim">
|
||||
{contentClaim && (
|
||||
<ClaimPreview
|
||||
uri={contentClaim.canonical_url}
|
||||
searchParams={{
|
||||
...(isChannel ? { view: 'discussion' } : {}),
|
||||
...(isLivestream ? {} : { lc: comment.comment_id }),
|
||||
}}
|
||||
hideActions
|
||||
hideMenu
|
||||
properties={() => null}
|
||||
/>
|
||||
)}
|
||||
{!contentClaim && <Empty text={__('Content or channel was deleted.')} />}
|
||||
</div>
|
||||
{/* Don't show replies here */}
|
||||
<Comment numDirectReplies={0} comment={comment} isTopLevel hideActions commentIsMine />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
return !activeChannelClaim ? null : (
|
||||
return (
|
||||
<Page noFooter noSideNavigation settingsPage backout={{ title: __('Your comments'), backLabel: __('Back') }}>
|
||||
<ChannelSelector hideAnon />
|
||||
<Card
|
||||
isBodyList
|
||||
title={
|
||||
(isFetchingComments && '') ||
|
||||
(totalComments > 0 && __('No comments')) ||
|
||||
(totalComments === 1 && __('1 comment')) ||
|
||||
(totalComments > 1 && __('%total_comments% comments', { total_comments: totalComments }))
|
||||
totalComments > 0
|
||||
? totalComments === 1
|
||||
? __('1 comment')
|
||||
: __('%total_comments% comments', { total_comments: totalComments })
|
||||
: isFetchingComments
|
||||
? ''
|
||||
: __('No comments')
|
||||
}
|
||||
titleActions={
|
||||
<Button
|
||||
button="alt"
|
||||
icon={ICONS.REFRESH}
|
||||
title={__('Refresh')}
|
||||
onClick={() => {
|
||||
setPage(0);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
titleActions={<Button button="alt" icon={ICONS.REFRESH} title={__('Refresh')} onClick={() => setPage(0)} />}
|
||||
body={
|
||||
<>
|
||||
{wasResetAndReady && <ul className="comments">{allComments && getCommentsElem(allComments)}</ul>}
|
||||
|
||||
@@ -124,7 +124,7 @@ export default function YoutubeSync(props: Props) {
|
||||
{nameError ? (
|
||||
<span className="error__text">{nameError}</span>
|
||||
) : (
|
||||
__('Your %site_name% channel name', { site_name: IS_WEB ? SITE_NAME : 'LBRY' })
|
||||
__('Your %site_name% desired channel name', { site_name: IS_WEB ? SITE_NAME : 'LBRY' })
|
||||
)}
|
||||
</label>
|
||||
<div className="form-field__prefix">@</div>
|
||||
@@ -206,9 +206,8 @@ export default function YoutubeSync(props: Props) {
|
||||
),
|
||||
}}
|
||||
>
|
||||
This will verify you are an active YouTuber. Channel names cannot be changed once chosen, please be
|
||||
extra careful. Additional instructions will be emailed to you after you verify your email on the
|
||||
next page. %learn_more%.
|
||||
This will verify you are an active YouTuber with over 300 subscribers and original content. Channel
|
||||
names cannot be changed once chosen, please be extra careful. %learn_more%.
|
||||
</I18nMessage>
|
||||
</div>
|
||||
</Form>
|
||||
|
||||
+18
-20
@@ -24,21 +24,6 @@ import { doFetchItemsInCollections } from 'redux/actions/collections';
|
||||
let onChannelConfirmCallback;
|
||||
let checkPendingInterval;
|
||||
|
||||
type ClaimSearchParams = {
|
||||
page_size?: number,
|
||||
page: number,
|
||||
no_totals?: boolean,
|
||||
any_tags?: Array<string>,
|
||||
claim_ids?: Array<string>,
|
||||
channel_ids?: Array<string>,
|
||||
not_channel_ids?: Array<string>,
|
||||
not_tags?: Array<string>,
|
||||
order_by?: Array<string>,
|
||||
release_time?: string,
|
||||
has_source?: boolean,
|
||||
has_no_souce?: boolean,
|
||||
};
|
||||
|
||||
export function doResolveUris(
|
||||
uris: Array<string>,
|
||||
returnCachedClaims: boolean = false,
|
||||
@@ -619,8 +604,24 @@ export function doFetchCollectionListMine(page: number = 1, pageSize: number = 9
|
||||
}
|
||||
|
||||
export function doClaimSearch(
|
||||
options: ClaimSearchParams = { page_size: 10, page: 1, no_totals: true },
|
||||
successCb?: (ClaimSearchResponse) => void
|
||||
options: {
|
||||
page_size?: number,
|
||||
page: number,
|
||||
no_totals?: boolean,
|
||||
any_tags?: Array<string>,
|
||||
claim_ids?: Array<string>,
|
||||
channel_ids?: Array<string>,
|
||||
not_channel_ids?: Array<string>,
|
||||
not_tags?: Array<string>,
|
||||
order_by?: Array<string>,
|
||||
release_time?: string,
|
||||
has_source?: boolean,
|
||||
has_no_souce?: boolean,
|
||||
} = {
|
||||
no_totals: true,
|
||||
page_size: 10,
|
||||
page: 1,
|
||||
}
|
||||
) {
|
||||
const query = createNormalizedClaimSearchKey(options);
|
||||
return async (dispatch: Dispatch) => {
|
||||
@@ -647,9 +648,6 @@ export function doClaimSearch(
|
||||
pageSize: options.page_size,
|
||||
},
|
||||
});
|
||||
|
||||
if (successCb) successCb(data);
|
||||
|
||||
return resolveInfo;
|
||||
};
|
||||
|
||||
|
||||
@@ -758,53 +758,67 @@ export function doCommentAbandon(commentId: string, creatorChannelUri?: string)
|
||||
|
||||
export function doCommentUpdate(comment_id: string, comment: string) {
|
||||
// if they provided an empty string, they must have wanted to abandon
|
||||
if (comment === '') return doCommentAbandon(comment_id);
|
||||
if (comment === '') {
|
||||
return doCommentAbandon(comment_id);
|
||||
} else {
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const activeChannelClaim = selectActiveChannelClaim(state);
|
||||
if (!activeChannelClaim) {
|
||||
return dispatch(doToast({ isError: true, message: __('No active channel selected.') }));
|
||||
}
|
||||
|
||||
const activeChannelClaim = selectActiveChannelClaim(state);
|
||||
if (!activeChannelClaim) {
|
||||
return dispatch(doToast({ isError: true, message: __('No active channel selected.') }));
|
||||
}
|
||||
const signedComment = await channelSignData(activeChannelClaim.claim_id, comment);
|
||||
if (!signedComment) {
|
||||
return dispatch(doToast({ isError: true, message: __('Unable to verify your channel. Please try again.') }));
|
||||
}
|
||||
|
||||
const signedComment = await channelSignData(activeChannelClaim.claim_id, comment);
|
||||
if (!signedComment) {
|
||||
return dispatch(doToast({ isError: true, message: __('Unable to verify your channel. Please try again.') }));
|
||||
}
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_UPDATE_STARTED,
|
||||
});
|
||||
|
||||
dispatch({ type: ACTIONS.COMMENT_UPDATE_STARTED });
|
||||
|
||||
return Comments.comment_edit({
|
||||
comment_id: comment_id,
|
||||
comment: comment,
|
||||
signature: signedComment.signature,
|
||||
signing_ts: signedComment.signing_ts,
|
||||
})
|
||||
.then((result: CommentEditResponse) => {
|
||||
if (result != null) {
|
||||
dispatch({ type: ACTIONS.COMMENT_UPDATE_COMPLETED, data: { comment: result } });
|
||||
} else {
|
||||
// the result will return null
|
||||
dispatch({ type: ACTIONS.COMMENT_UPDATE_FAILED });
|
||||
return Comments.comment_edit({
|
||||
comment_id: comment_id,
|
||||
comment: comment,
|
||||
signature: signedComment.signature,
|
||||
signing_ts: signedComment.signing_ts,
|
||||
})
|
||||
.then((result: CommentEditResponse) => {
|
||||
if (result != null) {
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_UPDATE_COMPLETED,
|
||||
data: {
|
||||
comment: result,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// the result will return null
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_UPDATE_FAILED,
|
||||
});
|
||||
dispatch(
|
||||
doToast({
|
||||
message: 'Your channel is still being setup, try again in a few moments.',
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_UPDATE_FAILED,
|
||||
data: error,
|
||||
});
|
||||
dispatch(
|
||||
doToast({
|
||||
message: 'Your channel is still being setup, try again in a few moments.',
|
||||
message: 'Unable to edit this comment, please try again later.',
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
dispatch({ type: ACTIONS.COMMENT_UPDATE_FAILED, data: error });
|
||||
dispatch(
|
||||
doToast({
|
||||
message: 'Unable to edit this comment, please try again later.',
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
});
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function channelSignName(channelClaimId: string, channelName: string) {
|
||||
|
||||
@@ -197,7 +197,7 @@ function handleClaimAction(state: State, action: any): State {
|
||||
claimsByUri: byUri,
|
||||
channelClaimCounts,
|
||||
resolvingUris: Array.from(newResolvingUrls),
|
||||
myClaims: Array.from(myClaimIds),
|
||||
...(!state.myClaims || myClaimIds.size !== state.myClaims.length ? { myClaims: Array.from(myClaimIds) } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,9 @@ export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true)
|
||||
}
|
||||
});
|
||||
|
||||
// Returns your claim IDs without handling pending and abandoned claims.
|
||||
export const selectMyClaimIdsRaw = (state: State) => selectState(state).myClaims;
|
||||
|
||||
export const selectMyClaimsRaw = createSelector(selectState, selectClaimsById, (state, byId) => {
|
||||
const ids = state.myClaims;
|
||||
if (!ids) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createCachedSelector } from 're-reselect';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
|
||||
import { selectClaimsById, selectMyActiveClaims } from 'redux/selectors/claims';
|
||||
import { selectClaimsById, selectMyClaimIdsRaw } from 'redux/selectors/claims';
|
||||
import { isClaimNsfw } from 'util/claim';
|
||||
|
||||
type State = { comments: CommentsState };
|
||||
@@ -180,7 +180,7 @@ export const makeSelectCommentIdsForUri = (uri: string) =>
|
||||
|
||||
const filterCommentsDepOnList = {
|
||||
claimsById: selectClaimsById,
|
||||
myClaims: selectMyActiveClaims,
|
||||
myClaimIds: selectMyClaimIdsRaw,
|
||||
mutedChannels: selectMutedChannels,
|
||||
personalBlockList: selectModerationBlockList,
|
||||
blacklistedMap: selectBlacklistedOutpointMap,
|
||||
@@ -258,7 +258,7 @@ export const selectRepliesForParentId = createCachedSelector(
|
||||
*
|
||||
* @param comments List of comments to filter.
|
||||
* @param claimId The claim that `comments` reside in.
|
||||
* @oaram filterInputs Values returned by filterCommentsDepOnList.
|
||||
* @param filterInputs Values returned by filterCommentsDepOnList.
|
||||
*/
|
||||
const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs: any) => {
|
||||
const filterProps = filterInputs.reduce(function (acc, cur, i) {
|
||||
@@ -268,7 +268,7 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
|
||||
|
||||
const {
|
||||
claimsById,
|
||||
myClaims,
|
||||
myClaimIds,
|
||||
mutedChannels,
|
||||
personalBlockList,
|
||||
blacklistedMap,
|
||||
@@ -287,8 +287,8 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
|
||||
|
||||
// Return comment if `channelClaim` doesn't exist so the component knows to resolve the author
|
||||
if (channelClaim) {
|
||||
if (myClaims && myClaims.size > 0) {
|
||||
const claimIsMine = channelClaim.is_my_output || myClaims.has(channelClaim.claim_id);
|
||||
if (myClaimIds && myClaimIds.size > 0) {
|
||||
const claimIsMine = channelClaim.is_my_output || myClaimIds.includes(channelClaim.claim_id);
|
||||
if (claimIsMine) {
|
||||
return true;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
|
||||
}
|
||||
|
||||
if (claimId) {
|
||||
const claimIdIsMine = myClaims && myClaims.size > 0 && myClaims.has(claimId);
|
||||
const claimIdIsMine = myClaimIds && myClaimIds.size > 0 && myClaimIds.includes(claimId);
|
||||
if (!claimIdIsMine) {
|
||||
if (personalBlockList.includes(comment.channel_url)) {
|
||||
return false;
|
||||
@@ -368,25 +368,17 @@ export const makeSelectUriIsBlockingOrUnBlocking = (uri: string) =>
|
||||
return blockingByUri[uri] || unBlockingByUri[uri];
|
||||
});
|
||||
|
||||
export const makeSelectSuperChatDataForUri = (uri: string) =>
|
||||
createSelector(selectSuperchatsByUri, (byUri) => {
|
||||
return byUri[uri];
|
||||
});
|
||||
export const selectSuperChatDataForUri = (state: State, uri: string) => {
|
||||
const byUri = selectSuperchatsByUri(state);
|
||||
return byUri[uri];
|
||||
};
|
||||
|
||||
export const makeSelectSuperChatsForUri = (uri: string) =>
|
||||
createSelector(makeSelectSuperChatDataForUri(uri), (superChatData) => {
|
||||
if (!superChatData) {
|
||||
return undefined;
|
||||
}
|
||||
export const selectSuperChatsForUri = (state: State, uri: string) => {
|
||||
const superChatData = selectSuperChatDataForUri(state, uri);
|
||||
return superChatData ? superChatData.comments : undefined;
|
||||
};
|
||||
|
||||
return superChatData.comments;
|
||||
});
|
||||
|
||||
export const makeSelectSuperChatTotalAmountForUri = (uri: string) =>
|
||||
createSelector(makeSelectSuperChatDataForUri(uri), (superChatData) => {
|
||||
if (!superChatData) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return superChatData.totalAmount;
|
||||
});
|
||||
export const selectSuperChatTotalAmountForUri = (state: State, uri: string) => {
|
||||
const superChatData = selectSuperChatDataForUri(state, uri);
|
||||
return superChatData ? superChatData.totalAmount : 0;
|
||||
};
|
||||
@@ -17,6 +17,7 @@
|
||||
@import 'component/channel-mention';
|
||||
@import 'component/claim-list';
|
||||
@import 'component/collection';
|
||||
@import 'component/comments';
|
||||
@import 'component/content';
|
||||
@import 'component/dat-gui';
|
||||
@import 'component/embed-player';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
@import '../../scss/component/form-field';
|
||||
|
||||
.button {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
|
||||
@@ -235,7 +235,6 @@
|
||||
.claim-preview__actions {
|
||||
align-self: flex-end;
|
||||
margin-bottom: auto;
|
||||
justify-content: flex-end;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
@@ -245,10 +244,6 @@
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
|
||||
.claim-preview__actions {
|
||||
margin-left: var(--spacing-m);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-xsmall) {
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
@import '../../../web/scss/themes/odysee/init/vars';
|
||||
|
||||
.comments {
|
||||
list-style-type: none;
|
||||
font-size: var(--font-small);
|
||||
margin-top: var(--spacing-l);
|
||||
}
|
||||
|
||||
.comments--contracted {
|
||||
max-height: 5rem;
|
||||
overflow: hidden;
|
||||
-webkit-mask-image: -webkit-gradient(linear, left 30%, left bottom, from(rgba(0, 0, 0, 1)), to(rgba(0, 0, 0, 0)));
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.comment__sort {
|
||||
margin: var(--spacing-s) 0;
|
||||
margin-right: var(--spacing-s);
|
||||
display: block;
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
margin-top: 0;
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
@import '../../../web/scss/themes/odysee/init/vars';
|
||||
@import '../../scss/init/mixins';
|
||||
|
||||
.comments--own {
|
||||
.section__actions {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.comments--own__claim {
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
min-width: 40%;
|
||||
max-width: 40%;
|
||||
}
|
||||
|
||||
.media__thumb {
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
$width: 5rem;
|
||||
@include handleClaimListGifThumbnail($width);
|
||||
width: $width;
|
||||
height: calc(#{$width} * (9 / 16));
|
||||
margin-right: var(--spacing-s);
|
||||
}
|
||||
|
||||
.channel-thumbnail {
|
||||
@include handleChannelGif(calc(5rem * 9 / 16));
|
||||
margin-right: var(--spacing-xs);
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
@include handleChannelGif(calc(5rem * 9 / 16));
|
||||
margin-right: var(--spacing-s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.claim-preview__wrapper {
|
||||
margin: 0 0;
|
||||
padding: 0;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin: 0 var(--spacing-xs);
|
||||
}
|
||||
}
|
||||
|
||||
.comment {
|
||||
margin-top: var(--spacing-s);
|
||||
margin-left: 0;
|
||||
padding-left: var(--spacing-m);
|
||||
border-left: 4px solid var(--color-border);
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin-top: 0;
|
||||
margin-left: var(--spacing-s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,37 @@
|
||||
@import '../../../web/scss/themes/odysee/init/vars';
|
||||
@import '../../scss/component/button';
|
||||
@import '../../scss/init/gui';
|
||||
@import '../../scss/init/mixins';
|
||||
|
||||
$thumbnailWidth: 1.5rem;
|
||||
$thumbnailWidthSmall: 1rem;
|
||||
|
||||
.comments {
|
||||
list-style-type: none;
|
||||
font-size: var(--font-small);
|
||||
margin-top: var(--spacing-l);
|
||||
}
|
||||
|
||||
.comments--contracted {
|
||||
@extend .comments;
|
||||
max-height: 5rem;
|
||||
overflow: hidden;
|
||||
-webkit-mask-image: -webkit-gradient(linear, left 30%, left bottom, from(rgba(0, 0, 0, 1)), to(rgba(0, 0, 0, 0)));
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.comments--replies {
|
||||
list-style-type: none;
|
||||
margin-left: var(--spacing-s);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.comment__sort {
|
||||
margin: var(--spacing-s) 0;
|
||||
margin-right: var(--spacing-s);
|
||||
display: block;
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
margin-top: 0;
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
.comment {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -24,7 +44,7 @@ $thumbnailWidthSmall: 1rem;
|
||||
margin-top: var(--spacing-l);
|
||||
}
|
||||
|
||||
.commentAuthor__thumbnail {
|
||||
.comment__author-thumbnail {
|
||||
@include handleChannelGif($thumbnailWidthSmall);
|
||||
margin-right: 0;
|
||||
|
||||
@@ -47,7 +67,7 @@ $thumbnailWidthSmall: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.commentThumbnail__wrapper {
|
||||
.comment__thumbnail-wrapper {
|
||||
flex: 0;
|
||||
margin-top: var(--spacing-xxs);
|
||||
}
|
||||
@@ -57,7 +77,7 @@ $thumbnailWidthSmall: 1rem;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.commentReplies__container {
|
||||
.comment__replies-container {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@@ -79,17 +99,17 @@ $thumbnailWidthSmall: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.comment--topLevel {
|
||||
.comment--top-level {
|
||||
&:not(:first-child) {
|
||||
margin-top: var(--spacing-l);
|
||||
}
|
||||
}
|
||||
|
||||
.comment__content--slimed {
|
||||
.comment--slimed {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.commentBody__editInput {
|
||||
.comment__edit-input {
|
||||
margin-top: var(--spacing-xxs);
|
||||
}
|
||||
|
||||
@@ -112,13 +132,13 @@ $thumbnailWidthSmall: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.comment__content--highlighted {
|
||||
.comment--highlighted {
|
||||
background: var(--color-comment-highlighted);
|
||||
box-shadow: 0 0 0 5px var(--color-comment-highlighted);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.commentBody__container {
|
||||
.comment__body-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
@@ -144,7 +164,7 @@ $thumbnailWidthSmall: 1rem;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.commentMeta__information {
|
||||
.comment__meta-information {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
@@ -168,14 +188,14 @@ $thumbnailWidthSmall: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.commentBadge__globalMod {
|
||||
.comment__badge--global-mod {
|
||||
.st0 {
|
||||
// @see: ICONS.BADGE_MOD
|
||||
fill: #fe7500;
|
||||
}
|
||||
}
|
||||
|
||||
.commentBadge__mod {
|
||||
.comment__badge--mod {
|
||||
.st0 {
|
||||
// @see: ICONS.BADGE_MOD
|
||||
fill: #ff3850;
|
||||
@@ -402,7 +422,64 @@ $thumbnailWidthSmall: 1rem;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.comment__message--sticker {
|
||||
.comments-own {
|
||||
.section__actions {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.comments-own--claim {
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
min-width: 40%;
|
||||
max-width: 40%;
|
||||
}
|
||||
|
||||
.media__thumb {
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
$width: 5rem;
|
||||
@include handleClaimListGifThumbnail($width);
|
||||
width: $width;
|
||||
height: calc(#{$width} * (9 / 16));
|
||||
margin-right: var(--spacing-s);
|
||||
}
|
||||
|
||||
.channel-thumbnail {
|
||||
@include handleChannelGif(calc(5rem * 9 / 16));
|
||||
margin-right: var(--spacing-xs);
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
@include handleChannelGif(calc(5rem * 9 / 16));
|
||||
margin-right: var(--spacing-s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.claim-preview__wrapper {
|
||||
margin: 0 0;
|
||||
padding: 0;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin: 0 var(--spacing-xs);
|
||||
}
|
||||
}
|
||||
|
||||
.comment {
|
||||
margin-top: var(--spacing-s);
|
||||
margin-left: 0;
|
||||
padding-left: var(--spacing-m);
|
||||
border-left: 4px solid var(--color-border);
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin-top: 0;
|
||||
margin-left: var(--spacing-s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sticker__comment {
|
||||
margin-left: var(--spacing-m);
|
||||
height: 6rem;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
@import '../../../web/scss/themes/odysee/init/vars';
|
||||
@import '../../scss/init/mixins';
|
||||
|
||||
.livestreamComment {
|
||||
list-style-type: none;
|
||||
position: relative;
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
&:hover {
|
||||
background-color: var(--color-card-background-highlighted);
|
||||
}
|
||||
|
||||
&:not(:hover) {
|
||||
.menu__button:not(:focus):not([aria-expanded='true']) {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
font-size: var(--font-xsmall);
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamComment__info {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.livestreamComment--superchat {
|
||||
background-color: var(--color-card-background-highlighted);
|
||||
|
||||
+ .livestreamComment--superchat {
|
||||
margin-bottom: var(--spacing-xxs);
|
||||
}
|
||||
|
||||
.livestreamComment__body {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: unset;
|
||||
flex: unset;
|
||||
}
|
||||
|
||||
.livestreamComment__info {
|
||||
margin-top: calc(var(--spacing-xxs) / 2);
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
max-height: 4rem;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
width: 5px;
|
||||
background-color: var(--color-superchat);
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamComment__body {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-left: var(--spacing-s);
|
||||
overflow: hidden;
|
||||
|
||||
.livestreamComment__info--sticker {
|
||||
display: flex;
|
||||
margin: var(--spacing-xxs) 0;
|
||||
}
|
||||
|
||||
.channel-thumbnail {
|
||||
@include handleChannelGif(2rem);
|
||||
margin-top: var(--spacing-xxs);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamComment__menu {
|
||||
position: absolute;
|
||||
right: var(--spacing-xs);
|
||||
top: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.livestreamComment__superchatBanner {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
padding: 0.25rem var(--spacing-s);
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// This is just a two small circles that overlap to make it look like
|
||||
// the banner and the left border are connected
|
||||
.livestreamComment__superchatBanner-corner {
|
||||
height: calc(var(--border-radius) * 2);
|
||||
width: calc(var(--border-radius) * 2);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
background-color: var(--color-superchat);
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
transform: translateX(0) translateY(50%);
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
height: calc(var(--border-radius) * 2);
|
||||
width: calc(var(--border-radius) * 2);
|
||||
border-top-left-radius: var(--border-radius);
|
||||
background-color: var(--color-card-background);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
transform: translateX(25%) translateY(50%);
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamComment__text {
|
||||
padding-right: var(--spacing-xl);
|
||||
padding-bottom: var(--spacing-xxs);
|
||||
|
||||
.markdown-preview {
|
||||
p {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
font-size: var(--font-small);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
@import '../../../web/scss/themes/odysee/init/vars';
|
||||
|
||||
$discussion-header__height: 3rem;
|
||||
$recent-msg-button__height: 2rem;
|
||||
|
||||
.livestream__discussion {
|
||||
width: 100%;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin: 0;
|
||||
width: var(--livestreamComments-width);
|
||||
height: calc(100vh - var(--header-height));
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: var(--header-height);
|
||||
bottom: 0;
|
||||
border-radius: 0;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
border-right: none;
|
||||
|
||||
.card__main-actions {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamDiscussion__header {
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
padding-bottom: var(--spacing-s);
|
||||
margin-bottom: 0;
|
||||
align-items: center;
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
height: $discussion-header__height;
|
||||
padding: 0 var(--spacing-s);
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamDiscussion__title {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.livestreamComments__wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh - var(--header-height) - #{$discussion-header__height});
|
||||
}
|
||||
|
||||
.livestream__comments {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
font-size: var(--font-small);
|
||||
overflow-y: scroll;
|
||||
overflow-x: visible;
|
||||
padding-top: var(--spacing-s);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.livestreamComments__scrollToRecent {
|
||||
margin-top: -$recent-msg-button__height;
|
||||
align-self: center;
|
||||
margin-bottom: var(--spacing-xs);
|
||||
font-size: var(--font-xsmall);
|
||||
padding: var(--spacing-xxs) var(--spacing-s);
|
||||
opacity: 0.9;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.livestream__commentCreate {
|
||||
padding: var(--spacing-s);
|
||||
border-top: 1px solid var(--color-border);
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.livestreamSuperchats__wrapper {
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
overflow-x: scroll;
|
||||
padding: var(--spacing-s) var(--spacing-xs);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
font-size: var(--font-small);
|
||||
background-color: var(--color-card-background);
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
padding: var(--spacing-xs);
|
||||
width: var(--livestreamComments-width);
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamPinned__wrapper {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
padding: var(--spacing-s) var(--spacing-xs);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
font-size: var(--font-small);
|
||||
background-color: var(--color-card-background-highlighted);
|
||||
width: 100%;
|
||||
|
||||
.livestreamComment {
|
||||
width: 100%;
|
||||
padding-top: var(--spacing-xs);
|
||||
max-height: 6rem;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
border-left: 1px solid var(--color-border);
|
||||
padding: 0 calc(var(--spacing-m) - var(--spacing-xs)) 0 var(--spacing-m);
|
||||
color: var(--color-text-subtitle);
|
||||
}
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
padding: var(--spacing-xs);
|
||||
width: var(--livestreamComments-width);
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamSuperchat__amount-large {
|
||||
.credit-amount {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamSuperchats__inner {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.livestreamSuperchat__info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
font-size: var(--font-xsmall);
|
||||
}
|
||||
|
||||
.livestreamSuperchat__info--sticker {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: row;
|
||||
width: 8rem;
|
||||
height: 3rem;
|
||||
|
||||
.livestreamSuperchat__info--image {
|
||||
padding-left: var(--spacing-m);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin-top: calc(var(--spacing-xxs) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamSuperchat__info--notSticker {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.livestreamSuperchat__tooltip-amount {
|
||||
margin-top: var(--spacing-xs);
|
||||
margin-left: 0;
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.livestream__superchat-comment {
|
||||
margin-top: var(--spacing-s);
|
||||
max-width: 5rem;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.livestreamSuperchat__amount-large {
|
||||
min-width: 2.5rem;
|
||||
}
|
||||
@@ -26,6 +26,162 @@ $recent-msg-button__height: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.livestream__discussion {
|
||||
width: 100%;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin: 0;
|
||||
width: var(--livestream-comments-width);
|
||||
height: calc(100vh - var(--header-height));
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: var(--header-height);
|
||||
bottom: 0;
|
||||
border-radius: 0;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
border-right: none;
|
||||
|
||||
.card__main-actions {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-discussion__header {
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
padding-bottom: var(--spacing-s);
|
||||
margin-bottom: 0;
|
||||
align-items: center;
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
height: $discussion-header__height;
|
||||
padding: 0 var(--spacing-s);
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-discussion__title {
|
||||
@extend .card__title-section;
|
||||
@extend .card__title-section--small;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.livestream__comments-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh - var(--header-height) - #{$discussion-header__height});
|
||||
}
|
||||
|
||||
.livestream__comments {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
font-size: var(--font-small);
|
||||
overflow-y: scroll;
|
||||
overflow-x: visible;
|
||||
padding-top: var(--spacing-s);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.livestream-comment {
|
||||
list-style-type: none;
|
||||
position: relative;
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
&:hover {
|
||||
background-color: var(--color-card-background-highlighted);
|
||||
}
|
||||
|
||||
&:not(:hover) {
|
||||
.menu__button:not(:focus):not([aria-expanded='true']) {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
font-size: var(--font-xsmall);
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-comment__info {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.livestream-comment--superchat {
|
||||
background-color: var(--color-card-background-highlighted);
|
||||
|
||||
+ .livestream-comment--superchat {
|
||||
margin-bottom: var(--spacing-xxs);
|
||||
}
|
||||
|
||||
.livestream-comment__body {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: unset;
|
||||
flex: unset;
|
||||
}
|
||||
|
||||
.livestream-comment__info {
|
||||
margin-top: calc(var(--spacing-xxs) / 2);
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
max-height: 4rem;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
width: 5px;
|
||||
background-color: var(--color-superchat);
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-comment__body {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-left: var(--spacing-s);
|
||||
overflow: hidden;
|
||||
|
||||
.livestream-comment__info--sticker {
|
||||
display: flex;
|
||||
margin: var(--spacing-xxs) 0;
|
||||
}
|
||||
|
||||
.channel-thumbnail {
|
||||
@include handleChannelGif(2rem);
|
||||
margin-top: var(--spacing-xxs);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-comment__menu {
|
||||
position: absolute;
|
||||
right: var(--spacing-xs);
|
||||
top: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.livestream__comments__scroll-to-recent {
|
||||
margin-top: -$recent-msg-button__height;
|
||||
align-self: center;
|
||||
margin-bottom: var(--spacing-xs);
|
||||
font-size: var(--font-xsmall);
|
||||
padding: var(--spacing-xxs) var(--spacing-s);
|
||||
opacity: 0.9;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.livestream__comment-create {
|
||||
padding: var(--spacing-s);
|
||||
border-top: 1px solid var(--color-border);
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.livestream__channel-link {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
box-shadow: 0 0 0 rgba(246, 72, 83, 0.4);
|
||||
@@ -87,7 +243,68 @@ $recent-msg-button__height: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.livestreamSuperchat {
|
||||
.livestream-superchats__wrapper {
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
overflow-x: scroll;
|
||||
padding: var(--spacing-s) var(--spacing-xs);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
font-size: var(--font-small);
|
||||
background-color: var(--color-card-background);
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
padding: var(--spacing-xs);
|
||||
width: var(--livestream-comments-width);
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-pinned__wrapper {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
padding: var(--spacing-s) var(--spacing-xs);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
font-size: var(--font-small);
|
||||
background-color: var(--color-card-background-highlighted);
|
||||
width: 100%;
|
||||
|
||||
.livestream-comment {
|
||||
width: 100%;
|
||||
padding-top: var(--spacing-xs);
|
||||
max-height: 6rem;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
border-left: 1px solid var(--color-border);
|
||||
padding: 0 calc(var(--spacing-m) - var(--spacing-xs)) 0 var(--spacing-m);
|
||||
color: var(--color-text-subtitle);
|
||||
}
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
padding: var(--spacing-xs);
|
||||
width: var(--livestream-comments-width);
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-superchat__amount-large {
|
||||
.credit-amount {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-superchats__inner {
|
||||
display: flex;
|
||||
|
||||
.close-button {
|
||||
padding-left: var(--spacing-m);
|
||||
padding-right: var(--spacing-l);
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-superchat {
|
||||
display: flex;
|
||||
margin-right: var(--spacing-xs);
|
||||
padding: var(--spacing-xxs);
|
||||
@@ -125,6 +342,100 @@ $recent-msg-button__height: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-superchat__info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
font-size: var(--font-xsmall);
|
||||
}
|
||||
|
||||
.livestream-superchat__info--sticker {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: row;
|
||||
width: 8rem;
|
||||
height: 3rem;
|
||||
|
||||
.livestream-superchat__info--image {
|
||||
padding-left: var(--spacing-m);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin-top: calc(var(--spacing-xxs) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-superchat__info--not-sticker {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.livestream-superchat__banner {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
padding: 0.25rem var(--spacing-s);
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// This is just a two small circles that overlap to make it look like
|
||||
// the banner and the left border are connected
|
||||
.livestream-superchat__banner-corner {
|
||||
height: calc(var(--border-radius) * 2);
|
||||
width: calc(var(--border-radius) * 2);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
background-color: var(--color-superchat);
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
transform: translateX(0) translateY(50%);
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
height: calc(var(--border-radius) * 2);
|
||||
width: calc(var(--border-radius) * 2);
|
||||
border-top-left-radius: var(--border-radius);
|
||||
background-color: var(--color-card-background);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
transform: translateX(25%) translateY(50%);
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-comment__text {
|
||||
padding-right: var(--spacing-xl);
|
||||
padding-bottom: var(--spacing-xxs);
|
||||
|
||||
.markdown-preview {
|
||||
p {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
font-size: var(--font-small);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.livestream-superchat__tooltip-amount {
|
||||
margin-top: var(--spacing-xs);
|
||||
margin-left: 0;
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.livestream__superchat-comment {
|
||||
margin-top: var(--spacing-s);
|
||||
max-width: 5rem;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.livestream-superchat__amount-large {
|
||||
min-width: 2.5rem;
|
||||
}
|
||||
|
||||
.table--livestream-data {
|
||||
td:nth-of-type(1) {
|
||||
max-width: 4rem;
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
}
|
||||
|
||||
@media (min-width: $breakpoint-medium) and (max-width: $breakpoint-large + 300px) {
|
||||
max-width: calc(100vw - var(--livestreamComments-width) - var(--spacing-m) * 3);
|
||||
max-width: calc(100vw - var(--livestream-comments-width) - var(--spacing-m) * 3);
|
||||
margin-left: var(--spacing-m);
|
||||
margin-right: var(--spacing-m);
|
||||
}
|
||||
@@ -234,7 +234,7 @@
|
||||
}
|
||||
|
||||
.main__right-side {
|
||||
width: var(--livestreamComments-width);
|
||||
width: var(--livestream-comments-width);
|
||||
|
||||
@media (max-width: $breakpoint-medium) {
|
||||
width: 100%;
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.superChat--light {
|
||||
.super-chat--light {
|
||||
position: absolute;
|
||||
display: inline;
|
||||
bottom: 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.superChat {
|
||||
.super-chat {
|
||||
border-radius: var(--border-radius);
|
||||
background: linear-gradient(to right, var(--color-superchat), var(--color-superchat-3));
|
||||
padding: 0.2rem var(--spacing-xs);
|
||||
@@ -10,8 +10,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
.superChat--light {
|
||||
@extend .superChat;
|
||||
.super-chat--light {
|
||||
@extend .super-chat;
|
||||
background: linear-gradient(to right, var(--color-superchat__light), var(--color-superchat-3__light));
|
||||
|
||||
.credit-amount {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
@import '../init/vars';
|
||||
|
||||
.claimPreviewReset {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-top: var(--spacing-xs);
|
||||
color: var(--color-text-subtitle);
|
||||
font-size: var(--font-small);
|
||||
flex-direction: column;
|
||||
@media (min-width: $breakpoint-xsmall) {
|
||||
flex-direction: row;
|
||||
}
|
||||
}
|
||||
.claimPreviewReset__hint {
|
||||
display: inline-block;
|
||||
margin-top: var(--spacing-s);
|
||||
@media (min-width: $breakpoint-xsmall) {
|
||||
margin-right: var(--spacing-xl);
|
||||
}
|
||||
}
|
||||
|
||||
.claimPreviewReset__button {
|
||||
margin-top: var(--spacing-s);
|
||||
width: 100%;
|
||||
.button__content {
|
||||
justify-content: center;
|
||||
}
|
||||
@media (min-width: $breakpoint-xsmall) {
|
||||
margin-top: 0;
|
||||
width: auto;
|
||||
.button__content {
|
||||
justify-content: start;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ textarea {
|
||||
margin: -1rem 0;
|
||||
padding: 0 30px;
|
||||
|
||||
background: url('../../../static/img/busy.gif') no-repeat center center;
|
||||
background: url('../../static/img/busy.gif') no-repeat center center;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ $breakpoint-large: 1600px;
|
||||
|
||||
--tag-height: 1.5rem;
|
||||
|
||||
--livestreamComments-width: 30rem;
|
||||
--livestream-comments-width: 30rem;
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-small) {
|
||||
|
||||
+2
-7
@@ -98,13 +98,8 @@ export const buildValidSticker = (sticker: string) => `<stkr>${sticker}<stkr>`;
|
||||
export function parseSticker(comment: string) {
|
||||
const matchSticker = comment.match(stickerRegex);
|
||||
const stickerValue = matchSticker && matchSticker[0];
|
||||
const stickerName = stickerValue && stickerValue.replace(/<stkr>/g, '');
|
||||
const commentIsSticker = stickerValue && stickerValue.length === comment.length;
|
||||
|
||||
return (
|
||||
commentIsSticker &&
|
||||
ALL_VALID_STICKERS.find((sticker) => {
|
||||
// $FlowFixMe
|
||||
return sticker.name === stickerValue.replaceAll('<stkr>', '');
|
||||
})
|
||||
);
|
||||
return commentIsSticker && ALL_VALID_STICKERS.find((sticker) => sticker.name === stickerName);
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// @flow
|
||||
|
||||
export function scaleToDevicePixelRatio(value: number) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
||||
return devicePixelRatio < 1.0 ? Math.ceil(value / devicePixelRatio) : Math.ceil(value * devicePixelRatio);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export default function NagDegradedPerformance(props: Props) {
|
||||
),
|
||||
}}
|
||||
>
|
||||
lbry.tv collects usage information for itself only (%more_information%).
|
||||
odysee collects usage information for itself only (%more_information%).
|
||||
</I18nMessage>
|
||||
}
|
||||
actionText={__('OK')}
|
||||
@@ -49,7 +49,7 @@ export default function NagDegradedPerformance(props: Props) {
|
||||
),
|
||||
}}
|
||||
>
|
||||
lbry.tv collects usage information for itself only (%more_information%). Want control over this and more?
|
||||
odysee collects usage information for itself only (%more_information%). Want control over this and more?
|
||||
</I18nMessage>
|
||||
}
|
||||
actionText={__('Get The App')}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
@import '../../ui/scss/component/channel-mention';
|
||||
@import '../../ui/scss/component/claim-list';
|
||||
@import '../../ui/scss/component/collection';
|
||||
@import '../../ui/scss/component/comments';
|
||||
@import '../../ui/scss/component/content';
|
||||
@import '../../ui/scss/component/dat-gui';
|
||||
@import '../../ui/scss/component/embed-player';
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
@import '../../ui/scss/component/channel-mention';
|
||||
@import '../../ui/scss/component/claim-list';
|
||||
@import '../../ui/scss/component/collection';
|
||||
@import '../../ui/scss/component/comments';
|
||||
@import '../../ui/scss/component/content';
|
||||
@import '../../ui/scss/component/dat-gui';
|
||||
@import '../../ui/scss/component/embed-player';
|
||||
|
||||
@@ -98,7 +98,7 @@ $breakpoint-large: 1600px;
|
||||
|
||||
--tag-height: 1.5rem;
|
||||
|
||||
--livestreamComments-width: 30rem;
|
||||
--livestream-comments-width: 30rem;
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-small) {
|
||||
|
||||
Reference in new issue
Block a user