update tslint -> eslint

This commit is contained in:
2021-05-21 20:17:26 +02:00
parent 80260df71f
commit a195fafa6b
252 changed files with 3080 additions and 2420 deletions

View File

@@ -3,9 +3,13 @@
<mat-label>Lied hinzufügen...</mat-label>
<mat-select (selectionChange)="onAddSongSelectionChanged($event)">
<mat-option>
<ngx-mat-select-search [formControl]="filteredSongsControl"></ngx-mat-select-search>
<ngx-mat-select-search
[formControl]="filteredSongsControl"
></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let song of filteredSongs()" [value]="song.id">{{song.title}}</mat-option>
<mat-option *ngFor="let song of filteredSongs()" [value]="song.id">{{
song.title
}}</mat-option>
</mat-select>
</mat-form-field>
</div>

View File

@@ -6,12 +6,13 @@ describe('AddSongComponent', () => {
let component: AddSongComponent;
let fixture: ComponentFixture<AddSongComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [AddSongComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [AddSongComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(AddSongComponent);
@@ -20,6 +21,6 @@ describe('AddSongComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -9,7 +9,7 @@ import {ShowSongService} from '../../../modules/shows/services/show-song.service
@Component({
selector: 'app-add-song',
templateUrl: './add-song.component.html',
styleUrls: ['./add-song.component.less']
styleUrls: ['./add-song.component.less'],
})
export class AddSongComponent {
@Input() public songs: Song[];
@@ -18,10 +18,9 @@ export class AddSongComponent {
@Input() public addedLive = false;
public filteredSongsControl = new FormControl();
constructor(private showSongService: ShowSongService) {
}
public constructor(private showSongService: ShowSongService) {}
filteredSongs() {
public filteredSongs(): Song[] {
const songs = this.songs
.filter(_ => !!_)
.filter(_ => !!_.title)
@@ -37,14 +36,13 @@ export class AddSongComponent {
return 0;
});
const filterValue = this.filteredSongsControl.value;
const filterValue = this.filteredSongsControl.value as string;
return filterValue ? songs.filter(_ => filterSong(_, filterValue)) : songs;
}
public async onAddSongSelectionChanged(event: MatSelectChange) {
public async onAddSongSelectionChanged(event: MatSelectChange): Promise<void> {
const order = this.showSongs.reduce((oa, u) => Math.max(oa, u.order), 0) + 1;
await this.showSongService.new$(this.showId, event.value, order, this.addedLive);
event.source.value = null;
}
}

View File

@@ -6,19 +6,9 @@ import {MatSelectModule} from '@angular/material/select';
import {NgxMatSelectSearchModule} from 'ngx-mat-select-search';
import {ReactiveFormsModule} from '@angular/forms';
@NgModule({
declarations: [AddSongComponent],
exports: [
AddSongComponent
],
imports: [
CommonModule,
MatFormFieldModule,
MatSelectModule,
NgxMatSelectSearchModule,
ReactiveFormsModule
]
exports: [AddSongComponent],
imports: [CommonModule, MatFormFieldModule, MatSelectModule, NgxMatSelectSearchModule, ReactiveFormsModule],
})
export class AddSongModule {
}
export class AddSongModule {}

View File

@@ -10,22 +10,8 @@ import {RoleModule} from '../../../services/user/role.module';
import {BrandComponent} from './navigation/brand/brand.component';
@NgModule({
declarations: [
NavigationComponent,
FilterComponent,
LinkComponent,
BrandComponent
],
imports: [
CommonModule,
RouterModule,
FontAwesomeModule,
FormsModule,
RoleModule
],
exports: [
NavigationComponent
]
declarations: [NavigationComponent, FilterComponent, LinkComponent, BrandComponent],
imports: [CommonModule, RouterModule, FontAwesomeModule, FormsModule, RoleModule],
exports: [NavigationComponent],
})
export class ApplicationFrameModule {
}
export class ApplicationFrameModule {}

File diff suppressed because one or more lines are too long

View File

@@ -6,12 +6,13 @@ describe('BrandComponent', () => {
let component: BrandComponent;
let fixture: ComponentFixture<BrandComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [BrandComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [BrandComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(BrandComponent);
@@ -20,6 +21,6 @@ describe('BrandComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -1,16 +1,8 @@
import {Component, OnInit} from '@angular/core';
import {Component} from '@angular/core';
@Component({
selector: 'app-brand',
templateUrl: './brand.component.html',
styleUrls: ['./brand.component.less']
styleUrls: ['./brand.component.less'],
})
export class BrandComponent implements OnInit {
constructor() {
}
ngOnInit(): void {
}
}
export class BrandComponent {}

View File

@@ -1 +1,5 @@
<input (ngModelChange)="valueChange($event)" [ngModel]="value" placeholder="Suche">
<input
(ngModelChange)="valueChange($event)"
[ngModel]="value"
placeholder="Suche"
/>

View File

@@ -6,12 +6,13 @@ describe('FilterComponent', () => {
let component: FilterComponent;
let fixture: ComponentFixture<FilterComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [FilterComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [FilterComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(FilterComponent);
@@ -20,6 +21,6 @@ describe('FilterComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -4,13 +4,13 @@ import {ActivatedRoute, Router} from '@angular/router';
@Component({
selector: 'app-filter',
templateUrl: './filter.component.html',
styleUrls: ['./filter.component.less']
styleUrls: ['./filter.component.less'],
})
export class FilterComponent {
public value: string;
constructor(private router: Router, activatedRoute: ActivatedRoute) {
activatedRoute.queryParams.subscribe(_ => {
public constructor(private router: Router, activatedRoute: ActivatedRoute) {
activatedRoute.queryParams.subscribe((_: {q: string}) => {
if (_.q) {
this.value = _.q;
}
@@ -18,7 +18,10 @@ export class FilterComponent {
}
public async valueChange(text: string): Promise<void> {
const route = this.router.createUrlTree(['songs'], {queryParams: {q: text}, queryParamsHandling: 'merge'});
const route = this.router.createUrlTree(['songs'], {
queryParams: {q: text},
queryParamsHandling: 'merge',
});
await this.router.navigateByUrl(route);
}
}

View File

@@ -1,3 +1,4 @@
<a [routerLink]="link" href="#" routerLinkActive="active">
<fa-icon [icon]="icon"></fa-icon>
<span class="link-text">&nbsp;&nbsp;{{text}}</span></a>
<span class="link-text">&nbsp;&nbsp;{{ text }}</span></a
>

View File

@@ -6,12 +6,13 @@ describe('LinkComponent', () => {
let component: LinkComponent;
let fixture: ComponentFixture<LinkComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [LinkComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [LinkComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(LinkComponent);
@@ -20,6 +21,6 @@ describe('LinkComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -4,7 +4,7 @@ import {IconProp} from '@fortawesome/fontawesome-svg-core';
@Component({
selector: 'app-link',
templateUrl: './link.component.html',
styleUrls: ['./link.component.less']
styleUrls: ['./link.component.less'],
})
export class LinkComponent {
@Input() public text: string;

View File

@@ -1,14 +1,27 @@
<nav [class.hidden]="(windowScroll$|async)>60" class="head">
<nav [class.hidden]="(windowScroll$ | async) > 60" class="head">
<div class="links">
<app-brand routerLink="/brand"></app-brand>
<app-link *appRole="['user','presenter', 'leader']" [icon]="faSongs" link="/songs" text="Lieder"></app-link>
<app-link *appRole="['leader']" [icon]="faShows" link="/shows" text="Veranstaltungen"></app-link>
<app-link *appRole="['presenter']" [icon]="faPresentation" link="/presentation" text="Präsentation"></app-link>
<app-link
*appRole="['user', 'presenter', 'leader']"
[icon]="faSongs"
link="/songs"
text="Lieder"
></app-link>
<app-link
*appRole="['leader']"
[icon]="faShows"
link="/shows"
text="Veranstaltungen"
></app-link>
<app-link
*appRole="['presenter']"
[icon]="faPresentation"
link="/presentation"
text="Präsentation"
></app-link>
<app-link [icon]="faUser" link="/user" text="Benutzer"></app-link>
</div>
<div *appRole="['user','presenter', 'leader']" class="actions">
<div *appRole="['user', 'presenter', 'leader']" class="actions">
<app-filter></app-filter>
</div>
</nav>

View File

@@ -6,12 +6,13 @@ describe('NavigationComponent', () => {
let component: NavigationComponent;
let fixture: ComponentFixture<NavigationComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [NavigationComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [NavigationComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(NavigationComponent);
@@ -20,6 +21,6 @@ describe('NavigationComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -9,15 +9,18 @@ import {faChalkboard} from '@fortawesome/free-solid-svg-icons/faChalkboard';
@Component({
selector: 'app-navigation',
templateUrl: './navigation.component.html',
styleUrls: ['./navigation.component.less']
styleUrls: ['./navigation.component.less'],
})
export class NavigationComponent {
public faSongs = faMusic;
public faShows = faPersonBooth;
public faUser = faUserCog;
public faPresentation = faChalkboard;
public readonly windowScroll$ = fromEvent(window, 'scroll').pipe(map(x => window.scrollY), startWith(0), distinctUntilChanged(), shareReplay(1));
public readonly windowScroll$ = fromEvent(window, 'scroll').pipe(
map(() => window.scrollY),
startWith(0),
distinctUntilChanged(),
shareReplay(1)
);
}

View File

@@ -6,12 +6,13 @@ describe('ButtonRowComponent', () => {
let component: ButtonRowComponent;
let fixture: ComponentFixture<ButtonRowComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ButtonRowComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [ButtonRowComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(ButtonRowComponent);
@@ -20,6 +21,6 @@ describe('ButtonRowComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -1,16 +1,8 @@
import {Component, OnInit} from '@angular/core';
import {Component} from '@angular/core';
@Component({
selector: 'app-button-row',
templateUrl: './button-row.component.html',
styleUrls: ['./button-row.component.less']
styleUrls: ['./button-row.component.less'],
})
export class ButtonRowComponent implements OnInit {
constructor() {
}
ngOnInit() {
}
}
export class ButtonRowComponent {}

View File

@@ -2,13 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {ButtonRowComponent} from './button-row.component';
@NgModule({
declarations: [ButtonRowComponent],
exports: [ButtonRowComponent],
imports: [
CommonModule
]
imports: [CommonModule],
})
export class ButtonRowModule {
}
export class ButtonRowModule {}

View File

@@ -1,5 +1,7 @@
<button mat-button>
<span *ngIf="icon"><fa-icon [icon]="icon"></fa-icon><span class="content">&nbsp;</span></span>
<span *ngIf="icon"
><fa-icon [icon]="icon"></fa-icon><span class="content">&nbsp;</span></span
>
<span class="button-content">
<ng-content></ng-content>
</span>

View File

@@ -6,12 +6,13 @@ describe('ButtonComponent', () => {
let component: ButtonComponent;
let fixture: ComponentFixture<ButtonComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ButtonComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [ButtonComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(ButtonComponent);
@@ -20,6 +21,6 @@ describe('ButtonComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -4,9 +4,8 @@ import {IconProp} from '@fortawesome/fontawesome-svg-core';
@Component({
selector: 'app-button',
templateUrl: './button.component.html',
styleUrls: ['./button.component.less']
styleUrls: ['./button.component.less'],
})
export class ButtonComponent {
@Input() icon: IconProp;
@Input() public icon: IconProp;
}

View File

@@ -4,17 +4,9 @@ import {ButtonComponent} from './button.component';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {MatButtonModule} from '@angular/material/button';
@NgModule({
declarations: [ButtonComponent],
exports: [
ButtonComponent
],
imports: [
CommonModule,
FontAwesomeModule,
MatButtonModule
]
exports: [ButtonComponent],
imports: [CommonModule, FontAwesomeModule, MatButtonModule],
})
export class ButtonModule {
}
export class ButtonModule {}

View File

@@ -1,7 +1,12 @@
<div [class.padding]="padding" class="card">
<button *ngIf="closeLink" [routerLink]="closeLink" class="btn-close" mat-icon-button>
<button
*ngIf="closeLink"
[routerLink]="closeLink"
class="btn-close"
mat-icon-button
>
<fa-icon [icon]="faClose"></fa-icon>
</button>
<div *ngIf="heading" class="heading">{{heading}}</div>
<div *ngIf="heading" class="heading">{{ heading }}</div>
<ng-content></ng-content>
</div>

View File

@@ -6,12 +6,13 @@ describe('CardComponent', () => {
let component: CardComponent;
let fixture: ComponentFixture<CardComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [CardComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [CardComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(CardComponent);
@@ -20,6 +21,6 @@ describe('CardComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -4,12 +4,12 @@ import {faTimes} from '@fortawesome/free-solid-svg-icons/faTimes';
@Component({
selector: 'app-card',
templateUrl: './card.component.html',
styleUrls: ['./card.component.less']
styleUrls: ['./card.component.less'],
})
export class CardComponent {
@Input() padding = true;
@Input() heading: string;
@Input() closeLink: string;
@Input() public padding = true;
@Input() public heading: string;
@Input() public closeLink: string;
public faClose = faTimes;
}

View File

@@ -5,16 +5,9 @@ import {MatButtonModule} from '@angular/material/button';
import {RouterModule} from '@angular/router';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
@NgModule({
declarations: [CardComponent],
exports: [CardComponent],
imports: [
CommonModule,
MatButtonModule,
RouterModule,
FontAwesomeModule
]
imports: [CommonModule, MatButtonModule, RouterModule, FontAwesomeModule],
})
export class CardModule {
}
export class CardModule {}

View File

@@ -1,6 +1,9 @@
<div class="header">
<button (click)="onFilterClick()" [class.filter-active]="anyFilterActive" mat-icon-button>
<button
(click)="onFilterClick()"
[class.filter-active]="anyFilterActive"
mat-icon-button
>
<fa-icon [icon]="faFilter"></fa-icon>
</button>
<button mat-icon-button routerLink="new">

View File

@@ -6,12 +6,13 @@ describe('ListHeaderComponent', () => {
let component: ListHeaderComponent;
let fixture: ComponentFixture<ListHeaderComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ListHeaderComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [ListHeaderComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(ListHeaderComponent);
@@ -20,6 +21,6 @@ describe('ListHeaderComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -1,4 +1,4 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {faFilter} from '@fortawesome/free-solid-svg-icons/faFilter';
import {faPlus} from '@fortawesome/free-solid-svg-icons/faPlus';
import {fade} from '../../../animations';
@@ -7,21 +7,14 @@ import {fade} from '../../../animations';
selector: 'app-list-header',
templateUrl: './list-header.component.html',
styleUrls: ['./list-header.component.less'],
animations: [fade]
animations: [fade],
})
export class ListHeaderComponent implements OnInit {
export class ListHeaderComponent {
public faNew = faPlus;
public faFilter = faFilter;
public filterVisible = false;
@Output() filterVisibleChanged = new EventEmitter<boolean>();
@Input() anyFilterActive = false;
constructor() {
}
ngOnInit() {
}
@Output() public filterVisibleChanged = new EventEmitter<boolean>();
@Input() public anyFilterActive = false;
public onFilterClick(): void {
this.filterVisible = !this.filterVisible || this.anyFilterActive;

View File

@@ -8,16 +8,7 @@ import {CardModule} from '../card/card.module';
@NgModule({
declarations: [ListHeaderComponent],
exports: [
ListHeaderComponent
],
imports: [
CommonModule,
FontAwesomeModule,
MatButtonModule,
RouterModule,
CardModule,
]
exports: [ListHeaderComponent],
imports: [CommonModule, FontAwesomeModule, MatButtonModule, RouterModule, CardModule],
})
export class ListHeaderModule {
}
export class ListHeaderModule {}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -6,12 +6,13 @@ describe('LogoComponent', () => {
let component: LogoComponent;
let fixture: ComponentFixture<LogoComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [LogoComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [LogoComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(LogoComponent);
@@ -20,6 +21,6 @@ describe('LogoComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -1,16 +1,8 @@
import {Component, OnInit} from '@angular/core';
import {Component} from '@angular/core';
@Component({
selector: 'app-logo',
templateUrl: './logo.component.html',
styleUrls: ['./logo.component.less']
styleUrls: ['./logo.component.less'],
})
export class LogoComponent implements OnInit {
constructor() {
}
ngOnInit(): void {
}
}
export class LogoComponent {}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {LogoComponent} from './logo.component';
@NgModule({
declarations: [LogoComponent],
exports: [
LogoComponent
],
imports: [
CommonModule
]
exports: [LogoComponent],
imports: [CommonModule],
})
export class LogoModule {
}
export class LogoModule {}

View File

@@ -6,12 +6,13 @@ describe('MenuButtonComponent', () => {
let component: MenuButtonComponent;
let fixture: ComponentFixture<MenuButtonComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [MenuButtonComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [MenuButtonComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(MenuButtonComponent);
@@ -20,6 +21,6 @@ describe('MenuButtonComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -4,7 +4,7 @@ import {IconProp} from '@fortawesome/fontawesome-svg-core';
@Component({
selector: 'app-menu-button',
templateUrl: './menu-button.component.html',
styleUrls: ['./menu-button.component.less']
styleUrls: ['./menu-button.component.less'],
})
export class MenuButtonComponent {
@Input() public icon: IconProp;

View File

@@ -4,17 +4,9 @@ import {MenuButtonComponent} from './menu-button.component';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {MatButtonModule} from '@angular/material/button';
@NgModule({
declarations: [MenuButtonComponent],
exports: [
MenuButtonComponent
],
imports: [
CommonModule,
FontAwesomeModule,
MatButtonModule
]
exports: [MenuButtonComponent],
imports: [CommonModule, FontAwesomeModule, MatButtonModule],
})
export class MenuButtonModule {
}
export class MenuButtonModule {}

View File

@@ -1,20 +1,13 @@
import {animate, state, style, transition, trigger} from '@angular/animations';
export const songSwitch = // the fade-in/fade-out animation.
trigger('songSwitch', [
export const songSwitch = trigger('songSwitch', [
// the fade-in/fade-out animation.
// the "in" style determines the "resting" state of the element when it is visible.
state('in', style({opacity: 1})),
// the "in" style determines the "resting" state of the element when it is visible.
state('in', style({opacity: 1})),
// fade in when created. this could also be written as transition('void => *')
transition(':enter', [style({opacity: 0}), animate(1200, style({opacity: 0})), animate(1200, style({opacity: 1}))]),
// fade in when created. this could also be written as transition('void => *')
transition(':enter', [
style({opacity: 0}),
animate(1200, style({opacity: 0})),
animate(1200, style({opacity: 1})),
]),
// fade out when destroyed. this could also be written as transition('void => *')
transition(':leave',
animate(1200, style({opacity: 0}))
)
]);
// fade out when destroyed. this could also be written as transition('void => *')
transition(':leave', animate(1200, style({opacity: 0}))),
]);

View File

@@ -1,33 +1,70 @@
<div (click)="onClick()" *ngIf="sections && !fullscreen" [class.chords]="_chordMode!=='hide'"
class="song-text">
<button (click)="onChordClick()" *ngIf="showSwitch" class="menu" mat-icon-button>
<div
(click)="onClick()"
*ngIf="sections && !fullscreen"
[class.chords]="iChordMode !== 'hide'"
class="song-text"
>
<button
(click)="onChordClick()"
*ngIf="showSwitch"
class="menu"
mat-icon-button
>
<fa-icon [icon]="faLines"></fa-icon>
</button>
<div [class.offset]="fullscreen" [style.top.px]="offset + 50">
<div #section *ngFor="let section of sections; let i = index" [class.chorus]="section.type===1" class="section">
<div *ngFor="let line of getLines(section)" [class.chord]="line.type===0" [class.disabled]="checkDisabled(i)"
class="line">{{line.text}}</div>
<div
#section
*ngFor="let section of sections; let i = index"
[class.chorus]="section.type === 1"
class="section"
>
<div
*ngFor="let line of getLines(section)"
[class.chord]="line.type === 0"
[class.disabled]="checkDisabled(i)"
class="line"
>
{{ line.text }}
</div>
</div>
</div>
<ng-content></ng-content>
</div>
<div (click)="onClick()" *ngIf="sections && fullscreen" [@songSwitch]="sections" [class.chords]="_chordMode!=='hide'"
class="song-text">
<button (click)="onChordClick()" *ngIf="showSwitch" class="menu" mat-icon-button>
<div
(click)="onClick()"
*ngIf="sections && fullscreen"
[@songSwitch]="sections"
[class.chords]="iChordMode !== 'hide'"
class="song-text"
>
<button
(click)="onChordClick()"
*ngIf="showSwitch"
class="menu"
mat-icon-button
>
<fa-icon [icon]="faLines"></fa-icon>
</button>
<div [class.offset]="fullscreen" [style.top.px]="offset + 50">
<div #section *ngFor="let section of sections; let i = index" [class.chorus]="section.type===1" class="section">
<div *ngFor="let line of getLines(section)" [class.chord]="line.type===0" [class.disabled]="checkDisabled(i)"
class="line">{{line.text}}</div>
<div
#section
*ngFor="let section of sections; let i = index"
[class.chorus]="section.type === 1"
class="section"
>
<div
*ngFor="let line of getLines(section)"
[class.chord]="line.type === 0"
[class.disabled]="checkDisabled(i)"
class="line"
>
{{ line.text }}
</div>
</div>
</div>

View File

@@ -6,12 +6,13 @@ describe('SongTextComponent', () => {
let component: SongTextComponent;
let fixture: ComponentFixture<SongTextComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [SongTextComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [SongTextComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(SongTextComponent);
@@ -20,6 +21,6 @@ describe('SongTextComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -23,18 +23,16 @@ export class SongTextComponent implements OnInit {
@Input() public showSwitch = false;
@Input() public transpose: TransposeMode = null;
@Output() public chordModeChanged = new EventEmitter<ChordMode>();
@ViewChildren('section') viewSections: QueryList<ElementRef>;
@ViewChildren('section') public viewSections: QueryList<ElementRef<HTMLElement>>;
public faLines = faGripLines;
public offset = 0;
public iChordMode: ChordMode = 'hide';
constructor(private textRenderingService: TextRenderingService, private elRef: ElementRef) {
}
public _chordMode: ChordMode = 'hide';
public constructor(private textRenderingService: TextRenderingService, private elRef: ElementRef<HTMLElement>) {}
@Input()
public set chordMode(value: ChordMode) {
this._chordMode = value ?? 'hide';
this.iChordMode = value ?? 'hide';
}
@Input()
@@ -42,23 +40,20 @@ export class SongTextComponent implements OnInit {
this.sections = null;
this.offset = 0;
if (this.fullscreen) {
setTimeout(() =>
this.sections = this.textRenderingService.parse(value, this.transpose).sort((a, b) => a.type - b.type), 100);
setTimeout(() => (this.sections = this.textRenderingService.parse(value, this.transpose).sort((a, b) => a.type - b.type)), 100);
} else {
this.sections = this.textRenderingService.parse(value, this.transpose).sort((a, b) => a.type - b.type);
}
}
public ngOnInit(): void {
setInterval(() => {
if (!this.fullscreen || this.index === -1 || !this.viewSections.toArray()[this.index]) {
this.offset = 0;
return;
}
this.offset = -this.viewSections.toArray()[this.index].nativeElement.offsetTop;
if (!this.fullscreen || this.index === -1 || !this.viewSections.toArray()[this.index]) {
this.offset = 0;
return;
}
, 100);
this.offset = -this.viewSections.toArray()[this.index].nativeElement.offsetTop;
}, 100);
}
public getLines(section: Section): Line[] {
@@ -67,7 +62,7 @@ export class SongTextComponent implements OnInit {
return true;
}
switch (this._chordMode) {
switch (this.iChordMode) {
case 'show':
return true;
case 'hide':
@@ -86,7 +81,8 @@ export class SongTextComponent implements OnInit {
}
public onClick(): void {
scrollTo(0, this.elRef.nativeElement.offsetTop - 20);
const nativeElement = this.elRef.nativeElement;
scrollTo(0, nativeElement.offsetTop - 20);
}
public checkDisabled(i: number): boolean {
@@ -94,7 +90,7 @@ export class SongTextComponent implements OnInit {
}
private getNextChordMode(): ChordMode {
switch (this._chordMode) {
switch (this.iChordMode) {
case 'show':
return 'hide';
case 'hide':

View File

@@ -4,15 +4,9 @@ import {SongTextComponent} from './song-text.component';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {MatButtonModule} from '@angular/material/button';
@NgModule({
declarations: [SongTextComponent],
exports: [SongTextComponent],
imports: [
CommonModule,
FontAwesomeModule,
MatButtonModule
]
imports: [CommonModule, FontAwesomeModule, MatButtonModule],
})
export class SongTextModule {
}
export class SongTextModule {}

View File

@@ -1,15 +1,15 @@
import {Directive, ElementRef, Input} from '@angular/core';
import {Directive, ElementRef, Input, OnInit} from '@angular/core';
@Directive({
selector: '[autofocus]'
selector: '[appAutofocus]',
})
export class AutofocusDirective {
export class AutofocusDirective implements OnInit {
private focus = true;
constructor(private el: ElementRef) {
}
public constructor(private el: ElementRef<HTMLElement>) {}
@Input() set autofocus(condition: boolean) {
@Input()
public set autofocus(condition: boolean) {
this.focus = condition !== false;
}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {AutofocusDirective} from './autofocus.directive';
@NgModule({
declarations: [AutofocusDirective],
exports: [
AutofocusDirective
],
imports: [
CommonModule
]
exports: [AutofocusDirective],
imports: [CommonModule],
})
export class AutofocusModule {
}
export class AutofocusModule {}

View File

@@ -6,11 +6,11 @@ describe('RoleGuard', () => {
let guard: RoleGuard;
beforeEach(() => {
TestBed.configureTestingModule({});
void TestBed.configureTestingModule({});
guard = TestBed.inject(RoleGuard);
});
it('should be created', () => {
expect(guard).toBeTruthy();
void expect(guard).toBeTruthy();
});
});

View File

@@ -1,20 +1,17 @@
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree} from '@angular/router';
import {ActivatedRouteSnapshot, CanActivate, Router, UrlTree} from '@angular/router';
import {Observable} from 'rxjs';
import {UserService} from '../../services/user/user.service';
import {map} from 'rxjs/operators';
@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class RoleGuard implements CanActivate {
constructor(private userService: UserService, private router: Router) {
}
public constructor(private userService: UserService, private router: Router) {}
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> {
const requiredRoles = next.data.requiredRoles;
public canActivate(next: ActivatedRouteSnapshot): Observable<boolean | UrlTree> {
const requiredRoles = next.data.requiredRoles as string[];
if (!requiredRoles) {
throw new Error('requiredRoles is not defined!');
}
@@ -47,5 +44,4 @@ export class RoleGuard implements CanActivate {
return ['brand', 'new-user'];
}
}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {KeyPipe} from './key.pipe';
@NgModule({
declarations: [KeyPipe],
exports: [
KeyPipe
],
imports: [
CommonModule
]
exports: [KeyPipe],
imports: [CommonModule],
})
export class KeyTranslatorModule {
}
export class KeyTranslatorModule {}

View File

@@ -3,6 +3,6 @@ import {KeyPipe} from './key.pipe';
describe('KeyPipe', () => {
it('create an instance', () => {
const pipe = new KeyPipe();
expect(pipe).toBeTruthy();
void expect(pipe).toBeTruthy();
});
});

View File

@@ -2,12 +2,10 @@ import {Pipe, PipeTransform} from '@angular/core';
import {scaleMapping} from '../../../modules/songs/services/key.helper';
@Pipe({
name: 'key'
name: 'key',
})
export class KeyPipe implements PipeTransform {
transform(key: string): string {
public transform(key: string): string {
return scaleMapping[key];
}
}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {LegalOwnerPipe} from './legal-owner.pipe';
@NgModule({
declarations: [LegalOwnerPipe],
exports: [
LegalOwnerPipe
],
imports: [
CommonModule
]
exports: [LegalOwnerPipe],
imports: [CommonModule],
})
export class LegalOwnerTranslatorModule {
}
export class LegalOwnerTranslatorModule {}

View File

@@ -3,6 +3,6 @@ import {LegalOwnerPipe} from './legal-owner.pipe';
describe('LegalOwnerPipe', () => {
it('create an instance', () => {
const pipe = new LegalOwnerPipe();
expect(pipe).toBeTruthy();
void expect(pipe).toBeTruthy();
});
});

View File

@@ -1,11 +1,10 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'legalOwner'
name: 'legalOwner',
})
export class LegalOwnerPipe implements PipeTransform {
transform(legalOwnerKey: string): string {
public transform(legalOwnerKey: string): string {
switch (legalOwnerKey) {
case 'CCLI':
return 'CCLI';
@@ -15,5 +14,4 @@ export class LegalOwnerPipe implements PipeTransform {
return '';
}
}
}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {LegalTypePipe} from './legal-type.pipe';
@NgModule({
declarations: [LegalTypePipe],
exports: [
LegalTypePipe
],
imports: [
CommonModule
]
exports: [LegalTypePipe],
imports: [CommonModule],
})
export class LegalTypeTranslatorModule {
}
export class LegalTypeTranslatorModule {}

View File

@@ -3,6 +3,6 @@ import {LegalTypePipe} from './legal-type.pipe';
describe('LegalTypePipe', () => {
it('create an instance', () => {
const pipe = new LegalTypePipe();
expect(pipe).toBeTruthy();
void expect(pipe).toBeTruthy();
});
});

View File

@@ -1,11 +1,10 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'legalType'
name: 'legalType',
})
export class LegalTypePipe implements PipeTransform {
transform(legalTypeKey: string): string {
public transform(legalTypeKey: string): string {
switch (legalTypeKey) {
case 'open':
return 'Klärung erforderlich ';
@@ -15,5 +14,4 @@ export class LegalTypePipe implements PipeTransform {
return '';
}
}
}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {SectionTypePipe} from './section-type.pipe';
@NgModule({
declarations: [SectionTypePipe],
exports: [
SectionTypePipe
],
imports: [
CommonModule
]
exports: [SectionTypePipe],
imports: [CommonModule],
})
export class SectionTypeTranslatorModule {
}
export class SectionTypeTranslatorModule {}

View File

@@ -3,6 +3,6 @@ import {SectionTypePipe} from './section-type.pipe';
describe('SectionTypePipe', () => {
it('create an instance', () => {
const pipe = new SectionTypePipe();
expect(pipe).toBeTruthy();
void expect(pipe).toBeTruthy();
});
});

View File

@@ -2,11 +2,10 @@ import {Pipe, PipeTransform} from '@angular/core';
import {SectionType} from '../../../modules/songs/services/section-type';
@Pipe({
name: 'sectionType'
name: 'sectionType',
})
export class SectionTypePipe implements PipeTransform {
transform(value: SectionType): string {
public transform(value: SectionType): string {
switch (value) {
case SectionType.Verse:
return 'Strophe';
@@ -16,5 +15,4 @@ export class SectionTypePipe implements PipeTransform {
return 'Bridge';
}
}
}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {ShowTypePipe} from './show-type.pipe';
@NgModule({
declarations: [ShowTypePipe],
exports: [
ShowTypePipe
],
imports: [
CommonModule
]
exports: [ShowTypePipe],
imports: [CommonModule],
})
export class ShowTypeTranslaterModule {
}
export class ShowTypeTranslaterModule {}

View File

@@ -3,6 +3,6 @@ import {ShowTypePipe} from './show-type.pipe';
describe('ShowTypePipe', () => {
it('create an instance', () => {
const pipe = new ShowTypePipe();
expect(pipe).toBeTruthy();
void expect(pipe).toBeTruthy();
});
});

View File

@@ -1,13 +1,12 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'showType'
name: 'showType',
})
export class ShowTypePipe implements PipeTransform {
transform(type: string): string {
public transform(type: string): string {
switch (type) {
case 'service-worship':
case 'service-worship':
return 'Gottesdienst Anbetung';
case 'service-praise':
return 'Gottesdienst Lobpreis';
@@ -15,18 +14,16 @@ export class ShowTypePipe implements PipeTransform {
return 'großer Hauskreis';
case 'home-group':
return 'Hauskreis';
case 'prayer-group':
case 'prayer-group':
return 'Gebetskreis';
case 'teens-group':
case 'teens-group':
return 'Teeniekreis';
case 'kids-group':
case 'kids-group':
return 'Kinderkreis';
case 'misc-public':
case 'misc-public':
return 'sonstige öffentliche Veranstaltung';
case 'misc-private':
case 'misc-private':
return 'sonstige private Veranstaltung';
}
}
}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {SongTypePipe} from './song-type.pipe';
@NgModule({
declarations: [SongTypePipe],
exports: [
SongTypePipe
],
imports: [
CommonModule
]
exports: [SongTypePipe],
imports: [CommonModule],
})
export class SongTypeTranslaterModule {
}
export class SongTypeTranslaterModule {}

View File

@@ -3,6 +3,6 @@ import {SongTypePipe} from './song-type.pipe';
describe('SongTypePipe', () => {
it('create an instance', () => {
const pipe = new SongTypePipe();
expect(pipe).toBeTruthy();
void expect(pipe).toBeTruthy();
});
});

View File

@@ -1,11 +1,10 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'songType'
name: 'songType',
})
export class SongTypePipe implements PipeTransform {
transform(songTypeKey: string): string {
public transform(songTypeKey: string): string {
switch (songTypeKey) {
case 'Worship':
return 'Anbetung';
@@ -15,5 +14,4 @@ export class SongTypePipe implements PipeTransform {
return '';
}
}
}

View File

@@ -2,15 +2,9 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {StatusPipe} from './status.pipe';
@NgModule({
declarations: [StatusPipe],
exports: [
StatusPipe
],
imports: [
CommonModule
]
exports: [StatusPipe],
imports: [CommonModule],
})
export class StatusTranslaterModule {
}
export class StatusTranslaterModule {}

View File

@@ -3,6 +3,6 @@ import {StatusPipe} from './status.pipe';
describe('StatusPipe', () => {
it('create an instance', () => {
const pipe = new StatusPipe();
expect(pipe).toBeTruthy();
void expect(pipe).toBeTruthy();
});
});

View File

@@ -1,11 +1,10 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'status'
name: 'status',
})
export class StatusPipe implements PipeTransform {
transform(songTypeKey: string): string {
public transform(songTypeKey: string): string {
switch (songTypeKey) {
case 'draft':
return 'Entwurf';
@@ -17,5 +16,4 @@ export class StatusPipe implements PipeTransform {
return '';
}
}
}