mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-02 10:15:11 +00:00
Merge pull request #2744 from zxawry/minor-fixes
do not show block button on own channels
This commit is contained in:
commit
b7675a02a5
2 changed files with 26 additions and 16 deletions
|
@ -1,9 +1,16 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectChannelIsBlocked, doToggleBlockChannel, doToast, makeSelectShortUrlForUri } from 'lbry-redux';
|
import {
|
||||||
|
selectChannelIsBlocked,
|
||||||
|
doToggleBlockChannel,
|
||||||
|
doToast,
|
||||||
|
makeSelectClaimIsMine,
|
||||||
|
makeSelectShortUrlForUri,
|
||||||
|
} from 'lbry-redux';
|
||||||
import BlockButton from './view';
|
import BlockButton from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
||||||
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||||
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,12 @@ type Props = {
|
||||||
isSubscribed: boolean,
|
isSubscribed: boolean,
|
||||||
toggleBlockChannel: (uri: string) => void,
|
toggleBlockChannel: (uri: string) => void,
|
||||||
channelIsBlocked: boolean,
|
channelIsBlocked: boolean,
|
||||||
|
claimIsMine: boolean,
|
||||||
doToast: ({ message: string, linkText: string, linkTarget: string }) => void,
|
doToast: ({ message: string, linkText: string, linkTarget: string }) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function BlockButton(props: Props) {
|
export default function BlockButton(props: Props) {
|
||||||
const { uri, shortUrl, toggleBlockChannel, channelIsBlocked, doToast } = props;
|
const { uri, shortUrl, toggleBlockChannel, channelIsBlocked, claimIsMine, doToast } = props;
|
||||||
|
|
||||||
const blockRef = useRef();
|
const blockRef = useRef();
|
||||||
const isHovering = useHover(blockRef);
|
const isHovering = useHover(blockRef);
|
||||||
|
@ -23,6 +24,7 @@ export default function BlockButton(props: Props) {
|
||||||
const blockedOverride = channelIsBlocked && isHovering && __('Unblock');
|
const blockedOverride = channelIsBlocked && isHovering && __('Unblock');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
!claimIsMine && (
|
||||||
<Button
|
<Button
|
||||||
ref={blockRef}
|
ref={blockRef}
|
||||||
iconColor="red"
|
iconColor="red"
|
||||||
|
@ -37,5 +39,6 @@ export default function BlockButton(props: Props) {
|
||||||
toggleBlockChannel(uri);
|
toggleBlockChannel(uri);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue