fix share link to use SHARE_DOMAIN_URL

This commit is contained in:
Sean Yesmunt 2021-03-12 08:48:42 -05:00
parent bd42418ff3
commit dbbe499a86

View file

@ -1,12 +1,16 @@
// @flow // @flow
import { URL, SHARE_DOMAIN_URL } from 'config';
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import React from 'react'; import React from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button'; import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import { convertToShareLink } from 'lbry-redux'; import { generateShareUrl } from 'util/url';
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
type Props = { type Props = {
uri: string,
claim: ?Claim, claim: ?Claim,
inline?: boolean, inline?: boolean,
claimIsMine: boolean, claimIsMine: boolean,
@ -19,6 +23,7 @@ type Props = {
function ClaimMenuList(props: Props) { function ClaimMenuList(props: Props) {
const { const {
uri,
claim, claim,
inline = false, inline = false,
claimIsMine, claimIsMine,
@ -34,6 +39,8 @@ function ClaimMenuList(props: Props) {
? claim.permanent_url ? claim.permanent_url
: claim.signing_channel && claim.signing_channel.permanent_url); : claim.signing_channel && claim.signing_channel.permanent_url);
const shareUrl: string = generateShareUrl(SHARE_DOMAIN, uri);
if (!channelUri || !claim) { if (!channelUri || !claim) {
return null; return null;
} }
@ -51,8 +58,7 @@ function ClaimMenuList(props: Props) {
} }
function handleCopyLink() { function handleCopyLink() {
const shareLink = convertToShareLink(claim.canonical_url || claim.permanent_url); navigator.clipboard.writeText(shareUrl);
navigator.clipboard.writeText(shareLink);
} }
function handleReportContent() { function handleReportContent() {