Add hide list

pull/3467/head
MahdiTurki 2020-04-27 20:14:40 +01:00 committed by Chocobozzz
parent bd49f8e988
commit 2ce949454f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 24 additions and 6 deletions

View File

@ -6,10 +6,16 @@
<div i18n class="no-results" *ngIf="followersPagination.totalItems === 0">This instance does not have instances followers.</div>
<a *ngFor="let follower of followers" [href]="buildLink(follower)" target="_blank" rel="noopener noreferrer">
{{ follower }}
{{follower}}
</a>
<ng-container *ngIf="showMoreFollowers">
<a *ngFor="let follower of moreFollowers" [href]="buildLink(follower)" target="_blank" rel="noopener noreferrer">
{{ follower }}
</a>
</ng-container>
<a i18n class="showMore" *ngIf="!showMoreFollowers" (click)="loadAllFollowers()" (click)= "showMoreFollowers=true">Show full list</a>
<a i18n class="showMore" *ngIf="!showMoreFollowers" (click)="loadAllFollowers()" (click)="showMoreFollowers=true">Show full list</a>
<a i18n class="showMore" *ngIf="showMoreFollowers" (click)= "showMoreFollowers=false">Show less</a>
</div>
<div class="col-xl-6 col-md-12">
@ -28,8 +34,14 @@
<a *ngFor="let following of followings" [href]="buildLink(following)" target="_blank" rel="noopener noreferrer">
{{ following }}
</a>
<ng-container *ngIf="showMoreFollowings">
<a *ngFor="let following of moreFollowings" [href]="buildLink(following)" target="_blank" rel="noopener noreferrer">
{{ following }}
</a>
</ng-container>
<a i18n class="showMore" *ngIf="!showMoreFollowings" (click)="loadAllFollowings()" (click)= "showMoreFollowings=true">Show full list</a>
<a i18n class="showMore" *ngIf="!showMoreFollowings" (click)="loadAllFollowings()" (click)="showMoreFollowings=true">Show full list</a>
<a i18n class="showMore" *ngIf="showMoreFollowings" (click)="showMoreFollowings=false">Show less</a>
</div>
</div>

View File

@ -13,6 +13,8 @@ import { InstanceFollowService } from '@app/shared/shared-instance'
export class AboutFollowsComponent implements OnInit {
followers: string[] = []
followings: string[] = []
moreFollowers: string[] = []
moreFollowings: string[] = []
showMoreFollowers = false
showMoreFollowings = false
@ -75,7 +77,9 @@ export class AboutFollowsComponent implements OnInit {
.subscribe(
resultList => {
const newFollowers = resultList.data.map(r => r.follower.host)
this.followers = this.followers.concat(newFollowers)
if (this.followers.length === 0) this.followers = this.followers.concat(newFollowers)
else this.moreFollowers = this.moreFollowers.concat(newFollowers)
this.followersPagination.totalItems = resultList.total
@ -93,7 +97,9 @@ export class AboutFollowsComponent implements OnInit {
.subscribe(
resultList => {
const newFollowings = resultList.data.map(r => r.following.host)
this.followings = this.followings.concat(newFollowings)
if (this.followings.length===0) this.followings = this.followings.concat(newFollowings)
else this.moreFollowings = this.moreFollowings.concat(newFollowings)
this.followingsPagination.totalItems = resultList.total