Add support for clickable link
This commit is contained in:
parent
445bf77e36
commit
2646ce4481
1 changed files with 16 additions and 4 deletions
|
@ -31,6 +31,16 @@ class DiscoverPage extends React.PureComponent<Props> {
|
|||
this.clearContinuousFetch();
|
||||
}
|
||||
|
||||
getCategoryLinkPartByCategory(category: string) {
|
||||
const channelName = category.substr(category.indexOf('@'));
|
||||
if (!channelName.includes('#')) {
|
||||
return null;
|
||||
}
|
||||
return channelName;
|
||||
}
|
||||
|
||||
continousFetch: ?IntervalID;
|
||||
|
||||
clearContinuousFetch() {
|
||||
if (this.continousFetch) {
|
||||
clearInterval(this.continousFetch);
|
||||
|
@ -38,20 +48,22 @@ class DiscoverPage extends React.PureComponent<Props> {
|
|||
}
|
||||
}
|
||||
|
||||
continousFetch: ?number;
|
||||
|
||||
render() {
|
||||
const { featuredUris, fetchingFeaturedUris } = this.props;
|
||||
const hasContent = typeof featuredUris === 'object' && Object.keys(featuredUris).length;
|
||||
const failedToLoad = !fetchingFeaturedUris && !hasContent;
|
||||
|
||||
return (
|
||||
<Page noPadding isLoading={!hasContent && fetchingFeaturedUris}>
|
||||
{hasContent &&
|
||||
Object.keys(featuredUris).map(
|
||||
category =>
|
||||
featuredUris[category].length ? (
|
||||
<CategoryList key={category} category={category} names={featuredUris[category]} />
|
||||
<CategoryList
|
||||
key={category}
|
||||
category={category}
|
||||
names={featuredUris[category]}
|
||||
categoryLink={this.getCategoryLinkPartByCategory(category)}
|
||||
/>
|
||||
) : (
|
||||
<CategoryList
|
||||
key={category}
|
||||
|
|
Loading…
Reference in a new issue