From 9add21d83128bb42a60baf724c7c594abf0c5d7f Mon Sep 17 00:00:00 2001 From: Jessop Breth Date: Thu, 30 May 2019 09:20:28 -0400 Subject: [PATCH] comment intro --- src/ui/component/commentCreate/index.js | 6 ++++-- src/ui/component/commentCreate/view.jsx | 16 ++++++++++++++++ src/ui/constants/action_types.js | 1 + src/ui/redux/actions/app.js | 8 +++++++- src/ui/redux/reducers/app.js | 5 +++++ src/ui/redux/selectors/app.js | 6 ++++++ 6 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/ui/component/commentCreate/index.js b/src/ui/component/commentCreate/index.js index 9bb550c48..f5ea1440d 100644 --- a/src/ui/component/commentCreate/index.js +++ b/src/ui/component/commentCreate/index.js @@ -1,16 +1,18 @@ import { connect } from 'react-redux'; -import { doCommentCreate, makeSelectClaimForUri, selectMyActiveChannelUri, } from 'lbry-redux'; - +import { doCommentCreate, makeSelectClaimForUri, selectMyActiveChannelUri } from 'lbry-redux'; +import { selectCommentsInfoAck, doAckComments } from 'redux/selectors/app'; import CommentCreate from './view'; const select = (state, props) => ({ claim: makeSelectClaimForUri(props.uri)(state), channelUri: selectMyActiveChannelUri(state), + acksComments: selectCommentsInfoAck(state), }); const perform = dispatch => ({ createComment: params => dispatch(doCommentCreate(params)), + ackComments: () => dispatch(doAckComments()), }); export default connect( diff --git a/src/ui/component/commentCreate/view.jsx b/src/ui/component/commentCreate/view.jsx index 78891b7da..adcb5c0a1 100644 --- a/src/ui/component/commentCreate/view.jsx +++ b/src/ui/component/commentCreate/view.jsx @@ -4,6 +4,7 @@ import { FormField, Form } from 'component/common/form'; import Button from 'component/button'; import ChannelSection from 'component/selectChannel'; import { parseURI } from 'lbry-redux'; +import { usePersistedState } from 'util/use-persisted-state'; // props: type Props = { @@ -51,6 +52,21 @@ class CommentCreate extends React.PureComponent { return (
+ {!acksComments && ( + +
+ +
+
+ {totalItems > 0 && ( + + {totalItems} {totalItems === 1 ? 'publish' : 'publishes'} + + )} + {!isResolvingUri && !totalItems && This is an empty channel.} +
+
+ )}
{ const state = getState(); diff --git a/src/ui/redux/reducers/app.js b/src/ui/redux/reducers/app.js index b6b073b06..04601f541 100644 --- a/src/ui/redux/reducers/app.js +++ b/src/ui/redux/reducers/app.js @@ -36,6 +36,8 @@ export type AppState = { isUpgradeAvailable: ?boolean, isUpgradeSkipped: ?boolean, hasClickedComment: boolean, + commentsInfoAck: boolean, + enhancedLayout: boolean, searchOptionsExpanded: boolean, }; @@ -54,6 +56,7 @@ const defaultState: AppState = { autoUpdateDeclined: false, modalsAllowed: true, hasClickedComment: false, + commentsInfoAck: false, downloadProgress: undefined, upgradeDownloading: undefined, upgradeDownloadComplete: undefined, @@ -194,6 +197,8 @@ reducers[ACTIONS.CLEAR_UPGRADE_TIMER] = state => Object.assign({}, state, { checkUpgradeTimer: undefined, }); +// HERE +reducers[ACTIONS.COMMENTS_ACK] = state => Object.assign({}, state, { commentsInfoAck: true }); reducers[ACTIONS.ADD_COMMENT] = state => Object.assign({}, state, { diff --git a/src/ui/redux/selectors/app.js b/src/ui/redux/selectors/app.js index 276c0496f..4e2545e9b 100644 --- a/src/ui/redux/selectors/app.js +++ b/src/ui/redux/selectors/app.js @@ -23,11 +23,17 @@ export const selectUpdateUrl = createSelector( } ); +// HERE export const selectHasClickedComment = createSelector( selectState, state => state.hasClickedComment ); +export const selectCommentsInfoAck = createSelector( + selectState, + state => state.commentsInfoAck +); + export const selectRemoteVersion = createSelector( selectState, state => state.remoteVersion