Open in desktop #6667

Closed
btzr-io wants to merge 13 commits from protocol into master
3 changed files with 17 additions and 27 deletions
Showing only changes of commit 1d6159fe55 - Show all commits

View file

@ -2056,6 +2056,5 @@
"Show reply": "Show reply", "Show reply": "Show reply",
"Show %count% replies": "Show %count% replies", "Show %count% replies": "Show %count% replies",
"Open in Desktop": "Open in Desktop", "Open in Desktop": "Open in Desktop",
"Open in Web": "Open in Web",
"--end--": "--end--" "--end--": "--end--"
} }

View file

@ -226,10 +226,6 @@ function ClaimMenuList(props: Props) {
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`); push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`);
} }
function handleOpenInWeb() {
window.open(shareUrl);
}
function handleOpenInDesktop() { function handleOpenInDesktop() {
window.open(claim.permanent_url); window.open(claim.permanent_url);
} }
@ -408,12 +404,14 @@ function ClaimMenuList(props: Props) {
</MenuItem> </MenuItem>
)} )}
<MenuItem className="comment__menu-option" onSelect={IS_WEB ? handleOpenInDesktop : handleOpenInWeb}> {IS_WEB && (
<div className="menu__link"> <MenuItem className="comment__menu-option" onSelect={handleOpenInDesktop}>
<Icon aria-hidden icon={IS_WEB ? ICONS.DESKTOP : ICONS.WEB} /> <div className="menu__link">
{IS_WEB ? __('Open in Desktop') : __('Open in Web')} <Icon aria-hidden icon={ICONS.DESKTOP} />
</div> {__('Open in Desktop')}
</MenuItem> </div>
</MenuItem>
)}
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}> <MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
<div className="menu__link"> <div className="menu__link">

View file

@ -1,5 +1,5 @@
// @flow // @flow
import { URL, SHARE_DOMAIN_URL, SITE_NAME, ENABLE_FILE_REACTIONS } from 'config'; import { 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,9 +16,6 @@ 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,
@ -70,8 +67,6 @@ 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
@ -118,10 +113,6 @@ function FileActions(props: Props) {
} }
} }
function handleOpenInWeb() {
window.open(shareUrl);
}
function handleOpenInDesktop() { function handleOpenInDesktop() {
window.open(claim.permanent_url); window.open(claim.permanent_url);
} }
@ -201,12 +192,14 @@ function FileActions(props: Props) {
</MenuItem> </MenuItem>
)} )}
{/* @endif */} {/* @endif */}
<MenuItem className="comment__menu-option" onSelect={IS_WEB ? handleOpenInDesktop : handleOpenInWeb}> {IS_WEB && (
<div className="menu__link"> <MenuItem className="comment__menu-option" onSelect={handleOpenInDesktop}>
<Icon aria-hidden icon={IS_WEB ? ICONS.DESKTOP : ICONS.WEB} /> <div className="menu__link">
{IS_WEB ? __('Open in Desktop') : __('Open in Web')} <Icon aria-hidden icon={ICONS.DESKTOP} />
</div> {__('Open in Desktop')}
</MenuItem> </div>
</MenuItem>
)}
{!claimIsMine && ( {!claimIsMine && (
<MenuItem <MenuItem
className="comment__menu-option" className="comment__menu-option"