Compare commits

..

23 Commits

Author SHA1 Message Date
Baltazar Gomez
00f67b0deb fix eslint 2021-08-03 17:08:55 -05:00
Baltazar Gomez
429528608e Merge branch 'master' into protocol 2021-08-03 16:43:28 -05:00
zeppi
fe35ea3764 stream type string or array 2021-08-03 14:49:59 -04:00
zeppi
67bcc1b1ec build 2021-08-03 14:49:59 -04:00
zeppi
ff5ca7398c naming 2021-08-03 13:38:17 -04:00
zeppi
e3e5c50a13 style logo in embed 2021-08-03 13:38:17 -04:00
saltrafael
426042feab Fix icon color 2021-08-03 13:23:31 -04:00
saltrafael
a6ad758c71 Show on content page if a file is part of a playlist already 2021-08-03 13:23:31 -04:00
zeppi
413b19a7e9 sync edited playlists 2021-08-03 11:47:54 -04:00
infinite-persistence
4156e83f57 Fix: OG messed up if $" is in title
## Issue
5951: OG messed up if `$"` is in title

The replacement string would contain `...$&quot...`. The character `$&` has special meaning in `replace`, so the output was messed up.

## Approach
Use a direct slice approach. A bit less elegant.
2021-08-03 11:36:26 -04:00
zeppi
2d66b8666d styling 2021-08-03 11:05:32 -04:00
saltrafael
f01fb7dd22 Mobile view: Make comments expandable 2021-08-03 11:05:32 -04:00
Baltazar Gomez
d8e92f9d6a Merge branch 'master' into protocol 2021-08-01 13:41:18 -05:00
btzr-io
2f9278d5cc dont' show open-in-desktop button on web-mobile version 2021-07-30 18:26:44 -05:00
btzr-io
1efef22885 fix unexpected trailing comma error 2021-07-30 17:51:44 -05:00
btzr-io
f87a212b32 minor fixes for electron/index.js 2021-07-30 17:37:01 -05:00
Baltazar Gomez
3f3be5feb0 Merge branch 'master' into protocol 2021-07-29 20:46:13 -05:00
Baltazar Gomez
5d057ed2ce remove comment 2021-07-26 15:16:57 -05:00
btzr-io
d3da113c71 remove unused import 2021-07-26 12:58:45 -05:00
btzr-io
1d6159fe55 remove open in web button 2021-07-26 12:53:52 -05:00
btzr-io
c6bf885adb add open in web / desktop button to file actions 2021-07-23 01:10:41 -05:00
btzr-io
d320a07d8b add open in desktop / web button to claim menu 2021-07-23 00:13:13 -05:00
btzr-io
68d528003d fix lbry protocol handler: #6659 2021-07-22 23:21:52 -05:00
32 changed files with 208 additions and 350 deletions

View File

@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- 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))
- Show on content page if a file is part of a playlist already _community pr!_([#6393](https://github.com/lbryio/lbry-desktop/pull/6393))
### Changed
- Use Canonical Url for copy link ([#6500](https://github.com/lbryio/lbry-desktop/pull/6500))

View File

@@ -45,9 +45,15 @@ let daemon;
let lbryFirst;
const appState = {};
const PROTOCOL = 'lbry';
if (process.platform !== 'linux') {
app.setAsDefaultProtocolClient('lbry');
if (isDev && process.platform === 'win32') {
// Setting this is required to get this working in dev mode.
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [
path.resolve(process.argv[1]),
]);
} else {
app.setAsDefaultProtocolClient(PROTOCOL);
}
app.name = 'LBRY';
@@ -149,9 +155,15 @@ if (!gotSingleInstanceLock) {
app.on('second-instance', (event, argv) => {
// Send the url to the app to navigate first, then focus
if (rendererWindow) {
if ((process.platform === 'win32' || process.platform === 'linux') && String(argv[1]).startsWith('lbry')) {
let URI = argv[1];
// External uri (last item on argv):
const EXTERNAL_URI = (argv.length) ? argv[argv.length - 1] : '';
// Handle protocol requests for windows and linux
const platforms = (process.platform === 'win32' || process.platform === 'linux');
// Is LBRY protocol
const isProtocolURI = String(EXTERNAL_URI).startsWith(PROTOCOL + '://');
// External protocol requested:
if (platforms && isProtocolURI) {
let URI = EXTERNAL_URI;
// Keep only command line / deep linked arguments
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
// restore the original URI that was typed.

View File

@@ -152,7 +152,7 @@
"imagesloaded": "^4.1.4",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#a327385cdf71568dbd15a17f3dcf5f4b83e0966d",
"lbry-redux": "lbryio/lbry-redux#7cc9923ed9ff1940b508842af6be44c8da906a60",
"lbryinc": "lbryio/lbryinc#8f9a58bfc8312a65614fd7327661cdcc502c4e59",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View File

@@ -2058,14 +2058,15 @@
"Only select creators can receive tips at this time": "Only select creators can receive tips at this time",
"The payment will be made from your saved card": "The payment will be made from your saved card",
"Commenting...": "Commenting...",
"Show %count% replies": "Show %count% replies",
"Show reply": "Show reply",
"added to": "added to",
"removed from": "removed from",
"Skip Navigation": "Skip Navigation",
"Reset": "Reset",
"Reset to original (previous) publish date": "Reset to original (previous) publish date",
"Search for something...": "Search for something...",
"Open in Desktop": "Open in Desktop",
"Show %count% replies": "Show %count% replies",
"Show reply": "Show reply",
"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?",

View File

@@ -1,11 +1,17 @@
import { connect } from 'react-redux';
import { doOpenModal } from 'redux/actions/app';
import CollectionAddButton from './view';
import { makeSelectClaimForUri } from 'lbry-redux';
import { makeSelectClaimForUri, makeSelectClaimUrlInCollection } from 'lbry-redux';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
});
const select = (state, props) => {
const claim = makeSelectClaimForUri(props.uri)(state);
const permanentUrl = claim && claim.permanent_url;
return {
claim,
isSaved: makeSelectClaimUrlInCollection(permanentUrl)(state),
};
};
export default connect(select, {
doOpenModal,

View File

@@ -11,10 +11,11 @@ type Props = {
fileAction?: boolean,
type?: boolean,
claim: Claim,
isSaved: boolean,
};
export default function CollectionAddButton(props: Props) {
const { doOpenModal, uri, fileAction, type = 'playlist', claim } = props;
const { doOpenModal, uri, fileAction, type = 'playlist', claim, isSaved } = props;
// $FlowFixMe
const streamType = (claim && claim.value && claim.value.stream_type) || '';
@@ -25,9 +26,9 @@ export default function CollectionAddButton(props: Props) {
<Button
button={fileAction ? undefined : 'alt'}
className={classnames({ 'button--file-action': fileAction })}
icon={fileAction ? ICONS.ADD : ICONS.LIBRARY}
icon={fileAction ? (!isSaved ? ICONS.ADD : ICONS.STACK) : ICONS.LIBRARY}
iconSize={fileAction ? 22 : undefined}
label={uri ? __('Save') : __('New List')}
label={uri ? (!isSaved ? __('Save') : __('Saved')) : __('New List')}
requiresAuth={IS_WEB}
title={__('Add this claim to a list')}
onClick={(e) => {

View File

@@ -106,7 +106,7 @@ function ClaimListDiscover(props: Props) {
claimType,
pageSize,
defaultClaimType,
streamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined,
streamType = SIMPLE_SITE ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
defaultStreamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined, // add param for DEFAULT_STREAM_TYPE
freshness,
defaultFreshness = CS.FRESH_WEEK,
@@ -319,7 +319,7 @@ function ClaimListDiscover(props: Props) {
}
if (streamTypeParam && streamTypeParam !== CS.CONTENT_ALL && claimType !== CS.CLAIM_CHANNEL) {
options.stream_types = [streamTypeParam];
options.stream_types = typeof streamTypeParam === 'string' ? [streamTypeParam] : streamTypeParam;
}
if (claimTypeParam) {

View File

@@ -9,6 +9,7 @@ import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
import Icon from 'component/common/icon';
import { generateShareUrl, generateRssUrl, generateLbryContentUrl } from 'util/url';
import { useHistory } from 'react-router';
import { useIsMobile } from 'effects/use-screensize';
import { buildURI, parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
@@ -94,6 +95,7 @@ function ClaimMenuList(props: Props) {
editedCollection,
isAuthenticated,
} = props;
const isMobile = useIsMobile();
const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
const isChannel = !incognitoClaim && !contentSigningChannel;
const { channelName } = parseURI(contentChannelUri);
@@ -229,6 +231,10 @@ function ClaimMenuList(props: Props) {
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`);
}
function handleOpenInDesktop() {
window.open(claim.permanent_url, '_top');
}
return (
<Menu>
<MenuButton
@@ -410,6 +416,15 @@ function ClaimMenuList(props: Props) {
</MenuItem>
)}
{IS_WEB && !isMobile && (
<MenuItem className="comment__menu-option" onSelect={handleOpenInDesktop}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.DESKTOP} />
{__('Open in Desktop')}
</div>
</MenuItem>
)}
{!claimIsMine && !isMyCollection && (
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
<div className="menu__link">

View File

@@ -59,9 +59,7 @@ type Props = {
stakedLevel: number,
supportAmount: number,
numDirectReplies: number,
isFiat: boolean,
setCommentReply: (any) => void,
commentReply: any,
isFiat: boolean
};
const LENGTH_TO_COLLAPSE = 300;
@@ -95,8 +93,6 @@ function Comment(props: Props) {
supportAmount,
numDirectReplies,
isFiat,
setCommentReply,
commentReply,
} = props;
const {
@@ -182,7 +178,6 @@ function Comment(props: Props) {
function handleSubmit() {
updateComment(commentId, editedMessage);
setCommentReply({ ...commentReply, comment_id: commentId, comment: editedMessage });
setEditing(false);
}
@@ -258,10 +253,7 @@ function Comment(props: Props) {
</span>
)}
</div>
<span className="comment__menu" onClick={(e) => {
e.stopPropagation();
e.preventDefault();
}}>
<div className="comment__menu">
<Menu>
<MenuButton className="menu__button">
<Icon
@@ -279,10 +271,9 @@ function Comment(props: Props) {
commentIsMine={commentIsMine}
handleEditComment={handleEditComment}
supportAmount={supportAmount}
setCommentReply={setCommentReply}
/>
</Menu>
</span>
</div>
</div>
<div>
{isEditing ? (
@@ -295,10 +286,6 @@ 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
@@ -307,15 +294,8 @@ function Comment(props: Props) {
label={__('Done')}
requiresAuth={IS_WEB}
disabled={message === editedMessage}
onClick={(e) => {
e.stopPropagation();
}}
/>
<Button button="link" label={__('Cancel')} onClick={(e) => {
setEditing(false);
e.stopPropagation();
e.preventDefault();
}} />
<Button button="link" label={__('Cancel')} onClick={() => setEditing(false)} />
</div>
</Form>
) : (
@@ -350,11 +330,7 @@ function Comment(props: Props) {
requiresAuth={IS_WEB}
label={commentingEnabled ? __('Reply') : __('Log in to reply')}
className="comment__action"
onClick={(e) => {
handleCommentReply();
e.stopPropagation();
e.preventDefault();
}}
onClick={handleCommentReply}
icon={ICONS.REPLY}
/>
)}

View File

@@ -50,7 +50,6 @@ type Props = {
sendTip: ({}, (any) => void, (any) => void) => void,
doToast: ({ message: string }) => void,
disabled: boolean,
setCommentReply: (any) => void,
};
export function CommentCreate(props: Props) {
@@ -72,7 +71,6 @@ export function CommentCreate(props: Props) {
claimIsMine,
sendTip,
doToast,
setCommentReply,
} = props;
const buttonRef: ElementRef<any> = React.useRef();
const {
@@ -82,7 +80,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 claimId = claim && claim.claim_id;
const { claim_id: claimId } = claim;
const [isSupportComment, setIsSupportComment] = React.useState();
const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState();
const [tipAmount, setTipAmount] = React.useState(1);
@@ -246,7 +244,6 @@ 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('');
@@ -333,21 +330,9 @@ export function CommentCreate(props: Props) {
? __('Re-submit')
: __('Send')
}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleSupportComment();
}}
/>
<Button
button="link"
label={__('Cancel')}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
setIsReviewingSupportComment(false);
}}
onClick={handleSupportComment}
/>
<Button button="link" label={__('Cancel')} onClick={() => setIsReviewingSupportComment(false)} />
</div>
</div>
);
@@ -386,10 +371,6 @@ 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
@@ -410,23 +391,10 @@ export function CommentCreate(props: Props) {
button="primary"
icon={activeTab === TAB_LBC ? ICONS.LBC : ICONS.FINANCE}
label={__('Review')}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
setIsReviewingSupportComment(true);
}}
onClick={() => setIsReviewingSupportComment(true)}
/>
<Button
disabled={disabled}
button="link"
label={__('Cancel')}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
setIsSupportComment(false);
}}
/>
<Button disabled={disabled} button="link" label={__('Cancel')} onClick={() => setIsSupportComment(false)} />
</>
) : (
<>
@@ -445,9 +413,6 @@ export function CommentCreate(props: Props) {
: __('Comment --[button to submit something]--')
}
requiresAuth={IS_WEB}
onClick={(e) => {
e.stopPropagation();
}}
/>
{!claimIsMine && (
<Button
@@ -455,9 +420,7 @@ export function CommentCreate(props: Props) {
button="alt"
className="thatButton"
icon={ICONS.LBC}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
onClick={() => {
setIsSupportComment(true);
setActiveTab(TAB_LBC);
}}
@@ -469,9 +432,7 @@ export function CommentCreate(props: Props) {
button="alt"
className="thisButton"
icon={ICONS.FINANCE}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
onClick={() => {
setIsSupportComment(true);
setActiveTab(TAB_FIAT);
}}
@@ -481,9 +442,7 @@ export function CommentCreate(props: Props) {
<Button
button="link"
label={__('Cancel')}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
onClick={() => {
if (onCancelReplying) {
onCancelReplying();
}

View File

@@ -30,7 +30,6 @@ type Props = {
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
openModal: (id: string, {}) => void,
supportAmount?: any,
setCommentReply: (any) => void,
};
function CommentMenuList(props: Props) {
@@ -57,7 +56,6 @@ function CommentMenuList(props: Props) {
moderationDelegatorsById,
openModal,
supportAmount,
setCommentReply,
} = props;
const contentChannelClaim = !claim
@@ -85,7 +83,7 @@ function CommentMenuList(props: Props) {
if (playingUri && playingUri.source === 'comment') {
clearPlayingUri();
}
openModal(MODALS.CONFIRM_REMOVE_COMMENT, { commentId, commentIsMine, contentChannelPermanentUrl, supportAmount, setCommentReply });
openModal(MODALS.CONFIRM_REMOVE_COMMENT, { commentId, commentIsMine, contentChannelPermanentUrl, supportAmount });
}
function handleCommentBlock() {

View File

@@ -91,11 +91,7 @@ export default function CommentReactions(props: Props) {
className={classnames('comment__action', {
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.LIKE),
})}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleCommentLike();
}}
onClick={handleCommentLike}
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.LIKE)}</span>}
/>
<Button
@@ -105,11 +101,7 @@ export default function CommentReactions(props: Props) {
className={classnames('comment__action', {
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.DISLIKE),
})}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleCommentDislike();
}}
onClick={handleCommentDislike}
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.DISLIKE)}</span>}
/>
@@ -121,11 +113,7 @@ 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={(e) => {
e.stopPropagation();
e.preventDefault();
react(commentId, REACTION_TYPES.CREATOR_LIKE);
}}
onClick={() => react(commentId, REACTION_TYPES.CREATOR_LIKE)}
>
{creatorLiked && (
<ChannelThumbnail xsmall uri={authorUri} hideStakedIndicator className="comment__creator-like" />

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 { useIsMobile } from 'effects/use-screensize';
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
@@ -74,6 +75,8 @@ function CommentList(props: Props) {
const DEFAULT_SORT = ENABLE_COMMENT_REACTIONS ? SORT_BY.POPULARITY : SORT_BY.NEWEST;
const [sort, setSort] = usePersistedState('comment-sort-by', DEFAULT_SORT);
const [page, setPage] = React.useState(0);
const isMobile = useIsMobile();
const [expandedComments, setExpandedComments] = React.useState(!isMobile);
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
// Display comments immediately if not fetching reactions
@@ -191,7 +194,7 @@ function CommentList(props: Props) {
}
const handleCommentScroll = debounce(() => {
if (shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
if (!isMobile && shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
setPage(page + 1);
}
}, DEBOUNCE_SCROLL_HANDLER_MS);
@@ -205,6 +208,7 @@ function CommentList(props: Props) {
}
}
}, [
isMobile,
page,
moreBelow,
spinnerRef,
@@ -279,7 +283,13 @@ function CommentList(props: Props) {
<Empty padded text={__('That was pretty deep. What do you think?')} />
)}
<ul className="comments" ref={commentRef}>
<ul
className={classnames({
comments: expandedComments,
'comments--contracted': !expandedComments,
})}
ref={commentRef}
>
{topLevelComments &&
displayedComments &&
displayedComments.map((comment) => {
@@ -307,7 +317,36 @@ function CommentList(props: Props) {
})}
</ul>
{(isFetchingComments || moreBelow) && (
{isMobile && (
<div className="card__bottom-actions--comments">
{moreBelow && (
<Button
button="link"
title={!expandedComments ? __('Expand Comments') : __('Load More')}
label={!expandedComments ? __('Expand') : __('More')}
onClick={() => {
if (!expandedComments) {
setExpandedComments(true);
} else {
setPage(page + 1);
}
}}
/>
)}
{expandedComments && (
<Button
button="link"
title={__('Collapse Thread')}
label={__('Collapse')}
onClick={() => {
setExpandedComments(false);
}}
/>
)}
</div>
)}
{(isFetchingComments || (!isMobile && moreBelow)) && (
<div className="main--empty" ref={spinnerRef}>
<Spinner type="small" />
</div>

View File

@@ -283,12 +283,10 @@ export class FormField extends React.PureComponent<Props> {
type="button"
className="button--emoji"
label={emoji}
onClick={(e) => {
onClick={() => {
inputProps.onChange({
target: { value: inputProps.value ? `${inputProps.value} ${emoji}` : emoji },
});
e.stopPropagation();
e.preventDefault();
}}
/>
))}

View File

@@ -2331,4 +2331,11 @@ export const icons = {
<path d="M4.954 14.753l3.535 3.535-1.768 1.768-3.535-3.535z" />
</g>
),
[ICONS.DESKTOP]: buildIcon(
<g>
<rect x="2" y="3" width="20" height="14" rx="2" ry="2" />
<line x1="8" y1="21" x2="16" y2="21" />
<line x1="12" y1="17" x2="12" y2="21" />
</g>
),
};

View File

@@ -113,6 +113,10 @@ function FileActions(props: Props) {
}
}
function handleOpenInDesktop() {
window.open(claim.permanent_url, '_top');
}
const lhsSection = (
<>
{ENABLE_FILE_REACTIONS && !reactionsDisabled && <FileReactions uri={uri} livestream={isLivestreamClaim} />}
@@ -188,6 +192,14 @@ function FileActions(props: Props) {
</MenuItem>
)}
{/* @endif */}
{IS_WEB && !isMobile && (
<MenuItem className="comment__menu-option" onSelect={handleOpenInDesktop}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.DESKTOP} />
{__('Open in Desktop')}
</div>
</MenuItem>
)}
{!claimIsMine && (
<MenuItem
className="comment__menu-option"

View File

@@ -31,7 +31,17 @@ export default function Logo(props: Props) {
if (LOGO_TEXT_LIGHT) {
return (
<>
<img className={'header__navigation-logo'} src={LOGO_TEXT_LIGHT} />
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
</>
);
} else {
return defaultWithLabel;
}
} else if (type === 'embed-ended') {
if (LOGO_TEXT_LIGHT) {
return (
<>
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
</>
);
} else {

View File

@@ -1,14 +1,8 @@
import { connect } from 'react-redux';
import { doReadNotifications, doDeleteNotification } from 'redux/actions/notifications';
import { doResolveUri, selectMyChannelClaims } from 'lbry-redux';
import Notification from './view';
const select = (state) => ({
myChannels: selectMyChannelClaims(state),
});
export default connect(select, {
export default connect(null, {
doReadNotifications,
doDeleteNotification,
doResolveUri,
})(Notification);

View File

@@ -16,11 +16,6 @@ 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,
@@ -28,33 +23,19 @@ 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, doResolveUri, myChannels } = props;
const { notification, menuButton = false, doReadNotifications, doDeleteNotification } = 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) {
@@ -70,20 +51,21 @@ export default function Notification(props: Props) {
notificationTarget = notification_parameters.device.target;
}
React.useEffect(() => {
if (isReplying && notificationTarget) {
doResolveUri(notificationTarget);
}
}, [doResolveUri, isReplying, notificationTarget]);
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);
}
} catch (e) {}
notificationLink += `?${urlParams.toString()}`;
const creatorIcon = (channelUrl) => {
return (
<UriIndicator uri={channelUrl} link>
<ChannelThumbnail small uri={channelUrl} />
</UriIndicator>
);
};
let channelUrl;
let icon;
switch (notification_rule) {
case RULE.CREATOR_SUBSCRIBER:
@@ -91,20 +73,16 @@ export default function Notification(props: Props) {
break;
case RULE.COMMENT:
case RULE.CREATOR_COMMENT:
channelUrl = notification_parameters.dynamic.comment_author;
icon = creatorIcon(channelUrl);
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.comment_author} />;
break;
case RULE.COMMENT_REPLY:
channelUrl = notification_parameters.dynamic.reply_author;
icon = creatorIcon(channelUrl);
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.reply_author} />;
break;
case RULE.NEW_CONTENT:
channelUrl = notification_parameters.dynamic.channel_url;
icon = creatorIcon(channelUrl);
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.channel_url} />;
break;
case RULE.NEW_LIVESTREAM:
channelUrl = notification_parameters.dynamic.channel_url;
icon = creatorIcon(channelUrl);
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.channel_url} />;
break;
case RULE.DAILY_WATCH_AVAILABLE:
case RULE.DAILY_WATCH_REMIND:
@@ -119,51 +97,6 @@ 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]);
@@ -179,10 +112,6 @@ 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}>
@@ -191,11 +120,9 @@ 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
@@ -219,12 +146,16 @@ export default function Notification(props: Props) {
<div className="notification__content">
<div className="notification__text-wrapper">
{!isCommentNotification && (
<div className="notification__title">{title}</div>
<div className="notification__title">
<LbcMessage>{notification_parameters.device.title}</LbcMessage>
</div>
)}
{isCommentNotification && commentText ? (
<>
<div className="notification__title">{title}</div>
<div className="notification__title">
<LbcMessage>{notification_parameters.device.title}</LbcMessage>
</div>
<div title={commentText} className="notification__text mobile-hidden">
{commentText}
</div>
@@ -239,55 +170,6 @@ 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 && (
@@ -311,10 +193,7 @@ export default function Notification(props: Props) {
<div className="notification__menu">
<Menu>
<MenuButton onClick={(e) => {
e.preventDefault();
e.stopPropagation();
}}>
<MenuButton className={'menu__button notification__menu-button'} onClick={(e) => e.stopPropagation()}>
<Icon size={18} icon={ICONS.MORE_VERTICAL} />
</MenuButton>
<MenuList className="menu__list">

View File

@@ -38,10 +38,6 @@ 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>

View File

@@ -165,3 +165,4 @@ export const GLOBE = 'globe';
export const RSS = 'rss';
export const STAR = 'star';
export const MUSIC = 'MusicCategory';
export const DESKTOP = 'desktop';

View File

@@ -11,11 +11,10 @@ type Props = {
closeModal: () => void,
deleteComment: (string, ?string) => void,
supportAmount?: any,
setCommentReply: (any) => void,
};
function ModalRemoveComment(props: Props) {
const { commentId, commentIsMine, contentChannelPermanentUrl, closeModal, deleteComment, supportAmount, setCommentReply } = props;
const { commentId, commentIsMine, contentChannelPermanentUrl, closeModal, deleteComment, supportAmount } = props;
return (
<Modal isOpen contentLabel={__('Confirm Comment Deletion')} type="card" onAborted={closeModal}>
@@ -37,7 +36,6 @@ function ModalRemoveComment(props: Props) {
label={__('Remove')}
onClick={() => {
deleteComment(commentId, commentIsMine ? undefined : contentChannelPermanentUrl);
setCommentReply(undefined);
closeModal();
}}
/>

View File

@@ -7,8 +7,6 @@ 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';
@@ -19,12 +17,10 @@ const select = (state) => ({
fetching: selectIsFetchingNotifications(state),
unreadCount: selectUnreadNotificationCount(state),
unseenCount: selectUnseenNotificationCount(state),
isFetchingReacts: selectIsFetchingReacts(state),
});
export default connect(select, {
doReadNotifications,
doNotificationList,
doSeeAllNotifications,
doCommentReactList,
})(NotificationsPage);

View File

@@ -10,7 +10,6 @@ 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>,
@@ -22,8 +21,6 @@ type Props = {
doSeeAllNotifications: () => void,
doReadNotifications: () => void,
doNotificationList: (?Array<string>) => void,
isFetchingReacts: boolean,
doCommentReactList: (Array<string>) => Promise<any>,
};
export default function NotificationsPage(props: Props) {
@@ -37,41 +34,11 @@ 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) {
@@ -139,7 +106,7 @@ export default function NotificationsPage(props: Props) {
{list && list.length > 0 && !(isFiltered && fetching) ? (
<div className="card">
<div className="notification_list">
{list.map((notification) => {
{list.map((notification, index) => {
return <Notification key={notification.id} notification={notification} />;
})}
</div>

View File

@@ -391,6 +391,11 @@
align-items: center;
}
.card__bottom-actions--comments {
@extend .card__bottom-actions;
margin-top: var(--spacing-s);
}
.card__multi-pane {
display: flex;

View File

@@ -7,6 +7,14 @@ $thumbnailWidthSmall: 1rem;
margin-top: var(--spacing-l);
}
.comments--contracted {
@extend .comments;
max-height: 5rem;
overflow: hidden;
-webkit-mask-image: -webkit-gradient(linear, left 30%, left bottom, from(rgba(0, 0, 0, 1)), to(rgba(0, 0, 0, 0)));
overflow-wrap: anywhere;
}
.comments--replies {
list-style-type: none;
margin-left: var(--spacing-s);
@@ -218,7 +226,6 @@ $thumbnailWidthSmall: 1rem;
.comment__message {
word-break: break-word;
max-width: 35rem;
color: var(--color-text);
ul li,
ol li {
@@ -268,7 +275,6 @@ $thumbnailWidthSmall: 1rem;
.comment__char-count {
font-size: var(--font-xsmall);
color: var(--color-text);
}
.comment__char-count-mde {

View File

@@ -60,3 +60,8 @@
font-size: var(--font-large);
}
}
.embed__overlay-logo {
max-height: 3.5rem;
max-width: 12rem;
}

View File

@@ -42,7 +42,6 @@ $contentMaxWidth: 60rem;
width: 100%;
display: flex;
padding: var(--spacing-m) 0;
justify-content: space-between;
.channel-thumbnail {
@include handleChannelGif(3rem);
@@ -61,7 +60,6 @@ $contentMaxWidth: 60rem;
.notification__wrapper--unread {
background-color: var(--color-card-background-highlighted);
justify-content: space-between;
&:hover {
background-color: var(--color-button-secondary-bg);
@@ -122,7 +120,6 @@ $contentMaxWidth: 60rem;
}
.notification__title {
position: relative;
font-size: var(--font-small);
color: var(--color-text);
margin-bottom: var(--spacing-s);
@@ -138,7 +135,6 @@ $contentMaxWidth: 60rem;
.notification__text {
font-size: var(--font-body);
color: var(--color-text);
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
@@ -162,19 +158,6 @@ $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;

View File

@@ -178,6 +178,7 @@ const sharedStateFilters = {
app_welcome_version: { source: 'app', property: 'welcomeVersion' },
sharing_3P: { source: 'app', property: 'allowAnalytics' },
builtinCollections: { source: 'collections', property: 'builtin' },
editedCollections: { source: 'collections', property: 'edited' },
// savedCollections: { source: 'collections', property: 'saved' },
unpublishedCollections: { source: 'collections', property: 'unpublished' },
};

View File

@@ -38,7 +38,7 @@ function FileViewerEmbeddedEnded(props: Props) {
<div className="file-viewer__overlay">
<div className="file-viewer__overlay-secondary">
<Button className="file-viewer__overlay-logo" href={URL}>
<Logo type={'embed'} />
<Logo type={'embed-ended'} />
</Button>
</div>
<div className="file-viewer__overlay-title">{prompt}</div>

View File

@@ -23,13 +23,17 @@ const { getJsBundleId } = require('../bundle-id.js');
const jsBundleId = getJsBundleId();
function insertToHead(fullHtml, htmlToInsert) {
return fullHtml.replace(
/<!-- VARIABLE_HEAD_BEGIN -->.*<!-- VARIABLE_HEAD_END -->/s,
`
${htmlToInsert || buildOgMetadata()}
<script src="/public/ui-${jsBundleId}.js" async></script>
`
);
const beginStr = '<!-- VARIABLE_HEAD_BEGIN -->';
const finalStr = '<!-- VARIABLE_HEAD_END -->';
const beginIndex = fullHtml.indexOf(beginStr);
const finalIndex = fullHtml.indexOf(finalStr);
if (beginIndex > -1 && finalIndex > -1 && finalIndex > beginIndex) {
return `${fullHtml.slice(0, beginIndex)}${
htmlToInsert || buildOgMetadata()
}<script src="/public/ui-${jsBundleId}.js" async></script>${fullHtml.slice(finalIndex + finalStr.length)}`;
}
}
function truncateDescription(description) {

View File

@@ -10136,9 +10136,9 @@ lazy-val@^1.0.4:
yargs "^13.2.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#a327385cdf71568dbd15a17f3dcf5f4b83e0966d:
lbry-redux@lbryio/lbry-redux#7cc9923ed9ff1940b508842af6be44c8da906a60:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/a327385cdf71568dbd15a17f3dcf5f4b83e0966d"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/7cc9923ed9ff1940b508842af6be44c8da906a60"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"