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