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