2021-12-02 17:49:13 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doResolveUris } from 'redux/actions/claims';
|
|
|
|
import { MAX_LIVESTREAM_COMMENTS } from 'constants/livestream';
|
|
|
|
import { selectChannelMentionData } from 'redux/selectors/comments';
|
|
|
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
|
|
|
import { withRouter } from 'react-router';
|
|
|
|
import TextareaWithSuggestions from './view';
|
|
|
|
|
|
|
|
const select = (state, props) => {
|
2021-12-06 18:28:36 +01:00
|
|
|
const { pathname } = props.location;
|
2021-12-02 17:49:13 +01:00
|
|
|
const maxComments = props.isLivestream ? MAX_LIVESTREAM_COMMENTS : -1;
|
2021-12-06 18:28:36 +01:00
|
|
|
const uri = `lbry:/${pathname.replaceAll(':', '#')}`;
|
|
|
|
|
|
|
|
const data = selectChannelMentionData(state, uri, maxComments);
|
|
|
|
const { canonicalCommentors, canonicalCreatorUri, canonicalSubscriptions, commentorUris } = data;
|
2021-12-02 17:49:13 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
canonicalCommentors,
|
2021-12-06 18:28:36 +01:00
|
|
|
canonicalCreatorUri,
|
2021-12-02 17:49:13 +01:00
|
|
|
canonicalSubscriptions,
|
|
|
|
commentorUris,
|
|
|
|
showMature: selectShowMatureContent(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const perform = (dispatch) => ({
|
|
|
|
doResolveUris: (uris) => dispatch(doResolveUris(uris, true)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default withRouter(connect(select, perform)(TextareaWithSuggestions));
|