From 29d8546b4fe098257f55f3e37870ec8372b110dc Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 13 May 2019 02:37:34 -0400 Subject: [PATCH] copy url to clipboard on file page --- src/ui/component/common/paginate.jsx | 2 +- src/ui/page/file/index.js | 2 ++ src/ui/page/file/view.jsx | 19 +++++++++++++++---- src/ui/page/search/view.jsx | 2 +- src/ui/scss/component/_channel.scss | 1 - 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/ui/component/common/paginate.jsx b/src/ui/component/common/paginate.jsx index c30be815f..70c21f331 100644 --- a/src/ui/component/common/paginate.jsx +++ b/src/ui/component/common/paginate.jsx @@ -16,7 +16,7 @@ type Props = { }; function Paginate(props: Props) { - const { totalPages, loading, location, history, onPageChange } = props; + const { totalPages = 1, loading, location, history, onPageChange } = props; const { search } = location; const urlParams = new URLSearchParams(search); const currentPage = Number(urlParams.get(PAGINATE_PARAM)) || 1; diff --git a/src/ui/page/file/index.js b/src/ui/page/file/index.js index d0d38f418..300d38a5c 100644 --- a/src/ui/page/file/index.js +++ b/src/ui/page/file/index.js @@ -16,6 +16,7 @@ import { makeSelectTitleForUri, makeSelectThumbnailForUri, makeSelectClaimIsNsfw, + doToast, } from 'lbry-redux'; import { doFetchViewCount, makeSelectViewCountForUri, makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc'; import { selectShowNsfw, makeSelectClientSetting } from 'redux/selectors/settings'; @@ -53,6 +54,7 @@ const perform = dispatch => ({ setViewed: uri => dispatch(doSetContentHistoryItem(uri)), markSubscriptionRead: (channel, uri) => dispatch(doRemoveUnreadSubscription(channel, uri)), fetchViewCount: claimId => dispatch(doFetchViewCount(claimId)), + showToast: options => dispatch(doToast(options)), }); export default connect( diff --git a/src/ui/page/file/view.jsx b/src/ui/page/file/view.jsx index f9678cb14..1b0b1e17c 100644 --- a/src/ui/page/file/view.jsx +++ b/src/ui/page/file/view.jsx @@ -2,6 +2,7 @@ import * as MODALS from 'constants/modal_types'; import * as icons from 'constants/icons'; import * as React from 'react'; +import { clipboard } from 'electron'; import { buildURI, normalizeURI } from 'lbry-redux'; import FileViewer from 'component/fileViewer'; import Thumbnail from 'component/common/thumbnail'; @@ -22,7 +23,6 @@ import RecommendedContent from 'component/recommendedContent'; type Props = { claim: StreamClaim, fileInfo: FileListItem, - metadata: StreamMetadata, contentType: string, uri: string, rewardedContentClaimIds: Array, @@ -44,6 +44,7 @@ type Props = { title: string, thumbnail: ?string, nsfw: boolean, + showToast: ({}) => void, }; class FilePage extends React.Component { @@ -125,7 +126,6 @@ class FilePage extends React.Component { render() { const { claim, - metadata, contentType, uri, rewardedContentClaimIds, @@ -141,10 +141,11 @@ class FilePage extends React.Component { title, thumbnail, nsfw, + showToast, } = this.props; // File info - const { height, channel_name: channelName } = claim; + const { channel_name: channelName } = claim; const { PLAYABLE_MEDIA_TYPES, PREVIEW_MEDIA_TYPES } = FilePage; const isRewardContent = (rewardedContentClaimIds || []).includes(claim.claim_id); const shouldObscureThumbnail = obscureNsfw && nsfw; @@ -175,7 +176,17 @@ class FilePage extends React.Component { return (
-

{uri}

+ {isChannel ? ( diff --git a/src/ui/scss/component/_channel.scss b/src/ui/scss/component/_channel.scss index 0f811d055..a67cf3235 100644 --- a/src/ui/scss/component/_channel.scss +++ b/src/ui/scss/component/_channel.scss @@ -82,7 +82,6 @@ $metadata-z-index: 1; .channel__url { font-size: 1.2rem; - user-select: all; margin-top: -0.25rem; color: rgba($lbry-white, 0.75); }