2021-11-03 16:52:18 -05:00
|
|
|
import { connect } from 'react-redux';
|
2022-04-20 15:48:45 -04:00
|
|
|
import { selectClaimIsMineForUri, selectClaimForUri } from 'redux/selectors/claims';
|
2021-11-03 16:52:18 -05:00
|
|
|
import { doToast } from 'redux/actions/notifications';
|
|
|
|
import ClaimPreviewReset from './view';
|
2022-04-20 15:48:45 -04:00
|
|
|
import { selectActiveLivestreamForChannel } from 'redux/selectors/livestream';
|
|
|
|
import { getChannelIdFromClaim, getChannelNameFromClaim } from 'util/claim';
|
2021-11-03 16:52:18 -05:00
|
|
|
|
2021-11-05 14:14:00 -05:00
|
|
|
const select = (state, props) => {
|
2022-04-20 15:48:45 -04:00
|
|
|
const { uri } = props;
|
|
|
|
const claim = selectClaimForUri(state, uri);
|
|
|
|
const channelId = getChannelIdFromClaim(claim);
|
|
|
|
const channelName = getChannelNameFromClaim(claim);
|
2021-11-03 16:52:18 -05:00
|
|
|
return {
|
2022-04-20 15:48:45 -04:00
|
|
|
activeLivestreamForChannel: selectActiveLivestreamForChannel(state, channelId),
|
2021-11-03 16:52:18 -05:00
|
|
|
channelId,
|
2022-04-20 15:48:45 -04:00
|
|
|
channelName,
|
2021-11-10 10:30:03 +08:00
|
|
|
claimIsMine: props.uri && selectClaimIsMineForUri(state, props.uri),
|
2021-11-03 16:52:18 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const perform = (dispatch) => ({
|
|
|
|
doToast: (props) => dispatch(doToast(props)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(ClaimPreviewReset);
|