Compare commits
37 Commits
ip/custom.
...
notificati
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
985f8e3724 | ||
|
|
076df9c47f | ||
|
|
56852955e4 | ||
|
|
62001810df | ||
|
|
a6eaf0b652 | ||
|
|
6bca894f1c | ||
|
|
7fd1849e3d | ||
|
|
3df47c607c | ||
|
|
4e02c84f90 | ||
|
|
ec6a2c315b | ||
|
|
08cca491fe | ||
|
|
1d6101ddd2 | ||
|
|
34368760de | ||
|
|
f8796e2950 | ||
|
|
74659f40a1 | ||
|
|
7bbb1a436c | ||
|
|
1f2762af02 | ||
|
|
26b1c901c8 | ||
|
|
0214c80544 | ||
|
|
b34a5068be | ||
|
|
79e39da47f | ||
|
|
4c87ec9dcb | ||
|
|
74e4c09033 | ||
|
|
c0c65c46f4 | ||
|
|
d462f96834 | ||
|
|
37d9cbfbeb | ||
|
|
9983777f86 | ||
|
|
7802337655 | ||
|
|
b5fec393c6 | ||
|
|
b93caf4ebc | ||
|
|
9dd065a595 | ||
|
|
172701aeba | ||
|
|
95c7d4f935 | ||
|
|
a9a0bc9462 | ||
|
|
87ae041472 | ||
|
|
415a522805 | ||
|
|
fa1b1737bb |
@@ -12,6 +12,8 @@ LBRY_WEB_API=https://api.na-backend.odysee.com
|
||||
LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||
COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||
THUMBNAIL_CDN_URL=https://image-processor.vanwanet.com/optimize/
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
@@ -37,6 +39,8 @@ SITE_NAME=lbry.tv
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
SITE_HELP_EMAIL=help@lbry.com
|
||||
LOGO_TITLE=lbry.tv
|
||||
## Social media
|
||||
TWITTER_ACCOUNT=LBRYcom
|
||||
|
||||
## IMAGE ASSETS
|
||||
YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
|
||||
@@ -9,13 +9,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Show currently active playing item on playlist _community pr!_ ([#6453](https://github.com/lbryio/lbry-desktop/pull/6453))
|
||||
- Add watch later to hover action for last used playlist on popup _community pr!_ ([#6274](https://github.com/lbryio/lbry-desktop/pull/6274))
|
||||
- Open in desktop (web feature) _community pr!_ ([#6667](https://github.com/lbryio/lbry-desktop/pull/6667))
|
||||
- Add confirmation on comment removal _community pr!_ ([#6563](https://github.com/lbryio/lbry-desktop/pull/6563))
|
||||
|
||||
### Changed
|
||||
- Use Canonical Url for copy link ([#6500](https://github.com/lbryio/lbry-desktop/pull/6500))
|
||||
- Use better icon for copy link ([#6485](https://github.com/lbryio/lbry-desktop/pull/6485))
|
||||
- Comments load paginated ([#6390](https://github.com/lbryio/lbry-desktop/pull/6390))
|
||||
- Update lighthouse search api _community pr!_ ([#6731](https://github.com/lbryio/lbry-desktop/pull/6731))
|
||||
- Improve twitter share _community pr!_ ([#6690](https://github.com/lbryio/lbry-desktop/pull/6690))
|
||||
- Update lighthouse search api _community pr!_ ([#6731](https://github.com/lbryio/lbry-desktop/pull/6731))
|
||||
- Update sockety api _community pr!_ ([#6747](https://github.com/lbryio/lbry-desktop/pull/6747))
|
||||
|
||||
### Fixed
|
||||
- App now supports '#' and ':' for claimId separator ([#6496](https://github.com/lbryio/lbry-desktop/pull/6496))
|
||||
|
||||
@@ -13,7 +13,9 @@ const config = {
|
||||
LBRY_API_URL: process.env.LBRY_API_URL, //api.lbry.com',
|
||||
LBRY_WEB_STREAMING_API: process.env.LBRY_WEB_STREAMING_API, //cdn.lbryplayer.xyz',
|
||||
LBRY_WEB_BUFFER_API: process.env.LBRY_WEB_BUFFER_API,
|
||||
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
||||
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
||||
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
||||
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
||||
DOMAIN: process.env.DOMAIN,
|
||||
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
|
||||
@@ -23,6 +25,8 @@ const config = {
|
||||
SITE_NAME: process.env.SITE_NAME,
|
||||
SITE_DESCRIPTION: process.env.SITE_DESCRIPTION,
|
||||
SITE_HELP_EMAIL: process.env.SITE_HELP_EMAIL,
|
||||
// SOCIAL MEDIA
|
||||
TWITTER_ACCOUNT: process.env.TWITTER_ACCOUNT,
|
||||
// LOGO
|
||||
LOGO_TITLE: process.env.LOGO_TITLE,
|
||||
FAVICON: process.env.FAVICON,
|
||||
@@ -69,7 +73,7 @@ const config = {
|
||||
BRANDED_SITE: process.env.BRANDED_SITE,
|
||||
};
|
||||
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
|
||||
module.exports = config;
|
||||
|
||||
@@ -209,6 +209,7 @@
|
||||
"Your comment": "Your comment",
|
||||
"Post --[button to submit something]--": "Post",
|
||||
"Post --[noun, markdown post tab button]--": "Post",
|
||||
"Livestream --[noun, livestream tab button]--": "Livestream --[noun, livestream tab button]--",
|
||||
"Posting...": "Posting...",
|
||||
"Incompatible daemon": "Incompatible daemon",
|
||||
"Incompatible daemon running": "Incompatible daemon running",
|
||||
@@ -2064,9 +2065,11 @@
|
||||
"Skip Navigation": "Skip Navigation",
|
||||
"Reset": "Reset",
|
||||
"Reset to original (previous) publish date": "Reset to original (previous) publish date",
|
||||
"%title% by %channelTitle%": "%title% by %channelTitle%",
|
||||
"%title% by %channelTitle% %ariaDate%": "%title% by %channelTitle% %ariaDate%",
|
||||
"%title% by %channelTitle% %ariaDate%, %mediaDuration%": "%title% by %channelTitle% %ariaDate%, %mediaDuration%",
|
||||
"Search for something...": "Search for something...",
|
||||
"Confirm Comment Deletion": "Confirm Comment Deletion",
|
||||
"Remove Comment": "Remove Comment",
|
||||
"Are you sure you want to remove this comment?": "Are you sure you want to remove this comment?",
|
||||
"This comment has a tip associated with it which cannot be reverted.": "This comment has a tip associated with it which cannot be reverted.",
|
||||
"Recent Comments": "Recent Comments",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ type Props = {
|
||||
searchOptions?: any,
|
||||
collectionId?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
onClick?: (e: any, index?: number) => void,
|
||||
};
|
||||
|
||||
export default function ClaimList(props: Props) {
|
||||
@@ -55,6 +56,7 @@ export default function ClaimList(props: Props) {
|
||||
uris,
|
||||
headerAltControls,
|
||||
loading,
|
||||
id,
|
||||
persistedStorageKey,
|
||||
empty,
|
||||
defaultSort,
|
||||
@@ -80,6 +82,7 @@ export default function ClaimList(props: Props) {
|
||||
searchOptions,
|
||||
collectionId,
|
||||
showNoSourceClaims,
|
||||
onClick,
|
||||
} = props;
|
||||
|
||||
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
|
||||
@@ -107,6 +110,12 @@ export default function ClaimList(props: Props) {
|
||||
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
||||
}
|
||||
|
||||
function handleClaimClicked(e, index) {
|
||||
if (onClick) {
|
||||
onClick(e, index);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = debounce((e) => {
|
||||
if (page && pageSize && onScrollBottom) {
|
||||
@@ -191,6 +200,8 @@ export default function ClaimList(props: Props) {
|
||||
{injectedItem && index === 4 && <li>{injectedItem}</li>}
|
||||
<ClaimPreview
|
||||
uri={uri}
|
||||
containerId={id}
|
||||
indexInContainer={index}
|
||||
type={type}
|
||||
active={activeUri && uri === activeUri}
|
||||
hideMenu={hideMenu}
|
||||
@@ -209,6 +220,7 @@ export default function ClaimList(props: Props) {
|
||||
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
||||
}}
|
||||
live={resolveLive(index)}
|
||||
onClick={handleClaimClicked}
|
||||
/>
|
||||
</React.Fragment>
|
||||
))}
|
||||
|
||||
@@ -394,6 +394,13 @@ function ClaimMenuList(props: Props) {
|
||||
)}
|
||||
<hr className="menu__separator" />
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.COPY_LINK} />
|
||||
{__('Copy Link')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{isChannelPage && IS_WEB && rssUrl && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyRssLink}>
|
||||
<div className="menu__link">
|
||||
@@ -403,13 +410,6 @@ function ClaimMenuList(props: Props) {
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHARE} />
|
||||
{__('Copy Link')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{!claimIsMine && !isMyCollection && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
|
||||
<div className="menu__link">
|
||||
|
||||
@@ -29,6 +29,7 @@ import ClaimPreviewNoContent from './claim-preview-no-content';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import { CONTAINER_ID } from 'constants/navigation';
|
||||
|
||||
const AbandonedChannelPreview = lazyImport(() =>
|
||||
import('component/abandonedChannelPreview' /* webpackChunkName: "abandonedChannelPreview" */)
|
||||
@@ -45,7 +46,7 @@ type Props = {
|
||||
reflectingProgress?: any, // fxme
|
||||
resolveUri: (string) => void,
|
||||
isResolvingUri: boolean,
|
||||
history: { push: (string) => void },
|
||||
history: { push: (string | any) => void },
|
||||
title: string,
|
||||
nsfw: boolean,
|
||||
placeholder: string,
|
||||
@@ -65,7 +66,7 @@ type Props = {
|
||||
actions: boolean | Node | string | number,
|
||||
properties: boolean | Node | string | number | ((Claim) => Node),
|
||||
empty?: Node,
|
||||
onClick?: (any) => any,
|
||||
onClick?: (e: any, index?: number) => any,
|
||||
streamingUrl: ?string,
|
||||
getFile: (string) => void,
|
||||
customShouldHide?: (Claim) => boolean,
|
||||
@@ -88,6 +89,8 @@ type Props = {
|
||||
disableNavigation?: boolean,
|
||||
mediaDuration?: string,
|
||||
date?: any,
|
||||
containerId?: string, // ID or name of the container (e.g. ClaimList, HOC, etc.) that this is in.
|
||||
indexInContainer?: number, // The index order of this component within 'containerId'.
|
||||
};
|
||||
|
||||
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
@@ -149,6 +152,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
isCollectionMine,
|
||||
collectionUris,
|
||||
disableNavigation,
|
||||
containerId,
|
||||
indexInContainer,
|
||||
} = props;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
@@ -202,9 +207,21 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
|
||||
const handleNavLinkClick = (e) => {
|
||||
if (onClick) {
|
||||
onClick(e, indexInContainer);
|
||||
}
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const navLinkProps = {
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
to: {
|
||||
pathname: navigateUrl,
|
||||
state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
|
||||
},
|
||||
onClick: (e) => handleNavLinkClick(e),
|
||||
onAuxClick: (e) => handleNavLinkClick(e),
|
||||
};
|
||||
|
||||
// do not block abandoned and nsfw claims if showUserBlocked is passed
|
||||
@@ -250,11 +267,14 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
|
||||
function handleOnClick(e) {
|
||||
if (onClick) {
|
||||
onClick(e);
|
||||
onClick(e, indexInContainer);
|
||||
}
|
||||
|
||||
if (claim && !pending && !disableNavigation) {
|
||||
history.push(navigateUrl);
|
||||
history.push({
|
||||
pathname: navigateUrl,
|
||||
state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ function ClaimPreviewTile(props: Props) {
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const isChannel = claim && claim.value_type === 'channel';
|
||||
const channelUri = !isChannel ? signingChannel && signingChannel.permanent_url : claim && claim.permanent_url;
|
||||
const channelTitle = signingChannel && (signingChannel.value.title || signingChannel.name);
|
||||
const channelTitle = signingChannel && ((signingChannel.value && signingChannel.value.title) || signingChannel.name);
|
||||
|
||||
// Aria-label value for claim preview
|
||||
let ariaLabelData = isChannel ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration);
|
||||
|
||||
@@ -159,6 +159,12 @@ function ClaimTilesDiscover(props: Props) {
|
||||
new Set(mutedUris.concat(blockedUris).map((uri) => splitBySeparator(uri)[1]))
|
||||
);
|
||||
const liveUris = [];
|
||||
let streamTypesParam;
|
||||
if (streamTypes) {
|
||||
streamTypesParam = streamTypes;
|
||||
} else if (SIMPLE_SITE && !hasNoSource && streamTypes !== null) {
|
||||
streamTypesParam = [CS.FILE_VIDEO, CS.FILE_AUDIO];
|
||||
}
|
||||
|
||||
const [prevUris, setPrevUris] = React.useState([]);
|
||||
|
||||
@@ -192,8 +198,7 @@ function ClaimTilesDiscover(props: Props) {
|
||||
channel_ids: channelIds || [],
|
||||
not_channel_ids: mutedAndBlockedChannelIds,
|
||||
order_by: orderBy || ['trending_group', 'trending_mixed'],
|
||||
stream_types:
|
||||
streamTypes === null ? undefined : SIMPLE_SITE && !hasNoSource ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
|
||||
stream_types: streamTypesParam,
|
||||
};
|
||||
|
||||
if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
|
||||
|
||||
@@ -59,7 +59,9 @@ type Props = {
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
numDirectReplies: number,
|
||||
isFiat: boolean
|
||||
isFiat: boolean,
|
||||
setCommentReply: (any) => void,
|
||||
commentReply: any,
|
||||
};
|
||||
|
||||
const LENGTH_TO_COLLAPSE = 300;
|
||||
@@ -93,6 +95,8 @@ function Comment(props: Props) {
|
||||
supportAmount,
|
||||
numDirectReplies,
|
||||
isFiat,
|
||||
setCommentReply,
|
||||
commentReply,
|
||||
} = props;
|
||||
|
||||
const {
|
||||
@@ -178,6 +182,7 @@ function Comment(props: Props) {
|
||||
|
||||
function handleSubmit() {
|
||||
updateComment(commentId, editedMessage);
|
||||
setCommentReply({ ...commentReply, comment_id: commentId, comment: editedMessage });
|
||||
setEditing(false);
|
||||
}
|
||||
|
||||
@@ -253,7 +258,10 @@ function Comment(props: Props) {
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="comment__menu">
|
||||
<span className="comment__menu" onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}>
|
||||
<Menu>
|
||||
<MenuButton className="menu__button">
|
||||
<Icon
|
||||
@@ -270,9 +278,11 @@ function Comment(props: Props) {
|
||||
authorUri={authorUri}
|
||||
commentIsMine={commentIsMine}
|
||||
handleEditComment={handleEditComment}
|
||||
supportAmount={supportAmount}
|
||||
setCommentReply={setCommentReply}
|
||||
/>
|
||||
</Menu>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
{isEditing ? (
|
||||
@@ -285,6 +295,10 @@ function Comment(props: Props) {
|
||||
charCount={charCount}
|
||||
onChange={handleEditMessageChanged}
|
||||
textAreaMaxLength={FF_MAX_CHARS_IN_COMMENT}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
/>
|
||||
<div className="section__actions section__actions--no-margin">
|
||||
<Button
|
||||
@@ -293,8 +307,15 @@ function Comment(props: Props) {
|
||||
label={__('Done')}
|
||||
requiresAuth={IS_WEB}
|
||||
disabled={message === editedMessage}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={() => setEditing(false)} />
|
||||
<Button button="link" label={__('Cancel')} onClick={(e) => {
|
||||
setEditing(false);
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}} />
|
||||
</div>
|
||||
</Form>
|
||||
) : (
|
||||
@@ -329,7 +350,11 @@ function Comment(props: Props) {
|
||||
requiresAuth={IS_WEB}
|
||||
label={commentingEnabled ? __('Reply') : __('Log in to reply')}
|
||||
className="comment__action"
|
||||
onClick={handleCommentReply}
|
||||
onClick={(e) => {
|
||||
handleCommentReply();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
icon={ICONS.REPLY}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -50,6 +50,7 @@ type Props = {
|
||||
sendTip: ({}, (any) => void, (any) => void) => void,
|
||||
doToast: ({ message: string }) => void,
|
||||
disabled: boolean,
|
||||
setCommentReply: (any) => void,
|
||||
};
|
||||
|
||||
export function CommentCreate(props: Props) {
|
||||
@@ -71,6 +72,7 @@ export function CommentCreate(props: Props) {
|
||||
claimIsMine,
|
||||
sendTip,
|
||||
doToast,
|
||||
setCommentReply,
|
||||
} = props;
|
||||
const buttonRef: ElementRef<any> = React.useRef();
|
||||
const {
|
||||
@@ -80,7 +82,7 @@ export function CommentCreate(props: Props) {
|
||||
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
||||
const [commentFailure, setCommentFailure] = React.useState(false);
|
||||
const [successTip, setSuccessTip] = React.useState({ txid: undefined, tipAmount: undefined });
|
||||
const { claim_id: claimId } = claim;
|
||||
const claimId = claim && claim.claim_id;
|
||||
const [isSupportComment, setIsSupportComment] = React.useState();
|
||||
const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState();
|
||||
const [tipAmount, setTipAmount] = React.useState(1);
|
||||
@@ -244,6 +246,7 @@ export function CommentCreate(props: Props) {
|
||||
createComment(commentValue, claimId, parentId, txid, payment_intent_id, environment)
|
||||
.then((res) => {
|
||||
setIsSubmitting(false);
|
||||
setCommentReply(res);
|
||||
|
||||
if (res && res.signature) {
|
||||
setCommentValue('');
|
||||
@@ -330,9 +333,21 @@ export function CommentCreate(props: Props) {
|
||||
? __('Re-submit')
|
||||
: __('Send')
|
||||
}
|
||||
onClick={handleSupportComment}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleSupportComment();
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
setIsReviewingSupportComment(false);
|
||||
}}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={() => setIsReviewingSupportComment(false)} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -371,6 +386,10 @@ export function CommentCreate(props: Props) {
|
||||
onChange={handleCommentChange}
|
||||
autoFocus={isReply}
|
||||
textAreaMaxLength={livestream ? FF_MAX_CHARS_IN_LIVESTREAM_COMMENT : FF_MAX_CHARS_IN_COMMENT}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
/>
|
||||
{isSupportComment && (
|
||||
<WalletTipAmountSelector
|
||||
@@ -391,10 +410,23 @@ export function CommentCreate(props: Props) {
|
||||
button="primary"
|
||||
icon={activeTab === TAB_LBC ? ICONS.LBC : ICONS.FINANCE}
|
||||
label={__('Review')}
|
||||
onClick={() => setIsReviewingSupportComment(true)}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
setIsReviewingSupportComment(true);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Button disabled={disabled} button="link" label={__('Cancel')} onClick={() => setIsSupportComment(false)} />
|
||||
<Button
|
||||
disabled={disabled}
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
setIsSupportComment(false);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@@ -413,6 +445,9 @@ export function CommentCreate(props: Props) {
|
||||
: __('Comment --[button to submit something]--')
|
||||
}
|
||||
requiresAuth={IS_WEB}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
/>
|
||||
{!claimIsMine && (
|
||||
<Button
|
||||
@@ -420,7 +455,9 @@ export function CommentCreate(props: Props) {
|
||||
button="alt"
|
||||
className="thatButton"
|
||||
icon={ICONS.LBC}
|
||||
onClick={() => {
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_LBC);
|
||||
}}
|
||||
@@ -432,7 +469,9 @@ export function CommentCreate(props: Props) {
|
||||
button="alt"
|
||||
className="thisButton"
|
||||
icon={ICONS.FINANCE}
|
||||
onClick={() => {
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_FIAT);
|
||||
}}
|
||||
@@ -442,7 +481,9 @@ export function CommentCreate(props: Props) {
|
||||
<Button
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
onClick={() => {
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
if (onCancelReplying) {
|
||||
onCancelReplying();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectChannelPermUrlForClaimUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import {
|
||||
doCommentAbandon,
|
||||
doCommentPin,
|
||||
doCommentModBlock,
|
||||
doCommentModBlockAsAdmin,
|
||||
@@ -10,6 +9,7 @@ import {
|
||||
} from 'redux/actions/comments';
|
||||
import { doChannelMute } from 'redux/actions/blocked';
|
||||
// import { doSetActiveChannel } from 'redux/actions/app';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
@@ -26,8 +26,8 @@ const select = (state, props) => ({
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
|
||||
deleteComment: (commentId, creatorChannelUrl) => dispatch(doCommentAbandon(commentId, creatorChannelUrl)),
|
||||
muteChannel: (channelUri) => dispatch(doChannelMute(channelUri)),
|
||||
pinComment: (commentId, claimId, remove) => dispatch(doCommentPin(commentId, claimId, remove)),
|
||||
// setActiveChannel: channelId => dispatch(doSetActiveChannel(channelId)),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import React from 'react';
|
||||
import { MenuList, MenuItem } from '@reach/menu-button';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
@@ -12,7 +13,6 @@ type Props = {
|
||||
authorUri: string, // full LBRY Channel URI: lbry://@channel#123...
|
||||
commentId: string, // sha256 digest identifying the comment
|
||||
commentIsMine: boolean, // if this comment was signed by an owned channel
|
||||
deleteComment: (string, ?string) => void,
|
||||
isPinned: boolean,
|
||||
pinComment: (string, string, boolean) => Promise<any>,
|
||||
muteChannel: (string) => void,
|
||||
@@ -28,6 +28,9 @@ type Props = {
|
||||
disableEdit?: boolean,
|
||||
disableRemove?: boolean,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
openModal: (id: string, {}) => void,
|
||||
supportAmount?: any,
|
||||
setCommentReply: (any) => void,
|
||||
};
|
||||
|
||||
function CommentMenuList(props: Props) {
|
||||
@@ -36,7 +39,6 @@ function CommentMenuList(props: Props) {
|
||||
authorUri,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
deleteComment,
|
||||
muteChannel,
|
||||
pinComment,
|
||||
clearPlayingUri,
|
||||
@@ -53,6 +55,9 @@ function CommentMenuList(props: Props) {
|
||||
disableEdit,
|
||||
disableRemove,
|
||||
moderationDelegatorsById,
|
||||
openModal,
|
||||
supportAmount,
|
||||
setCommentReply,
|
||||
} = props;
|
||||
|
||||
const contentChannelClaim = !claim
|
||||
@@ -80,7 +85,7 @@ function CommentMenuList(props: Props) {
|
||||
if (playingUri && playingUri.source === 'comment') {
|
||||
clearPlayingUri();
|
||||
}
|
||||
deleteComment(commentId, commentIsMine ? undefined : contentChannelPermanentUrl);
|
||||
openModal(MODALS.CONFIRM_REMOVE_COMMENT, { commentId, commentIsMine, contentChannelPermanentUrl, supportAmount, setCommentReply });
|
||||
}
|
||||
|
||||
function handleCommentBlock() {
|
||||
|
||||
@@ -91,7 +91,11 @@ export default function CommentReactions(props: Props) {
|
||||
className={classnames('comment__action', {
|
||||
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.LIKE),
|
||||
})}
|
||||
onClick={handleCommentLike}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleCommentLike();
|
||||
}}
|
||||
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.LIKE)}</span>}
|
||||
/>
|
||||
<Button
|
||||
@@ -101,7 +105,11 @@ export default function CommentReactions(props: Props) {
|
||||
className={classnames('comment__action', {
|
||||
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.DISLIKE),
|
||||
})}
|
||||
onClick={handleCommentDislike}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleCommentDislike();
|
||||
}}
|
||||
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.DISLIKE)}</span>}
|
||||
/>
|
||||
|
||||
@@ -113,7 +121,11 @@ export default function CommentReactions(props: Props) {
|
||||
title={claimIsMine ? __('You loved this') : __('Creator loved this')}
|
||||
icon={creatorLiked ? ICONS.CREATOR_LIKE : ICONS.SUBSCRIBE}
|
||||
className={classnames('comment__action comment__action--creator-like')}
|
||||
onClick={() => react(commentId, REACTION_TYPES.CREATOR_LIKE)}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
react(commentId, REACTION_TYPES.CREATOR_LIKE);
|
||||
}}
|
||||
>
|
||||
{creatorLiked && (
|
||||
<ChannelThumbnail xsmall uri={authorUri} hideStakedIndicator className="comment__creator-like" />
|
||||
|
||||
@@ -283,10 +283,12 @@ export class FormField extends React.PureComponent<Props> {
|
||||
type="button"
|
||||
className="button--emoji"
|
||||
label={emoji}
|
||||
onClick={() => {
|
||||
onClick={(e) => {
|
||||
inputProps.onChange({
|
||||
target: { value: inputProps.value ? `${inputProps.value} ${emoji}` : emoji },
|
||||
});
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -18,11 +18,16 @@ export default function LivestreamLink(props: Props) {
|
||||
const [livestreamClaim, setLivestreamClaim] = React.useState(false);
|
||||
const [isLivestreaming, setIsLivestreaming] = React.useState(false);
|
||||
const livestreamChannelId = (channelClaim && channelClaim.claim_id) || ''; // TODO: fail in a safer way, probably
|
||||
const isChannelEmpty = !channelClaim || !channelClaim.meta || !channelClaim.meta.claims_in_channel;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (livestreamChannelId) {
|
||||
// Don't search empty channels
|
||||
if (livestreamChannelId && !isChannelEmpty) {
|
||||
Lbry.claim_search({
|
||||
channel_ids: [livestreamChannelId],
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
no_totals: true,
|
||||
has_no_source: true,
|
||||
claim_type: ['stream'],
|
||||
order_by: CS.ORDER_BY_NEW_VALUE,
|
||||
@@ -35,7 +40,7 @@ export default function LivestreamLink(props: Props) {
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}, [livestreamChannelId]);
|
||||
}, [livestreamChannelId, isChannelEmpty]);
|
||||
|
||||
React.useEffect(() => {
|
||||
function fetchIsStreaming() {
|
||||
@@ -53,17 +58,23 @@ export default function LivestreamLink(props: Props) {
|
||||
}
|
||||
|
||||
let interval;
|
||||
if (livestreamChannelId) {
|
||||
// Only call livestream api if channel has livestream claims
|
||||
if (livestreamChannelId && livestreamClaim) {
|
||||
if (!interval) fetchIsStreaming();
|
||||
interval = setInterval(fetchIsStreaming, 10 * 1000);
|
||||
}
|
||||
|
||||
// Prevent any more api calls on update
|
||||
if (!livestreamChannelId || !livestreamClaim) {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
}, [livestreamChannelId]);
|
||||
}, [livestreamChannelId, livestreamClaim]);
|
||||
|
||||
if (!livestreamClaim || !isLivestreaming) {
|
||||
return null;
|
||||
|
||||
@@ -26,12 +26,12 @@ export default function Logo(props: Props) {
|
||||
);
|
||||
|
||||
if (type === 'small' || (isMobile && type !== 'embed')) {
|
||||
return LOGO ? <img src={LOGO} /> : <Icon icon={ICONS.LBRY} />;
|
||||
return LOGO ? <img className={'header__navigation-logo'} src={LOGO} /> : <Icon icon={ICONS.LBRY} />;
|
||||
} else if (type === 'embed') {
|
||||
if (LOGO_TEXT_LIGHT) {
|
||||
return (
|
||||
<>
|
||||
<img src={LOGO_TEXT_LIGHT} />
|
||||
<img className={'header__navigation-logo'} src={LOGO_TEXT_LIGHT} />
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
@@ -41,7 +41,10 @@ export default function Logo(props: Props) {
|
||||
if (LOGO_TEXT_LIGHT && LOGO_TEXT_DARK) {
|
||||
return (
|
||||
<>
|
||||
<img src={currentTheme === 'light' ? LOGO_TEXT_DARK : LOGO_TEXT_LIGHT} />
|
||||
<img
|
||||
className={'header__navigation-logo'}
|
||||
src={currentTheme === 'light' ? LOGO_TEXT_DARK : LOGO_TEXT_LIGHT}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doReadNotifications, doDeleteNotification } from 'redux/actions/notifications';
|
||||
import { doResolveUri, selectMyChannelClaims } from 'lbry-redux';
|
||||
import Notification from './view';
|
||||
|
||||
export default connect(null, {
|
||||
const select = (state) => ({
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doReadNotifications,
|
||||
doDeleteNotification,
|
||||
doResolveUri,
|
||||
})(Notification);
|
||||
|
||||
@@ -16,6 +16,11 @@ import FileThumbnail from 'component/fileThumbnail';
|
||||
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
|
||||
import NotificationContentChannelMenu from 'component/notificationContentChannelMenu';
|
||||
import LbcMessage from 'component/common/lbc-message';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import CommentReactions from 'component/commentReactions';
|
||||
import CommentCreate from 'component/commentCreate';
|
||||
import CommentView from 'component/comment';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
|
||||
type Props = {
|
||||
notification: WebNotification,
|
||||
@@ -23,19 +28,33 @@ type Props = {
|
||||
children: any,
|
||||
doReadNotifications: ([number]) => void,
|
||||
doDeleteNotification: (number) => void,
|
||||
doResolveUri: (string) => void,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
};
|
||||
|
||||
export default function Notification(props: Props) {
|
||||
const { notification, menuButton = false, doReadNotifications, doDeleteNotification } = props;
|
||||
const { notification, menuButton = false, doReadNotifications, doDeleteNotification, doResolveUri, myChannels } = props;
|
||||
const { push } = useHistory();
|
||||
const { notification_rule, notification_parameters, is_read, id } = notification;
|
||||
const [isReplying, setReplying] = React.useState(false);
|
||||
const [commentReply, setCommentReply] = React.useState();
|
||||
|
||||
const isMyComment = (channelId: string): boolean => {
|
||||
if (myChannels != null && channelId != null) {
|
||||
for (let i = 0; i < myChannels.length; i++) {
|
||||
if (myChannels[i].claim_id === channelId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const isCommentNotification =
|
||||
notification_rule === RULE.COMMENT ||
|
||||
notification_rule === RULE.COMMENT_REPLY ||
|
||||
notification_rule === RULE.CREATOR_COMMENT;
|
||||
const commentText = isCommentNotification && notification_parameters.dynamic.comment;
|
||||
const channelUrl =
|
||||
(notification_rule === RULE.NEW_CONTENT && notification.notification_parameters.dynamic.channel_url) || '';
|
||||
|
||||
let notificationTarget;
|
||||
switch (notification_rule) {
|
||||
@@ -51,21 +70,20 @@ export default function Notification(props: Props) {
|
||||
notificationTarget = notification_parameters.device.target;
|
||||
}
|
||||
|
||||
let notificationLink = formatLbryUrlForWeb(notificationTarget);
|
||||
let urlParams = new URLSearchParams();
|
||||
if (isCommentNotification && notification_parameters.dynamic.hash) {
|
||||
urlParams.append('lc', notification_parameters.dynamic.hash);
|
||||
}
|
||||
|
||||
try {
|
||||
const { isChannel } = parseURI(notificationTarget);
|
||||
if (isChannel) {
|
||||
urlParams.append(PAGE_VIEW_QUERY, DISCUSSION_PAGE);
|
||||
React.useEffect(() => {
|
||||
if (isReplying && notificationTarget) {
|
||||
doResolveUri(notificationTarget);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
notificationLink += `?${urlParams.toString()}`;
|
||||
}, [doResolveUri, isReplying, notificationTarget]);
|
||||
|
||||
const creatorIcon = (channelUrl) => {
|
||||
return (
|
||||
<UriIndicator uri={channelUrl} link>
|
||||
<ChannelThumbnail small uri={channelUrl} />
|
||||
</UriIndicator>
|
||||
);
|
||||
};
|
||||
let channelUrl;
|
||||
let icon;
|
||||
switch (notification_rule) {
|
||||
case RULE.CREATOR_SUBSCRIBER:
|
||||
@@ -73,16 +91,20 @@ export default function Notification(props: Props) {
|
||||
break;
|
||||
case RULE.COMMENT:
|
||||
case RULE.CREATOR_COMMENT:
|
||||
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.comment_author} />;
|
||||
channelUrl = notification_parameters.dynamic.comment_author;
|
||||
icon = creatorIcon(channelUrl);
|
||||
break;
|
||||
case RULE.COMMENT_REPLY:
|
||||
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.reply_author} />;
|
||||
channelUrl = notification_parameters.dynamic.reply_author;
|
||||
icon = creatorIcon(channelUrl);
|
||||
break;
|
||||
case RULE.NEW_CONTENT:
|
||||
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.channel_url} />;
|
||||
channelUrl = notification_parameters.dynamic.channel_url;
|
||||
icon = creatorIcon(channelUrl);
|
||||
break;
|
||||
case RULE.NEW_LIVESTREAM:
|
||||
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.channel_url} />;
|
||||
channelUrl = notification_parameters.dynamic.channel_url;
|
||||
icon = creatorIcon(channelUrl);
|
||||
break;
|
||||
case RULE.DAILY_WATCH_AVAILABLE:
|
||||
case RULE.DAILY_WATCH_REMIND:
|
||||
@@ -97,6 +119,51 @@ export default function Notification(props: Props) {
|
||||
icon = <Icon icon={ICONS.NOTIFICATION} sectionIcon />;
|
||||
}
|
||||
|
||||
let notificationLink = formatLbryUrlForWeb(notificationTarget);
|
||||
let urlParams = new URLSearchParams();
|
||||
if (isCommentNotification && notification_parameters.dynamic.hash) {
|
||||
urlParams.append('lc', notification_parameters.dynamic.hash);
|
||||
}
|
||||
|
||||
let channelName = channelUrl && ('@' + channelUrl.split('@')[1].split('#')[0]);
|
||||
|
||||
const notificationTitle = notification_parameters.device.title;
|
||||
const titleSplit = notificationTitle.split(' ');
|
||||
let fullTitle = [' '];
|
||||
let uriIndicator;
|
||||
const title = titleSplit.map((message, index) => {
|
||||
if (channelName === message) {
|
||||
uriIndicator = (
|
||||
<UriIndicator uri={channelUrl} link />
|
||||
);
|
||||
fullTitle.push(' ');
|
||||
const resultTitle = fullTitle;
|
||||
fullTitle = [' '];
|
||||
|
||||
return [resultTitle.join(' '), uriIndicator];
|
||||
} else {
|
||||
fullTitle.push(message);
|
||||
|
||||
if (index === (titleSplit.length - 1)) {
|
||||
return (
|
||||
<LbcMessage>{fullTitle.join(' ')}</LbcMessage>
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const { isChannel } = parseURI(notificationTarget);
|
||||
if (isChannel) {
|
||||
urlParams.append(PAGE_VIEW_QUERY, DISCUSSION_PAGE);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
notificationLink += `?${urlParams.toString()}`;
|
||||
const navLinkProps = {
|
||||
to: notificationLink,
|
||||
};
|
||||
|
||||
function handleNotificationClick() {
|
||||
if (!is_read) {
|
||||
doReadNotifications([id]);
|
||||
@@ -112,6 +179,10 @@ export default function Notification(props: Props) {
|
||||
doReadNotifications([id]);
|
||||
}
|
||||
|
||||
function handleCommentReply() {
|
||||
setReplying(!isReplying);
|
||||
}
|
||||
|
||||
const Wrapper = menuButton
|
||||
? (props: { children: any }) => (
|
||||
<MenuItem className="menu__link--notification" onSelect={handleNotificationClick}>
|
||||
@@ -120,9 +191,11 @@ export default function Notification(props: Props) {
|
||||
)
|
||||
: notificationLink
|
||||
? (props: { children: any }) => (
|
||||
<NavLink {...navLinkProps}>
|
||||
<a className="menu__link--notification" onClick={handleNotificationClick}>
|
||||
{props.children}
|
||||
</a>
|
||||
</NavLink>
|
||||
)
|
||||
: (props: { children: any }) => (
|
||||
<span
|
||||
@@ -146,16 +219,12 @@ export default function Notification(props: Props) {
|
||||
<div className="notification__content">
|
||||
<div className="notification__text-wrapper">
|
||||
{!isCommentNotification && (
|
||||
<div className="notification__title">
|
||||
<LbcMessage>{notification_parameters.device.title}</LbcMessage>
|
||||
</div>
|
||||
<div className="notification__title">{title}</div>
|
||||
)}
|
||||
|
||||
{isCommentNotification && commentText ? (
|
||||
<>
|
||||
<div className="notification__title">
|
||||
<LbcMessage>{notification_parameters.device.title}</LbcMessage>
|
||||
</div>
|
||||
<div className="notification__title">{title}</div>
|
||||
<div title={commentText} className="notification__text mobile-hidden">
|
||||
{commentText}
|
||||
</div>
|
||||
@@ -170,6 +239,55 @@ export default function Notification(props: Props) {
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{isCommentNotification && (
|
||||
<>
|
||||
<div className="notification__reactions">
|
||||
<Button
|
||||
label={__('Reply')}
|
||||
className="comment__action"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleCommentReply();
|
||||
}}
|
||||
icon={ICONS.REPLY}
|
||||
/>
|
||||
<CommentReactions uri={notificationTarget} commentId={notification_parameters.dynamic.hash} />
|
||||
</div>
|
||||
|
||||
{isReplying && (
|
||||
<CommentCreate
|
||||
isReply
|
||||
uri={notificationTarget}
|
||||
parentId={notification_parameters.dynamic.hash}
|
||||
onDoneReplying={() => setReplying(false)}
|
||||
onCancelReplying={() => setReplying(false)}
|
||||
setCommentReply={setCommentReply}
|
||||
/>
|
||||
)}
|
||||
|
||||
{commentReply && (
|
||||
<CommentView
|
||||
key={commentReply.comment_id}
|
||||
uri={notificationTarget}
|
||||
authorUri={commentReply.channel_url}
|
||||
author={commentReply.channel_name}
|
||||
claimId={commentReply.claim_id}
|
||||
commentId={commentReply.comment_id}
|
||||
message={commentReply.comment}
|
||||
timePosted={commentReply.timestamp * 1000}
|
||||
commentIsMine={commentReply.channel_id && isMyComment(commentReply.channel_id)}
|
||||
isPinned={commentReply.is_pinned}
|
||||
supportAmount={commentReply.support_amount}
|
||||
numDirectReplies={commentReply.replies}
|
||||
isFiat={commentReply.is_fiat}
|
||||
setCommentReply={setCommentReply}
|
||||
commentReply={commentReply}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{notification_rule === RULE.NEW_CONTENT && (
|
||||
@@ -193,7 +311,10 @@ export default function Notification(props: Props) {
|
||||
|
||||
<div className="notification__menu">
|
||||
<Menu>
|
||||
<MenuButton className={'menu-button notification__menu-button'} onClick={(e) => e.stopPropagation()}>
|
||||
<MenuButton onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}}>
|
||||
<Icon size={18} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIsNsfw, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { doRecommendationUpdate, doRecommendationClicked } from 'redux/actions/content';
|
||||
import { doFetchRecommendedContent } from 'redux/actions/search';
|
||||
import { makeSelectRecommendedContentForUri, selectIsSearching } from 'redux/selectors/search';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
@@ -17,6 +18,9 @@ const select = (state, props) => ({
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doFetchRecommendedContent: (uri, mature) => dispatch(doFetchRecommendedContent(uri, mature)),
|
||||
doRecommendationUpdate: (claimId, urls, id, parentId) =>
|
||||
dispatch(doRecommendationUpdate(claimId, urls, id, parentId)),
|
||||
doRecommendationClicked: (claimId, index) => dispatch(doRecommendationClicked(claimId, index)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(RecommendedContent);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// @flow
|
||||
import { SHOW_ADS } from 'config';
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import ClaimList from 'component/claimList';
|
||||
import ClaimListDiscover from 'component/claimListDiscover';
|
||||
import Ads from 'web/component/ads';
|
||||
@@ -8,6 +10,7 @@ import Card from 'component/common/card';
|
||||
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
||||
import Button from 'component/button';
|
||||
import classnames from 'classnames';
|
||||
import { CONTAINER_ID } from 'constants/navigation';
|
||||
|
||||
const VIEW_ALL_RELATED = 'view_all_related';
|
||||
const VIEW_MORE_FROM = 'view_more_from';
|
||||
@@ -21,6 +24,8 @@ type Props = {
|
||||
mature: boolean,
|
||||
isAuthenticated: boolean,
|
||||
claim: ?StreamClaim,
|
||||
doRecommendationUpdate: (claimId: string, urls: Array<string>, id: string, parentId: string) => void,
|
||||
doRecommendationClicked: (claimId: string, index: number) => void,
|
||||
};
|
||||
|
||||
export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
@@ -33,33 +38,70 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
isSearching,
|
||||
isAuthenticated,
|
||||
claim,
|
||||
doRecommendationUpdate,
|
||||
doRecommendationClicked,
|
||||
} = props;
|
||||
const [viewMode, setViewMode] = React.useState(VIEW_ALL_RELATED);
|
||||
const [recommendationId, setRecommendationId] = React.useState('');
|
||||
const [recommendationUrls, setRecommendationUrls] = React.useState();
|
||||
const history = useHistory();
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const channelName = signingChannel ? signingChannel.name : null;
|
||||
const isMobile = useIsMobile();
|
||||
const isMedium = useIsMediumScreen();
|
||||
|
||||
function reorderList(recommendedContent) {
|
||||
let newList = recommendedContent;
|
||||
if (newList) {
|
||||
const index = newList.indexOf(nextRecommendedUri);
|
||||
if (index === -1) {
|
||||
// This would be weird. Shouldn't happen since it is derived from the same list.
|
||||
} else if (index !== 0) {
|
||||
// Swap the "next" item to the top of the list
|
||||
const a = newList[0];
|
||||
newList[0] = nextRecommendedUri;
|
||||
newList[index] = a;
|
||||
React.useEffect(() => {
|
||||
function moveAutoplayNextItemToTop(recommendedContent) {
|
||||
let newList = recommendedContent;
|
||||
if (newList) {
|
||||
const index = newList.indexOf(nextRecommendedUri);
|
||||
if (index > 0) {
|
||||
const a = newList[0];
|
||||
newList[0] = nextRecommendedUri;
|
||||
newList[index] = a;
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
function listEq(prev, next) {
|
||||
if (prev && next) {
|
||||
return prev.length === next.length && prev.every((value, index) => value === next[index]);
|
||||
} else {
|
||||
return prev === next;
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
const newRecommendationUrls = moveAutoplayNextItemToTop(recommendedContent);
|
||||
|
||||
if (claim && !listEq(recommendationUrls, newRecommendationUrls)) {
|
||||
const parentId = (history.location.state && history.location.state[CONTAINER_ID]) || '';
|
||||
const id = uuidv4();
|
||||
setRecommendationId(id);
|
||||
setRecommendationUrls(newRecommendationUrls);
|
||||
|
||||
doRecommendationUpdate(claim.claim_id, newRecommendationUrls, id, parentId);
|
||||
}
|
||||
}, [
|
||||
recommendedContent,
|
||||
nextRecommendedUri,
|
||||
recommendationUrls,
|
||||
setRecommendationUrls,
|
||||
claim,
|
||||
doRecommendationUpdate,
|
||||
history.location.state,
|
||||
]);
|
||||
|
||||
React.useEffect(() => {
|
||||
doFetchRecommendedContent(uri, mature);
|
||||
}, [uri, mature, doFetchRecommendedContent]);
|
||||
|
||||
function handleRecommendationClicked(e: any, index: number) {
|
||||
if (claim) {
|
||||
doRecommendationClicked(claim.claim_id, index);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
isBodyList
|
||||
@@ -91,12 +133,14 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
<div>
|
||||
{viewMode === VIEW_ALL_RELATED && (
|
||||
<ClaimList
|
||||
id={recommendationId}
|
||||
type="small"
|
||||
loading={isSearching}
|
||||
uris={reorderList(recommendedContent)}
|
||||
uris={recommendationUrls}
|
||||
hideMenu={isMobile}
|
||||
injectedItem={SHOW_ADS && IS_WEB && !isAuthenticated && <Ads small type={'video'} />}
|
||||
empty={__('No related content found')}
|
||||
onClick={handleRecommendationClicked}
|
||||
/>
|
||||
)}
|
||||
{viewMode === VIEW_MORE_FROM && signingChannel && (
|
||||
|
||||
@@ -38,6 +38,10 @@ function SelectChannel(props: Props) {
|
||||
onChange={handleChannelChange}
|
||||
value={activeChannelClaim && activeChannelClaim.claim_id}
|
||||
disabled={fetchingChannels}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
{fetchingChannels ? (
|
||||
<option>{__('Loading your channels...')}</option>
|
||||
|
||||
@@ -9,12 +9,15 @@ import { useIsMobile } from 'effects/use-screensize';
|
||||
import { FormField } from 'component/common/form';
|
||||
import { hmsToSeconds, secondsToHms } from 'util/time';
|
||||
import { generateLbryContentUrl, generateLbryWebUrl, generateEncodedLbryURL, generateShareUrl } from 'util/url';
|
||||
import { URL, SHARE_DOMAIN_URL } from 'config';
|
||||
import { URL, TWITTER_ACCOUNT, SHARE_DOMAIN_URL } from 'config';
|
||||
|
||||
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
|
||||
const IOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
||||
const SUPPORTS_SHARE_API = typeof navigator.share !== 'undefined';
|
||||
|
||||
// Twitter share
|
||||
const TWITTER_INTENT_API = 'https://twitter.com/intent/tweet?';
|
||||
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
title: ?string,
|
||||
@@ -68,6 +71,21 @@ function SocialShare(props: Props) {
|
||||
);
|
||||
const downloadUrl = `${generateDownloadUrl(name, claimId)}`;
|
||||
|
||||
// Tweet params
|
||||
let tweetIntentParams = {
|
||||
url: shareUrl,
|
||||
text: title || claim.name,
|
||||
hashtags: 'LBRY',
|
||||
};
|
||||
|
||||
if (TWITTER_ACCOUNT) {
|
||||
// $FlowFixMe
|
||||
tweetIntentParams.via = TWITTER_ACCOUNT;
|
||||
}
|
||||
|
||||
// Generate twitter web intent url
|
||||
const tweetIntent = TWITTER_INTENT_API + new URLSearchParams(tweetIntentParams).toString();
|
||||
|
||||
function handleWebShareClick() {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
@@ -115,7 +133,7 @@ function SocialShare(props: Props) {
|
||||
iconSize={24}
|
||||
icon={ICONS.TWITTER}
|
||||
title={__('Share on Twitter')}
|
||||
href={`https://twitter.com/intent/tweet?text=${encodedLbryURL}`}
|
||||
href={tweetIntent}
|
||||
/>
|
||||
<Button
|
||||
className="share"
|
||||
|
||||
@@ -7,7 +7,7 @@ import { makeSelectContentPositionForUri } from 'redux/selectors/content';
|
||||
import VideoViewer from './view';
|
||||
import { withRouter } from 'react-router';
|
||||
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
||||
import { makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings';
|
||||
import { selectDaemonSettings, makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings';
|
||||
import { toggleVideoTheaterMode, doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
|
||||
|
||||
@@ -31,6 +31,7 @@ const select = (state, props) => {
|
||||
homepageData: selectHomepageData(state),
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
userId: userId,
|
||||
shareTelemetry: IS_WEB || selectDaemonSettings(state).share_usage_data,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
// Created by xander on 6/21/2021
|
||||
import videojs from 'video.js';
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
import {
|
||||
makeSelectRecommendationId,
|
||||
makeSelectRecommendationParentId,
|
||||
makeSelectRecommendedClaimIds,
|
||||
makeSelectRecommendationClicks,
|
||||
} from 'redux/selectors/content';
|
||||
|
||||
const VERSION = '0.0.1';
|
||||
|
||||
const recsysEndpoint = 'https://clickstream.odysee.com/log/video/view';
|
||||
@@ -17,23 +23,28 @@ const RecsysData = {
|
||||
};
|
||||
|
||||
function createRecsys(claimId, userId, events, loadedAt, isEmbed) {
|
||||
// TODO: use a UUID generator
|
||||
const uuid = uuidV4();
|
||||
const pageLoadedAt = loadedAt;
|
||||
const pageExitedAt = Date.now();
|
||||
return {
|
||||
uuid: uuid,
|
||||
parentUuid: null,
|
||||
uid: userId,
|
||||
claimId: claimId,
|
||||
pageLoadedAt: pageLoadedAt,
|
||||
pageExitedAt: pageExitedAt,
|
||||
recsysId: recsysId,
|
||||
recClaimIds: null,
|
||||
recClickedVideoIdx: null,
|
||||
events: events,
|
||||
isEmbed: isEmbed,
|
||||
};
|
||||
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
|
||||
return {
|
||||
uuid: makeSelectRecommendationId(claimId)(state),
|
||||
parentUuid: makeSelectRecommendationParentId(claimId)(state),
|
||||
uid: userId,
|
||||
claimId: claimId,
|
||||
pageLoadedAt: pageLoadedAt,
|
||||
pageExitedAt: pageExitedAt,
|
||||
recsysId: recsysId,
|
||||
recClaimIds: makeSelectRecommendedClaimIds(claimId)(state),
|
||||
recClickedVideoIdx: makeSelectRecommendationClicks(claimId)(state),
|
||||
events: events,
|
||||
isEmbed: isEmbed,
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function newRecsysEvent(eventType, offset, arg) {
|
||||
@@ -130,7 +141,10 @@ class RecsysPlugin extends Component {
|
||||
this.loadedAt,
|
||||
false
|
||||
);
|
||||
sendRecsysEvents(event);
|
||||
|
||||
if (event) {
|
||||
sendRecsysEvents(event);
|
||||
}
|
||||
}
|
||||
|
||||
onPlay(event) {
|
||||
@@ -226,7 +240,7 @@ const onPlayerReady = (player, options) => {
|
||||
* @function plugin
|
||||
* @param {Object} [options={}]
|
||||
*/
|
||||
const plugin = function(options) {
|
||||
const plugin = function (options) {
|
||||
this.ready(() => {
|
||||
onPlayerReady(this, videojs.mergeOptions(defaults, options));
|
||||
});
|
||||
|
||||
@@ -56,6 +56,7 @@ type Props = {
|
||||
claimId: ?string,
|
||||
userId: ?number,
|
||||
allowPreRoll: ?boolean,
|
||||
shareTelemetry: boolean,
|
||||
};
|
||||
|
||||
// type VideoJSOptions = {
|
||||
@@ -193,6 +194,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
claimId,
|
||||
userId,
|
||||
// allowPreRoll,
|
||||
shareTelemetry,
|
||||
} = props;
|
||||
|
||||
const [reload, setReload] = useState('initial');
|
||||
@@ -564,11 +566,12 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
});
|
||||
|
||||
// Add recsys plugin
|
||||
// TODO: Add an if(odysee.com) around this function to only use recsys on odysee
|
||||
player.recsys({
|
||||
videoId: claimId,
|
||||
userId: userId,
|
||||
});
|
||||
if (shareTelemetry) {
|
||||
player.recsys({
|
||||
videoId: claimId,
|
||||
userId: userId,
|
||||
});
|
||||
}
|
||||
|
||||
// set playsinline for mobile
|
||||
// TODO: make this better
|
||||
|
||||
@@ -51,6 +51,7 @@ type Props = {
|
||||
authenticated: boolean,
|
||||
userId: number,
|
||||
homepageData?: { [string]: HomepageCat },
|
||||
shareTelemetry: boolean,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -84,6 +85,7 @@ function VideoViewer(props: Props) {
|
||||
homepageData,
|
||||
authenticated,
|
||||
userId,
|
||||
shareTelemetry,
|
||||
} = props;
|
||||
|
||||
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
||||
@@ -319,6 +321,7 @@ function VideoViewer(props: Props) {
|
||||
claimId={claimId}
|
||||
userId={userId}
|
||||
allowPreRoll={!embedded && !authenticated}
|
||||
shareTelemetry={shareTelemetry}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -98,6 +98,8 @@ export const CLEAR_CONTENT_POSITION = 'CLEAR_CONTENT_POSITION';
|
||||
export const SET_CONTENT_LAST_VIEWED = 'SET_CONTENT_LAST_VIEWED';
|
||||
export const CLEAR_CONTENT_HISTORY_URI = 'CLEAR_CONTENT_HISTORY_URI';
|
||||
export const CLEAR_CONTENT_HISTORY_ALL = 'CLEAR_CONTENT_HISTORY_ALL';
|
||||
export const RECOMMENDATION_UPDATED = 'RECOMMENDATION_UPDATED';
|
||||
export const RECOMMENDATION_CLICKED = 'RECOMMENDATION_CLICKED';
|
||||
|
||||
// Files
|
||||
export const FILE_LIST_STARTED = 'FILE_LIST_STARTED';
|
||||
|
||||
@@ -46,3 +46,4 @@ export const CONFIRM_REMOVE_BTC_SWAP_ADDRESS = 'confirm_remove_btc_swap_address'
|
||||
export const COLLECTION_ADD = 'collection_add';
|
||||
export const COLLECTION_DELETE = 'collection_delete';
|
||||
export const CONFIRM_REMOVE_CARD = 'CONFIRM_REMOVE_CARD';
|
||||
export const CONFIRM_REMOVE_COMMENT = 'CONFIRM_REMOVE_COMMENT';
|
||||
|
||||
1
ui/constants/navigation.js
Normal file
1
ui/constants/navigation.js
Normal file
@@ -0,0 +1 @@
|
||||
export const CONTAINER_ID = 'CONTAINER_ID';
|
||||
11
ui/modal/modalRemoveComment/index.js
Normal file
11
ui/modal/modalRemoveComment/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doHideModal } from 'redux/actions/app';
|
||||
import ModalRemoveComment from './view';
|
||||
import { doCommentAbandon } from 'redux/actions/comments';
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
closeModal: () => dispatch(doHideModal()),
|
||||
deleteComment: (commentId, creatorChannelUrl) => dispatch(doCommentAbandon(commentId, creatorChannelUrl)),
|
||||
});
|
||||
|
||||
export default connect(null, perform)(ModalRemoveComment);
|
||||
53
ui/modal/modalRemoveComment/view.jsx
Normal file
53
ui/modal/modalRemoveComment/view.jsx
Normal file
@@ -0,0 +1,53 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { Modal } from 'modal/modal';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
|
||||
type Props = {
|
||||
commentId: string, // sha256 digest identifying the comment
|
||||
commentIsMine: boolean, // if this comment was signed by an owned channel
|
||||
contentChannelPermanentUrl: any,
|
||||
closeModal: () => void,
|
||||
deleteComment: (string, ?string) => void,
|
||||
supportAmount?: any,
|
||||
setCommentReply: (any) => void,
|
||||
};
|
||||
|
||||
function ModalRemoveComment(props: Props) {
|
||||
const { commentId, commentIsMine, contentChannelPermanentUrl, closeModal, deleteComment, supportAmount, setCommentReply } = props;
|
||||
|
||||
return (
|
||||
<Modal isOpen contentLabel={__('Confirm Comment Deletion')} type="card" onAborted={closeModal}>
|
||||
<Card
|
||||
title={__('Remove Comment')}
|
||||
body={
|
||||
<React.Fragment>
|
||||
<p>{__('Are you sure you want to remove this comment?')}</p>
|
||||
{Boolean(supportAmount) && (
|
||||
<p className="help error__text"> {__('This comment has a tip associated with it which cannot be reverted.')}</p>
|
||||
)}
|
||||
</React.Fragment>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="primary"
|
||||
label={__('Remove')}
|
||||
onClick={() => {
|
||||
deleteComment(commentId, commentIsMine ? undefined : contentChannelPermanentUrl);
|
||||
setCommentReply(undefined);
|
||||
closeModal();
|
||||
}}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={closeModal} />
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default ModalRemoveComment;
|
||||
@@ -30,6 +30,7 @@ const ModalPublish = lazyImport(() => import('modal/modalPublish' /* webpackChun
|
||||
const ModalPublishPreview = lazyImport(() => import('modal/modalPublishPreview' /* webpackChunkName: "modalPublishPreview" */));
|
||||
const ModalRemoveBtcSwapAddress = lazyImport(() => import('modal/modalRemoveBtcSwapAddress' /* webpackChunkName: "modalRemoveBtcSwapAddress" */));
|
||||
const ModalRemoveCard = lazyImport(() => import('modal/modalRemoveCard' /* webpackChunkName: "modalRemoveCard" */));
|
||||
const ModalRemoveComment = lazyImport(() => import('modal/modalRemoveComment' /* webpackChunkName: "modalRemoveComment" */));
|
||||
const ModalRemoveFile = lazyImport(() => import('modal/modalRemoveFile' /* webpackChunkName: "modalRemoveFile" */));
|
||||
const ModalRevokeClaim = lazyImport(() => import('modal/modalRevokeClaim' /* webpackChunkName: "modalRevokeClaim" */));
|
||||
const ModalRewardCode = lazyImport(() => import('modal/modalRewardCode' /* webpackChunkName: "modalRewardCode" */));
|
||||
@@ -154,6 +155,8 @@ function ModalRouter(props: Props) {
|
||||
return ModalDeleteCollection;
|
||||
case MODALS.CONFIRM_REMOVE_CARD:
|
||||
return ModalRemoveCard;
|
||||
case MODALS.CONFIRM_REMOVE_COMMENT:
|
||||
return ModalRemoveComment;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -125,9 +125,11 @@ function DiscoverPage(props: Props) {
|
||||
// Assume wild west page if no dynamicRouteProps
|
||||
// Not a very good solution, but just doing it for now
|
||||
// until we are sure this page will stay around
|
||||
// TODO: find a better way to determine discover / wild west vs other modes release times
|
||||
// for now including && !tags so that
|
||||
releaseTime={
|
||||
SIMPLE_SITE
|
||||
? !dynamicRouteProps && `>${Math.floor(moment().subtract(1, 'day').startOf('week').unix())}`
|
||||
? !dynamicRouteProps && !tags && `>${Math.floor(moment().subtract(1, 'day').startOf('week').unix())}`
|
||||
: undefined
|
||||
}
|
||||
feeAmount={SIMPLE_SITE ? !dynamicRouteProps && CS.FEE_AMOUNT_ANY : undefined}
|
||||
|
||||
@@ -7,6 +7,8 @@ import {
|
||||
selectUnseenNotificationCount,
|
||||
selectNotificationCategories,
|
||||
} from 'redux/selectors/notifications';
|
||||
import { selectIsFetchingReacts } from 'redux/selectors/comments';
|
||||
import { doCommentReactList } from 'redux/actions/comments';
|
||||
import { doReadNotifications, doNotificationList, doSeeAllNotifications } from 'redux/actions/notifications';
|
||||
import NotificationsPage from './view';
|
||||
|
||||
@@ -17,10 +19,12 @@ const select = (state) => ({
|
||||
fetching: selectIsFetchingNotifications(state),
|
||||
unreadCount: selectUnreadNotificationCount(state),
|
||||
unseenCount: selectUnseenNotificationCount(state),
|
||||
isFetchingReacts: selectIsFetchingReacts(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doReadNotifications,
|
||||
doNotificationList,
|
||||
doSeeAllNotifications,
|
||||
doCommentReactList,
|
||||
})(NotificationsPage);
|
||||
|
||||
@@ -10,6 +10,7 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||
import Yrbl from 'component/yrbl';
|
||||
import * as NOTIFICATIONS from 'constants/notifications';
|
||||
import useFetched from 'effects/use-fetched';
|
||||
import { RULE } from 'constants/notifications';
|
||||
|
||||
type Props = {
|
||||
notifications: Array<Notification>,
|
||||
@@ -21,6 +22,8 @@ type Props = {
|
||||
doSeeAllNotifications: () => void,
|
||||
doReadNotifications: () => void,
|
||||
doNotificationList: (?Array<string>) => void,
|
||||
isFetchingReacts: boolean,
|
||||
doCommentReactList: (Array<string>) => Promise<any>,
|
||||
};
|
||||
|
||||
export default function NotificationsPage(props: Props) {
|
||||
@@ -34,11 +37,41 @@ export default function NotificationsPage(props: Props) {
|
||||
doReadNotifications,
|
||||
doNotificationList,
|
||||
notificationCategories,
|
||||
isFetchingReacts,
|
||||
doCommentReactList,
|
||||
} = props;
|
||||
const initialFetchDone = useFetched(fetching);
|
||||
const [name, setName] = usePersistedState('notifications--rule', NOTIFICATIONS.NOTIFICATION_NAME_ALL);
|
||||
const isFiltered = name !== NOTIFICATIONS.NOTIFICATION_NAME_ALL;
|
||||
const list = isFiltered ? notificationsFiltered : notifications;
|
||||
const [reactsFetched, setReactsFetched] = React.useState(false);
|
||||
|
||||
// Fetch reacts
|
||||
React.useEffect(() => {
|
||||
if (!fetching && !isFetchingReacts && !reactsFetched) {
|
||||
let idsForReactionFetch = [];
|
||||
list.map((notification) => {
|
||||
const { notification_rule, notification_parameters } = notification;
|
||||
const isComment =
|
||||
notification_rule === RULE.COMMENT ||
|
||||
notification_rule === RULE.COMMENT_REPLY ||
|
||||
notification_rule === RULE.CREATOR_COMMENT;
|
||||
const commentId = isComment && notification_parameters && notification_parameters.dynamic && notification_parameters.dynamic.hash;
|
||||
|
||||
if (commentId) {
|
||||
idsForReactionFetch.push(commentId);
|
||||
}
|
||||
});
|
||||
|
||||
if (idsForReactionFetch.length !== 0) {
|
||||
doCommentReactList(idsForReactionFetch)
|
||||
.then(() => {
|
||||
setReactsFetched(true);
|
||||
})
|
||||
.catch(() => setReactsFetched(true));
|
||||
}
|
||||
}
|
||||
}, [isFetchingReacts, fetching, doCommentReactList, list, reactsFetched]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (unseenCount > 0 || unreadCount > 0) {
|
||||
@@ -106,7 +139,7 @@ export default function NotificationsPage(props: Props) {
|
||||
{list && list.length > 0 && !(isFiltered && fetching) ? (
|
||||
<div className="card">
|
||||
<div className="notification_list">
|
||||
{list.map((notification, index) => {
|
||||
{list.map((notification) => {
|
||||
return <Notification key={notification.id} notification={notification} />;
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -40,7 +40,9 @@ function TopPage(props: Props) {
|
||||
label={__('Repost Here')}
|
||||
/>
|
||||
),
|
||||
publish: <Button button="secondary" onClick={() => beginPublish(queryName)} label={'Publish Here'} />,
|
||||
publish: (
|
||||
<Button button="secondary" onClick={() => beginPublish(queryName)} label={__('Publish Here')} />
|
||||
),
|
||||
}}
|
||||
>
|
||||
%repost% %publish%
|
||||
|
||||
@@ -43,7 +43,7 @@ export function doUpdateLoadStatus(uri: string, outpoint: string) {
|
||||
full_status: true,
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
}).then(result => {
|
||||
}).then((result) => {
|
||||
const { items: fileInfos } = result;
|
||||
const fileInfo = fileInfos[0];
|
||||
if (!fileInfo || fileInfo.written_bytes === 0) {
|
||||
@@ -261,3 +261,21 @@ export function doClearContentHistoryAll() {
|
||||
dispatch({ type: ACTIONS.CLEAR_CONTENT_HISTORY_ALL });
|
||||
};
|
||||
}
|
||||
|
||||
export const doRecommendationUpdate = (claimId: string, urls: Array<string>, id: string, parentId: string) => (
|
||||
dispatch: Dispatch
|
||||
) => {
|
||||
dispatch({
|
||||
type: ACTIONS.RECOMMENDATION_UPDATED,
|
||||
data: { claimId, urls, id, parentId },
|
||||
});
|
||||
};
|
||||
|
||||
export const doRecommendationClicked = (claimId: string, index: number) => (dispatch: Dispatch) => {
|
||||
if (index !== undefined && index !== null) {
|
||||
dispatch({
|
||||
type: ACTIONS.RECOMMENDATION_CLICKED,
|
||||
data: { claimId, index },
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ import { buildURI, doResolveUris, batchActions, isURIValid, makeSelectClaimForUr
|
||||
import { makeSelectSearchUris, selectSearchValue } from 'redux/selectors/search';
|
||||
import handleFetchResponse from 'util/handle-fetch';
|
||||
import { getSearchQueryString } from 'util/query-params';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import { SIMPLE_SITE, SEARCH_SERVER_API } from 'config';
|
||||
|
||||
type Dispatch = (action: any) => any;
|
||||
type GetState = () => { search: SearchState };
|
||||
@@ -19,7 +19,7 @@ type SearchOptions = {
|
||||
};
|
||||
|
||||
let lighthouse = {
|
||||
CONNECTION_STRING: 'https://lighthouse.lbry.com/search',
|
||||
CONNECTION_STRING: SEARCH_SERVER_API,
|
||||
search: (queryString: string) => fetch(`${lighthouse.CONNECTION_STRING}?${queryString}`).then(handleFetchResponse),
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import { getAuthToken } from 'util/saved-passwords';
|
||||
import { doNotificationList } from 'redux/actions/notifications';
|
||||
import { SOCKETY_SERVER_API } from 'config';
|
||||
|
||||
const NOTIFICATION_WS_URL = 'wss://sockety.lbry.com/ws/internal?id=';
|
||||
const COMMENT_WS_URL = 'wss://sockety.lbry.com/ws/commentron?id=';
|
||||
const NOTIFICATION_WS_URL = `${SOCKETY_SERVER_API}/internal?id=`;
|
||||
const COMMENT_WS_URL = `${SOCKETY_SERVER_API}/commentron?id=`;
|
||||
|
||||
let sockets = {};
|
||||
let closingSockets = {};
|
||||
|
||||
@@ -7,6 +7,10 @@ const defaultState = {
|
||||
channelClaimCounts: {},
|
||||
positions: {},
|
||||
history: [],
|
||||
recommendationId: {}, // { "claimId": "recommendationId" }
|
||||
recommendationParentId: {}, // { "claimId": "referrerId" }
|
||||
recommendationUrls: {}, // { "claimId": [lbryUrls...] }
|
||||
recommendationClicks: {}, // { "claimId": [clicked indices...] }
|
||||
};
|
||||
|
||||
reducers[ACTIONS.SET_PRIMARY_URI] = (state, action) =>
|
||||
@@ -73,7 +77,7 @@ reducers[ACTIONS.SET_CONTENT_LAST_VIEWED] = (state, action) => {
|
||||
const { uri, lastViewed } = action.data;
|
||||
const { history } = state;
|
||||
const historyObj = { uri, lastViewed };
|
||||
const index = history.findIndex(i => i.uri === uri);
|
||||
const index = history.findIndex((i) => i.uri === uri);
|
||||
const newHistory =
|
||||
index === -1
|
||||
? [historyObj].concat(history)
|
||||
@@ -84,7 +88,7 @@ reducers[ACTIONS.SET_CONTENT_LAST_VIEWED] = (state, action) => {
|
||||
reducers[ACTIONS.CLEAR_CONTENT_HISTORY_URI] = (state, action) => {
|
||||
const { uri } = action.data;
|
||||
const { history } = state;
|
||||
const index = history.findIndex(i => i.uri === uri);
|
||||
const index = history.findIndex((i) => i.uri === uri);
|
||||
return index === -1
|
||||
? state
|
||||
: {
|
||||
@@ -93,7 +97,44 @@ reducers[ACTIONS.CLEAR_CONTENT_HISTORY_URI] = (state, action) => {
|
||||
};
|
||||
};
|
||||
|
||||
reducers[ACTIONS.CLEAR_CONTENT_HISTORY_ALL] = state => ({ ...state, history: [] });
|
||||
reducers[ACTIONS.CLEAR_CONTENT_HISTORY_ALL] = (state) => ({ ...state, history: [] });
|
||||
|
||||
reducers[ACTIONS.RECOMMENDATION_UPDATED] = (state, action) => {
|
||||
const { claimId, urls, id, parentId } = action.data;
|
||||
const recommendationId = Object.assign({}, state.recommendationId);
|
||||
const recommendationParentId = Object.assign({}, state.recommendationParentId);
|
||||
const recommendationUrls = Object.assign({}, state.recommendationUrls);
|
||||
const recommendationClicks = Object.assign({}, state.recommendationClicks);
|
||||
|
||||
if (urls && urls.length > 0) {
|
||||
recommendationId[claimId] = id;
|
||||
recommendationParentId[claimId] = parentId;
|
||||
recommendationUrls[claimId] = urls;
|
||||
recommendationClicks[claimId] = [];
|
||||
} else {
|
||||
delete recommendationId[claimId];
|
||||
delete recommendationParentId[claimId];
|
||||
delete recommendationUrls[claimId];
|
||||
delete recommendationClicks[claimId];
|
||||
}
|
||||
|
||||
return { ...state, recommendationId, recommendationParentId, recommendationUrls, recommendationClicks };
|
||||
};
|
||||
|
||||
reducers[ACTIONS.RECOMMENDATION_CLICKED] = (state, action) => {
|
||||
const { claimId, index } = action.data;
|
||||
const recommendationClicks = Object.assign({}, state.recommendationClicks);
|
||||
|
||||
if (state.recommendationUrls[claimId] && index >= 0 && index < state.recommendationUrls[claimId].length) {
|
||||
if (recommendationClicks[claimId]) {
|
||||
recommendationClicks[claimId].push(index);
|
||||
} else {
|
||||
recommendationClicks[claimId] = [index];
|
||||
}
|
||||
}
|
||||
|
||||
return { ...state, recommendationClicks };
|
||||
};
|
||||
|
||||
// reducers[LBRY_REDUX_ACTIONS.PURCHASE_URI_FAILED] = (state, action) => {
|
||||
// return {
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
makeSelectFileNameForUri,
|
||||
normalizeURI,
|
||||
selectMyActiveClaims,
|
||||
selectClaimIdsByUri,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectRecommendedContentForUri } from 'redux/selectors/search';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
@@ -247,19 +248,37 @@ export const makeSelectInsufficientCreditsForUri = (uri: string) =>
|
||||
);
|
||||
|
||||
export const makeSelectSigningIsMine = (rawUri: string) => {
|
||||
let uri;
|
||||
let uri;
|
||||
try {
|
||||
uri = normalizeURI(rawUri);
|
||||
} catch (e) {}
|
||||
|
||||
return createSelector(selectClaimsByUri, selectMyActiveClaims, (claims, myClaims) => {
|
||||
try {
|
||||
uri = normalizeURI(rawUri);
|
||||
} catch (e) { }
|
||||
parseURI(uri);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
const signingChannel = claims && claims[uri] && (claims[uri].signing_channel || claims[uri]);
|
||||
|
||||
return createSelector(selectClaimsByUri, selectMyActiveClaims, (claims, myClaims) => {
|
||||
try {
|
||||
parseURI(uri);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
const signingChannel = claims && claims[uri] && (claims[uri].signing_channel || claims[uri]);
|
||||
return signingChannel && myClaims.has(signingChannel.claim_id);
|
||||
});
|
||||
};
|
||||
|
||||
return signingChannel && myClaims.has(signingChannel.claim_id);
|
||||
});
|
||||
};
|
||||
export const makeSelectRecommendationId = (claimId: string) =>
|
||||
createSelector(selectState, (state) => state.recommendationId[claimId]);
|
||||
|
||||
export const makeSelectRecommendationParentId = (claimId: string) =>
|
||||
createSelector(selectState, (state) => state.recommendationParentId[claimId]);
|
||||
|
||||
export const makeSelectRecommendedClaimIds = (claimId: string) =>
|
||||
createSelector(selectState, selectClaimIdsByUri, (state, claimIdsByUri) => {
|
||||
const recommendationUrls = state.recommendationUrls[claimId];
|
||||
if (recommendationUrls) {
|
||||
return recommendationUrls.map((url) => claimIdsByUri[url]);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
|
||||
export const makeSelectRecommendationClicks = (claimId: string) =>
|
||||
createSelector(selectState, (state) => state.recommendationClicks[claimId]);
|
||||
|
||||
@@ -165,7 +165,7 @@ $actions-z-index: 2;
|
||||
}
|
||||
|
||||
.channel__title {
|
||||
display: inline;
|
||||
display: flex;
|
||||
margin-right: var(--spacing-s);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@@ -218,6 +218,7 @@ $thumbnailWidthSmall: 1rem;
|
||||
.comment__message {
|
||||
word-break: break-word;
|
||||
max-width: 35rem;
|
||||
color: var(--color-text);
|
||||
|
||||
ul li,
|
||||
ol li {
|
||||
@@ -267,6 +268,7 @@ $thumbnailWidthSmall: 1rem;
|
||||
|
||||
.comment__char-count {
|
||||
font-size: var(--font-xsmall);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.comment__char-count-mde {
|
||||
|
||||
@@ -71,6 +71,13 @@
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.header__navigation-logo {
|
||||
height: var(--height-button);
|
||||
max-width: -webkit-fit-content;
|
||||
max-width: -moz-fit-content;
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
.header__navigation-item {
|
||||
height: var(--height-button);
|
||||
display: flex;
|
||||
|
||||
@@ -42,6 +42,7 @@ $contentMaxWidth: 60rem;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
padding: var(--spacing-m) 0;
|
||||
justify-content: space-between;
|
||||
|
||||
.channel-thumbnail {
|
||||
@include handleChannelGif(3rem);
|
||||
@@ -60,6 +61,7 @@ $contentMaxWidth: 60rem;
|
||||
|
||||
.notification__wrapper--unread {
|
||||
background-color: var(--color-card-background-highlighted);
|
||||
justify-content: space-between;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--color-button-secondary-bg);
|
||||
@@ -120,6 +122,7 @@ $contentMaxWidth: 60rem;
|
||||
}
|
||||
|
||||
.notification__title {
|
||||
position: relative;
|
||||
font-size: var(--font-small);
|
||||
color: var(--color-text);
|
||||
margin-bottom: var(--spacing-s);
|
||||
@@ -135,6 +138,7 @@ $contentMaxWidth: 60rem;
|
||||
|
||||
.notification__text {
|
||||
font-size: var(--font-body);
|
||||
color: var(--color-text);
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
@@ -158,6 +162,19 @@ $contentMaxWidth: 60rem;
|
||||
}
|
||||
}
|
||||
|
||||
.notification__reactions {
|
||||
display: flex;
|
||||
margin-top: var(--spacing-s);
|
||||
|
||||
> *:not(:last-of-type) {
|
||||
margin-right: var(--spacing-m);
|
||||
}
|
||||
|
||||
.button__label {
|
||||
margin-left: var(--spacing-xs);
|
||||
}
|
||||
}
|
||||
|
||||
.notification__bubble {
|
||||
height: 1.5rem;
|
||||
width: 1.5rem;
|
||||
|
||||
@@ -51,10 +51,7 @@
|
||||
padding: 0.3rem;
|
||||
|
||||
.icon {
|
||||
stroke: var(--color-menu);
|
||||
}
|
||||
|
||||
.comment__menu-icon--hovering {
|
||||
stroke: var(--color-menu-icon);
|
||||
}
|
||||
|
||||
&:focus,
|
||||
@@ -62,7 +59,7 @@
|
||||
opacity: 1;
|
||||
background-color: var(--color-button-alt-bg);
|
||||
.icon {
|
||||
stroke: var(--color-menu-hovering);
|
||||
stroke: var(--color-menu-icon-active);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,8 +124,7 @@
|
||||
--color-menu-background: var(--color-header-background);
|
||||
--color-menu-background--active: var(--color-card-background-highlighted);
|
||||
--color-menu-icon: var(--color-navigation-link);
|
||||
--color-menu: var(--color-gray-3);
|
||||
--color-menu-hovering: var(--color-gray-6);
|
||||
--color-menu-icon-active: var(--color-gray-6);
|
||||
|
||||
// Comments
|
||||
--color-comment-highlighted: #fff2d9;
|
||||
|
||||
@@ -90,8 +90,7 @@
|
||||
--color-menu-background: var(--color-header-background);
|
||||
--color-menu-background--active: var(--color-gray-7);
|
||||
--color-menu-icon: var(--color-gray-4);
|
||||
--color-menu: var(--color-gray-5);
|
||||
--color-menu-hovering: var(--color-gray-2);
|
||||
--color-menu-icon-active: var(--color-gray-2);
|
||||
|
||||
// Comments
|
||||
--color-comment-threadline: #434b54;
|
||||
|
||||
@@ -286,7 +286,7 @@ export function GetLinksData(
|
||||
? `>${Math.floor(moment().subtract(9, 'months').startOf('week').unix())}`
|
||||
: `>${Math.floor(moment().subtract(1, 'year').startOf('week').unix())}`,
|
||||
pageSize: getPageSize(subscribedChannels.length > 3 ? (subscribedChannels.length > 6 ? 16 : 8) : 4),
|
||||
streamTypes: CS.FILE_TYPES,
|
||||
streamTypes: null,
|
||||
channelIds: subscribedChannels.map((subscription: Subscription) => {
|
||||
const { channelClaimId } = parseURI(subscription.uri);
|
||||
return channelClaimId;
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
--color-menu-background: var(--color-header-background);
|
||||
--color-menu-background--active: var(--color-gray-7);
|
||||
--color-menu-icon: var(--color-gray-4);
|
||||
--color-menu-icon-active: var(--color-gray-2);
|
||||
|
||||
// Comments
|
||||
--color-comment-menu: var(--color-gray-5);
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
--color-menu-background: var(--color-header-background);
|
||||
--color-menu-background--active: var(--color-card-background-highlighted);
|
||||
--color-menu-icon: var(--color-navigation-link);
|
||||
--color-menu-icon-active: var(--color-navigation-link);
|
||||
|
||||
// Comments
|
||||
--color-comment-menu: var(--color-gray-3);
|
||||
|
||||
Reference in New Issue
Block a user