Set 'activeChannel' before entering Dashboard
## Issue 6237: Analytics button from Channels page doesn't open analytics to right channel
This commit is contained in:
parent
16cfe1c815
commit
f4d327f1f4
2 changed files with 12 additions and 4 deletions
|
@ -5,18 +5,20 @@ import {
|
|||
doFetchChannelListMine,
|
||||
selectFetchingMyChannels,
|
||||
} from 'lbry-redux';
|
||||
import { doSetActiveChannel } from 'redux/actions/app';
|
||||
import { selectYoutubeChannels } from 'redux/selectors/user';
|
||||
import ChannelsPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
const select = (state) => ({
|
||||
channelUrls: selectMyChannelUrls(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
youtubeChannels: selectYoutubeChannels(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
const perform = (dispatch) => ({
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
doSetActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ChannelsPage);
|
||||
|
|
|
@ -11,6 +11,7 @@ import Yrbl from 'component/yrbl';
|
|||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import HelpLink from 'component/common/help-link';
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
type Props = {
|
||||
channels: Array<ChannelClaim>,
|
||||
|
@ -18,13 +19,15 @@ type Props = {
|
|||
fetchChannelListMine: () => void,
|
||||
fetchingChannels: boolean,
|
||||
youtubeChannels: ?Array<any>,
|
||||
doSetActiveChannel: (string) => void,
|
||||
};
|
||||
|
||||
export default function ChannelsPage(props: Props) {
|
||||
const { channels, channelUrls, fetchChannelListMine, fetchingChannels, youtubeChannels } = props;
|
||||
const { channels, channelUrls, fetchChannelListMine, fetchingChannels, youtubeChannels, doSetActiveChannel } = props;
|
||||
const [rewardData, setRewardData] = React.useState();
|
||||
const hasYoutubeChannels = youtubeChannels && Boolean(youtubeChannels.length);
|
||||
const hasPendingChannels = channels && channels.some((channel) => channel.confirmations < 0);
|
||||
const { push } = useHistory();
|
||||
|
||||
useEffect(() => {
|
||||
fetchChannelListMine();
|
||||
|
@ -62,7 +65,10 @@ export default function ChannelsPage(props: Props) {
|
|||
button="alt"
|
||||
icon={ICONS.ANALYTICS}
|
||||
label={__('Analytics')}
|
||||
navigate={`/$/${PAGES.CREATOR_DASHBOARD}?channel=${encodeURIComponent(claim.canonical_url)}`}
|
||||
onClick={() => {
|
||||
doSetActiveChannel(claim.claim_id);
|
||||
push(`/$/${PAGES.CREATOR_DASHBOARD}`);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue