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) {
|
||||
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;
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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<string>,
|
||||
|
@ -44,6 +44,7 @@ type Props = {
|
|||
title: string,
|
||||
thumbnail: ?string,
|
||||
nsfw: boolean,
|
||||
showToast: ({}) => void,
|
||||
};
|
||||
|
||||
class FilePage extends React.Component<Props> {
|
||||
|
@ -125,7 +126,6 @@ class FilePage extends React.Component<Props> {
|
|||
render() {
|
||||
const {
|
||||
claim,
|
||||
metadata,
|
||||
contentType,
|
||||
uri,
|
||||
rewardedContentClaimIds,
|
||||
|
@ -141,10 +141,11 @@ class FilePage extends React.Component<Props> {
|
|||
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<Props> {
|
|||
return (
|
||||
<Page notContained className="main--file-page">
|
||||
<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 && (
|
||||
<div className="media__insufficient-credits help--warning">
|
||||
{__(
|
||||
|
|
|
@ -39,7 +39,7 @@ export default function SearchPage(props: Props) {
|
|||
<Fragment>
|
||||
{isValid && (
|
||||
<header className="search__header">
|
||||
<Button navigate={uri} className="media__uri">
|
||||
<Button button="alt" navigate={uri} className="media__uri">
|
||||
{uri}
|
||||
</Button>
|
||||
{isChannel ? (
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue