mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-14 06:19:47 +00:00
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();
|
this.clearContinuousFetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCategoryLinkPartByCategory(category: string) {
|
||||||
|
const channelName = category.substr(category.indexOf('@'));
|
||||||
|
if (!channelName.includes('#')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return channelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
continousFetch: ?IntervalID;
|
||||||
|
|
||||||
clearContinuousFetch() {
|
clearContinuousFetch() {
|
||||||
if (this.continousFetch) {
|
if (this.continousFetch) {
|
||||||
clearInterval(this.continousFetch);
|
clearInterval(this.continousFetch);
|
||||||
|
@ -38,20 +48,22 @@ class DiscoverPage extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
continousFetch: ?number;
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { featuredUris, fetchingFeaturedUris } = this.props;
|
const { featuredUris, fetchingFeaturedUris } = this.props;
|
||||||
const hasContent = typeof featuredUris === 'object' && Object.keys(featuredUris).length;
|
const hasContent = typeof featuredUris === 'object' && Object.keys(featuredUris).length;
|
||||||
const failedToLoad = !fetchingFeaturedUris && !hasContent;
|
const failedToLoad = !fetchingFeaturedUris && !hasContent;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page noPadding isLoading={!hasContent && fetchingFeaturedUris}>
|
<Page noPadding isLoading={!hasContent && fetchingFeaturedUris}>
|
||||||
{hasContent &&
|
{hasContent &&
|
||||||
Object.keys(featuredUris).map(
|
Object.keys(featuredUris).map(
|
||||||
category =>
|
category =>
|
||||||
featuredUris[category].length ? (
|
featuredUris[category].length ? (
|
||||||
<CategoryList key={category} category={category} names={featuredUris[category]} />
|
<CategoryList
|
||||||
|
key={category}
|
||||||
|
category={category}
|
||||||
|
names={featuredUris[category]}
|
||||||
|
categoryLink={this.getCategoryLinkPartByCategory(category)}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<CategoryList
|
<CategoryList
|
||||||
key={category}
|
key={category}
|
||||||
|
|
Loading…
Add table
Reference in a new issue