Add quick filter for followers
This commit is contained in:
parent
906f46d084
commit
7e76cc3800
|
@ -7,7 +7,7 @@
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="followers-header">
|
<div class="followers-header">
|
||||||
<my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter>
|
<my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)"></my-advanced-input-filter>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="no-results" i18n *ngIf="pagination.totalItems === 0">No follower found.</div>
|
<div class="no-results" i18n *ngIf="pagination.totalItems === 0">No follower found.</div>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Subject } from 'rxjs'
|
||||||
import { Component, OnInit } from '@angular/core'
|
import { Component, OnInit } from '@angular/core'
|
||||||
import { ActivatedRoute } from '@angular/router'
|
import { ActivatedRoute } from '@angular/router'
|
||||||
import { AuthService, ComponentPagination, Notifier } from '@app/core'
|
import { AuthService, ComponentPagination, Notifier } from '@app/core'
|
||||||
|
import { AdvancedInputFilter } from '@app/shared/shared-forms'
|
||||||
import { UserSubscriptionService } from '@app/shared/shared-user-subscription'
|
import { UserSubscriptionService } from '@app/shared/shared-user-subscription'
|
||||||
import { ActorFollow } from '@shared/models'
|
import { ActorFollow } from '@shared/models'
|
||||||
|
|
||||||
|
@ -21,6 +22,8 @@ export class MyFollowersComponent implements OnInit {
|
||||||
onDataSubject = new Subject<any[]>()
|
onDataSubject = new Subject<any[]>()
|
||||||
search: string
|
search: string
|
||||||
|
|
||||||
|
inputFilters: AdvancedInputFilter[]
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private auth: AuthService,
|
private auth: AuthService,
|
||||||
|
@ -32,6 +35,15 @@ export class MyFollowersComponent implements OnInit {
|
||||||
if (this.route.snapshot.queryParams['search']) {
|
if (this.route.snapshot.queryParams['search']) {
|
||||||
this.search = this.route.snapshot.queryParams['search']
|
this.search = this.route.snapshot.queryParams['search']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.auth.userInformationLoaded.subscribe(() => {
|
||||||
|
this.inputFilters = this.auth.getUser().videoChannels.map(c => {
|
||||||
|
return {
|
||||||
|
queryParams: { search: 'channel:' + c.name },
|
||||||
|
label: $localize`Followers of ${c.name}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onNearOfBottom () {
|
onNearOfBottom () {
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class AdvancedInputFilterComponent implements OnInit, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
hasFilters () {
|
hasFilters () {
|
||||||
return this.filters.length !== 0
|
return this.filters && this.filters.length !== 0
|
||||||
}
|
}
|
||||||
|
|
||||||
private scheduleSearchUpdate (value: string) {
|
private scheduleSearchUpdate (value: string) {
|
||||||
|
|
Loading…
Reference in New Issue