clean up and lint files
This commit is contained in:
@@ -8,8 +8,8 @@ describe('ArchiveDialogComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ArchiveDialogComponent],
|
||||
}).compileComponents();
|
||||
imports: [ArchiveDialogComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ArchiveDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
import {Component} from '@angular/core';
|
||||
import { CdkScrollable } from '@angular/cdk/scrolling';
|
||||
import { MatDialogContent, MatDialogActions, MatDialogClose } from '@angular/material/dialog';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import {MatDialogActions, MatDialogClose, MatDialogContent} from '@angular/material/dialog';
|
||||
import {MatButton} from '@angular/material/button';
|
||||
|
||||
@Component({
|
||||
selector: 'app-archive-dialog',
|
||||
templateUrl: './archive-dialog.component.html',
|
||||
styleUrls: ['./archive-dialog.component.less'],
|
||||
imports: [
|
||||
CdkScrollable,
|
||||
MatDialogContent,
|
||||
MatDialogActions,
|
||||
MatButton,
|
||||
MatDialogClose,
|
||||
],
|
||||
selector: 'app-archive-dialog',
|
||||
templateUrl: './archive-dialog.component.html',
|
||||
styleUrls: ['./archive-dialog.component.less'],
|
||||
imports: [MatDialogContent, MatDialogActions, MatButton, MatDialogClose],
|
||||
})
|
||||
export class ArchiveDialogComponent {
|
||||
}
|
||||
export class ArchiveDialogComponent {}
|
||||
|
||||
@@ -3,45 +3,45 @@ import {ShowDataService} from '../services/show-data.service';
|
||||
import {Observable, take} from 'rxjs';
|
||||
import {Show} from '../services/show';
|
||||
import {ShowService} from '../services/show.service';
|
||||
import { FormControl, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {faSave} from '@fortawesome/free-solid-svg-icons';
|
||||
import {map, switchMap} from 'rxjs/operators';
|
||||
import firebase from 'firebase/compat/app';
|
||||
import { CardComponent } from '../../../widget-modules/components/card/card.component';
|
||||
import { MatFormField, MatLabel, MatSuffix } from '@angular/material/form-field';
|
||||
import { MatSelect } from '@angular/material/select';
|
||||
import { MatOptgroup, MatOption } from '@angular/material/core';
|
||||
import { NgFor } from '@angular/common';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import { MatDatepickerInput, MatDatepickerToggle, MatDatepicker } from '@angular/material/datepicker';
|
||||
import { ButtonRowComponent } from '../../../widget-modules/components/button-row/button-row.component';
|
||||
import { ButtonComponent } from '../../../widget-modules/components/button/button.component';
|
||||
import { ShowTypePipe } from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||
import {CardComponent} from '../../../widget-modules/components/card/card.component';
|
||||
import {MatFormField, MatLabel, MatSuffix} from '@angular/material/form-field';
|
||||
import {MatSelect} from '@angular/material/select';
|
||||
import {MatOptgroup, MatOption} from '@angular/material/core';
|
||||
import {NgFor} from '@angular/common';
|
||||
import {MatInput} from '@angular/material/input';
|
||||
import {MatDatepicker, MatDatepickerInput, MatDatepickerToggle} from '@angular/material/datepicker';
|
||||
import {ButtonRowComponent} from '../../../widget-modules/components/button-row/button-row.component';
|
||||
import {ButtonComponent} from '../../../widget-modules/components/button/button.component';
|
||||
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||
import Timestamp = firebase.firestore.Timestamp;
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit',
|
||||
templateUrl: './edit.component.html',
|
||||
styleUrls: ['./edit.component.less'],
|
||||
imports: [
|
||||
CardComponent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatSelect,
|
||||
MatOptgroup,
|
||||
NgFor,
|
||||
MatOption,
|
||||
MatInput,
|
||||
MatDatepickerInput,
|
||||
MatDatepickerToggle,
|
||||
MatSuffix,
|
||||
MatDatepicker,
|
||||
ButtonRowComponent,
|
||||
ButtonComponent,
|
||||
ShowTypePipe,
|
||||
],
|
||||
selector: 'app-edit',
|
||||
templateUrl: './edit.component.html',
|
||||
styleUrls: ['./edit.component.less'],
|
||||
imports: [
|
||||
CardComponent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatSelect,
|
||||
MatOptgroup,
|
||||
NgFor,
|
||||
MatOption,
|
||||
MatInput,
|
||||
MatDatepickerInput,
|
||||
MatDatepickerToggle,
|
||||
MatSuffix,
|
||||
MatDatepicker,
|
||||
ButtonRowComponent,
|
||||
ButtonComponent,
|
||||
ShowTypePipe,
|
||||
],
|
||||
})
|
||||
export class EditComponent implements OnInit {
|
||||
public shows$: Observable<Show[]>;
|
||||
@@ -54,7 +54,12 @@ export class EditComponent implements OnInit {
|
||||
});
|
||||
public faSave = faSave;
|
||||
|
||||
public constructor(private showService: ShowService, showDataService: ShowDataService, private router: Router, private activatedRoute: ActivatedRoute) {
|
||||
public constructor(
|
||||
private showService: ShowService,
|
||||
showDataService: ShowDataService,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute
|
||||
) {
|
||||
this.shows$ = showDataService.list$;
|
||||
}
|
||||
|
||||
@@ -66,7 +71,7 @@ export class EditComponent implements OnInit {
|
||||
map(param => param as {showId: string}),
|
||||
map(param => param.showId),
|
||||
switchMap((showId: string) => this.showService.read$(showId)),
|
||||
take(1),
|
||||
take(1)
|
||||
)
|
||||
.subscribe(show => {
|
||||
this.form.setValue({
|
||||
@@ -83,13 +88,10 @@ export class EditComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.showService.update$(
|
||||
this.form.value.id as string,
|
||||
{
|
||||
date: Timestamp.fromDate(this.form.value.date),
|
||||
showType: this.form.value.showType,
|
||||
} as Partial<Show>,
|
||||
);
|
||||
await this.showService.update$(this.form.value.id, {
|
||||
date: Timestamp.fromDate(this.form.value.date),
|
||||
showType: this.form.value.showType,
|
||||
} as Partial<Show>);
|
||||
await this.router.navigateByUrl(`/shows/${this.form.value.id ?? ''}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ describe('FilterComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [FilterComponent],
|
||||
}).compileComponents();
|
||||
imports: [FilterComponent],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -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}[])
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -6,13 +6,11 @@ describe('NewComponent', () => {
|
||||
let component: NewComponent;
|
||||
let fixture: ComponentFixture<NewComponent>;
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [NewComponent],
|
||||
}).compileComponents();
|
||||
}),
|
||||
);
|
||||
beforeEach(waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [NewComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NewComponent);
|
||||
|
||||
@@ -3,42 +3,42 @@ import {ShowDataService} from '../services/show-data.service';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Show} from '../services/show';
|
||||
import {ShowService} from '../services/show.service';
|
||||
import { UntypedFormControl, UntypedFormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import {ReactiveFormsModule, UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
|
||||
import {Router} from '@angular/router';
|
||||
import {faSave} from '@fortawesome/free-solid-svg-icons';
|
||||
import { CardComponent } from '../../../widget-modules/components/card/card.component';
|
||||
import { MatFormField, MatLabel, MatSuffix } from '@angular/material/form-field';
|
||||
import { MatSelect } from '@angular/material/select';
|
||||
import { MatOptgroup, MatOption } from '@angular/material/core';
|
||||
import { NgFor } from '@angular/common';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import { MatDatepickerInput, MatDatepickerToggle, MatDatepicker } from '@angular/material/datepicker';
|
||||
import { ButtonRowComponent } from '../../../widget-modules/components/button-row/button-row.component';
|
||||
import { ButtonComponent } from '../../../widget-modules/components/button/button.component';
|
||||
import { ShowTypePipe } from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||
import {CardComponent} from '../../../widget-modules/components/card/card.component';
|
||||
import {MatFormField, MatLabel, MatSuffix} from '@angular/material/form-field';
|
||||
import {MatSelect} from '@angular/material/select';
|
||||
import {MatOptgroup, MatOption} from '@angular/material/core';
|
||||
import {NgFor} from '@angular/common';
|
||||
import {MatInput} from '@angular/material/input';
|
||||
import {MatDatepicker, MatDatepickerInput, MatDatepickerToggle} from '@angular/material/datepicker';
|
||||
import {ButtonRowComponent} from '../../../widget-modules/components/button-row/button-row.component';
|
||||
import {ButtonComponent} from '../../../widget-modules/components/button/button.component';
|
||||
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new',
|
||||
templateUrl: './new.component.html',
|
||||
styleUrls: ['./new.component.less'],
|
||||
imports: [
|
||||
CardComponent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatSelect,
|
||||
MatOptgroup,
|
||||
NgFor,
|
||||
MatOption,
|
||||
MatInput,
|
||||
MatDatepickerInput,
|
||||
MatDatepickerToggle,
|
||||
MatSuffix,
|
||||
MatDatepicker,
|
||||
ButtonRowComponent,
|
||||
ButtonComponent,
|
||||
ShowTypePipe,
|
||||
],
|
||||
selector: 'app-new',
|
||||
templateUrl: './new.component.html',
|
||||
styleUrls: ['./new.component.less'],
|
||||
imports: [
|
||||
CardComponent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatSelect,
|
||||
MatOptgroup,
|
||||
NgFor,
|
||||
MatOption,
|
||||
MatInput,
|
||||
MatDatepickerInput,
|
||||
MatDatepickerToggle,
|
||||
MatSuffix,
|
||||
MatDatepicker,
|
||||
ButtonRowComponent,
|
||||
ButtonComponent,
|
||||
ShowTypePipe,
|
||||
],
|
||||
})
|
||||
export class NewComponent implements OnInit {
|
||||
public shows$: Observable<Show[]>;
|
||||
@@ -53,7 +53,7 @@ export class NewComponent implements OnInit {
|
||||
public constructor(
|
||||
private showService: ShowService,
|
||||
showDataService: ShowDataService,
|
||||
private router: Router,
|
||||
private router: Router
|
||||
) {
|
||||
this.shows$ = showDataService.list$;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import {ShowService} from './show.service';
|
||||
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||
import {ShowSongService} from './show-song.service';
|
||||
import {Song} from '../../songs/services/song';
|
||||
import {SongService} from '../../songs/services/song.service';
|
||||
import {ShowSong} from './show-song';
|
||||
import {Show} from './show';
|
||||
import {ChordMode} from '../../../widget-modules/components/song-text/song-text.component';
|
||||
@@ -32,7 +31,7 @@ export class DocxService {
|
||||
private showSongService: ShowSongService,
|
||||
private textRenderingService: TextRenderingService,
|
||||
private userService: UserService,
|
||||
private configService: ConfigService,
|
||||
private configService: ConfigService
|
||||
) {}
|
||||
|
||||
public async create(showId: string, options: DownloadOptions = {}): Promise<void> {
|
||||
|
||||
@@ -11,8 +11,7 @@ export class ShowSongDataService {
|
||||
private collection = 'shows';
|
||||
private subCollection = 'songs';
|
||||
|
||||
public constructor(private dbService: DbService) {
|
||||
}
|
||||
public constructor(private dbService: DbService) {}
|
||||
|
||||
public list$ = (showId: string, queryFn?: QueryFn): Observable<ShowSong[]> => this.dbService.col$(`${this.collection}/${showId}/${this.subCollection}`, queryFn);
|
||||
public read$ = (showId: string, songId: string): Observable<ShowSong | null> => this.dbService.doc$(`${this.collection}/${showId}/${this.subCollection}/${songId}`);
|
||||
|
||||
@@ -14,9 +14,8 @@ export class ShowSongService {
|
||||
private showSongDataService: ShowSongDataService,
|
||||
private songDataService: SongDataService,
|
||||
private userService: UserService,
|
||||
private showService: ShowService,
|
||||
) {
|
||||
}
|
||||
private showService: ShowService
|
||||
) {}
|
||||
|
||||
public async new$(showId: string, songId: string, addedLive = false): Promise<string | null> {
|
||||
const song = await firstValueFrom(this.songDataService.read$(songId));
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('ShowService', () => {
|
||||
() =>
|
||||
void TestBed.configureTestingModule({
|
||||
providers: [{provide: ShowDataService, useValue: mockShowDataService}],
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
ShowService.SHOW_TYPE_PUBLIC.forEach(type => {
|
||||
|
||||
@@ -15,7 +15,10 @@ export class ShowService {
|
||||
public static SHOW_TYPE_PRIVATE = ['home-group', 'prayer-group', 'misc-private'];
|
||||
private user: User | null = null;
|
||||
|
||||
public constructor(private showDataService: ShowDataService, private userService: UserService) {
|
||||
public constructor(
|
||||
private showDataService: ShowDataService,
|
||||
private userService: UserService
|
||||
) {
|
||||
userService.user$.subscribe(_ => (this.user = _));
|
||||
}
|
||||
|
||||
@@ -25,14 +28,14 @@ export class ShowService {
|
||||
return this.userService.user$.pipe(
|
||||
switchMap(
|
||||
() => this.showDataService.list$,
|
||||
(user: User | null, shows: Show[]) => ({user, shows}),
|
||||
(user: User | null, shows: Show[]) => ({user, shows})
|
||||
),
|
||||
map(s =>
|
||||
s.shows
|
||||
.sort((a, b) => a.date.toMillis() - b.date.toMillis())
|
||||
.filter(_ => !_.archived)
|
||||
.filter(show => show.published || (show.owner === s.user?.id && !publishedOnly)),
|
||||
),
|
||||
.filter(show => show.published || (show.owner === s.user?.id && !publishedOnly))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
matTooltip="Swiper umschalten"></app-menu-button>
|
||||
</div>
|
||||
</div>
|
||||
<div (cdkDropListDropped)="drop($event, show)" *ngIf="showSongs && !useSwiper" [cdkDropListDisabled]="show.published || showText"
|
||||
<div (cdkDropListDropped)="drop($event, show)" *ngIf="showSongs && !useSwiper"
|
||||
[cdkDropListDisabled]="show.published || showText"
|
||||
[style.cursor]="!(show.published || showText) ? 'drag' : 'inherit'"
|
||||
[style.font-size]="textSize + 'em'"
|
||||
cdkDropList
|
||||
@@ -52,7 +53,9 @@
|
||||
[showText]="true"
|
||||
[show]="show"
|
||||
></app-song>
|
||||
<div class="next-song" *ngIf="getNextSong(orderedShowSongs(show), i) as next">{{next}}<fa-icon [icon]="faNextSong"></fa-icon></div>
|
||||
<div *ngIf="getNextSong(orderedShowSongs(show), i) as next" class="next-song">{{ next }}
|
||||
<fa-icon [icon]="faNextSong"></fa-icon>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
</swiper-container>
|
||||
|
||||
|
||||
@@ -6,13 +6,11 @@ describe('ShowComponent', () => {
|
||||
let component: ShowComponent;
|
||||
let fixture: ComponentFixture<ShowComponent>;
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [ShowComponent],
|
||||
}).compileComponents();
|
||||
}),
|
||||
);
|
||||
beforeEach(waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [ShowComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ShowComponent);
|
||||
|
||||
@@ -25,60 +25,60 @@ import {
|
||||
faUser,
|
||||
faUsers,
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import { CdkDragDrop, moveItemInArray, CdkDropList, CdkDrag } from '@angular/cdk/drag-drop';
|
||||
import {CdkDrag, CdkDragDrop, CdkDropList, moveItemInArray} from '@angular/cdk/drag-drop';
|
||||
import {fade} from '../../../animations';
|
||||
import {MatDialog} from '@angular/material/dialog';
|
||||
import {ArchiveDialogComponent} from '../dialog/archive-dialog/archive-dialog.component';
|
||||
import {closeFullscreen, openFullscreen} from '../../../services/fullscreen';
|
||||
import {GuestShowService} from '../../guest/guest-show.service';
|
||||
import {ShareDialogComponent} from '../dialog/share-dialog/share-dialog.component';
|
||||
import { NgIf, NgFor, AsyncPipe, DatePipe } from '@angular/common';
|
||||
import { CardComponent } from '../../../widget-modules/components/card/card.component';
|
||||
import { UserNameComponent } from '../../../services/user/user-name/user-name.component';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
||||
import { MenuButtonComponent } from '../../../widget-modules/components/menu-button/menu-button.component';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { SongComponent } from './song/song.component';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { AddSongComponent } from '../../../widget-modules/components/add-song/add-song.component';
|
||||
import { ButtonRowComponent } from '../../../widget-modules/components/button-row/button-row.component';
|
||||
import { RoleDirective } from '../../../services/user/role.directive';
|
||||
import { OwnerDirective } from '../../../services/user/owner.directive';
|
||||
import { ButtonComponent } from '../../../widget-modules/components/button/button.component';
|
||||
import { MatMenuTrigger, MatMenu } from '@angular/material/menu';
|
||||
import { ShowTypePipe } from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||
import {AsyncPipe, DatePipe, NgFor, NgIf} from '@angular/common';
|
||||
import {CardComponent} from '../../../widget-modules/components/card/card.component';
|
||||
import {UserNameComponent} from '../../../services/user/user-name/user-name.component';
|
||||
import {MatCheckbox} from '@angular/material/checkbox';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {MenuButtonComponent} from '../../../widget-modules/components/menu-button/menu-button.component';
|
||||
import {MatTooltip} from '@angular/material/tooltip';
|
||||
import {SongComponent} from './song/song.component';
|
||||
import {FaIconComponent} from '@fortawesome/angular-fontawesome';
|
||||
import {AddSongComponent} from '../../../widget-modules/components/add-song/add-song.component';
|
||||
import {ButtonRowComponent} from '../../../widget-modules/components/button-row/button-row.component';
|
||||
import {RoleDirective} from '../../../services/user/role.directive';
|
||||
import {OwnerDirective} from '../../../services/user/owner.directive';
|
||||
import {ButtonComponent} from '../../../widget-modules/components/button/button.component';
|
||||
import {MatMenu, MatMenuTrigger} from '@angular/material/menu';
|
||||
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-show',
|
||||
templateUrl: './show.component.html',
|
||||
styleUrls: ['./show.component.less'],
|
||||
animations: [fade],
|
||||
imports: [
|
||||
NgIf,
|
||||
CardComponent,
|
||||
UserNameComponent,
|
||||
MatCheckbox,
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
MenuButtonComponent,
|
||||
MatTooltip,
|
||||
CdkDropList,
|
||||
NgFor,
|
||||
CdkDrag,
|
||||
SongComponent,
|
||||
FaIconComponent,
|
||||
AddSongComponent,
|
||||
ButtonRowComponent,
|
||||
RoleDirective,
|
||||
OwnerDirective,
|
||||
ButtonComponent,
|
||||
MatMenuTrigger,
|
||||
MatMenu,
|
||||
AsyncPipe,
|
||||
DatePipe,
|
||||
ShowTypePipe,
|
||||
],
|
||||
selector: 'app-show',
|
||||
templateUrl: './show.component.html',
|
||||
styleUrls: ['./show.component.less'],
|
||||
animations: [fade],
|
||||
imports: [
|
||||
NgIf,
|
||||
CardComponent,
|
||||
UserNameComponent,
|
||||
MatCheckbox,
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
MenuButtonComponent,
|
||||
MatTooltip,
|
||||
CdkDropList,
|
||||
NgFor,
|
||||
CdkDrag,
|
||||
SongComponent,
|
||||
FaIconComponent,
|
||||
AddSongComponent,
|
||||
ButtonRowComponent,
|
||||
RoleDirective,
|
||||
OwnerDirective,
|
||||
ButtonComponent,
|
||||
MatMenuTrigger,
|
||||
MatMenu,
|
||||
AsyncPipe,
|
||||
DatePipe,
|
||||
ShowTypePipe,
|
||||
],
|
||||
})
|
||||
export class ShowComponent implements OnInit, OnDestroy {
|
||||
public show$: Observable<Show | null> | null = null;
|
||||
@@ -114,16 +114,15 @@ export class ShowComponent implements OnInit, OnDestroy {
|
||||
private router: Router,
|
||||
private cRef: ChangeDetectorRef,
|
||||
public dialog: MatDialog,
|
||||
private guestShowService: GuestShowService,
|
||||
) {
|
||||
}
|
||||
private guestShowService: GuestShowService
|
||||
) {}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.show$ = this.activatedRoute.params.pipe(
|
||||
map(param => param as {showId: string}),
|
||||
map(param => param.showId),
|
||||
tap((_: string) => (this.showId = _)),
|
||||
switchMap((showId: string) => this.showService.read$(showId)),
|
||||
switchMap((showId: string) => this.showService.read$(showId))
|
||||
);
|
||||
this.subs.push(
|
||||
this.activatedRoute.params
|
||||
@@ -131,7 +130,7 @@ export class ShowComponent implements OnInit, OnDestroy {
|
||||
map(param => param as {showId: string}),
|
||||
map(param => param.showId),
|
||||
switchMap(showId => this.showSongService.list$(showId)),
|
||||
filter(_ => !!_ && _.length > 0),
|
||||
filter(_ => !!_ && _.length > 0)
|
||||
)
|
||||
.subscribe(_ => {
|
||||
this.showSongs = _;
|
||||
@@ -143,7 +142,7 @@ export class ShowComponent implements OnInit, OnDestroy {
|
||||
.subscribe(_ => {
|
||||
this.songs = _;
|
||||
this.cRef.markForCheck();
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,11 @@ describe('SongComponent', () => {
|
||||
let component: SongComponent;
|
||||
let fixture: ComponentFixture<SongComponent>;
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [SongComponent],
|
||||
}).compileComponents();
|
||||
}),
|
||||
);
|
||||
beforeEach(waitForAsync(() => {
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [SongComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SongComponent);
|
||||
|
||||
@@ -2,43 +2,43 @@ import {Component, Input, OnInit, ViewChild} from '@angular/core';
|
||||
import {ShowSongService} from '../../services/show-song.service';
|
||||
import {ShowSong} from '../../services/show-song';
|
||||
import {getScale} from '../../../songs/services/key.helper';
|
||||
import { UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ChordMode, SongTextComponent } from '../../../../widget-modules/components/song-text/song-text.component';
|
||||
import {ReactiveFormsModule, UntypedFormControl} from '@angular/forms';
|
||||
import {ChordMode, SongTextComponent} from '../../../../widget-modules/components/song-text/song-text.component';
|
||||
import {Show} from '../../services/show';
|
||||
import {faEraser, faPenToSquare, faSave, faTrash} from '@fortawesome/free-solid-svg-icons';
|
||||
import {fade} from '../../../../animations';
|
||||
import {MatSelect} from '@angular/material/select';
|
||||
import { NgIf, NgFor } from '@angular/common';
|
||||
import { MatFormField, MatLabel } from '@angular/material/form-field';
|
||||
import { MatOption } from '@angular/material/core';
|
||||
import { MenuButtonComponent } from '../../../../widget-modules/components/menu-button/menu-button.component';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||
import { ButtonRowComponent } from '../../../../widget-modules/components/button-row/button-row.component';
|
||||
import { ButtonComponent } from '../../../../widget-modules/components/button/button.component';
|
||||
import {NgFor, NgIf} from '@angular/common';
|
||||
import {MatFormField, MatLabel} from '@angular/material/form-field';
|
||||
import {MatOption} from '@angular/material/core';
|
||||
import {MenuButtonComponent} from '../../../../widget-modules/components/menu-button/menu-button.component';
|
||||
import {MatTooltip} from '@angular/material/tooltip';
|
||||
import {MatInput} from '@angular/material/input';
|
||||
import {CdkTextareaAutosize} from '@angular/cdk/text-field';
|
||||
import {ButtonRowComponent} from '../../../../widget-modules/components/button-row/button-row.component';
|
||||
import {ButtonComponent} from '../../../../widget-modules/components/button/button.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-song',
|
||||
templateUrl: './song.component.html',
|
||||
styleUrls: ['./song.component.less'],
|
||||
animations: [fade],
|
||||
imports: [
|
||||
NgIf,
|
||||
MatFormField,
|
||||
MatSelect,
|
||||
ReactiveFormsModule,
|
||||
NgFor,
|
||||
MatOption,
|
||||
MenuButtonComponent,
|
||||
MatTooltip,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
CdkTextareaAutosize,
|
||||
ButtonRowComponent,
|
||||
ButtonComponent,
|
||||
SongTextComponent,
|
||||
],
|
||||
selector: 'app-song',
|
||||
templateUrl: './song.component.html',
|
||||
styleUrls: ['./song.component.less'],
|
||||
animations: [fade],
|
||||
imports: [
|
||||
NgIf,
|
||||
MatFormField,
|
||||
MatSelect,
|
||||
ReactiveFormsModule,
|
||||
NgFor,
|
||||
MatOption,
|
||||
MenuButtonComponent,
|
||||
MatTooltip,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
CdkTextareaAutosize,
|
||||
ButtonRowComponent,
|
||||
ButtonComponent,
|
||||
SongTextComponent,
|
||||
],
|
||||
})
|
||||
export class SongComponent implements OnInit {
|
||||
@Input() public show: Show | null = null;
|
||||
@@ -57,8 +57,7 @@ export class SongComponent implements OnInit {
|
||||
public editSongControl = new UntypedFormControl();
|
||||
@ViewChild('option') private keyOptions: MatSelect;
|
||||
|
||||
public constructor(private showSongService: ShowSongService) {
|
||||
}
|
||||
public constructor(private showSongService: ShowSongService) {}
|
||||
|
||||
@Input()
|
||||
public set showSong(song: ShowSong) {
|
||||
|
||||
@@ -29,5 +29,4 @@ const routes: Routes = [
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class ShowsRoutingModule {
|
||||
}
|
||||
export class ShowsRoutingModule {}
|
||||
|
||||
@@ -22,8 +22,6 @@ import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
|
||||
|
||||
import {NgxMatSelectSearchModule} from 'ngx-mat-select-search';
|
||||
|
||||
|
||||
|
||||
import {MatMenuModule} from '@angular/material/menu';
|
||||
import {DragDropModule} from '@angular/cdk/drag-drop';
|
||||
|
||||
@@ -38,7 +36,7 @@ import {ShowTypePipe} from '../../widget-modules/pipes/show-type-translater/show
|
||||
import {SortByPipe} from '../../widget-modules/pipes/sort-by/sort-by.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
imports: [
|
||||
CommonModule,
|
||||
ShowsRoutingModule,
|
||||
MatFormFieldModule,
|
||||
@@ -60,8 +58,15 @@ import {SortByPipe} from '../../widget-modules/pipes/sort-by/sort-by.pipe';
|
||||
SortByPipe,
|
||||
MatTooltipModule,
|
||||
MatDialogModule,
|
||||
NewComponent, ListComponent, ListItemComponent, ShowComponent, SongComponent, FilterComponent, EditComponent, ArchiveDialogComponent,
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
NewComponent,
|
||||
ListComponent,
|
||||
ListItemComponent,
|
||||
ShowComponent,
|
||||
SongComponent,
|
||||
FilterComponent,
|
||||
EditComponent,
|
||||
ArchiveDialogComponent,
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
export class ShowsModule {}
|
||||
|
||||
Reference in New Issue
Block a user