declare const Sortable: any;
+const communityLimit = 100;
+
interface CommunitiesState {
communities: Array<Community>;
page: number;
super(props, context);
this.state = this.emptyState;
this.subscription = WebSocketService.Instance.subject
- .pipe(
- retryWhen(errors =>
- errors.pipe(
- delay(3000),
- take(10)
- )
- )
- )
+ .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
.subscribe(
msg => this.parseMessage(msg),
err => console.error(err),
<T i18nKey="prev">#</T>
</button>
)}
- <button
- class="btn btn-sm btn-secondary"
- onClick={linkEvent(this, this.nextPage)}
- >
- <T i18nKey="next">#</T>
- </button>
+ {this.state.communities.length == communityLimit && (
+ <button
+ class="btn btn-sm btn-secondary"
+ onClick={linkEvent(this, this.nextPage)}
+ >
+ <T i18nKey="next">#</T>
+ </button>
+ )}
</div>
);
}
refetch() {
let listCommunitiesForm: ListCommunitiesForm = {
sort: SortType[SortType.TopAll],
- limit: 100,
+ limit: communityLimit,
page: this.state.page,
};
<T i18nKey="prev">#</T>
</button>
)}
- <button
- class="btn btn-sm btn-secondary"
- onClick={linkEvent(this, this.nextPage)}
- >
- <T i18nKey="next">#</T>
- </button>
+ {this.state.posts.length == fetchLimit && (
+ <button
+ class="btn btn-sm btn-secondary"
+ onClick={linkEvent(this, this.nextPage)}
+ >
+ <T i18nKey="next">#</T>
+ </button>
+ )}
</div>
);
}
<T i18nKey="prev">#</T>
</button>
)}
- <button
- class="btn btn-sm btn-secondary"
- onClick={linkEvent(this, this.nextPage)}
- >
- <T i18nKey="next">#</T>
- </button>
+ {this.state.posts.length == fetchLimit && (
+ <button
+ class="btn btn-sm btn-secondary"
+ onClick={linkEvent(this, this.nextPage)}
+ >
+ <T i18nKey="next">#</T>
+ </button>
+ )}
</div>
);
}
postId={this.state.post.id}
disabled={this.state.post.locked}
/>
- {this.sortRadios()}
+ {this.state.comments.length > 0 && this.sortRadios()}
{this.commentsTree()}
</div>
<div class="col-12 col-sm-12 col-md-4">