update angular
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
<mat-label>Zeitraum</mat-label>
|
||||
<mat-select formControlName="time">
|
||||
<mat-option *ngFor="let time of times" [value]="time.key">{{
|
||||
time.value
|
||||
}}</mat-option>
|
||||
time.value
|
||||
}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import {isEqual} from 'lodash';
|
||||
selector: 'app-filter',
|
||||
templateUrl: './filter.component.html',
|
||||
styleUrls: ['./filter.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class FilterComponent {
|
||||
@Input() public route = '/shows/';
|
||||
@@ -38,7 +39,7 @@ export class FilterComponent {
|
||||
private showService: ShowService,
|
||||
private userService: UserService,
|
||||
activatedRoute: ActivatedRoute,
|
||||
fb: UntypedFormBuilder
|
||||
fb: UntypedFormBuilder,
|
||||
) {
|
||||
this.filterFormGroup = fb.group({
|
||||
time: 1,
|
||||
@@ -63,7 +64,7 @@ export class FilterComponent {
|
||||
this.showService.list$().pipe(
|
||||
map(shows => {
|
||||
return shows.map(show => show.owner).filter(onlyUnique);
|
||||
})
|
||||
}),
|
||||
),
|
||||
this.userService.users$,
|
||||
]).pipe(
|
||||
@@ -76,7 +77,7 @@ export class FilterComponent {
|
||||
.sort(dynamicSort('value'));
|
||||
}),
|
||||
distinctUntilChanged(isEqual),
|
||||
map(_ => _ as {key: string; value: string}[])
|
||||
map(_ => _ as {key: string; value: string}[]),
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<div class="list-item" *ngIf="show">
|
||||
<div *ngIf="show" class="list-item">
|
||||
<div>{{ show.date.toDate() | date: "dd.MM.yyyy" }}</div>
|
||||
<div><app-user-name [userId]="show.owner"></app-user-name></div>
|
||||
<div>
|
||||
<app-user-name [userId]="show.owner"></app-user-name>
|
||||
</div>
|
||||
<div>{{ show.showType | showType }}</div>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('ListItemComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [ListItemComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import {Show} from '../../services/show';
|
||||
selector: 'app-list-item',
|
||||
templateUrl: './list-item.component.html',
|
||||
styleUrls: ['./list-item.component.less'],
|
||||
standalone: false,
|
||||
})
|
||||
export class ListItemComponent {
|
||||
@Input() public show: Show | null = null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<!-- <app-list-header *appRole="['leader']"></app-list-header>-->
|
||||
<!-- <app-list-header *appRole="['leader']"></app-list-header>-->
|
||||
<app-list-header *appRole="['leader']">
|
||||
<app-filter *ngIf="shows$ | async as shows" [shows]="publicShows$ | async"></app-filter>
|
||||
</app-list-header>
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('ListComponent', () => {
|
||||
void TestBed.configureTestingModule({
|
||||
declarations: [ListComponent],
|
||||
}).compileComponents();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -12,6 +12,7 @@ import {map} from 'rxjs/operators';
|
||||
templateUrl: './list.component.html',
|
||||
styleUrls: ['./list.component.less'],
|
||||
animations: [fade],
|
||||
standalone: false,
|
||||
})
|
||||
export class ListComponent {
|
||||
public shows$ = this.showService.list$();
|
||||
@@ -21,13 +22,13 @@ export class ListComponent {
|
||||
const filterValues = params as FilterValues;
|
||||
if (!filterValues?.time) return 1;
|
||||
return +filterValues.time;
|
||||
})
|
||||
}),
|
||||
);
|
||||
public owner$ = this.activatedRoute.queryParams.pipe(
|
||||
map(params => {
|
||||
const filterValues = params as FilterValues;
|
||||
return filterValues?.owner;
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
public publicShows$ = combineLatest([this.shows$, this.lastMonths$, this.owner$]).pipe(
|
||||
@@ -38,14 +39,15 @@ export class ListComponent {
|
||||
d.setMonth(d.getMonth() - lastMonths);
|
||||
return f.published && f.date.toDate() >= d;
|
||||
})
|
||||
.filter(show => !owner || show.owner === owner)
|
||||
)
|
||||
.filter(show => !owner || show.owner === owner),
|
||||
),
|
||||
);
|
||||
|
||||
public constructor(
|
||||
private showService: ShowService,
|
||||
private activatedRoute: ActivatedRoute
|
||||
) {}
|
||||
private activatedRoute: ActivatedRoute,
|
||||
) {
|
||||
}
|
||||
|
||||
public trackBy = (index: number, show: unknown) => (show as Show).id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user