Compare commits
16 Commits
searchDefa
...
ip/test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed2b5ff1d7 | ||
|
|
05f7e55aed | ||
|
|
bf710cb325 | ||
|
|
7d67c5fdf0 | ||
|
|
b28d95b3bb | ||
|
|
9d97350f09 | ||
|
|
f3a825c0e7 | ||
|
|
c76f6e58ba | ||
|
|
26514f9be6 | ||
|
|
ffad52d5b7 | ||
|
|
6e402240b0 | ||
|
|
7a8d213861 | ||
|
|
c62c667436 | ||
|
|
038431f95c | ||
|
|
ed0387d94a | ||
|
|
f2cd9f372e |
@@ -64,7 +64,6 @@ const config = {
|
||||
CUSTOM_HOMEPAGE: process.env.CUSTOM_HOMEPAGE === 'true',
|
||||
SHOW_TAGS_INTRO: process.env.SHOW_TAGS_INTRO === 'true',
|
||||
AVATAR_DEFAULT: process.env.AVATAR_DEFAULT,
|
||||
LIGHTHOUSE_DEFAULT_TYPES: process.env.LIGHTHOUSE_DEFAULT_TYPES,
|
||||
};
|
||||
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
|
||||
3
flow-typed/Comment.js
vendored
3
flow-typed/Comment.js
vendored
@@ -14,6 +14,9 @@ declare type Comment = {
|
||||
is_pinned: boolean,
|
||||
support_amount: number,
|
||||
replies: number, // number of direct replies (i.e. excluding nested replies).
|
||||
is_moderator: boolean,
|
||||
is_creator: boolean,
|
||||
is_global_mod: boolean,
|
||||
is_fiat?: boolean,
|
||||
};
|
||||
|
||||
|
||||
2
flow-typed/homepage.js
vendored
2
flow-typed/homepage.js
vendored
@@ -17,7 +17,7 @@ declare type RowDataItem = {
|
||||
help?: any,
|
||||
icon?: string,
|
||||
extra?: any,
|
||||
pinUrls?: Array<string>,
|
||||
pinnedUrls?: Array<string>,
|
||||
options?: {
|
||||
channelIds?: Array<string>,
|
||||
limitClaimsPerChannel?: number,
|
||||
|
||||
@@ -1453,6 +1453,7 @@
|
||||
"Unable to comment. This channel has blocked you.": "Unable to comment. This channel has blocked you.",
|
||||
"Unable to comment. Your channel has been blocked by an admin.": "Unable to comment. Your channel has been blocked by an admin.",
|
||||
"Unable to comment. The content owner has disabled comments.": "Unable to comment. The content owner has disabled comments.",
|
||||
"Please do not spam.": "Please do not spam.",
|
||||
"Slow mode is on. Please wait up to %value% seconds before commenting again.": "Slow mode is on. Please wait up to %value% seconds before commenting again.",
|
||||
"The comment contains contents that are blocked by %author%": "The comment contains contents that are blocked by %author%",
|
||||
"Your channel is still being setup, try again in a few moments.": "Your channel is still being setup, try again in a few moments.",
|
||||
@@ -1726,6 +1727,7 @@
|
||||
"Are you sure you want to view this content? Viewing will not unmute @%channel%": "Are you sure you want to view this content? Viewing will not unmute @%channel%",
|
||||
"View Content": "View Content",
|
||||
"Global": "Global",
|
||||
"Global Admin": "Global Admin",
|
||||
"Moderator": "Moderator",
|
||||
"Global Unblock Channel": "Global Unblock Channel",
|
||||
"Global Block Channel": "Global Block Channel",
|
||||
|
||||
@@ -58,6 +58,8 @@ type Analytics = {
|
||||
rewardEligibleEvent: () => void,
|
||||
startupEvent: () => void,
|
||||
purchaseEvent: (number) => void,
|
||||
commentReactionFetchFailedEvent: (string, Array<string>) => void,
|
||||
commentReactionFetchDupEvent: (string, Array<string>) => void,
|
||||
readyEvent: (number) => void,
|
||||
openUrlEvent: (string) => void,
|
||||
};
|
||||
@@ -273,6 +275,14 @@ const analytics: Analytics = {
|
||||
purchaseEvent: (purchaseInt: number) => {
|
||||
sendMatomoEvent('Purchase', 'Purchase-Complete', 'someLabel', purchaseInt);
|
||||
},
|
||||
commentReactionFetchFailedEvent: (claimId: string, commentIds: Array<string>) => {
|
||||
const idCsv = commentIds.map((c) => c.slice(0, 5)).join(',');
|
||||
sendMatomoEvent('Comment', 'Reaction-Fetch-Failed', `${claimId}:${idCsv}`);
|
||||
},
|
||||
commentReactionFetchDupEvent: (claimId: string, commentIds: Array<string>) => {
|
||||
const idCsv = commentIds.map((c) => c.slice(0, 5)).join(',');
|
||||
sendMatomoEvent('Comment', 'Reaction-Fetch-Dup', `${claimId}:${idCsv}`);
|
||||
},
|
||||
};
|
||||
|
||||
function sendMatomoEvent(category, action, name, value) {
|
||||
|
||||
@@ -14,6 +14,7 @@ function ClaimPreviewLoading(props: Props) {
|
||||
className={classnames('claim-preview__wrapper', {
|
||||
'claim-preview__wrapper--channel': isChannel && type !== 'inline',
|
||||
'claim-preview__wrapper--inline': type === 'inline',
|
||||
'claim-preview__wrapper--small': type === 'small',
|
||||
})}
|
||||
>
|
||||
<div className={classnames('claim-preview', { 'claim-preview--large': type === 'large' })}>
|
||||
|
||||
@@ -114,7 +114,6 @@ type Props = {
|
||||
renderProperties?: (Claim) => ?Node,
|
||||
liveLivestreamsFirst?: boolean,
|
||||
livestreamMap?: { [string]: any },
|
||||
pin?: boolean,
|
||||
pinUrls?: Array<string>,
|
||||
showNoSourceClaims?: boolean,
|
||||
};
|
||||
@@ -147,7 +146,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||
mutedUris,
|
||||
liveLivestreamsFirst,
|
||||
livestreamMap,
|
||||
pin,
|
||||
pinUrls,
|
||||
prefixUris,
|
||||
showNoSourceClaims,
|
||||
@@ -291,9 +289,9 @@ function ClaimTilesDiscover(props: Props) {
|
||||
};
|
||||
|
||||
const modifiedUris = uris ? uris.slice() : [];
|
||||
const fixUris = pinUrls || ['lbry://@AlisonMorrow#6/LBRY#8'];
|
||||
const fixUris = pinUrls || [];
|
||||
|
||||
if (pin && modifiedUris && modifiedUris.length > 2 && window.location.pathname === '/') {
|
||||
if (pinUrls && modifiedUris && modifiedUris.length > 2 && window.location.pathname === '/') {
|
||||
fixUris.forEach((fixUri) => {
|
||||
if (modifiedUris.indexOf(fixUri) !== -1) {
|
||||
modifiedUris.splice(modifiedUris.indexOf(fixUri), 1);
|
||||
@@ -308,7 +306,13 @@ function ClaimTilesDiscover(props: Props) {
|
||||
<ul className="claim-grid">
|
||||
{modifiedUris && modifiedUris.length
|
||||
? modifiedUris.map((uri, index) => (
|
||||
<ClaimPreviewTile key={uri} uri={uri} properties={renderProperties} live={resolveLive(index)} />
|
||||
<ClaimPreviewTile
|
||||
showNoSourceClaims={hasNoSource || showNoSourceClaims}
|
||||
key={uri}
|
||||
uri={uri}
|
||||
properties={renderProperties}
|
||||
live={resolveLive(index)}
|
||||
/>
|
||||
))
|
||||
: new Array(pageSize)
|
||||
.fill(1)
|
||||
|
||||
@@ -59,7 +59,9 @@ type Props = {
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
numDirectReplies: number,
|
||||
isFiat: boolean
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
};
|
||||
|
||||
const LENGTH_TO_COLLAPSE = 300;
|
||||
@@ -92,6 +94,8 @@ function Comment(props: Props) {
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
numDirectReplies,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
} = props;
|
||||
|
||||
@@ -244,6 +248,18 @@ function Comment(props: Props) {
|
||||
|
||||
{supportAmount > 0 && <CreditAmount isFiat={isFiat} amount={supportAmount} superChatLight size={12} />}
|
||||
|
||||
{isGlobalMod && (
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_GLOBAL_MOD} size={20} tooltip customTooltipText={__('Global Admin')} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
{isModerator && (
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={20} tooltip customTooltipText={__('Moderator')} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
{isPinned && (
|
||||
<span className="comment__pin">
|
||||
<Icon icon={ICONS.PIN} size={14} />
|
||||
|
||||
@@ -13,6 +13,7 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import Empty from 'component/common/empty';
|
||||
import debounce from 'util/debounce';
|
||||
import analytics from 'analytics';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
|
||||
|
||||
@@ -76,6 +77,8 @@ function CommentList(props: Props) {
|
||||
const [page, setPage] = React.useState(0);
|
||||
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
||||
|
||||
const [lastRequestedIds, setLastRequestedIds] = React.useState([]);
|
||||
|
||||
// Display comments immediately if not fetching reactions
|
||||
// If not, wait to show comments until reactions are fetched
|
||||
const [readyToDisplayComments, setReadyToDisplayComments] = React.useState(
|
||||
@@ -137,6 +140,14 @@ function CommentList(props: Props) {
|
||||
}
|
||||
|
||||
if (idsForReactionFetch.length !== 0) {
|
||||
const isEq = (a, b) => a.length === b.length && a.every((value, index) => value === b[index]);
|
||||
if (isEq(idsForReactionFetch, lastRequestedIds)) {
|
||||
const fromScratch = !othersReactsById || !myReactsByCommentId ? 's' : '';
|
||||
analytics.commentReactionFetchDupEvent(`${fromScratch}${activeChannelId || ''}`, idsForReactionFetch);
|
||||
}
|
||||
|
||||
setLastRequestedIds(idsForReactionFetch);
|
||||
|
||||
fetchReacts(idsForReactionFetch)
|
||||
.then(() => {
|
||||
setReadyToDisplayComments(true);
|
||||
@@ -154,6 +165,8 @@ function CommentList(props: Props) {
|
||||
activeChannelId,
|
||||
fetchingChannels,
|
||||
isFetchingReacts,
|
||||
lastRequestedIds,
|
||||
setLastRequestedIds,
|
||||
]);
|
||||
|
||||
// Scroll to linked-comment
|
||||
@@ -301,6 +314,8 @@ function CommentList(props: Props) {
|
||||
isPinned={comment.is_pinned}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -97,6 +97,8 @@ function CommentsReplies(props: Props) {
|
||||
commentingEnabled={commentingEnabled}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -2323,4 +2323,34 @@ export const icons = {
|
||||
<path d="M4.954 14.753l3.535 3.535-1.768 1.768-3.535-3.535z" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.BADGE_GLOBAL_MOD]: buildIcon(
|
||||
<g>
|
||||
<path
|
||||
d="M23.25,15.75a7.669,7.669,0,0,1-6,7.5,7.669,7.669,0,0,1-6-7.5v-3a1.5,1.5,0,0,1,1.5-1.5h9a1.5,1.5,0,0,1,1.5,1.5Z"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
<path d="M17.25 15L17.25 19.5" strokeWidth="1.5" />
|
||||
<path d="M15 17.25L19.5 17.25" strokeWidth="1.5" />
|
||||
<path d="M11.24,23.225a11.25,11.25,0,1,1,11.362-15" strokeWidth="1.5" />
|
||||
<path d="M9.289,22.921C7.768,20.689,6.75,16.633,6.75,12S7.768,3.312,9.289,1.079" strokeWidth="1.5" />
|
||||
<path d="M0.775 11.25L8.25 11.25" strokeWidth="1.5" />
|
||||
<path d="M2.999 5.25L21 5.25" strokeWidth="1.5" />
|
||||
<path d="M2.048 17.25L8.25 17.25" strokeWidth="1.5" />
|
||||
<path d="M14.711,1.079a17.009,17.009,0,0,1,2.307,7.159" strokeWidth="1.5" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.BADGE_MOD]: buildIcon(
|
||||
<g>
|
||||
<path
|
||||
d="M23.25,15.75a7.668,7.668,0,0,1-6,7.5,7.669,7.669,0,0,1-6-7.5v-3a1.5,1.5,0,0,1,1.5-1.5h9a1.5,1.5,0,0,1,1.5,1.5Z"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
<path d="M17.25 15L17.25 19.5" strokeWidth="1.5" />
|
||||
<path d="M15 17.25L19.5 17.25" strokeWidth="1.5" />
|
||||
<path d="M3.000 3.750 A3.000 3.000 0 1 0 9.000 3.750 A3.000 3.000 0 1 0 3.000 3.750 Z" strokeWidth="1.5" />
|
||||
<path d="M9.174,9.317A5.251,5.251,0,0,0,.75,13.5v2.25H3l.75,7.5h4.5L8.7,18.713" strokeWidth="1.5" />
|
||||
<path d="M13.875 3.375 A2.625 2.625 0 1 0 19.125 3.375 A2.625 2.625 0 1 0 13.875 3.375 Z" strokeWidth="1.5" />
|
||||
<path d="M20.4,9a4.5,4.5,0,0,0-7.285-.71" strokeWidth="1.5" />
|
||||
</g>
|
||||
),
|
||||
};
|
||||
|
||||
@@ -20,11 +20,25 @@ type Props = {
|
||||
commentIsMine: boolean,
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
};
|
||||
|
||||
function LivestreamComment(props: Props) {
|
||||
const { claim, uri, authorUri, message, commentIsMine, commentId, stakedLevel, supportAmount, isFiat } = props;
|
||||
const {
|
||||
claim,
|
||||
uri,
|
||||
authorUri,
|
||||
message,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
} = props;
|
||||
const [mouseIsHovering, setMouseHover] = React.useState(false);
|
||||
const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const { claimName } = parseURI(authorUri);
|
||||
@@ -57,6 +71,18 @@ function LivestreamComment(props: Props) {
|
||||
{claimName}
|
||||
</Button>
|
||||
|
||||
{isGlobalMod && (
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_GLOBAL_MOD} size={16} tooltip customTooltipText={__('Global Admin')} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
{isModerator && (
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={16} tooltip customTooltipText={__('Moderator')} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div className="livestream-comment__text">
|
||||
<MarkdownPreview content={message} promptLinks stakedLevel={stakedLevel} />
|
||||
</div>
|
||||
|
||||
@@ -197,6 +197,8 @@ export default function LivestreamComments(props: Props) {
|
||||
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)}
|
||||
/>
|
||||
|
||||
@@ -6,12 +6,11 @@ import Nag from 'component/common/nag';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import { AUTO_FOLLOW_CHANNELS, CUSTOM_HOMEPAGE } from 'config';
|
||||
import { AUTO_FOLLOW_CHANNELS, CUSTOM_HOMEPAGE, SIMPLE_SITE, SITE_NAME } from 'config';
|
||||
|
||||
type Props = {
|
||||
subscribedChannels: Array<Subscription>,
|
||||
onContinue: () => void,
|
||||
onBack: () => void,
|
||||
channelSubscribe: (sub: Subscription) => void,
|
||||
homepageData: any,
|
||||
prefsReady: boolean,
|
||||
@@ -22,7 +21,7 @@ const channelsToSubscribe = AUTO_FOLLOW_CHANNELS.trim()
|
||||
.filter((x) => x !== '');
|
||||
|
||||
function UserChannelFollowIntro(props: Props) {
|
||||
const { subscribedChannels, channelSubscribe, onContinue, onBack, homepageData, prefsReady } = props;
|
||||
const { subscribedChannels, channelSubscribe, onContinue, homepageData, prefsReady } = props;
|
||||
const { PRIMARY_CONTENT } = homepageData;
|
||||
let channelIds;
|
||||
if (PRIMARY_CONTENT && CUSTOM_HOMEPAGE) {
|
||||
@@ -49,25 +48,27 @@ function UserChannelFollowIntro(props: Props) {
|
||||
<Card
|
||||
title={__('Find channels to follow')}
|
||||
subtitle={__(
|
||||
'LBRY works better if you find and follow a couple creators you like. You can also block channels you never want to see.'
|
||||
'%SITE_NAME% works better if you find and follow a couple creators you like. You can also block channels you never want to see.',
|
||||
{ SITE_NAME }
|
||||
)}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
<div className="section__actions--between">
|
||||
<Button button="secondary" onClick={onBack} label={__('Back')} />
|
||||
<Button
|
||||
button={subscribedChannels.length < 1 ? 'alt' : 'primary'}
|
||||
onClick={onContinue}
|
||||
label={subscribedChannels.length < 1 ? __('Skip') : __('Continue')}
|
||||
/>
|
||||
</div>
|
||||
<div className="section__body">
|
||||
<ClaimListDiscover
|
||||
defaultOrderBy={CS.ORDER_BY_TOP}
|
||||
hideFilters={SIMPLE_SITE}
|
||||
meta={
|
||||
<Button
|
||||
button={subscribedChannels.length < 1 ? 'alt' : 'primary'}
|
||||
onClick={onContinue}
|
||||
label={subscribedChannels.length < 1 ? __('Skip') : __('Continue')}
|
||||
/>
|
||||
}
|
||||
defaultOrderBy={SIMPLE_SITE ? CS.ORDER_BY_TOP : CS.ORDER_BY_TRENDING}
|
||||
defaultFreshness={CS.FRESH_ALL}
|
||||
claimType="channel"
|
||||
claimIds={CUSTOM_HOMEPAGE && channelIds ? channelIds : undefined}
|
||||
defaultTags={followingCount > 3 ? CS.TAGS_FOLLOWED : undefined}
|
||||
maxPages={SIMPLE_SITE ? 3 : undefined}
|
||||
/>
|
||||
{followingCount > 0 && (
|
||||
<Nag
|
||||
|
||||
@@ -497,7 +497,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
}
|
||||
|
||||
function detectFileType() {
|
||||
console.log(`Detecting file type via pre-fetch...`);
|
||||
return new Promise(async (res, rej) => {
|
||||
try {
|
||||
const response = await fetch(source, { method: 'HEAD', cache: 'no-store' });
|
||||
@@ -514,8 +513,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
finalSource = response.url;
|
||||
}
|
||||
|
||||
console.log(`File type is: ${finalType}`);
|
||||
|
||||
// Modify video source in options
|
||||
videoJsOptions.sources = [
|
||||
{
|
||||
@@ -526,7 +523,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
|
||||
return res(videoJsOptions);
|
||||
} catch (error) {
|
||||
console.error(`Failed to pre-fetch video!`);
|
||||
return rej(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -165,3 +165,5 @@ export const GLOBE = 'globe';
|
||||
export const RSS = 'rss';
|
||||
export const STAR = 'star';
|
||||
export const MUSIC = 'MusicCategory';
|
||||
export const BADGE_GLOBAL_MOD = 'BadgeGlobalMod';
|
||||
export const BADGE_MOD = 'BadgeMod';
|
||||
|
||||
@@ -28,11 +28,15 @@ import I18nMessage from 'component/i18nMessage';
|
||||
import PlaceholderTx from 'static/img/placeholderTx.gif';
|
||||
|
||||
export const PAGE_VIEW_QUERY = `view`;
|
||||
const CONTENT_PAGE = 'content';
|
||||
const LISTS_PAGE = 'lists';
|
||||
const ABOUT_PAGE = `about`;
|
||||
export const DISCUSSION_PAGE = `discussion`;
|
||||
const EDIT_PAGE = 'edit';
|
||||
|
||||
const PAGE = {
|
||||
CONTENT: 'content',
|
||||
LISTS: 'lists',
|
||||
ABOUT: 'about',
|
||||
DISCUSSION: DISCUSSION_PAGE,
|
||||
EDIT: 'edit',
|
||||
};
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -83,9 +87,9 @@ function ChannelPage(props: Props) {
|
||||
} = useHistory();
|
||||
const [viewBlockedChannel, setViewBlockedChannel] = React.useState(false);
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const currentView = urlParams.get(PAGE_VIEW_QUERY) || undefined;
|
||||
const currentView = urlParams.get(PAGE_VIEW_QUERY) || PAGE.CONTENT;
|
||||
const [discussionWasMounted, setDiscussionWasMounted] = React.useState(false);
|
||||
const editing = urlParams.get(PAGE_VIEW_QUERY) === EDIT_PAGE;
|
||||
const editing = urlParams.get(PAGE_VIEW_QUERY) === PAGE.EDIT;
|
||||
const { channelName } = parseURI(uri);
|
||||
const { permanent_url: permanentUrl } = claim;
|
||||
const claimId = claim.claim_id;
|
||||
@@ -143,16 +147,16 @@ function ChannelPage(props: Props) {
|
||||
// would alter the Tab label's role attribute, which should stay role="tab" to work with keyboards/screen readers.
|
||||
let tabIndex;
|
||||
switch (currentView) {
|
||||
case CONTENT_PAGE:
|
||||
case PAGE.CONTENT:
|
||||
tabIndex = 0;
|
||||
break;
|
||||
case LISTS_PAGE:
|
||||
case PAGE.LISTS:
|
||||
tabIndex = 1;
|
||||
break;
|
||||
case ABOUT_PAGE:
|
||||
case PAGE.ABOUT:
|
||||
tabIndex = 2;
|
||||
break;
|
||||
case DISCUSSION_PAGE:
|
||||
case PAGE.DISCUSSION:
|
||||
tabIndex = 3;
|
||||
break;
|
||||
default:
|
||||
@@ -165,20 +169,20 @@ function ChannelPage(props: Props) {
|
||||
let search = '?';
|
||||
|
||||
if (newTabIndex === 0) {
|
||||
search += `${PAGE_VIEW_QUERY}=${CONTENT_PAGE}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.CONTENT}`;
|
||||
} else if (newTabIndex === 1) {
|
||||
search += `${PAGE_VIEW_QUERY}=${LISTS_PAGE}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.LISTS}`;
|
||||
} else if (newTabIndex === 2) {
|
||||
search += `${PAGE_VIEW_QUERY}=${ABOUT_PAGE}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.ABOUT}`;
|
||||
} else {
|
||||
search += `${PAGE_VIEW_QUERY}=${DISCUSSION_PAGE}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.DISCUSSION}`;
|
||||
}
|
||||
|
||||
push(`${url}${search}`);
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (currentView === DISCUSSION_PAGE) {
|
||||
if (currentView === PAGE.DISCUSSION) {
|
||||
setDiscussionWasMounted(true);
|
||||
}
|
||||
}, [currentView]);
|
||||
@@ -241,7 +245,7 @@ function ChannelPage(props: Props) {
|
||||
<Button
|
||||
button="alt"
|
||||
title={__('Edit')}
|
||||
onClick={() => push(`?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`)}
|
||||
onClick={() => push(`?${PAGE_VIEW_QUERY}=${PAGE.EDIT}`)}
|
||||
icon={ICONS.EDIT}
|
||||
iconSize={18}
|
||||
disabled={pending}
|
||||
@@ -284,27 +288,31 @@ function ChannelPage(props: Props) {
|
||||
</TabList>
|
||||
<TabPanels>
|
||||
<TabPanel>
|
||||
<ChannelContent
|
||||
uri={uri}
|
||||
channelIsBlackListed={channelIsBlackListed}
|
||||
viewHiddenChannels
|
||||
empty={<section className="main--empty">{__('No Content Found')}</section>}
|
||||
/>
|
||||
{currentView === PAGE.CONTENT && (
|
||||
<ChannelContent
|
||||
uri={uri}
|
||||
channelIsBlackListed={channelIsBlackListed}
|
||||
viewHiddenChannels
|
||||
empty={<section className="main--empty">{__('No Content Found')}</section>}
|
||||
/>
|
||||
)}
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ChannelContent
|
||||
claimType={'collection'}
|
||||
uri={uri}
|
||||
channelIsBlackListed={channelIsBlackListed}
|
||||
viewHiddenChannels
|
||||
empty={collectionEmpty}
|
||||
/>
|
||||
{currentView === PAGE.LISTS && (
|
||||
<ChannelContent
|
||||
claimType={'collection'}
|
||||
uri={uri}
|
||||
channelIsBlackListed={channelIsBlackListed}
|
||||
viewHiddenChannels
|
||||
empty={collectionEmpty}
|
||||
/>
|
||||
)}
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ChannelAbout uri={uri} />
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
{(discussionWasMounted || currentView === DISCUSSION_PAGE) && <ChannelDiscussion uri={uri} />}
|
||||
{(discussionWasMounted || currentView === PAGE.DISCUSSION) && <ChannelDiscussion uri={uri} />}
|
||||
</TabPanel>
|
||||
</TabPanels>
|
||||
</Tabs>
|
||||
|
||||
@@ -127,6 +127,9 @@ function ChannelsFollowingDiscover(props: Props) {
|
||||
claimType={CS.CLAIM_CHANNEL}
|
||||
claimIds={CUSTOM_HOMEPAGE && channelIds ? channelIds : undefined}
|
||||
scrollAnchor={MORE_CHANNELS_ANCHOR}
|
||||
maxPages={SIMPLE_SITE ? 3 : undefined}
|
||||
hideFilters={SIMPLE_SITE}
|
||||
header={SIMPLE_SITE ? <h1 className="section__title">{__('Moon cheese is an acquired taste')}</h1> : undefined}
|
||||
/>
|
||||
</Page>
|
||||
);
|
||||
|
||||
@@ -62,7 +62,6 @@ function HomePage(props: Props) {
|
||||
showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS}
|
||||
hasSource
|
||||
pinUrls={pinUrls}
|
||||
pin={route === `/$/${PAGES.GENERAL}`} // use pinUrls here
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -145,12 +144,12 @@ function HomePage(props: Props) {
|
||||
{/* @if TARGET='web' */}
|
||||
{SIMPLE_SITE && <Meme />}
|
||||
{/* @endif */}
|
||||
{rowData.map(({ title, route, link, icon, help, pinUrls, options = {} }, index) => {
|
||||
{rowData.map(({ title, route, link, icon, help, pinnedUrls: pinUrls, options = {} }, index) => {
|
||||
// add pins here
|
||||
return getRowElements(title, route, link, icon, help, options, index, pinUrls);
|
||||
})}
|
||||
{/* @if TARGET='web' */}
|
||||
<Pixel type={'retargeting'} />
|
||||
<Pixel type={'retargeting'} />
|
||||
{/* @endif */}
|
||||
</Page>
|
||||
);
|
||||
|
||||
@@ -15,7 +15,9 @@ import { getUriForSearchTerm } from 'util/search';
|
||||
|
||||
const DEBOUNCE_REFRESH_MS = 1000;
|
||||
|
||||
const FEATURE_IS_READY = false;
|
||||
const BTC_SATOSHIS = 100000000;
|
||||
const LBC_MAX = 21000000;
|
||||
const LBC_MIN = 1;
|
||||
|
||||
type Props = {
|
||||
activeChannelClaim: ChannelClaim,
|
||||
@@ -297,47 +299,46 @@ export default function SettingsCreatorPage(props: Props) {
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
{FEATURE_IS_READY && (
|
||||
<Card
|
||||
title={__('Tip')}
|
||||
actions={
|
||||
<>
|
||||
<FormField
|
||||
name="min_tip_amount_comment"
|
||||
label={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Minimum %lbc% tip amount for comments</I18nMessage>
|
||||
}
|
||||
helper={__(
|
||||
'Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.'
|
||||
)}
|
||||
className="form-field--price-amount"
|
||||
min={0}
|
||||
step="any"
|
||||
type="number"
|
||||
placeholder="1"
|
||||
value={minTipAmountComment}
|
||||
onChange={(e) => setSettings({ min_tip_amount_comment: parseFloat(e.target.value) })}
|
||||
/>
|
||||
<FormField
|
||||
name="min_tip_amount_super_chat"
|
||||
label={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Minimum %lbc% tip amount for hyperchats</I18nMessage>
|
||||
}
|
||||
helper={__(
|
||||
'Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.'
|
||||
)}
|
||||
className="form-field--price-amount"
|
||||
min={0}
|
||||
step="any"
|
||||
type="number"
|
||||
placeholder="1"
|
||||
value={minTipAmountSuperChat}
|
||||
onChange={(e) => setSettings({ min_tip_amount_super_chat: parseFloat(e.target.value) })}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<Card
|
||||
title={__('Tip')}
|
||||
actions={
|
||||
<>
|
||||
<FormField
|
||||
name="min_tip_amount_comment"
|
||||
label={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Minimum %lbc% tip amount for comments</I18nMessage>
|
||||
}
|
||||
helper={__(
|
||||
'Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.'
|
||||
)}
|
||||
className="form-field--price-amount"
|
||||
max={LBC_MAX}
|
||||
min={LBC_MIN}
|
||||
step={1 / BTC_SATOSHIS}
|
||||
type="number"
|
||||
placeholder="3.14"
|
||||
value={minTipAmountComment}
|
||||
onChange={(e) => setSettings({ min_tip_amount_comment: parseFloat(e.target.value) })}
|
||||
/>
|
||||
<FormField
|
||||
name="min_tip_amount_super_chat"
|
||||
label={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Minimum %lbc% tip amount for hyperchats</I18nMessage>
|
||||
}
|
||||
helper={__(
|
||||
'Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.'
|
||||
)}
|
||||
className="form-field--price-amount"
|
||||
min={0}
|
||||
step="any"
|
||||
type="number"
|
||||
placeholder="1"
|
||||
value={minTipAmountSuperChat}
|
||||
onChange={(e) => setSettings({ min_tip_amount_super_chat: parseFloat(e.target.value) })}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<Card
|
||||
title={__('Delegation')}
|
||||
className="card--enable-overflow"
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
selectModerationBlockList,
|
||||
selectModerationDelegatorsById,
|
||||
} from 'redux/selectors/comments';
|
||||
import analytics from 'analytics';
|
||||
import { makeSelectNotificationForCommentId } from 'redux/selectors/notifications';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { toHex } from 'util/hex';
|
||||
@@ -247,6 +248,7 @@ export function doCommentReactList(commentIds: Array<string>) {
|
||||
})
|
||||
.catch((error) => {
|
||||
devToast(dispatch, `doCommentReactList: ${error.message}`);
|
||||
analytics.commentReactionFetchFailedEvent(activeChannelClaim ? activeChannelClaim.claim_id : '', commentIds);
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_REACTION_LIST_FAILED,
|
||||
data: error,
|
||||
@@ -436,7 +438,6 @@ export function doCommentCreate(
|
||||
...(environment ? { environment } : {}), // add environment for stripe if it exists
|
||||
})
|
||||
.then((result: CommentCreateResponse) => {
|
||||
console.log(result);
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_CREATE_COMPLETED,
|
||||
data: {
|
||||
@@ -449,7 +450,6 @@ export function doCommentCreate(
|
||||
return result;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_CREATE_FAILED,
|
||||
data: error,
|
||||
@@ -472,6 +472,9 @@ export function doCommentCreate(
|
||||
case 'comments are disabled by the creator':
|
||||
toastMessage = __('Unable to comment. The content owner has disabled comments.');
|
||||
break;
|
||||
case 'duplicate comment!':
|
||||
toastMessage = __('Please do not spam.');
|
||||
break;
|
||||
default:
|
||||
const BLOCKED_WORDS_ERR_MSG = 'the comment contents are blocked by';
|
||||
const SLOW_MODE_PARTIAL_ERR_MSG = 'Slow mode is on. Please wait at most';
|
||||
@@ -1390,7 +1393,9 @@ export const doFetchCreatorSettings = (channelClaimIds: Array<string> = []) => {
|
||||
const channelId = channelSignatures[i].claim_id;
|
||||
settingsByChannelId[channelId] = settings[i];
|
||||
|
||||
settingsByChannelId[channelId].words = settingsByChannelId[channelId].words.split(',');
|
||||
if (settings[i].words) {
|
||||
settingsByChannelId[channelId].words = settings[i].words.split(',');
|
||||
}
|
||||
|
||||
delete settingsByChannelId[channelId].channel_name;
|
||||
delete settingsByChannelId[channelId].channel_id;
|
||||
@@ -1445,21 +1450,21 @@ export const doFetchCreatorSettings = (channelClaimIds: Array<string> = []) => {
|
||||
*/
|
||||
export const doUpdateCreatorSettings = (channelClaim: ChannelClaim, settings: PerChannelSettings) => {
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
let channelSignature: ?{
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
try {
|
||||
channelSignature = await Lbry.channel_sign({
|
||||
channel_id: channelClaim.claim_id,
|
||||
hexdata: toHex(channelClaim.name),
|
||||
});
|
||||
} catch (e) {}
|
||||
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'doUpdateCreatorSettings: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
|
||||
const BTC_SATOSHIS = 100000000;
|
||||
|
||||
if (settings.min_tip_amount_comment !== undefined) {
|
||||
settings.min_tip_amount_comment *= BTC_SATOSHIS;
|
||||
}
|
||||
if (settings.min_tip_amount_super_chat !== undefined) {
|
||||
settings.min_tip_amount_super_chat *= BTC_SATOSHIS;
|
||||
}
|
||||
|
||||
return Comments.setting_update({
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
@@ -1467,12 +1472,7 @@ export const doUpdateCreatorSettings = (channelClaim: ChannelClaim, settings: Pe
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
...settings,
|
||||
}).catch((err) => {
|
||||
dispatch(
|
||||
doToast({
|
||||
message: err.message,
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -986,9 +986,27 @@ export default handleActions(
|
||||
fetchingSettings: false,
|
||||
}),
|
||||
[ACTIONS.COMMENT_FETCH_SETTINGS_COMPLETED]: (state: CommentsState, action: any) => {
|
||||
// TODO: This is incorrect, as it could make 'settingsByChannelId' store
|
||||
// only 1 channel with other channel's data purged. It works for now
|
||||
// because the GUI only shows 1 channel's setting at a time, and *always*
|
||||
// re-fetches to get latest data before displaying. Either rename this to
|
||||
// 'activeChannelCreatorSettings', or append the new data properly.
|
||||
const settingsByChannelId = Object.assign({}, action.data);
|
||||
const BTC_SATOSHIS = 100000000;
|
||||
|
||||
const channelIds = Object.keys(settingsByChannelId);
|
||||
channelIds.forEach((ci) => {
|
||||
if (settingsByChannelId[ci].min_tip_amount_comment) {
|
||||
settingsByChannelId[ci].min_tip_amount_comment /= BTC_SATOSHIS;
|
||||
}
|
||||
if (settingsByChannelId[ci].min_tip_amount_super_chat) {
|
||||
settingsByChannelId[ci].min_tip_amount_super_chat /= BTC_SATOSHIS;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
...state,
|
||||
settingsByChannelId: action.data,
|
||||
settingsByChannelId,
|
||||
fetchingSettings: false,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -3,19 +3,17 @@ import * as ACTIONS from 'constants/action_types';
|
||||
import { handleActions } from 'util/redux-utils';
|
||||
import { SEARCH_OPTIONS, SEARCH_PAGE_SIZE } from 'constants/search';
|
||||
import { createNormalizedSearchKey } from 'util/search';
|
||||
import { LIGHTHOUSE_DEFAULT_TYPES } from 'config';
|
||||
const defaultSearchTypes = LIGHTHOUSE_DEFAULT_TYPES && LIGHTHOUSE_DEFAULT_TYPES.split(',');
|
||||
|
||||
const defaultState: SearchState = {
|
||||
// $FlowFixMe
|
||||
options: {
|
||||
[SEARCH_OPTIONS.RESULT_COUNT]: SEARCH_PAGE_SIZE,
|
||||
[SEARCH_OPTIONS.CLAIM_TYPE]: SEARCH_OPTIONS.INCLUDE_FILES_AND_CHANNELS,
|
||||
[SEARCH_OPTIONS.MEDIA_AUDIO]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_AUDIO),
|
||||
[SEARCH_OPTIONS.MEDIA_VIDEO]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_VIDEO),
|
||||
[SEARCH_OPTIONS.MEDIA_TEXT]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_TEXT),
|
||||
[SEARCH_OPTIONS.MEDIA_IMAGE]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_IMAGE),
|
||||
[SEARCH_OPTIONS.MEDIA_APPLICATION]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_APPLICATION),
|
||||
[SEARCH_OPTIONS.MEDIA_AUDIO]: true,
|
||||
[SEARCH_OPTIONS.MEDIA_VIDEO]: true,
|
||||
[SEARCH_OPTIONS.MEDIA_TEXT]: true,
|
||||
[SEARCH_OPTIONS.MEDIA_IMAGE]: true,
|
||||
[SEARCH_OPTIONS.MEDIA_APPLICATION]: true,
|
||||
},
|
||||
urisByQuery: {},
|
||||
hasReachedMaxResultsLength: {},
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
min-width: 15rem;
|
||||
}
|
||||
|
||||
.ads__injected-video {
|
||||
aspect-ratio: 16 / 9;
|
||||
}
|
||||
|
||||
.avp-p-gui {
|
||||
z-index: 1 !important;
|
||||
}
|
||||
|
||||
@@ -215,6 +215,14 @@ $thumbnailWidthSmall: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.comment__badge {
|
||||
margin-left: var(--spacing-xxs);
|
||||
|
||||
.icon {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.comment__message {
|
||||
word-break: break-word;
|
||||
max-width: 35rem;
|
||||
|
||||
@@ -106,6 +106,7 @@ export const getHomepageRowForCat = (cat: HomepageCat) => {
|
||||
route: cat.name ? `/$/${cat.name}` : undefined,
|
||||
icon: cat.icon || '', // some default
|
||||
title: cat.label,
|
||||
pinnedUrls: cat.pinnedUrls,
|
||||
options: {
|
||||
claimType: cat.claimType || 'stream',
|
||||
channelIds: cat.channelIds,
|
||||
|
||||
@@ -19,11 +19,7 @@ export function getThumbnailCdnUrl(props: Props) {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
if (thumbnail && !thumbnail.includes('https://spee.ch')) {
|
||||
if (thumbnail) {
|
||||
return `${THUMBNAIL_CDN_URL}s:${width}:${height}/quality:${quality}/plain/${thumbnail}`;
|
||||
}
|
||||
|
||||
if (thumbnail && thumbnail.includes('https://spee.ch')) {
|
||||
return `${thumbnail}?quality=${quality}&height=${height}&width=${width}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ function Ads(props: Props) {
|
||||
|
||||
const videoAd = (
|
||||
<div className="ads__claim-item">
|
||||
<div id="62d1eb10-e362-4873-99ed-c64a4052b43b" />
|
||||
<div id="62d1eb10-e362-4873-99ed-c64a4052b43b" className="ads__injected-video" />
|
||||
<div
|
||||
className={classnames('ads__claim-text', {
|
||||
'ads__claim-text--small': small,
|
||||
|
||||
Reference in New Issue
Block a user