Open in desktop #6667
1 changed files with 20 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { SITE_NAME, ENABLE_FILE_REACTIONS } from 'config';
|
import { URL, SHARE_DOMAIN_URL, SITE_NAME, ENABLE_FILE_REACTIONS } from 'config';
|
||||||
import * as PAGES from 'constants/pages';
|
import * as PAGES from 'constants/pages';
|
||||||
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';
|
||||||
|
@ -16,6 +16,9 @@ import FileReactions from 'component/fileReactions';
|
||||||
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 { webDownloadClaim } from 'util/downloadClaim';
|
import { webDownloadClaim } from 'util/downloadClaim';
|
||||||
|
import { generateShareUrl, generateLbryContentUrl } from 'util/url';
|
||||||
|
|
||||||
|
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
@ -67,6 +70,8 @@ function FileActions(props: Props) {
|
||||||
const { signing_channel: signingChannel } = claim;
|
const { signing_channel: signingChannel } = claim;
|
||||||
const channelName = signingChannel && signingChannel.name;
|
const channelName = signingChannel && signingChannel.name;
|
||||||
const fileName = claim && claim.value && claim.value.source && claim.value.source.name;
|
const fileName = claim && claim.value && claim.value.source && claim.value.source.name;
|
||||||
|
const lbryUrl = generateLbryContentUrl(claim.canonical_url, claim.permanent_url);
|
||||||
|
const shareUrl = generateShareUrl(SHARE_DOMAIN, lbryUrl);
|
||||||
|
|
||||||
// We want to use the short form uri for editing
|
// We want to use the short form uri for editing
|
||||||
// This is what the user is used to seeing, they don't care about the claim id
|
// This is what the user is used to seeing, they don't care about the claim id
|
||||||
|
@ -113,6 +118,14 @@ function FileActions(props: Props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleOpenInWeb() {
|
||||||
|
window.open(shareUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleOpenInDesktop() {
|
||||||
|
window.open(claim.permanent_url);
|
||||||
|
}
|
||||||
|
|
||||||
const lhsSection = (
|
const lhsSection = (
|
||||||
<>
|
<>
|
||||||
{ENABLE_FILE_REACTIONS && !reactionsDisabled && <FileReactions uri={uri} livestream={isLivestreamClaim} />}
|
{ENABLE_FILE_REACTIONS && !reactionsDisabled && <FileReactions uri={uri} livestream={isLivestreamClaim} />}
|
||||||
|
@ -188,6 +201,12 @@ function FileActions(props: Props) {
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
{/* @endif */}
|
{/* @endif */}
|
||||||
|
<MenuItem className="comment__menu-option" onSelect={IS_WEB ? handleOpenInDesktop : handleOpenInWeb}>
|
||||||
|
<div className="menu__link">
|
||||||
|
<Icon aria-hidden icon={IS_WEB ? ICONS.DESKTOP : ICONS.WEB} />
|
||||||
|
{IS_WEB ? __('Open in Desktop') : __('Open in Web')}
|
||||||
|
</div>
|
||||||
|
</MenuItem>
|
||||||
{!claimIsMine && (
|
{!claimIsMine && (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
className="comment__menu-option"
|
className="comment__menu-option"
|
||||||
|
|
Loading…
Add table
Reference in a new issue