comment intro
This commit is contained in:
parent
69cb2b8be8
commit
9add21d831
6 changed files with 39 additions and 3 deletions
|
@ -1,16 +1,18 @@
|
||||||
import { connect } from 'react-redux';
|
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';
|
import CommentCreate from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
channelUri: selectMyActiveChannelUri(state),
|
channelUri: selectMyActiveChannelUri(state),
|
||||||
|
acksComments: selectCommentsInfoAck(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
createComment: params => dispatch(doCommentCreate(params)),
|
createComment: params => dispatch(doCommentCreate(params)),
|
||||||
|
ackComments: () => dispatch(doAckComments()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { FormField, Form } from 'component/common/form';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import ChannelSection from 'component/selectChannel';
|
import ChannelSection from 'component/selectChannel';
|
||||||
import { parseURI } from 'lbry-redux';
|
import { parseURI } from 'lbry-redux';
|
||||||
|
import { usePersistedState } from 'util/use-persisted-state';
|
||||||
|
|
||||||
// props:
|
// props:
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -51,6 +52,21 @@ class CommentCreate extends React.PureComponent<Props> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="card card--section">
|
<section className="card card--section">
|
||||||
|
{!acksComments && (
|
||||||
|
<React.Fragment>
|
||||||
|
<div className="media__title">
|
||||||
|
<TruncatedText text={channelName || uri} lines={1} />
|
||||||
|
</div>
|
||||||
|
<div className="media__subtitle">
|
||||||
|
{totalItems > 0 && (
|
||||||
|
<span>
|
||||||
|
{totalItems} {totalItems === 1 ? 'publish' : 'publishes'}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{!isResolvingUri && !totalItems && <span>This is an empty channel.</span>}
|
||||||
|
</div>
|
||||||
|
</React.Fragment>
|
||||||
|
)}
|
||||||
<Form onSubmit={this.handleSubmit}>
|
<Form onSubmit={this.handleSubmit}>
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
<FormField
|
<FormField
|
||||||
|
|
|
@ -14,6 +14,7 @@ export const DAEMON_VERSION_MATCH = 'DAEMON_VERSION_MATCH';
|
||||||
export const DAEMON_VERSION_MISMATCH = 'DAEMON_VERSION_MISMATCH';
|
export const DAEMON_VERSION_MISMATCH = 'DAEMON_VERSION_MISMATCH';
|
||||||
export const VOLUME_CHANGED = 'VOLUME_CHANGED';
|
export const VOLUME_CHANGED = 'VOLUME_CHANGED';
|
||||||
export const ADD_COMMENT = 'ADD_COMMENT';
|
export const ADD_COMMENT = 'ADD_COMMENT';
|
||||||
|
export const ACTIVATE_COMMENTS = 'ACTIVATE_COMMENTS';
|
||||||
export const SHOW_MODAL = 'SHOW_MODAL';
|
export const SHOW_MODAL = 'SHOW_MODAL';
|
||||||
export const HIDE_MODAL = 'HIDE_MODAL';
|
export const HIDE_MODAL = 'HIDE_MODAL';
|
||||||
export const CHANGE_MODALS_ALLOWED = 'CHANGE_MODALS_ALLOWED';
|
export const CHANGE_MODALS_ALLOWED = 'CHANGE_MODALS_ALLOWED';
|
||||||
|
|
|
@ -373,13 +373,19 @@ export function doChangeVolume(volume) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// HERE
|
||||||
export function doClickCommentButton() {
|
export function doClickCommentButton() {
|
||||||
return {
|
return {
|
||||||
type: ACTIONS.ADD_COMMENT,
|
type: ACTIONS.ADD_COMMENT,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doAckComments() {
|
||||||
|
return {
|
||||||
|
type: ACTIONS.COMMENTS_ACK,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function doConditionalAuthNavigate(newSession) {
|
export function doConditionalAuthNavigate(newSession) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
|
|
|
@ -36,6 +36,8 @@ export type AppState = {
|
||||||
isUpgradeAvailable: ?boolean,
|
isUpgradeAvailable: ?boolean,
|
||||||
isUpgradeSkipped: ?boolean,
|
isUpgradeSkipped: ?boolean,
|
||||||
hasClickedComment: boolean,
|
hasClickedComment: boolean,
|
||||||
|
commentsInfoAck: boolean,
|
||||||
|
enhancedLayout: boolean,
|
||||||
searchOptionsExpanded: boolean,
|
searchOptionsExpanded: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,6 +56,7 @@ const defaultState: AppState = {
|
||||||
autoUpdateDeclined: false,
|
autoUpdateDeclined: false,
|
||||||
modalsAllowed: true,
|
modalsAllowed: true,
|
||||||
hasClickedComment: false,
|
hasClickedComment: false,
|
||||||
|
commentsInfoAck: false,
|
||||||
downloadProgress: undefined,
|
downloadProgress: undefined,
|
||||||
upgradeDownloading: undefined,
|
upgradeDownloading: undefined,
|
||||||
upgradeDownloadComplete: undefined,
|
upgradeDownloadComplete: undefined,
|
||||||
|
@ -194,6 +197,8 @@ reducers[ACTIONS.CLEAR_UPGRADE_TIMER] = state =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
checkUpgradeTimer: undefined,
|
checkUpgradeTimer: undefined,
|
||||||
});
|
});
|
||||||
|
// HERE
|
||||||
|
reducers[ACTIONS.COMMENTS_ACK] = state => Object.assign({}, state, { commentsInfoAck: true });
|
||||||
|
|
||||||
reducers[ACTIONS.ADD_COMMENT] = state =>
|
reducers[ACTIONS.ADD_COMMENT] = state =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
|
|
|
@ -23,11 +23,17 @@ export const selectUpdateUrl = createSelector(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// HERE
|
||||||
export const selectHasClickedComment = createSelector(
|
export const selectHasClickedComment = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.hasClickedComment
|
state => state.hasClickedComment
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectCommentsInfoAck = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.commentsInfoAck
|
||||||
|
);
|
||||||
|
|
||||||
export const selectRemoteVersion = createSelector(
|
export const selectRemoteVersion = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.remoteVersion
|
state => state.remoteVersion
|
||||||
|
|
Loading…
Reference in a new issue