Adds channelDiscussion
to components & creates discussion tab
This commit is contained in:
parent
f1d2d0243b
commit
b2e6fc0181
3 changed files with 41 additions and 5 deletions
7
src/ui/component/channelDiscussion/index.js
Normal file
7
src/ui/component/channelDiscussion/index.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import ChannelDiscussion from './view';
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
)(ChannelDiscussion);
|
20
src/ui/component/channelDiscussion/view.jsx
Normal file
20
src/ui/component/channelDiscussion/view.jsx
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// @flow
|
||||||
|
import React from 'react';
|
||||||
|
import CommentsList from 'component/commentsList';
|
||||||
|
import CommentCreate from 'component/commentCreate';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
uri: string,
|
||||||
|
};
|
||||||
|
|
||||||
|
function ChannelDiscussion(props: Props) {
|
||||||
|
const uri = props.uri;
|
||||||
|
return (
|
||||||
|
<section className="card--section">
|
||||||
|
<CommentCreate uri={uri} />
|
||||||
|
<CommentsList uri={uri} />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ChannelDiscussion;
|
|
@ -11,6 +11,7 @@ import Button from 'component/button';
|
||||||
import { formatLbryUriForWeb } from 'util/uri';
|
import { formatLbryUriForWeb } from 'util/uri';
|
||||||
import ChannelContent from 'component/channelContent';
|
import ChannelContent from 'component/channelContent';
|
||||||
import ChannelAbout from 'component/channelAbout';
|
import ChannelAbout from 'component/channelAbout';
|
||||||
|
import ChannelDiscussion from 'component/channelDiscussion';
|
||||||
import ChannelThumbnail from 'component/channelThumbnail';
|
import ChannelThumbnail from 'component/channelThumbnail';
|
||||||
import ChannelEdit from 'component/channelEdit';
|
import ChannelEdit from 'component/channelEdit';
|
||||||
import ClaimUri from 'component/claimUri';
|
import ClaimUri from 'component/claimUri';
|
||||||
|
@ -24,6 +25,7 @@ import HelpLink from 'component/common/help-link';
|
||||||
|
|
||||||
const PAGE_VIEW_QUERY = `view`;
|
const PAGE_VIEW_QUERY = `view`;
|
||||||
const ABOUT_PAGE = `about`;
|
const ABOUT_PAGE = `about`;
|
||||||
|
const DISCUSSION_PAGE = `discussion`;
|
||||||
const LIGHTHOUSE_URL = 'https://lighthouse.lbry.com/search';
|
const LIGHTHOUSE_URL = 'https://lighthouse.lbry.com/search';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -84,17 +86,20 @@ function ChannelPage(props: Props) {
|
||||||
// If a user changes tabs, update the url so it stays on the same page if they refresh.
|
// If a user changes tabs, update the url so it stays on the same page if they refresh.
|
||||||
// We don't want to use links here because we can't animate the tab change and using links
|
// We don't want to use links here because we can't animate the tab change and using links
|
||||||
// would alter the Tab label's role attribute, which should stay role="tab" to work with keyboards/screen readers.
|
// would alter the Tab label's role attribute, which should stay role="tab" to work with keyboards/screen readers.
|
||||||
const tabIndex = currentView === ABOUT_PAGE || editing ? 1 : 0;
|
const tabIndex = currentView === ABOUT_PAGE || editing ? 1 : currentView === DISCUSSION_PAGE ? 2 : 0;
|
||||||
|
|
||||||
function onTabChange(newTabIndex) {
|
function onTabChange(newTabIndex) {
|
||||||
let url = formatLbryUriForWeb(uri);
|
let url = formatLbryUriForWeb(uri);
|
||||||
let search = '?';
|
let search = '?';
|
||||||
if (newTabIndex !== 0) {
|
|
||||||
search += `${PAGE_VIEW_QUERY}=${ABOUT_PAGE}`;
|
if (newTabIndex === 0) {
|
||||||
} else {
|
|
||||||
setSearchResults(null);
|
setSearchResults(null);
|
||||||
search += `page=${page}`;
|
search += `page=${page}`;
|
||||||
|
} else if (newTabIndex === 1) {
|
||||||
|
search += `${PAGE_VIEW_QUERY}=${ABOUT_PAGE}`;
|
||||||
|
} else {
|
||||||
|
search += `${PAGE_VIEW_QUERY}=${DISCUSSION_PAGE}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
history.push(`${url}${search}`);
|
history.push(`${url}${search}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,6 +205,7 @@ function ChannelPage(props: Props) {
|
||||||
<TabList className="tabs__list--channel-page">
|
<TabList className="tabs__list--channel-page">
|
||||||
<Tab disabled={editing}>{__('Content')}</Tab>
|
<Tab disabled={editing}>{__('Content')}</Tab>
|
||||||
<Tab>{editing ? __('Editing Your Channel') : __('About')}</Tab>
|
<Tab>{editing ? __('Editing Your Channel') : __('About')}</Tab>
|
||||||
|
<Tab disabled={editing}>{__('Discussion')}</Tab>
|
||||||
<Form onSubmit={handleSearch} className="wunderbar--channel">
|
<Form onSubmit={handleSearch} className="wunderbar--channel">
|
||||||
<Icon icon={ICONS.SEARCH} />
|
<Icon icon={ICONS.SEARCH} />
|
||||||
<FormField
|
<FormField
|
||||||
|
@ -232,6 +238,9 @@ function ChannelPage(props: Props) {
|
||||||
<ChannelAbout uri={uri} />
|
<ChannelAbout uri={uri} />
|
||||||
)}
|
)}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
<TabPanel>
|
||||||
|
<ChannelDiscussion uri={uri} />
|
||||||
|
</TabPanel>
|
||||||
</TabPanels>
|
</TabPanels>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue