diff --git a/src/app/modules/shows/list/filter/filter.component.ts b/src/app/modules/shows/list/filter/filter.component.ts
index 8a03384..b8663b6 100644
--- a/src/app/modules/shows/list/filter/filter.component.ts
+++ b/src/app/modules/shows/list/filter/filter.component.ts
@@ -29,7 +29,7 @@ export class FilterComponent {
activatedRoute.queryParams.subscribe(params => {
const filterValues = params as FilterValues;
- if (filterValues.time) this.filterFormGroup.controls.time.setValue(filterValues.time);
+ if (filterValues.time) this.filterFormGroup.controls.time.setValue(+filterValues.time);
});
this.filterFormGroup.controls.time.valueChanges.subscribe(_ => void this.filerValueChanged('time', _ as number));
diff --git a/src/app/modules/shows/list/list-item/list-item.component.less b/src/app/modules/shows/list/list-item/list-item.component.less
index a363605..87f5de2 100644
--- a/src/app/modules/shows/list/list-item/list-item.component.less
+++ b/src/app/modules/shows/list/list-item/list-item.component.less
@@ -4,7 +4,7 @@
padding: 5px 20px;
display: grid;
grid-template-columns: 100px 200px auto;
- min-height: 34px;
+ min-height: 21px;
& > div {
display: flex;
diff --git a/src/app/modules/shows/list/list.component.html b/src/app/modules/shows/list/list.component.html
index c06e038..da78d80 100644
--- a/src/app/modules/shows/list/list.component.html
+++ b/src/app/modules/shows/list/list.component.html
@@ -1,8 +1,8 @@
-
-
-
-
+
+
+
+
@@ -21,15 +21,15 @@
-
+
0"
+ *ngIf="shows.length > 0"
@fade
[padding]="false"
heading="veröffentlichte Veranstaltungen"
>
diff --git a/src/app/modules/shows/list/list.component.ts b/src/app/modules/shows/list/list.component.ts
index 112fb54..c6268a6 100644
--- a/src/app/modules/shows/list/list.component.ts
+++ b/src/app/modules/shows/list/list.component.ts
@@ -1,8 +1,11 @@
import {Component} from '@angular/core';
-import {Observable} from 'rxjs';
+import {combineLatest, Observable} from 'rxjs';
import {Show} from '../services/show';
import {fade} from '../../../animations';
import {ShowService} from '../services/show.service';
+import {FilterValues} from './filter/filter-values';
+import {ActivatedRoute} from '@angular/router';
+import {map} from 'rxjs/operators';
@Component({
selector: 'app-list',
@@ -12,13 +15,28 @@ import {ShowService} from '../services/show.service';
})
export class ListComponent {
public shows$: Observable;
+ public publicShows$: Observable;
+ public lastMonths$: Observable;
- public constructor(showService: ShowService) {
+ public constructor(showService: ShowService, activatedRoute: ActivatedRoute) {
this.shows$ = showService.list$();
- }
+ this.lastMonths$ = activatedRoute.queryParams.pipe(
+ map(params => {
+ const filterValues = params as FilterValues;
+ if (!filterValues?.time) return 3;
+ return +filterValues.time;
+ })
+ );
- public getPublicShows(songs: Show[]): Show[] {
- return songs.filter(_ => _.published);
+ this.publicShows$ = combineLatest([this.shows$, this.lastMonths$]).pipe(
+ map(_ =>
+ _[0].filter(f => {
+ const d = new Date();
+ d.setMonth(d.getMonth() - _[1]);
+ return f.published && f.date.toDate() >= d;
+ })
+ )
+ );
}
public getPrivateSongs(songs: Show[]): Show[] {