2019-10-15 00:21:40 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
2021-02-04 06:45:49 +01:00
|
|
|
import Empty from 'component/common/empty';
|
2021-10-18 17:54:59 +02:00
|
|
|
import { lazyImport } from 'util/lazyImport';
|
|
|
|
|
|
|
|
const CommentsList = lazyImport(() => import('component/commentsList' /* webpackChunkName: "comments" */));
|
2019-10-15 00:21:40 +02:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
2021-07-15 16:43:28 +02:00
|
|
|
linkedCommentId?: string,
|
2021-02-05 00:00:07 +01:00
|
|
|
commentsDisabled: boolean,
|
2019-10-15 00:21:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
function ChannelDiscussion(props: Props) {
|
2021-07-15 16:43:28 +02:00
|
|
|
const { uri, linkedCommentId, commentsDisabled } = props;
|
2020-08-31 19:12:34 +02:00
|
|
|
|
2021-02-05 00:00:07 +01:00
|
|
|
if (commentsDisabled) {
|
|
|
|
return <Empty text={__('This channel has disabled comments on their page.')} />;
|
2021-02-04 06:45:49 +01:00
|
|
|
}
|
2019-10-15 00:21:40 +02:00
|
|
|
return (
|
2020-08-25 21:25:33 +02:00
|
|
|
<section className="section">
|
2021-10-18 17:54:59 +02:00
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
<CommentsList uri={uri} linkedCommentId={linkedCommentId} commentsAreExpanded />
|
|
|
|
</React.Suspense>
|
2020-08-25 21:25:33 +02:00
|
|
|
</section>
|
2019-10-15 00:21:40 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ChannelDiscussion;
|