mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-28 16:01:26 +00:00
copy url to clipboard on file page
This commit is contained in:
parent
db67c39ec6
commit
29d8546b4f
5 changed files with 19 additions and 7 deletions
|
@ -16,7 +16,7 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function Paginate(props: Props) {
|
function Paginate(props: Props) {
|
||||||
const { totalPages, loading, location, history, onPageChange } = props;
|
const { totalPages = 1, loading, location, history, onPageChange } = props;
|
||||||
const { search } = location;
|
const { search } = location;
|
||||||
const urlParams = new URLSearchParams(search);
|
const urlParams = new URLSearchParams(search);
|
||||||
const currentPage = Number(urlParams.get(PAGINATE_PARAM)) || 1;
|
const currentPage = Number(urlParams.get(PAGINATE_PARAM)) || 1;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {
|
||||||
makeSelectTitleForUri,
|
makeSelectTitleForUri,
|
||||||
makeSelectThumbnailForUri,
|
makeSelectThumbnailForUri,
|
||||||
makeSelectClaimIsNsfw,
|
makeSelectClaimIsNsfw,
|
||||||
|
doToast,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { doFetchViewCount, makeSelectViewCountForUri, makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc';
|
import { doFetchViewCount, makeSelectViewCountForUri, makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc';
|
||||||
import { selectShowNsfw, makeSelectClientSetting } from 'redux/selectors/settings';
|
import { selectShowNsfw, makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
|
@ -53,6 +54,7 @@ const perform = dispatch => ({
|
||||||
setViewed: uri => dispatch(doSetContentHistoryItem(uri)),
|
setViewed: uri => dispatch(doSetContentHistoryItem(uri)),
|
||||||
markSubscriptionRead: (channel, uri) => dispatch(doRemoveUnreadSubscription(channel, uri)),
|
markSubscriptionRead: (channel, uri) => dispatch(doRemoveUnreadSubscription(channel, uri)),
|
||||||
fetchViewCount: claimId => dispatch(doFetchViewCount(claimId)),
|
fetchViewCount: claimId => dispatch(doFetchViewCount(claimId)),
|
||||||
|
showToast: options => dispatch(doToast(options)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import * as MODALS from 'constants/modal_types';
|
import * as MODALS from 'constants/modal_types';
|
||||||
import * as icons from 'constants/icons';
|
import * as icons from 'constants/icons';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { clipboard } from 'electron';
|
||||||
import { buildURI, normalizeURI } from 'lbry-redux';
|
import { buildURI, normalizeURI } from 'lbry-redux';
|
||||||
import FileViewer from 'component/fileViewer';
|
import FileViewer from 'component/fileViewer';
|
||||||
import Thumbnail from 'component/common/thumbnail';
|
import Thumbnail from 'component/common/thumbnail';
|
||||||
|
@ -22,7 +23,6 @@ import RecommendedContent from 'component/recommendedContent';
|
||||||
type Props = {
|
type Props = {
|
||||||
claim: StreamClaim,
|
claim: StreamClaim,
|
||||||
fileInfo: FileListItem,
|
fileInfo: FileListItem,
|
||||||
metadata: StreamMetadata,
|
|
||||||
contentType: string,
|
contentType: string,
|
||||||
uri: string,
|
uri: string,
|
||||||
rewardedContentClaimIds: Array<string>,
|
rewardedContentClaimIds: Array<string>,
|
||||||
|
@ -44,6 +44,7 @@ type Props = {
|
||||||
title: string,
|
title: string,
|
||||||
thumbnail: ?string,
|
thumbnail: ?string,
|
||||||
nsfw: boolean,
|
nsfw: boolean,
|
||||||
|
showToast: ({}) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
class FilePage extends React.Component<Props> {
|
class FilePage extends React.Component<Props> {
|
||||||
|
@ -125,7 +126,6 @@ class FilePage extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
claim,
|
claim,
|
||||||
metadata,
|
|
||||||
contentType,
|
contentType,
|
||||||
uri,
|
uri,
|
||||||
rewardedContentClaimIds,
|
rewardedContentClaimIds,
|
||||||
|
@ -141,10 +141,11 @@ class FilePage extends React.Component<Props> {
|
||||||
title,
|
title,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
nsfw,
|
nsfw,
|
||||||
|
showToast,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// File info
|
// File info
|
||||||
const { height, channel_name: channelName } = claim;
|
const { channel_name: channelName } = claim;
|
||||||
const { PLAYABLE_MEDIA_TYPES, PREVIEW_MEDIA_TYPES } = FilePage;
|
const { PLAYABLE_MEDIA_TYPES, PREVIEW_MEDIA_TYPES } = FilePage;
|
||||||
const isRewardContent = (rewardedContentClaimIds || []).includes(claim.claim_id);
|
const isRewardContent = (rewardedContentClaimIds || []).includes(claim.claim_id);
|
||||||
const shouldObscureThumbnail = obscureNsfw && nsfw;
|
const shouldObscureThumbnail = obscureNsfw && nsfw;
|
||||||
|
@ -175,7 +176,17 @@ class FilePage extends React.Component<Props> {
|
||||||
return (
|
return (
|
||||||
<Page notContained className="main--file-page">
|
<Page notContained className="main--file-page">
|
||||||
<div className="grid-area--content">
|
<div className="grid-area--content">
|
||||||
<h1 className="media__uri">{uri}</h1>
|
<Button
|
||||||
|
className="media__uri"
|
||||||
|
button="alt"
|
||||||
|
label={uri}
|
||||||
|
onClick={() => {
|
||||||
|
clipboard.writeText(uri);
|
||||||
|
showToast({
|
||||||
|
message: __('Text copied'),
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
{!fileInfo && insufficientCredits && (
|
{!fileInfo && insufficientCredits && (
|
||||||
<div className="media__insufficient-credits help--warning">
|
<div className="media__insufficient-credits help--warning">
|
||||||
{__(
|
{__(
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default function SearchPage(props: Props) {
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{isValid && (
|
{isValid && (
|
||||||
<header className="search__header">
|
<header className="search__header">
|
||||||
<Button navigate={uri} className="media__uri">
|
<Button button="alt" navigate={uri} className="media__uri">
|
||||||
{uri}
|
{uri}
|
||||||
</Button>
|
</Button>
|
||||||
{isChannel ? (
|
{isChannel ? (
|
||||||
|
|
|
@ -82,7 +82,6 @@ $metadata-z-index: 1;
|
||||||
|
|
||||||
.channel__url {
|
.channel__url {
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
user-select: all;
|
|
||||||
margin-top: -0.25rem;
|
margin-top: -0.25rem;
|
||||||
color: rgba($lbry-white, 0.75);
|
color: rgba($lbry-white, 0.75);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue