2019-06-28 19:00:29 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
|
|
|
makeSelectTitleForUri,
|
|
|
|
makeSelectThumbnailForUri,
|
|
|
|
makeSelectCoverForUri,
|
|
|
|
makeSelectMetadataItemForUri,
|
|
|
|
makeSelectAmountForUri,
|
2019-08-15 13:36:03 +02:00
|
|
|
makeSelectClaimForUri,
|
2020-06-21 18:51:06 +02:00
|
|
|
selectUpdateChannelError,
|
2020-06-22 17:19:55 +02:00
|
|
|
selectUpdatingChannel,
|
2020-06-29 21:54:07 +02:00
|
|
|
selectCreateChannelError,
|
|
|
|
selectCreatingChannel,
|
2021-10-08 05:47:39 +02:00
|
|
|
} from 'redux/selectors/claims';
|
|
|
|
import { selectBalance } from 'redux/selectors/wallet';
|
|
|
|
import { doUpdateChannel, doCreateChannel, doClearChannelErrors } from 'redux/actions/claims';
|
2020-06-29 21:54:07 +02:00
|
|
|
import { doOpenModal } from 'redux/actions/app';
|
2021-03-03 19:50:16 +01:00
|
|
|
import { doUpdateBlockListForPublishedChannel } from 'redux/actions/comments';
|
2021-12-09 02:11:06 +01:00
|
|
|
import { doClaimInitialRewards } from 'redux/actions/rewards';
|
2021-08-18 18:34:24 +02:00
|
|
|
import { selectIsClaimingInitialRewards, selectHasClaimedInitialRewards } from 'redux/selectors/rewards';
|
2021-07-06 03:29:46 +02:00
|
|
|
import ChannelForm from './view';
|
2019-06-28 19:00:29 +02:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
2020-06-29 21:54:07 +02:00
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
2019-06-28 19:00:29 +02:00
|
|
|
title: makeSelectTitleForUri(props.uri)(state),
|
2020-07-02 19:39:29 +02:00
|
|
|
thumbnailUrl: makeSelectThumbnailForUri(props.uri)(state),
|
|
|
|
coverUrl: makeSelectCoverForUri(props.uri)(state),
|
2019-06-28 19:00:29 +02:00
|
|
|
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
|
|
|
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
|
|
|
|
email: makeSelectMetadataItemForUri(props.uri, 'email')(state),
|
|
|
|
tags: makeSelectMetadataItemForUri(props.uri, 'tags')(state),
|
|
|
|
locations: makeSelectMetadataItemForUri(props.uri, 'locations')(state),
|
|
|
|
languages: makeSelectMetadataItemForUri(props.uri, 'languages')(state),
|
|
|
|
amount: makeSelectAmountForUri(props.uri)(state),
|
2020-06-21 18:51:06 +02:00
|
|
|
updateError: selectUpdateChannelError(state),
|
2020-06-22 17:19:55 +02:00
|
|
|
updatingChannel: selectUpdatingChannel(state),
|
2020-06-29 21:54:07 +02:00
|
|
|
createError: selectCreateChannelError(state),
|
|
|
|
creatingChannel: selectCreatingChannel(state),
|
|
|
|
balance: selectBalance(state),
|
2021-08-18 18:34:24 +02:00
|
|
|
isClaimingInitialRewards: selectIsClaimingInitialRewards(state),
|
|
|
|
hasClaimedInitialRewards: selectHasClaimedInitialRewards(state),
|
2019-06-28 19:00:29 +02:00
|
|
|
});
|
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
const perform = (dispatch) => ({
|
2020-06-29 21:54:07 +02:00
|
|
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
2021-03-03 19:50:16 +01:00
|
|
|
updateChannel: (params) => dispatch(doUpdateChannel(params)),
|
|
|
|
createChannel: (params) => {
|
2020-06-29 21:54:07 +02:00
|
|
|
const { name, amount, ...optionalParams } = params;
|
2021-03-03 19:50:16 +01:00
|
|
|
return dispatch(
|
|
|
|
doCreateChannel('@' + name, amount, optionalParams, (channelClaim) => {
|
|
|
|
dispatch(doUpdateBlockListForPublishedChannel(channelClaim));
|
|
|
|
})
|
|
|
|
);
|
2020-06-29 21:54:07 +02:00
|
|
|
},
|
2020-07-03 00:14:40 +02:00
|
|
|
clearChannelErrors: () => dispatch(doClearChannelErrors()),
|
2021-08-18 18:34:24 +02:00
|
|
|
claimInitialRewards: () => dispatch(doClaimInitialRewards()),
|
2019-06-28 19:00:29 +02:00
|
|
|
});
|
|
|
|
|
2021-07-06 03:29:46 +02:00
|
|
|
export default connect(select, perform)(ChannelForm);
|