Compare commits

...

16 Commits

Author SHA1 Message Date
infinite-persistence
ed2b5ff1d7 Avoid extra redirect with spee.ch images
I'm not sure what's the history behind splitting the logic between speech and non-speech, but currently, doing

`${thumbnail}?quality=${quality}&height=${height}&width=${width}`

will result in a redirect to

`${THUMBNAIL_CDN_URL}s:${width}:${height}/quality:80/plain/${thumbnail}` (hardcoded to 80).

That's the same CDN url we use for non-speech, so might as do the same for all images to avoid the redirect.
2021-07-24 11:06:04 +08:00
infinite-persistence
05f7e55aed Enable min_tip setting 2021-07-23 20:53:41 +08:00
infinite-persistence
bf710cb325 Beautify/elaborate comment spam-check message 2021-07-23 20:53:41 +08:00
infinite-persistence
7d67c5fdf0 Log comment reaction-fetch events 2021-07-23 20:53:40 +08:00
infinite-persistence
b28d95b3bb Revert "Disable test instance to remove index."
This reverts commit 216b893b504757dcf88afa8266de42a751481af6.
2021-07-23 20:53:39 +08:00
infinite-persistence
9d97350f09 Disable test instance to remove index. 2021-07-23 20:53:38 +08:00
infinite-persistence
f3a825c0e7 ChannelPage: Don't mount inactive ChannelContent
## Issue
In the Channel Page, if the _Collections_ `claim_search` comes in after the main content's `claim_search`, the Collection's `ChannelContent` is being re-rendered despite not being in the active Tab. This causes a 0.4 CLS score (it's ridiculous that invisible components are taken into account). Apparently 41% of users are hitting this scenario, causing a poor aggregate.

## Change
Don't mount the `ChannelContent` components unless its tab is the active one. It doesn't seem like Reach Tab hides components under the inactive tab.
2021-07-23 20:53:37 +08:00
infinite-persistence
c76f6e58ba Change constants to object for IDE auto complete
No functional change; just thought this is cleaner (group up the constants) and easier to type via IDE auto-complete, at the expense of creating an extra object.
2021-07-23 20:53:37 +08:00
infinite-persistence
26514f9be6 Comment badge to reflect mod and admin status.
## Issue
6467 Add status indicators for messages from creator, delegated moderator, global moderator

## Changes
- Added the required icons.
- Added tooltip.

## Notes
- I left out "creator" since we are already highlighting the creator's name.
- Note that currently the status is only available via websocket deltas. `comment.List` does not provide the data.
- When `comment.List` includes the info, regular comments will include the badges as well.
2021-07-23 20:53:36 +08:00
infinite-persistence
ffad52d5b7 Remove console.log
Seems like lint is being bypassed recently?
2021-07-23 08:42:58 -04:00
infinite-persistence
6e402240b0 Fix muted-words now returning null instead of ""
## Issue
Creating Settings suddenly start to stop loading correctly for some of my channels.

## Change
`settings.List` now returns null instead of empty array. Double-checked the Commentron repo and this is indeed the case.

Updated the code to handle null.
2021-07-23 15:46:38 +08:00
infinite-persistence
7a8d213861 Eliminate CLS in Recommended due to wrapper mismatch
Seem like `type === small` was missed out, so it was using a wrapper than necessary, causing the shift.
2021-07-23 13:23:52 +08:00
infinite-persistence
c62c667436 CLS: reserve space for injected video ads 2021-07-23 13:23:51 +08:00
zeppi
038431f95c channel follow first run on master 2021-07-23 00:00:32 -04:00
zeppi
ed0387d94a pinning 2021-07-22 23:24:55 -04:00
zeppi
f2cd9f372e Chan fol disc recon 2021-07-22 23:08:33 -04:00
26 changed files with 275 additions and 127 deletions

View File

@@ -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,
};

View File

@@ -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,

View File

@@ -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",

View File

@@ -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) {

View File

@@ -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' })}>

View File

@@ -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)

View File

@@ -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} />

View File

@@ -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}
/>
);

View File

@@ -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}
/>
);
})}

View File

@@ -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>
),
};

View File

@@ -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>

View File

@@ -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)}
/>

View File

@@ -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

View File

@@ -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);
}
});

View File

@@ -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';

View File

@@ -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>

View File

@@ -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>
);

View File

@@ -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>
);

View File

@@ -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"

View File

@@ -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 }));
});
};
};

View File

@@ -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,
};
},

View File

@@ -33,6 +33,10 @@
min-width: 15rem;
}
.ads__injected-video {
aspect-ratio: 16 / 9;
}
.avp-p-gui {
z-index: 1 !important;
}

View File

@@ -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;

View File

@@ -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,

View File

@@ -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}`;
}
}

View File

@@ -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,