2021-12-02 17:49:13 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doResolveUris } from 'redux/actions/claims';
|
2021-12-07 19:17:29 +01:00
|
|
|
import { doSetMentionSearchResults } from 'redux/actions/search';
|
|
|
|
import { makeSelectWinningUriForQuery } from 'redux/selectors/search';
|
2021-12-02 17:49:13 +01:00
|
|
|
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) => {
|
2022-01-26 12:50:43 +01:00
|
|
|
const { uri } = props;
|
2021-12-06 18:28:36 +01:00
|
|
|
|
2021-12-07 19:17:29 +01:00
|
|
|
const maxComments = props.isLivestream ? MAX_LIVESTREAM_COMMENTS : -1;
|
2021-12-06 18:28:36 +01:00
|
|
|
const data = selectChannelMentionData(state, uri, maxComments);
|
2021-12-07 15:51:55 +01:00
|
|
|
const {
|
|
|
|
canonicalCommentors,
|
|
|
|
canonicalCreatorUri,
|
|
|
|
canonicalSearch,
|
|
|
|
canonicalSubscriptions,
|
|
|
|
commentorUris,
|
|
|
|
hasNewResolvedResults,
|
2021-12-07 19:17:29 +01:00
|
|
|
query,
|
2021-12-07 15:51:55 +01:00
|
|
|
} = data;
|
2021-12-02 17:49:13 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
canonicalCommentors,
|
2021-12-06 18:28:36 +01:00
|
|
|
canonicalCreatorUri,
|
2021-12-06 20:39:39 +01:00
|
|
|
canonicalSearch,
|
2021-12-02 17:49:13 +01:00
|
|
|
canonicalSubscriptions,
|
2021-12-07 19:17:29 +01:00
|
|
|
canonicalTop: makeSelectWinningUriForQuery(query)(state),
|
2021-12-02 17:49:13 +01:00
|
|
|
commentorUris,
|
2021-12-07 15:51:55 +01:00
|
|
|
hasNewResolvedResults,
|
2021-12-07 19:17:29 +01:00
|
|
|
searchQuery: query,
|
2021-12-02 17:49:13 +01:00
|
|
|
showMature: selectShowMatureContent(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const perform = (dispatch) => ({
|
|
|
|
doResolveUris: (uris) => dispatch(doResolveUris(uris, true)),
|
2021-12-07 19:17:29 +01:00
|
|
|
doSetMentionSearchResults: (query, uris) => dispatch(doSetMentionSearchResults(query, uris)),
|
2021-12-02 17:49:13 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
export default withRouter(connect(select, perform)(TextareaWithSuggestions));
|