comments cleanup
This commit is contained in:
parent
99c85a2ff7
commit
97ba09b605
8 changed files with 74 additions and 62 deletions
|
@ -3,8 +3,7 @@ import React from 'react';
|
||||||
import { FormField, Form } from 'component/common/form';
|
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 { COMMENT_ACKNOWLEDGED, COMMENT_ACKNOWLEDGED_TRUE } from 'constants/settings';
|
import usePersistedState from 'util/use-persisted-state';
|
||||||
import { usePersistedState } from 'util/use-persisted-state';
|
|
||||||
|
|
||||||
// props:
|
// props:
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -14,10 +13,11 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export function CommentCreate(props: Props) {
|
export function CommentCreate(props: Props) {
|
||||||
|
const COMMENT_ACKNOWLEDGED = 'COMMENT_ACKNOWLEDGED';
|
||||||
const { createComment, claim } = props;
|
const { createComment, claim } = props;
|
||||||
const { claim_id: claimId } = claim;
|
const { claim_id: claimId } = claim;
|
||||||
const [commentValue, setCommentValue] = usePersistedState(`comment-${claimId}`, '');
|
const [commentValue, setCommentValue] = usePersistedState(`comment-${claimId}`, '');
|
||||||
const [commentAck, setCommentAck] = usePersistedState(COMMENT_ACKNOWLEDGED, 'no');
|
const [commentAck, setCommentAck] = usePersistedState(COMMENT_ACKNOWLEDGED, false);
|
||||||
const [channel, setChannel] = usePersistedState('COMMENT_CHANNEL', 'anonymous');
|
const [channel, setChannel] = usePersistedState('COMMENT_CHANNEL', 'anonymous');
|
||||||
|
|
||||||
function handleCommentChange(event) {
|
function handleCommentChange(event) {
|
||||||
|
@ -29,7 +29,7 @@ export function CommentCreate(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCommentAck(event) {
|
function handleCommentAck(event) {
|
||||||
setCommentAck(COMMENT_ACKNOWLEDGED_TRUE);
|
setCommentAck(true);
|
||||||
}
|
}
|
||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
if (channel !== 'new' && commentValue.length) createComment(commentValue, claimId, channel);
|
if (channel !== 'new' && commentValue.length) createComment(commentValue, claimId, channel);
|
||||||
|
@ -38,7 +38,7 @@ export function CommentCreate(props: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{commentAck !== COMMENT_ACKNOWLEDGED_TRUE && (
|
{commentAck !== true && (
|
||||||
<section className="card card--section">
|
<section className="card card--section">
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
<div className="media__title">About comments..</div>
|
<div className="media__title">About comments..</div>
|
||||||
|
@ -51,7 +51,7 @@ export function CommentCreate(props: Props) {
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
{commentAck === COMMENT_ACKNOWLEDGED_TRUE && (
|
{commentAck === true && (
|
||||||
<section className="card card--section">
|
<section className="card card--section">
|
||||||
<Form onSubmit={handleSubmit}>
|
<Form onSubmit={handleSubmit}>
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
|
|
|
@ -4,12 +4,9 @@ import {
|
||||||
makeSelectContentTypeForUri,
|
makeSelectContentTypeForUri,
|
||||||
makeSelectMetadataForUri,
|
makeSelectMetadataForUri,
|
||||||
makeSelectFileInfoForUri,
|
makeSelectFileInfoForUri,
|
||||||
doToast,
|
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectUser } from 'lbryinc';
|
import { selectUser } from 'lbryinc';
|
||||||
import { doOpenFileInFolder } from 'redux/actions/file';
|
import { doOpenFileInFolder } from 'redux/actions/file';
|
||||||
import { selectHasClickedComment } from 'redux/selectors/app';
|
|
||||||
import { doClickCommentButton } from 'redux/actions/app';
|
|
||||||
import FileDetails from './view';
|
import FileDetails from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -17,14 +14,11 @@ const select = (state, props) => ({
|
||||||
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
||||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||||
hasClickedComment: selectHasClickedComment(state),
|
|
||||||
user: selectUser(state),
|
user: selectUser(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
openFolder: path => dispatch(doOpenFileInFolder(path)),
|
openFolder: path => dispatch(doOpenFileInFolder(path)),
|
||||||
showSnackBar: message => dispatch(doToast({ message })),
|
|
||||||
clickCommentButton: () => dispatch(doClickCommentButton()),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { Fragment, PureComponent } from 'react';
|
import React, { Fragment, PureComponent } from 'react';
|
||||||
import { Lbryio } from 'lbryinc';
|
|
||||||
import MarkdownPreview from 'component/common/markdown-preview';
|
import MarkdownPreview from 'component/common/markdown-preview';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Expandable from 'component/expandable';
|
import Expandable from 'component/expandable';
|
||||||
|
@ -12,31 +11,10 @@ type Props = {
|
||||||
metadata: StreamMetadata,
|
metadata: StreamMetadata,
|
||||||
openFolder: string => void,
|
openFolder: string => void,
|
||||||
contentType: string,
|
contentType: string,
|
||||||
clickCommentButton: () => void,
|
|
||||||
showSnackBar: React$Node => void,
|
|
||||||
hasClickedComment: boolean,
|
|
||||||
user: ?any,
|
user: ?any,
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileDetails extends PureComponent<Props> {
|
class FileDetails extends PureComponent<Props> {
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
(this: any).handleCommentClick = this.handleCommentClick.bind(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleCommentClick() {
|
|
||||||
const { clickCommentButton, showSnackBar } = this.props;
|
|
||||||
|
|
||||||
clickCommentButton();
|
|
||||||
Lbryio.call('user_tag', 'edit', { add: 'comments-waitlist' });
|
|
||||||
showSnackBar(
|
|
||||||
<span>
|
|
||||||
{__('Your Comment Has Been Posted')}
|
|
||||||
<sup>TM</sup>
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { claim, contentType, fileInfo, metadata, openFolder } = this.props;
|
const { claim, contentType, fileInfo, metadata, openFolder } = this.props;
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,57 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { remote } from 'electron';
|
import { remote } from 'electron';
|
||||||
import React, { Suspense } from 'react';
|
import React from 'react';
|
||||||
import LoadingScreen from 'component/common/loading-screen';
|
import LoadingScreen from 'component/common/loading-screen';
|
||||||
import VideoViewer from 'component/viewers/videoViewer';
|
import VideoViewer from 'component/viewers/videoViewer';
|
||||||
|
|
||||||
const AudioViewer = React.lazy<*>(() =>
|
const AudioViewer = React.lazy<*>(() =>
|
||||||
import(/* webpackChunkName: "audioViewer" */
|
import(
|
||||||
'component/viewers/audioViewer')
|
/* webpackChunkName: "audioViewer" */
|
||||||
|
'component/viewers/audioViewer'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const DocumentViewer = React.lazy<*>(() =>
|
const DocumentViewer = React.lazy<*>(() =>
|
||||||
import(/* webpackChunkName: "documentViewer" */
|
import(
|
||||||
'component/viewers/documentViewer')
|
/* webpackChunkName: "documentViewer" */
|
||||||
|
'component/viewers/documentViewer'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const DocxViewer = React.lazy<*>(() =>
|
const DocxViewer = React.lazy<*>(() =>
|
||||||
import(/* webpackChunkName: "docxViewer" */
|
import(
|
||||||
'component/viewers/docxViewer')
|
/* webpackChunkName: "docxViewer" */
|
||||||
|
'component/viewers/docxViewer'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const HtmlViewer = React.lazy<*>(() =>
|
const HtmlViewer = React.lazy<*>(() =>
|
||||||
import(/* webpackChunkName: "htmlViewer" */
|
import(
|
||||||
'component/viewers/htmlViewer')
|
/* webpackChunkName: "htmlViewer" */
|
||||||
|
'component/viewers/htmlViewer'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const PdfViewer = React.lazy<*>(() =>
|
const PdfViewer = React.lazy<*>(() =>
|
||||||
import(/* webpackChunkName: "pdfViewer" */
|
import(
|
||||||
'component/viewers/pdfViewer')
|
/* webpackChunkName: "pdfViewer" */
|
||||||
|
'component/viewers/pdfViewer'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
const ComicBookViewer = React.lazy<*>(() =>
|
const ComicBookViewer = React.lazy<*>(() =>
|
||||||
import(/* webpackChunkName: "comicBookViewer" */
|
import(
|
||||||
'component/viewers/comicBookViewer')
|
/* webpackChunkName: "comicBookViewer" */
|
||||||
|
'component/viewers/comicBookViewer'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const ThreeViewer = React.lazy<*>(() =>
|
const ThreeViewer = React.lazy<*>(() =>
|
||||||
import(/* webpackChunkName: "threeViewer" */
|
import(
|
||||||
'component/viewers/threeViewer')
|
/* webpackChunkName: "threeViewer" */
|
||||||
|
'component/viewers/threeViewer'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
|
@ -174,7 +188,7 @@ class FileRender extends React.PureComponent<Props> {
|
||||||
|
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
// temp workaround to disabled paid content on web
|
// temp workaround to disabled paid content on web
|
||||||
if (claim && claim.value.fee && claim.value.fee.amount > 0) {
|
if (claim && claim.value.fee && Number(claim.value.fee.amount) > 0) {
|
||||||
const paidMessage = __(
|
const paidMessage = __(
|
||||||
'Currently, only free content is available on lbry.tv. Try viewing it in the desktop app.'
|
'Currently, only free content is available on lbry.tv. Try viewing it in the desktop app.'
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { Suspense } from 'react';
|
import React from 'react';
|
||||||
import { stopContextMenu } from 'util/context-menu';
|
import { stopContextMenu } from 'util/context-menu';
|
||||||
import analytics from 'analytics';
|
import analytics from 'analytics';
|
||||||
import(/* webpackChunkName: "videojs" */
|
import(
|
||||||
/* webpackPreload: true */
|
/* webpackChunkName: "videojs" */
|
||||||
'video.js/dist/video-js.css');
|
/* webpackPreload: true */
|
||||||
|
'video.js/dist/video-js.css'
|
||||||
|
);
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
source: {
|
source: {
|
||||||
|
@ -44,10 +46,12 @@ class AudioVideoViewer extends React.PureComponent<Props> {
|
||||||
sources,
|
sources,
|
||||||
};
|
};
|
||||||
|
|
||||||
import(/* webpackChunkName: "videojs" */
|
import(
|
||||||
/* webpackMode: "lazy" */
|
/* webpackChunkName: "videojs" */
|
||||||
/* webpackPreload: true */
|
/* webpackMode: "lazy" */
|
||||||
'video.js').then(videojs => {
|
/* webpackPreload: true */
|
||||||
|
'video.js'
|
||||||
|
).then(videojs => {
|
||||||
if (videojs.__esModule) {
|
if (videojs.__esModule) {
|
||||||
videojs = videojs.default;
|
videojs = videojs.default;
|
||||||
this.player = videojs(this.videoNode, videoJsOptions, () => {});
|
this.player = videojs(this.videoNode, videoJsOptions, () => {});
|
||||||
|
|
|
@ -16,5 +16,3 @@ export const AUTOPLAY = 'autoplay';
|
||||||
export const RESULT_COUNT = 'resultCount';
|
export const RESULT_COUNT = 'resultCount';
|
||||||
export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled';
|
export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled';
|
||||||
export const AUTO_DOWNLOAD = 'autoDownload';
|
export const AUTO_DOWNLOAD = 'autoDownload';
|
||||||
export const COMMENT_ACKNOWLEDGED = 'comment_acknowledged';
|
|
||||||
export const COMMENT_ACKNOWLEDGED_TRUE = 'comment_acknowledged_true';
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ export const selectUpdateUrl = createSelector(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// HERE
|
|
||||||
export const selectHasClickedComment = createSelector(
|
export const selectHasClickedComment = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.hasClickedComment
|
state => state.hasClickedComment
|
||||||
|
|
|
@ -285,7 +285,32 @@
|
||||||
"Downloading stream... not long left now!": "Downloading stream... not long left now!",
|
"Downloading stream... not long left now!": "Downloading stream... not long left now!",
|
||||||
"Downloading: ": "Downloading: ",
|
"Downloading: ": "Downloading: ",
|
||||||
"% complete": "% complete",
|
"% complete": "% complete",
|
||||||
|
<<<<<<< HEAD
|
||||||
"Updates published": "Updates published",
|
"Updates published": "Updates published",
|
||||||
"Your updates have been published to LBRY at the address": "Your updates have been published to LBRY at the address",
|
"Your updates have been published to LBRY at the address": "Your updates have been published to LBRY at the address",
|
||||||
"The updates will take a few minutes to appear for other LBRY users. Until then your file will be listed as \"pending\" under your published files.": "The updates will take a few minutes to appear for other LBRY users. Until then your file will be listed as \"pending\" under your published files."
|
"The updates will take a few minutes to appear for other LBRY users. Until then your file will be listed as \"pending\" under your published files.": "The updates will take a few minutes to appear for other LBRY users. Until then your file will be listed as \"pending\" under your published files."
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
"Incompatible Daemon": "Incompatible Daemon",
|
||||||
|
"Incompatible daemon running": "Incompatible daemon running",
|
||||||
|
"Close App and LBRY Processes": "Close App and LBRY Processes",
|
||||||
|
"Continue Anyway": "Continue Anyway",
|
||||||
|
"This app is running with an incompatible version of the LBRY protocol. You can still use it, but there may be issues. Re-run the installation package for best results.": "This app is running with an incompatible version of the LBRY protocol. You can still use it, but there may be issues. Re-run the installation package for best results.",
|
||||||
|
"Update ready to install": "Update ready to install",
|
||||||
|
"Install now": "Install now",
|
||||||
|
"Upgrade available": "Upgrade available",
|
||||||
|
"LBRY Leveled Up": "LBRY Leveled Up",
|
||||||
|
"Upgrade": "Upgrade",
|
||||||
|
"Skip": "Skip",
|
||||||
|
"An updated version of LBRY is now available.": "An updated version of LBRY is now available.",
|
||||||
|
"Your version is out of date and may be unreliable or insecure.": "Your version is out of date and may be unreliable or insecure.",
|
||||||
|
"Want to know what has changed?": "Want to know what has changed?",
|
||||||
|
"release notes": "release notes",
|
||||||
|
"Your comment": "Your comment",
|
||||||
|
"Post": "Post",
|
||||||
|
"Uh oh. The flux in our Retro Encabulator must be out of whack. Try refreshing to fix it.": "Uh oh. The flux in our Retro Encabulator must be out of whack. Try refreshing to fix it.",
|
||||||
|
"If you still have issues, your anti-virus software or firewall may be preventing startup.": "If you still have issues, your anti-virus software or firewall may be preventing startup.",
|
||||||
|
"Reach out to hello@lbry.com for help, or check out": "Reach out to hello@lbry.com for help, or check out",
|
||||||
|
"Got it!": "Got it!"
|
||||||
|
}
|
||||||
|
>>>>>>> comments cleanup
|
||||||
|
|
Loading…
Add table
Reference in a new issue