canonical_url fixes
This commit is contained in:
parent
4f7ec53eb2
commit
c7bebdce54
10 changed files with 43 additions and 44 deletions
|
@ -130,7 +130,7 @@
|
||||||
"jsmediatags": "^3.8.1",
|
"jsmediatags": "^3.8.1",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||||
"lbry-redux": "lbryio/lbry-redux#3861c692664f4c3e5ec1751fa0b655abe49036ea",
|
"lbry-redux": "lbryio/lbry-redux#a6bad61a9b03df9b48a380da544b61ec708a1281",
|
||||||
"lbryinc": "lbryio/lbryinc#1ce266b3c52654190b955e9c869b8e302aa5c585",
|
"lbryinc": "lbryio/lbryinc#1ce266b3c52654190b955e9c869b8e302aa5c585",
|
||||||
"lint-staged": "^7.0.2",
|
"lint-staged": "^7.0.2",
|
||||||
"localforage": "^1.7.1",
|
"localforage": "^1.7.1",
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
"yarn": "^1.3"
|
"yarn": "^1.3"
|
||||||
},
|
},
|
||||||
"lbrySettings": {
|
"lbrySettings": {
|
||||||
"lbrynetDaemonVersion": "0.39.0",
|
"lbrynetDaemonVersion": "0.40.0",
|
||||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||||
"lbrynetDaemonDir": "static/daemon",
|
"lbrynetDaemonDir": "static/daemon",
|
||||||
"lbrynetDaemonFileName": "lbrynet"
|
"lbrynetDaemonFileName": "lbrynet"
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
doToast,
|
doToast,
|
||||||
makeSelectClaimIsMine,
|
makeSelectClaimIsMine,
|
||||||
makeSelectShortUrlForUri,
|
makeSelectShortUrlForUri,
|
||||||
|
makeSelectPermanentUrlForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import BlockButton from './view';
|
import BlockButton from './view';
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ const select = (state, props) => ({
|
||||||
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
||||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||||
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
||||||
|
permanentUrl: makeSelectPermanentUrlForUri(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -6,7 +6,7 @@ import Button from 'component/button';
|
||||||
import useHover from 'util/use-hover';
|
import useHover from 'util/use-hover';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
permanentUrl: ?string,
|
||||||
shortUrl: string,
|
shortUrl: string,
|
||||||
isSubscribed: boolean,
|
isSubscribed: boolean,
|
||||||
toggleBlockChannel: (uri: string) => void,
|
toggleBlockChannel: (uri: string) => void,
|
||||||
|
@ -16,29 +16,28 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function BlockButton(props: Props) {
|
export default function BlockButton(props: Props) {
|
||||||
const { uri, shortUrl, toggleBlockChannel, channelIsBlocked, claimIsMine, doToast } = props;
|
const { permanentUrl, shortUrl, toggleBlockChannel, channelIsBlocked, claimIsMine, doToast } = props;
|
||||||
|
|
||||||
const blockRef = useRef();
|
const blockRef = useRef();
|
||||||
const isHovering = useHover(blockRef);
|
const isHovering = useHover(blockRef);
|
||||||
const blockLabel = channelIsBlocked ? __('Blocked') : __('Block');
|
const blockLabel = channelIsBlocked ? __('Blocked') : __('Block');
|
||||||
const blockedOverride = channelIsBlocked && isHovering && __('Unblock');
|
const blockedOverride = channelIsBlocked && isHovering && __('Unblock');
|
||||||
|
|
||||||
return (
|
return permanentUrl && !claimIsMine ? (
|
||||||
!claimIsMine && (
|
<Button
|
||||||
<Button
|
ref={blockRef}
|
||||||
ref={blockRef}
|
iconColor="red"
|
||||||
iconColor="red"
|
icon={ICONS.BLOCK}
|
||||||
icon={ICONS.BLOCK}
|
button={'alt'}
|
||||||
button={'alt'}
|
label={blockedOverride || blockLabel}
|
||||||
label={blockedOverride || blockLabel}
|
onClick={e => {
|
||||||
onClick={e => {
|
e.stopPropagation();
|
||||||
e.stopPropagation();
|
if (!channelIsBlocked) {
|
||||||
if (!channelIsBlocked) {
|
doToast({ message: `Blocked ${shortUrl}`, linkText: 'Manage', linkTarget: `/${PAGES.BLOCKED}` });
|
||||||
doToast({ message: `Blocked ${shortUrl}`, linkText: 'Manage', linkTarget: `/${PAGES.BLOCKED}` });
|
}
|
||||||
}
|
|
||||||
toggleBlockChannel(uri);
|
toggleBlockChannel(permanentUrl);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
) : null;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,11 +209,12 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)}
|
)}
|
||||||
<div>
|
<div>
|
||||||
{isChannel ? (
|
{claim &&
|
||||||
type !== 'inline' && `${claimsInChannel} ${__('publishes')}`
|
(isChannel ? (
|
||||||
) : (
|
type !== 'inline' && `${claimsInChannel} ${__('publishes')}`
|
||||||
<DateTime timeAgo uri={uri} />
|
) : (
|
||||||
)}
|
<DateTime timeAgo uri={uri} />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default function ShareButton(props: Props) {
|
||||||
<Button
|
<Button
|
||||||
button="alt"
|
button="alt"
|
||||||
icon={ICONS.SHARE}
|
icon={ICONS.SHARE}
|
||||||
label={__('Share Channel')}
|
label={__('Share')}
|
||||||
onClick={() => doOpenModal(MODALS.SOCIAL_SHARE, { uri, speechShareable: true, isChannel: true })}
|
onClick={() => doOpenModal(MODALS.SOCIAL_SHARE, { uri, speechShareable: true, isChannel: true })}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,13 +2,14 @@ import { connect } from 'react-redux';
|
||||||
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
||||||
import { doOpenModal } from 'redux/actions/app';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { selectSubscriptions, makeSelectIsSubscribed, selectFirstRunCompleted } from 'redux/selectors/subscriptions';
|
import { selectSubscriptions, makeSelectIsSubscribed, selectFirstRunCompleted } from 'redux/selectors/subscriptions';
|
||||||
import { doToast } from 'lbry-redux';
|
import { doToast, makeSelectPermanentUrlForUri } from 'lbry-redux';
|
||||||
import SubscribeButton from './view';
|
import SubscribeButton from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
subscriptions: selectSubscriptions(state),
|
subscriptions: selectSubscriptions(state),
|
||||||
isSubscribed: makeSelectIsSubscribed(props.uri, true)(state),
|
isSubscribed: makeSelectIsSubscribed(props.uri, true)(state),
|
||||||
firstRunCompleted: selectFirstRunCompleted(state),
|
firstRunCompleted: selectFirstRunCompleted(state),
|
||||||
|
permanentUrl: makeSelectPermanentUrlForUri(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -12,7 +12,7 @@ type SubscriptionArgs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
permanentUrl: ?string,
|
||||||
isSubscribed: boolean,
|
isSubscribed: boolean,
|
||||||
subscriptions: Array<string>,
|
subscriptions: Array<string>,
|
||||||
doChannelSubscribe: ({ channelName: string, uri: string }) => void,
|
doChannelSubscribe: ({ channelName: string, uri: string }) => void,
|
||||||
|
@ -24,7 +24,7 @@ type Props = {
|
||||||
|
|
||||||
export default function SubscribeButton(props: Props) {
|
export default function SubscribeButton(props: Props) {
|
||||||
const {
|
const {
|
||||||
uri,
|
permanentUrl,
|
||||||
doChannelSubscribe,
|
doChannelSubscribe,
|
||||||
doChannelUnsubscribe,
|
doChannelUnsubscribe,
|
||||||
doOpenModal,
|
doOpenModal,
|
||||||
|
@ -35,13 +35,13 @@ export default function SubscribeButton(props: Props) {
|
||||||
} = props;
|
} = props;
|
||||||
const buttonRef = useRef();
|
const buttonRef = useRef();
|
||||||
const isHovering = useHover(buttonRef);
|
const isHovering = useHover(buttonRef);
|
||||||
const { channelName } = parseURI(uri);
|
const { channelName } = parseURI(permanentUrl);
|
||||||
const claimName = '@' + channelName;
|
const claimName = '@' + channelName;
|
||||||
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
||||||
const subscriptionLabel = isSubscribed ? __('Following') : __('Follow');
|
const subscriptionLabel = isSubscribed ? __('Following') : __('Follow');
|
||||||
const unfollowOverride = isSubscribed && isHovering && __('Unfollow');
|
const unfollowOverride = isSubscribed && isHovering && __('Unfollow');
|
||||||
|
|
||||||
return (
|
return permanentUrl ? (
|
||||||
<Button
|
<Button
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
iconColor="red"
|
iconColor="red"
|
||||||
|
@ -57,7 +57,7 @@ export default function SubscribeButton(props: Props) {
|
||||||
|
|
||||||
subscriptionHandler({
|
subscriptionHandler({
|
||||||
channelName: claimName,
|
channelName: claimName,
|
||||||
uri,
|
uri: permanentUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (showSnackBarOnSubscribe) {
|
if (showSnackBarOnSubscribe) {
|
||||||
|
@ -65,5 +65,5 @@ export default function SubscribeButton(props: Props) {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
) : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import { buildURI } from 'lbry-redux';
|
|
||||||
import Tooltip from 'component/common/tooltip';
|
import Tooltip from 'component/common/tooltip';
|
||||||
import ClaimPreview from 'component/claimPreview';
|
import ClaimPreview from 'component/claimPreview';
|
||||||
|
|
||||||
|
@ -54,11 +53,8 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
const channelClaim = isChannelClaim ? claim : claim.signing_channel;
|
const channelClaim = isChannelClaim ? claim : claim.signing_channel;
|
||||||
|
|
||||||
if (channelClaim) {
|
if (channelClaim) {
|
||||||
const { name, claim_id: claimId } = channelClaim;
|
const { name } = channelClaim;
|
||||||
let channelLink;
|
const channelLink = link ? channelClaim.canonical_url : false;
|
||||||
if (claimId && name) {
|
|
||||||
channelLink = link ? buildURI({ channelName: name, channelClaimId: claimId }) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const inner = <span className="channel-name">{name}</span>;
|
const inner = <span className="channel-name">{name}</span>;
|
||||||
|
|
||||||
|
|
|
@ -684,4 +684,4 @@
|
||||||
"The viewer doesn't support this file type. See more info below.": "The viewer doesn't support this file type. See more info below.",
|
"The viewer doesn't support this file type. See more info below.": "The viewer doesn't support this file type. See more info below.",
|
||||||
"Catching up...": "Catching up...",
|
"Catching up...": "Catching up...",
|
||||||
"%s blocks behind": "%s blocks behind"
|
"%s blocks behind": "%s blocks behind"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7179,9 +7179,9 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
|
||||||
yargs "^13.2.2"
|
yargs "^13.2.2"
|
||||||
zstd-codec "^0.1.1"
|
zstd-codec "^0.1.1"
|
||||||
|
|
||||||
lbry-redux@lbryio/lbry-redux#3861c692664f4c3e5ec1751fa0b655abe49036ea:
|
lbry-redux@lbryio/lbry-redux#a6bad61a9b03df9b48a380da544b61ec708a1281:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/3861c692664f4c3e5ec1751fa0b655abe49036ea"
|
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/a6bad61a9b03df9b48a380da544b61ec708a1281"
|
||||||
dependencies:
|
dependencies:
|
||||||
proxy-polyfill "0.1.6"
|
proxy-polyfill "0.1.6"
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue