clean up and lint files

This commit is contained in:
2025-01-05 10:29:29 +01:00
parent 54ee9a5b11
commit 189478f078
137 changed files with 1096 additions and 1340 deletions

View File

@@ -8,8 +8,8 @@ describe('FilterComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [FilterComponent],
}).compileComponents();
imports: [FilterComponent],
}).compileComponents();
});
beforeEach(() => {

View File

@@ -1,7 +1,7 @@
import {Component, Input} from '@angular/core';
import { KeyValue, NgFor } from '@angular/common';
import {KeyValue, NgFor} from '@angular/common';
import {ActivatedRoute, Router} from '@angular/router';
import { UntypedFormBuilder, UntypedFormGroup, ReactiveFormsModule } from '@angular/forms';
import {ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup} from '@angular/forms';
import {FilterValues} from './filter-values';
import {Show} from '../../services/show';
import {ShowService} from '../../services/show.service';
@@ -10,25 +10,16 @@ import {combineLatest, Observable} from 'rxjs';
import {dynamicSort, onlyUnique} from '../../../../services/filter.helper';
import {UserService} from '../../../../services/user/user.service';
import {isEqual} from 'lodash';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatSelect } from '@angular/material/select';
import { MatOption, MatOptgroup } from '@angular/material/core';
import { ShowTypePipe } from '../../../../widget-modules/pipes/show-type-translater/show-type.pipe';
import {MatFormField, MatLabel} from '@angular/material/form-field';
import {MatSelect} from '@angular/material/select';
import {MatOptgroup, MatOption} from '@angular/material/core';
import {ShowTypePipe} from '../../../../widget-modules/pipes/show-type-translater/show-type.pipe';
@Component({
selector: 'app-filter',
templateUrl: './filter.component.html',
styleUrls: ['./filter.component.less'],
imports: [
ReactiveFormsModule,
MatFormField,
MatLabel,
MatSelect,
NgFor,
MatOption,
MatOptgroup,
ShowTypePipe,
],
selector: 'app-filter',
templateUrl: './filter.component.html',
styleUrls: ['./filter.component.less'],
imports: [ReactiveFormsModule, MatFormField, MatLabel, MatSelect, NgFor, MatOption, MatOptgroup, ShowTypePipe],
})
export class FilterComponent {
@Input() public route = '/shows/';
@@ -52,7 +43,7 @@ export class FilterComponent {
private showService: ShowService,
private userService: UserService,
activatedRoute: ActivatedRoute,
fb: UntypedFormBuilder,
fb: UntypedFormBuilder
) {
this.filterFormGroup = fb.group({
time: 1,
@@ -77,7 +68,7 @@ export class FilterComponent {
this.showService.list$().pipe(
map(shows => {
return shows.map(show => show.owner).filter(onlyUnique);
}),
})
),
this.userService.users$,
]).pipe(
@@ -90,7 +81,7 @@ export class FilterComponent {
.sort(dynamicSort('value'));
}),
distinctUntilChanged(isEqual),
map(_ => _ as {key: string; value: string}[]),
map(_ => _ as {key: string; value: string}[])
);
};

View File

@@ -6,13 +6,11 @@ describe('ListItemComponent', () => {
let component: ListItemComponent;
let fixture: ComponentFixture<ListItemComponent>;
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
imports: [ListItemComponent],
}).compileComponents();
}),
);
beforeEach(waitForAsync(() => {
void TestBed.configureTestingModule({
imports: [ListItemComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListItemComponent);

View File

@@ -1,19 +1,14 @@
import {Component, Input} from '@angular/core';
import {Show} from '../../services/show';
import { NgIf, DatePipe } from '@angular/common';
import { UserNameComponent } from '../../../../services/user/user-name/user-name.component';
import { ShowTypePipe } from '../../../../widget-modules/pipes/show-type-translater/show-type.pipe';
import {DatePipe, NgIf} from '@angular/common';
import {UserNameComponent} from '../../../../services/user/user-name/user-name.component';
import {ShowTypePipe} from '../../../../widget-modules/pipes/show-type-translater/show-type.pipe';
@Component({
selector: 'app-list-item',
templateUrl: './list-item.component.html',
styleUrls: ['./list-item.component.less'],
imports: [
NgIf,
UserNameComponent,
DatePipe,
ShowTypePipe,
],
selector: 'app-list-item',
templateUrl: './list-item.component.html',
styleUrls: ['./list-item.component.less'],
imports: [NgIf, UserNameComponent, DatePipe, ShowTypePipe],
})
export class ListItemComponent {
@Input() public show: Show | null = null;

View File

@@ -6,13 +6,11 @@ describe('ListComponent', () => {
let component: ListComponent;
let fixture: ComponentFixture<ListComponent>;
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
imports: [ListComponent],
}).compileComponents();
}),
);
beforeEach(waitForAsync(() => {
void TestBed.configureTestingModule({
imports: [ListComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListComponent);

View File

@@ -4,33 +4,22 @@ import {Show} from '../services/show';
import {fade} from '../../../animations';
import {ShowService} from '../services/show.service';
import {FilterValues} from './filter/filter-values';
import { ActivatedRoute, RouterLink } from '@angular/router';
import {ActivatedRoute, RouterLink} from '@angular/router';
import {map} from 'rxjs/operators';
import { RoleDirective } from '../../../services/user/role.directive';
import { ListHeaderComponent } from '../../../widget-modules/components/list-header/list-header.component';
import { NgIf, NgFor, AsyncPipe } from '@angular/common';
import { FilterComponent } from './filter/filter.component';
import { CardComponent } from '../../../widget-modules/components/card/card.component';
import { ListItemComponent } from './list-item/list-item.component';
import { SortByPipe } from '../../../widget-modules/pipes/sort-by/sort-by.pipe';
import {RoleDirective} from '../../../services/user/role.directive';
import {ListHeaderComponent} from '../../../widget-modules/components/list-header/list-header.component';
import {AsyncPipe, NgFor, NgIf} from '@angular/common';
import {FilterComponent} from './filter/filter.component';
import {CardComponent} from '../../../widget-modules/components/card/card.component';
import {ListItemComponent} from './list-item/list-item.component';
import {SortByPipe} from '../../../widget-modules/pipes/sort-by/sort-by.pipe';
@Component({
selector: 'app-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.less'],
animations: [fade],
imports: [
RoleDirective,
ListHeaderComponent,
NgIf,
FilterComponent,
CardComponent,
NgFor,
ListItemComponent,
RouterLink,
AsyncPipe,
SortByPipe,
],
selector: 'app-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.less'],
animations: [fade],
imports: [RoleDirective, ListHeaderComponent, NgIf, FilterComponent, CardComponent, NgFor, ListItemComponent, RouterLink, AsyncPipe, SortByPipe],
})
export class ListComponent {
public shows$ = this.showService.list$();
@@ -40,13 +29,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(
@@ -57,15 +46,14 @@ 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;
}