only show bell for users with notifications on
This commit is contained in:
parent
25085fe881
commit
c94d22994f
2 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,7 @@ import {
|
||||||
} from 'redux/selectors/subscriptions';
|
} from 'redux/selectors/subscriptions';
|
||||||
import { makeSelectPermanentUrlForUri } from 'lbry-redux';
|
import { makeSelectPermanentUrlForUri } from 'lbry-redux';
|
||||||
import { doToast } from 'redux/actions/notifications';
|
import { doToast } from 'redux/actions/notifications';
|
||||||
|
import { selectUser } from 'redux/selectors/user';
|
||||||
import SubscribeButton from './view';
|
import SubscribeButton from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -14,6 +15,7 @@ const select = (state, props) => ({
|
||||||
firstRunCompleted: selectFirstRunCompleted(state),
|
firstRunCompleted: selectFirstRunCompleted(state),
|
||||||
permanentUrl: makeSelectPermanentUrlForUri(props.uri)(state),
|
permanentUrl: makeSelectPermanentUrlForUri(props.uri)(state),
|
||||||
notificationsDisabled: makeSelectNotificationsDisabled(props.uri)(state),
|
notificationsDisabled: makeSelectNotificationsDisabled(props.uri)(state),
|
||||||
|
user: selectUser(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, {
|
export default connect(select, {
|
||||||
|
|
|
@ -21,6 +21,7 @@ type Props = {
|
||||||
doToast: ({ message: string }) => void,
|
doToast: ({ message: string }) => void,
|
||||||
shrinkOnMobile: boolean,
|
shrinkOnMobile: boolean,
|
||||||
notificationsDisabled: boolean,
|
notificationsDisabled: boolean,
|
||||||
|
user: ?User,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function SubscribeButton(props: Props) {
|
export default function SubscribeButton(props: Props) {
|
||||||
|
@ -33,12 +34,14 @@ export default function SubscribeButton(props: Props) {
|
||||||
doToast,
|
doToast,
|
||||||
shrinkOnMobile = false,
|
shrinkOnMobile = false,
|
||||||
notificationsDisabled,
|
notificationsDisabled,
|
||||||
|
user,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const buttonRef = useRef();
|
const buttonRef = useRef();
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
let isHovering = useHover(buttonRef);
|
let isHovering = useHover(buttonRef);
|
||||||
isHovering = isMobile ? true : isHovering;
|
isHovering = isMobile ? true : isHovering;
|
||||||
|
const uiNotificationsEnabled = user && user.experimental_ui;
|
||||||
|
|
||||||
const { channelName } = parseURI(permanentUrl);
|
const { channelName } = parseURI(permanentUrl);
|
||||||
const claimName = '@' + channelName;
|
const claimName = '@' + channelName;
|
||||||
|
@ -77,7 +80,7 @@ export default function SubscribeButton(props: Props) {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{isSubscribed && (
|
{isSubscribed && uiNotificationsEnabled && (
|
||||||
<Button
|
<Button
|
||||||
button="alt"
|
button="alt"
|
||||||
icon={notificationsDisabled ? ICONS.BELL : ICONS.BELL_ON}
|
icon={notificationsDisabled ? ICONS.BELL : ICONS.BELL_ON}
|
||||||
|
|
Loading…
Add table
Reference in a new issue