Hide next paginator.
- Fixes #441 - Hide post sort radio if no comments.
This commit is contained in:
parent
7f0e69e54c
commit
7b7fb0f5d2
4 changed files with 29 additions and 28 deletions
15
ui/src/components/communities.tsx
vendored
15
ui/src/components/communities.tsx
vendored
|
@ -18,6 +18,8 @@ import { T } from 'inferno-i18next';
|
||||||
|
|
||||||
declare const Sortable: any;
|
declare const Sortable: any;
|
||||||
|
|
||||||
|
const communityLimit = 100;
|
||||||
|
|
||||||
interface CommunitiesState {
|
interface CommunitiesState {
|
||||||
communities: Array<Community>;
|
communities: Array<Community>;
|
||||||
page: number;
|
page: number;
|
||||||
|
@ -36,14 +38,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this.state = this.emptyState;
|
this.state = this.emptyState;
|
||||||
this.subscription = WebSocketService.Instance.subject
|
this.subscription = WebSocketService.Instance.subject
|
||||||
.pipe(
|
.pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
|
||||||
retryWhen(errors =>
|
|
||||||
errors.pipe(
|
|
||||||
delay(3000),
|
|
||||||
take(10)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.subscribe(
|
.subscribe(
|
||||||
msg => this.parseMessage(msg),
|
msg => this.parseMessage(msg),
|
||||||
err => console.error(err),
|
err => console.error(err),
|
||||||
|
@ -180,12 +175,14 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
<T i18nKey="prev">#</T>
|
<T i18nKey="prev">#</T>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{this.state.communities.length == communityLimit && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
>
|
>
|
||||||
<T i18nKey="next">#</T>
|
<T i18nKey="next">#</T>
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -227,7 +224,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
refetch() {
|
refetch() {
|
||||||
let listCommunitiesForm: ListCommunitiesForm = {
|
let listCommunitiesForm: ListCommunitiesForm = {
|
||||||
sort: SortType[SortType.TopAll],
|
sort: SortType[SortType.TopAll],
|
||||||
limit: 100,
|
limit: communityLimit,
|
||||||
page: this.state.page,
|
page: this.state.page,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
2
ui/src/components/community.tsx
vendored
2
ui/src/components/community.tsx
vendored
|
@ -192,12 +192,14 @@ export class Community extends Component<any, State> {
|
||||||
<T i18nKey="prev">#</T>
|
<T i18nKey="prev">#</T>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{this.state.posts.length == fetchLimit && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
>
|
>
|
||||||
<T i18nKey="next">#</T>
|
<T i18nKey="next">#</T>
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
2
ui/src/components/main.tsx
vendored
2
ui/src/components/main.tsx
vendored
|
@ -480,12 +480,14 @@ export class Main extends Component<any, MainState> {
|
||||||
<T i18nKey="prev">#</T>
|
<T i18nKey="prev">#</T>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{this.state.posts.length == fetchLimit && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
>
|
>
|
||||||
<T i18nKey="next">#</T>
|
<T i18nKey="next">#</T>
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
2
ui/src/components/post.tsx
vendored
2
ui/src/components/post.tsx
vendored
|
@ -178,7 +178,7 @@ export class Post extends Component<any, PostState> {
|
||||||
postId={this.state.post.id}
|
postId={this.state.post.id}
|
||||||
disabled={this.state.post.locked}
|
disabled={this.state.post.locked}
|
||||||
/>
|
/>
|
||||||
{this.sortRadios()}
|
{this.state.comments.length > 0 && this.sortRadios()}
|
||||||
{this.commentsTree()}
|
{this.commentsTree()}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-sm-12 col-md-4">
|
<div class="col-12 col-sm-12 col-md-4">
|
||||||
|
|
Loading…
Reference in a new issue