Open in desktop #6818

Closed
btzr-io wants to merge 4 commits from desktop-redirect into master
Showing only changes of commit 47f7d0c7e3 - Show all commits

View file

@ -7,10 +7,10 @@ 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 { useIsMobile } from 'effects/use-screensize';
import { generateShareUrl, generateRssUrl, generateLbryContentUrl } from 'util/url'; import { generateShareUrl, generateRssUrl, generateLbryContentUrl } from 'util/url';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import { buildURI, parseURI, COLLECTIONS_CONSTS } from 'lbry-redux'; import { buildURI, parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL; const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
const PAGE_VIEW_QUERY = `view`; const PAGE_VIEW_QUERY = `view`;
const EDIT_PAGE = 'edit'; const EDIT_PAGE = 'edit';
@ -94,6 +94,8 @@ function ClaimMenuList(props: Props) {
editedCollection, editedCollection,
isAuthenticated, isAuthenticated,
} = props; } = props;
const isMobile = useIsMobile();
const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@'); const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
const isChannel = !incognitoClaim && !contentSigningChannel; const isChannel = !incognitoClaim && !contentSigningChannel;
const { channelName } = parseURI(contentChannelUri); const { channelName } = parseURI(contentChannelUri);
@ -229,7 +231,7 @@ function ClaimMenuList(props: Props) {
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`); push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`);
} }
function openInDesktop() { function handleOpenInDesktop() {
// $FlowFixMe // $FlowFixMe
window.open(`/$/${PAGES.OPEN_IN_DESKTOP}/${contentClaim.name}/${contentClaim.claim_id}`, '_blank'); window.open(`/$/${PAGES.OPEN_IN_DESKTOP}/${contentClaim.name}/${contentClaim.claim_id}`, '_blank');
} }
@ -416,11 +418,11 @@ function ClaimMenuList(props: Props) {
</MenuItem> </MenuItem>
)} )}
{IS_WEB && ( {IS_WEB && !isMobile && (
<MenuItem className="comment__menu-option" onSelect={openInDesktop}> <MenuItem className="comment__menu-option" onSelect={handleOpenInDesktop}>
<div className="menu__link"> <div className="menu__link">
<Icon aria-hidden icon={ICONS.DESKTOP} /> <Icon aria-hidden icon={ICONS.DESKTOP} />
{__('Open in desktop')} {__('Open in Desktop')}
</div> </div>
</MenuItem> </MenuItem>
)} )}