diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c1d7b95..5b8ca96 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -10,19 +10,21 @@ import {PerfectScrollbarComponent} from 'ngx-perfect-scrollbar'; animations: [fader] }) export class AppComponent implements OnInit { - public static hideLoader = () => document.querySelector('#load-bg').classList.add('hidden'); + @ViewChild('scrollbar', {static: false}) scrollbar: PerfectScrollbarComponent; constructor(private scrollService: ScrollService) { scrollService.restoreScrollPosition$.subscribe(pos => { if (this.scrollbar && pos) { - //this.scrollbar.scrollTo(pos, 0); - this.scrollbar.directiveRef.scrollTo(0, pos, 300) + // this.scrollbar.scrollTo(pos, 0); + this.scrollbar.directiveRef.scrollTo(0, pos, 300); // debugger; } - }) + }); } + public static hideLoader = () => document.querySelector('#load-bg').classList.add('hidden'); + public ngOnInit(): void { setTimeout(() => AppComponent.hideLoader(), 800); diff --git a/src/app/modules/brand/new-user/new-user.component.ts b/src/app/modules/brand/new-user/new-user.component.ts index 74af3df..cef247a 100644 --- a/src/app/modules/brand/new-user/new-user.component.ts +++ b/src/app/modules/brand/new-user/new-user.component.ts @@ -9,9 +9,9 @@ import {User} from '../../../services/user/user'; styleUrls: ['./new-user.component.less'] }) export class NewUserComponent { - public user$: Observable + public user$: Observable; constructor(private userService: UserService) { - this.user$ = userService.user$ + this.user$ = userService.user$; } } diff --git a/src/app/modules/presentation/remote/remote.component.ts b/src/app/modules/presentation/remote/remote.component.ts index 0537b66..9a2187d 100644 --- a/src/app/modules/presentation/remote/remote.component.ts +++ b/src/app/modules/presentation/remote/remote.component.ts @@ -77,7 +77,7 @@ export class RemoteComponent { id: song.id, title: song.title, sections: this.textRenderingService.parse(song.text, null) - })) + })); }); await delay(500); this.progress = false; @@ -91,7 +91,7 @@ export class RemoteComponent { await this.showService.update$(this.currentShowId, { presentationSongId: id, presentationSection: index - }) + }); } public async onZoom(zoom: number) { diff --git a/src/app/modules/shows/list/list.component.ts b/src/app/modules/shows/list/list.component.ts index 06d5c3b..f0f8521 100644 --- a/src/app/modules/shows/list/list.component.ts +++ b/src/app/modules/shows/list/list.component.ts @@ -18,11 +18,11 @@ export class ListComponent { } public getPublicShows(songs: Show[]): Show[] { - return songs.filter(_ => _.published) + return songs.filter(_ => _.published); } public getPrivateSongs(songs: Show[]): Show[] { - return songs.filter(_ => !_.published) + return songs.filter(_ => !_.published); } } diff --git a/src/app/modules/shows/new/new.component.ts b/src/app/modules/shows/new/new.component.ts index f014db6..a9b7168 100644 --- a/src/app/modules/shows/new/new.component.ts +++ b/src/app/modules/shows/new/new.component.ts @@ -27,12 +27,14 @@ export class NewComponent implements OnInit { this.form = new FormGroup({ date: new FormControl(null, Validators.required), showType: new FormControl(null, Validators.required), - }) + }); } public async onSave() { this.form.markAllAsTouched(); - if (!this.form.valid) return; + if (!this.form.valid) { + return; + } const id = await this.showService.new$(this.form.value); await this.router.navigateByUrl('/shows/' + id); diff --git a/src/app/modules/shows/services/docx.service.ts b/src/app/modules/shows/services/docx.service.ts index d21faf5..969d6de 100644 --- a/src/app/modules/shows/services/docx.service.ts +++ b/src/app/modules/shows/services/docx.service.ts @@ -86,11 +86,11 @@ export class DocxService { }, ] } - }) + }); } private renderSongs(songs: { showSong: ShowSong; song: Song; sections: Section[] }[], options: DownloadOptions, config: Config): Paragraph[] { - return songs.reduce((p, song) => [...p, ...this.renderSong(song.showSong, song.song, song.sections, options, config)], []) + return songs.reduce((p, song) => [...p, ...this.renderSong(song.showSong, song.song, song.sections, options, config)], []); } private renderSong(showSong: ShowSong, song: Song, sections: Section[], options: DownloadOptions, config: Config): Paragraph[] { @@ -121,7 +121,9 @@ export class DocxService { } private renderCopyright(song: Song, options: DownloadOptions, config: Config): Paragraph { - if (!options?.copyright) return null; + if (!options?.copyright) { + return null; + } const label = song.label ? song.label + ', ' : ''; const artist = song.artist ? song.artist + ', ' : ''; @@ -141,7 +143,9 @@ export class DocxService { private renderSection(section: Section, chordMode: ChordMode): Paragraph[] { return section.lines .filter(line => { - if (line.type === LineType.text) return true; + if (line.type === LineType.text) { + return true; + } switch (chordMode) { case 'show': return true; @@ -172,7 +176,7 @@ export class DocxService { thematicBreak: true, }); - return [songTitle] + return [songTitle]; } private async prepareData(showId: string): Promise<{ songs: ({ showSong: ShowSong, song: Song, sections: Section[] })[]; show: Show, user: User, config: Config }> { @@ -191,8 +195,8 @@ export class DocxService { showSong, song, sections - } - }) + }; + }); const songs = await Promise.all(songsAsync); return {songs, show, user, config}; } @@ -213,5 +217,5 @@ export class DocxService { window.URL.revokeObjectURL(url); document.body.removeChild(a); }, 1000); - }; + } } diff --git a/src/app/modules/shows/services/show-data.service.ts b/src/app/modules/shows/services/show-data.service.ts index 109f912..aafd935 100644 --- a/src/app/modules/shows/services/show-data.service.ts +++ b/src/app/modules/shows/services/show-data.service.ts @@ -15,5 +15,5 @@ export class ShowDataService { public list$ = (queryFn?): Observable => this.dbService.col$(this.collection, queryFn); public read$ = (showId: string): Observable => this.dbService.doc$(`${this.collection}/${showId}`); public update = async (showId: string, data: Partial): Promise => await this.dbService.doc(`${this.collection}/${showId}`).update(data); - public add = async (data: Partial): Promise => (await this.dbService.col(this.collection).add(data)).id + public add = async (data: Partial): Promise => (await this.dbService.col(this.collection).add(data)).id; } diff --git a/src/app/modules/shows/services/show-song-data.service.ts b/src/app/modules/shows/services/show-song-data.service.ts index a2bdc00..b2ce0d9 100644 --- a/src/app/modules/shows/services/show-song-data.service.ts +++ b/src/app/modules/shows/services/show-song-data.service.ts @@ -17,5 +17,5 @@ export class ShowSongDataService { public read$ = (showId: string, songId: string): Observable => this.dbService.doc$(`${this.collection}/${showId}/${this.subCollection}/${songId}`); public update$ = async (showId: string, songId: string, data: Partial): Promise => await this.dbService.doc(`${this.collection}/${showId}/${this.subCollection}/${songId}`).update(data); public delete = async (showId: string, songId: string): Promise => await this.dbService.doc(`${this.collection}/${showId}/${this.subCollection}/${songId}`).delete(); - public add = async (showId: string, data: Partial): Promise => (await this.dbService.col(`${this.collection}/${showId}/${this.subCollection}`).add(data)).id + public add = async (showId: string, data: Partial): Promise => (await this.dbService.col(`${this.collection}/${showId}/${this.subCollection}`).add(data)).id; } diff --git a/src/app/modules/shows/services/show.service.ts b/src/app/modules/shows/services/show.service.ts index ea07f5a..2680771 100644 --- a/src/app/modules/shows/services/show.service.ts +++ b/src/app/modules/shows/services/show.service.ts @@ -30,7 +30,7 @@ export class ShowService { .filter(_ => !_.archived) .filter(show => show.published || (show.owner === _.user.id && !publishedOnly)) ) - ) + ); } diff --git a/src/app/modules/shows/show/show.component.ts b/src/app/modules/shows/show/show.component.ts index f5e2911..91cc0cb 100644 --- a/src/app/modules/shows/show/show.component.ts +++ b/src/app/modules/shows/show/show.component.ts @@ -76,8 +76,12 @@ export class ShowComponent implements OnInit { } public getStatus(show: Show): string { - if (show.published) return 'veröffentlicht'; - if (show.reported) return 'gemeldet'; + if (show.published) { + return 'veröffentlicht'; + } + if (show.reported) { + return 'gemeldet'; + } return 'entwurf'; } diff --git a/src/app/modules/shows/show/song/song.component.ts b/src/app/modules/shows/show/song/song.component.ts index 5efb41c..7862f8c 100644 --- a/src/app/modules/shows/show/song/song.component.ts +++ b/src/app/modules/shows/show/song/song.component.ts @@ -40,13 +40,13 @@ export class SongComponent implements OnInit { public set song(song: Song) { this._song = song; this.keys = !!song ? getScale(song.key) : []; - }; + } public ngOnInit(): void { this.keyFormControl = new FormControl(this.showSong.key); this.keyFormControl.valueChanges.subscribe(async value => { await this.showSongService.update$(this.showId, this.showSong.id, {key: value}); - }) + }); } public async onDelete(): Promise { @@ -55,12 +55,18 @@ export class SongComponent implements OnInit { public async reorder(up: boolean): Promise { - if (up) await this.reorderUp(); else await this.reorderDown(); + if (up) { + await this.reorderUp(); + } else { + await this.reorderDown(); + } } public async reorderUp(): Promise { const index = this.showSongs.findIndex(_ => _.songId === this._song.id); - if (index === 0) return; + if (index === 0) { + return; + } const song = this.showSongs[index]; const toggleSong = this.showSongs[index - 1]; @@ -71,7 +77,9 @@ export class SongComponent implements OnInit { public async reorderDown(): Promise { const index = this.showSongs.findIndex(_ => _.songId === this._song.id); - if (index === this.showSongs.length - 1) return; + if (index === this.showSongs.length - 1) { + return; + } const song = this.showSongs[index]; const toggleSong = this.showSongs[index + 1]; diff --git a/src/app/modules/songs/services/file.service.ts b/src/app/modules/songs/services/file.service.ts index 7dcf395..dab9a92 100644 --- a/src/app/modules/songs/services/file.service.ts +++ b/src/app/modules/songs/services/file.service.ts @@ -21,7 +21,7 @@ export class FileService { public async delete(path: string, songId: string, fileId: string) { const ref = this.storage.ref(path); - await ref.delete().toPromise() + await ref.delete().toPromise(); await this.fileDataService.delete(songId, fileId); } } diff --git a/src/app/modules/songs/services/song.service.ts b/src/app/modules/songs/services/song.service.ts index b4397d7..278a3d1 100644 --- a/src/app/modules/songs/services/song.service.ts +++ b/src/app/modules/songs/services/song.service.ts @@ -34,12 +34,12 @@ export class SongService { const song = await this.read(songId); const edits = song.edits ?? []; const user = await this.userService.currentUser(); - edits.push({username: user.name, timestamp: Timestamp.now()}) + edits.push({username: user.name, timestamp: Timestamp.now()}); await this.songDataService.update$(songId, {...data, edits}); } public async new(number: number, title: string): Promise { - return await this.songDataService.add({number, title, status: 'draft', legalType: 'open'}) + return await this.songDataService.add({number, title, status: 'draft', legalType: 'open'}); } public async delete(songId: string): Promise { diff --git a/src/app/modules/songs/services/text-rendering.service.spec.ts b/src/app/modules/songs/services/text-rendering.service.spec.ts index 986b14d..6e3df32 100644 --- a/src/app/modules/songs/services/text-rendering.service.spec.ts +++ b/src/app/modules/songs/services/text-rendering.service.spec.ts @@ -90,7 +90,7 @@ Cool bridge without any chords const service: TextRenderingService = TestBed.inject(TextRenderingService); const text = `Strophe g# F# E g# F# E -text` +text`; const sections = service.parse(text, null); expect(sections[0].lines[0].type).toBe(LineType.chord); expect(sections[0].lines[0].text).toBe('g# F# E g# F# E'); diff --git a/src/app/modules/songs/services/text-rendering.service.ts b/src/app/modules/songs/services/text-rendering.service.ts index 02e898a..365ad68 100644 --- a/src/app/modules/songs/services/text-rendering.service.ts +++ b/src/app/modules/songs/services/text-rendering.service.ts @@ -17,7 +17,9 @@ export class TextRenderingService { } public parse(text: string, transpose: TransposeMode): Section[] { - if (!text) return []; + if (!text) { + return []; + } const arrayOfLines = text.split(/\r?\n/).filter(_ => _); const indices = { [SectionType.Bridge]: 0, @@ -26,18 +28,22 @@ export class TextRenderingService { }; return arrayOfLines.reduce((array, line) => { const type = this.getSectionTypeOfLine(line); - if (line.match(this.regexSection)) return [...array, { - type: type, - number: indices[type]++, - lines: [] - }]; + if (line.match(this.regexSection)) { + return [...array, { + type, + number: indices[type]++, + lines: [] + }]; + } array[array.length - 1].lines.push(this.getLineOfLineText(line, transpose)); return array; }, [] as Section[]); } private getLineOfLineText(text: string, transpose: TransposeMode): Line { - if (!text) return null; + if (!text) { + return null; + } const cords = this.readChords(text); const hasMatches = cords.length > 0; const type = hasMatches ? LineType.chord : LineType.text; @@ -49,16 +55,20 @@ export class TextRenderingService { } private getSectionTypeOfLine(line: string): SectionType { - if (!line) return null; + if (!line) { + return null; + } const match = line.match(this.regexSection); - if (!match || match.length < 2) return null; + if (!match || match.length < 2) { + return null; + } const typeString = match[1]; switch (typeString) { - case "Strophe": + case 'Strophe': return SectionType.Verse; - case "Refrain": + case 'Refrain': return SectionType.Chorus; - case "Bridge": + case 'Bridge': return SectionType.Bridge; } } @@ -76,14 +86,18 @@ export class TextRenderingService { length: match[0].length, position: regex.lastIndex - match[0].length, }; - if (match[3]) chord.slashChord = match[3]; - if (match[4]) chord.add = match[4]; + if (match[3]) { + chord.slashChord = match[3]; + } + if (match[4]) { + chord.add = match[4]; + } chords.push(chord); } const chordCount = chords.reduce((acc: number, cur: Chord) => acc + cur.length, 0); - const lineCount = chordLine.replace(/\s/g, "").length; + const lineCount = chordLine.replace(/\s/g, '').length; const isChrod = chordCount * 1.2 > lineCount; return isChrod ? chords : []; } diff --git a/src/app/modules/songs/services/transpose-mode.ts b/src/app/modules/songs/services/transpose-mode.ts index b55a4c9..1b60e3d 100644 --- a/src/app/modules/songs/services/transpose-mode.ts +++ b/src/app/modules/songs/services/transpose-mode.ts @@ -1,4 +1,4 @@ export interface TransposeMode { baseKey: string; - targetKey: string + targetKey: string; } diff --git a/src/app/modules/songs/services/transpose.service.ts b/src/app/modules/songs/services/transpose.service.ts index 88945fa..74817bd 100644 --- a/src/app/modules/songs/services/transpose.service.ts +++ b/src/app/modules/songs/services/transpose.service.ts @@ -10,7 +10,9 @@ import {Line} from './line'; export class TransposeService { public transpose(line: Line, baseKey: string, targetKey: string): Line { - if (line.type !== LineType.chord) return line; + if (line.type !== LineType.chord) { + return line; + } const difference = this.getDistance(baseKey, targetKey); const map = this.getMap(baseKey, difference); @@ -21,7 +23,9 @@ export class TransposeService { } public renderChords(line: Line): Line { - if (line.type !== LineType.chord) return line; + if (line.type !== LineType.chord) { + return line; + } const renderedLine = this.renderLine(line.chords); return {...line, text: renderedLine}; @@ -37,7 +41,9 @@ export class TransposeService { public getMap(baseKey: string, difference: number) { const scale = getScaleType(baseKey); - if (!scale) return null; + if (!scale) { + return null; + } const map = {}; for (let i = 0; i < 12; i++) { const source = scale[0][i]; @@ -71,7 +77,7 @@ export class TransposeService { const post = template.substr(pos + newLength); template = pre + renderedChord + post; - }) + }); return template.trimRight(); } diff --git a/src/app/modules/songs/song-list/filter/filter.component.ts b/src/app/modules/songs/song-list/filter/filter.component.ts index 2ef5f67..1055704 100644 --- a/src/app/modules/songs/song-list/filter/filter.component.ts +++ b/src/app/modules/songs/song-list/filter/filter.component.ts @@ -30,12 +30,22 @@ export class FilterComponent implements OnInit { }); activatedRoute.queryParams.subscribe((filterValues: FilterValues) => { - if (filterValues.q) this.filterFormGroup.controls.q.setValue(filterValues.q); - if (filterValues.type) this.filterFormGroup.controls.type.setValue(filterValues.type); - if (filterValues.key) this.filterFormGroup.controls.key.setValue(filterValues.key); - if (filterValues.legalType) this.filterFormGroup.controls.legalType.setValue(filterValues.legalType); - if (filterValues.flag) this.filterFormGroup.controls.flag.setValue(filterValues.flag); - }) + if (filterValues.q) { + this.filterFormGroup.controls.q.setValue(filterValues.q); + } + if (filterValues.type) { + this.filterFormGroup.controls.type.setValue(filterValues.type); + } + if (filterValues.key) { + this.filterFormGroup.controls.key.setValue(filterValues.key); + } + if (filterValues.legalType) { + this.filterFormGroup.controls.legalType.setValue(filterValues.legalType); + } + if (filterValues.flag) { + this.filterFormGroup.controls.flag.setValue(filterValues.flag); + } + }); this.filterFormGroup.controls.q.valueChanges.subscribe(_ => this.filerValueChanged('q', _)); this.filterFormGroup.controls.key.valueChanges.subscribe(_ => this.filerValueChanged('key', _)); diff --git a/src/app/modules/songs/song-list/song-list.component.ts b/src/app/modules/songs/song-list/song-list.component.ts index 635aa90..aa35254 100644 --- a/src/app/modules/songs/song-list/song-list.component.ts +++ b/src/app/modules/songs/song-list/song-list.component.ts @@ -38,8 +38,8 @@ export class SongListComponent implements OnInit, OnDestroy { this.songs$ = combineLatest([filter$, songs$]).pipe( map(_ => { - let songs = _[1]; - let filter = _[0]; + const songs = _[1]; + const filter = _[0]; this.anyFilterActive = this.checkIfFilterActive(filter); return songs.filter(song => this.filter(song, filter)); }) @@ -68,10 +68,14 @@ export class SongListComponent implements OnInit, OnDestroy { } private checkFlag(flag: string, flags: string) { - if (!flags) return false; + if (!flags) { + return false; + } const flagStrings = flags.split(';'); - if (flagStrings.length === 0) return false; + if (flagStrings.length === 0) { + return false; + } return flagStrings.indexOf(flag) !== -1; } diff --git a/src/app/modules/songs/song/edit/edit-file/file/file.component.ts b/src/app/modules/songs/song/edit/edit-file/file/file.component.ts index e51b823..24dc809 100644 --- a/src/app/modules/songs/song/edit/edit-file/file/file.component.ts +++ b/src/app/modules/songs/song/edit/edit-file/file/file.component.ts @@ -25,7 +25,7 @@ export class FileComponent { this.name = file.name; this.fileId = file.id; this.path = file.path + '/' + file.name; - }; + } public async onDelete(): Promise { await this.fileService.delete(this.path, this.songId, this.fileId); diff --git a/src/app/modules/songs/song/edit/edit-song/edit-song.component.ts b/src/app/modules/songs/song/edit/edit-song/edit-song.component.ts index afe1a7d..eff4f6e 100644 --- a/src/app/modules/songs/song/edit/edit-song/edit-song.component.ts +++ b/src/app/modules/songs/song/edit/edit-song/edit-song.component.ts @@ -51,7 +51,7 @@ export class EditSongComponent implements OnInit { ).subscribe(song => { this.song = song; this.form = this.editService.createSongForm(song); - this.form.controls.flags.valueChanges.subscribe(_ => this.onFlagsChanged(_)) + this.form.controls.flags.valueChanges.subscribe(_ => this.onFlagsChanged(_)); this.onFlagsChanged(this.form.controls.flags.value); }); } @@ -78,7 +78,9 @@ export class EditSongComponent implements OnInit { this.form.controls.flags.setValue(flags.join(';')); } - if (input) input.value = ''; + if (input) { + input.value = ''; + } } private onFlagsChanged(flagArray: string): void { @@ -91,7 +93,9 @@ export class EditSongComponent implements OnInit { } public askForSave(nextState?: RouterStateSnapshot): boolean { - if (!this.form.dirty) return true; + if (!this.form.dirty) { + return true; + } const dialogRef = this.dialog.open(SaveDialogComponent, { width: '350px' diff --git a/src/app/modules/songs/song/file/file.component.ts b/src/app/modules/songs/song/file/file.component.ts index 29b0e10..836b927 100644 --- a/src/app/modules/songs/song/file/file.component.ts +++ b/src/app/modules/songs/song/file/file.component.ts @@ -21,7 +21,7 @@ export class FileComponent implements OnInit { this.url$ = ref.getDownloadURL(); this.name = file.name; - }; + } ngOnInit(): void { } diff --git a/src/app/modules/songs/song/new/new.component.ts b/src/app/modules/songs/song/new/new.component.ts index 9dbed3c..c907a09 100644 --- a/src/app/modules/songs/song/new/new.component.ts +++ b/src/app/modules/songs/song/new/new.component.ts @@ -23,12 +23,12 @@ export class NewComponent implements OnInit { this.form = new FormGroup({ number: new FormControl(null, Validators.required), title: new FormControl(null, Validators.required), - }) + }); this.songService.list$().pipe(autoComplete(this)).subscribe(songs => { const freeSongnumber = this.getFreeSongNumber(songs); this.form.controls.number.setValue(freeSongnumber); - }) + }); } public async onSave(): Promise { @@ -41,7 +41,9 @@ export class NewComponent implements OnInit { private getFreeSongNumber(songs: Song[]): Number { const numbers = songs.map(_ => _.number); for (let i = 1; i < Number.MAX_SAFE_INTEGER; i++) { - if (!numbers.some(_ => _ === i)) return i; + if (!numbers.some(_ => _ === i)) { + return i; + } } } } diff --git a/src/app/modules/songs/song/song.component.ts b/src/app/modules/songs/song/song.component.ts index 54fcfb3..327d34f 100644 --- a/src/app/modules/songs/song/song.component.ts +++ b/src/app/modules/songs/song/song.component.ts @@ -46,9 +46,11 @@ export class SongComponent implements OnInit { } public getFlags = (flags: string): string[] => { - if (!flags) return []; + if (!flags) { + return []; + } return flags.split(';').filter(_ => !!_); - }; + } public async onDelete(songId: string): Promise { await this.songService.delete(songId); diff --git a/src/app/modules/user/info/users/user/user.component.ts b/src/app/modules/user/info/users/user/user.component.ts index c6c6123..80b40bf 100644 --- a/src/app/modules/user/info/users/user/user.component.ts +++ b/src/app/modules/user/info/users/user/user.component.ts @@ -11,7 +11,7 @@ import {faTimes} from '@fortawesome/free-solid-svg-icons/faTimes'; }) export class UserComponent { public id: string; - public name: string + public name: string; public roles: string[]; public ROLE_TYPES = ROLE_TYPES; public edit = false; @@ -24,7 +24,7 @@ export class UserComponent { this.id = value.id; this.name = value.name; this.roles = this.getRoleArray(value.role); - }; + } public async onRoleChanged(id: string, roles: string[]): Promise { const role = roles.join(';'); diff --git a/src/app/modules/user/new/new.component.ts b/src/app/modules/user/new/new.component.ts index f5d0e6d..749a746 100644 --- a/src/app/modules/user/new/new.component.ts +++ b/src/app/modules/user/new/new.component.ts @@ -20,7 +20,7 @@ export class NewComponent implements OnInit { email: new FormControl(null, [Validators.required, Validators.email]), name: new FormControl(null, [Validators.required]), password: new FormControl(null, [Validators.required, Validators.minLength(6)]), - }) + }); } public async onCreate(): Promise { diff --git a/src/app/services/config.ts b/src/app/services/config.ts index 1f8ebff..96f9c2b 100644 --- a/src/app/services/config.ts +++ b/src/app/services/config.ts @@ -1,3 +1,3 @@ export interface Config { - ccliLicenseId: string + ccliLicenseId: string; } diff --git a/src/app/services/global-settings.ts b/src/app/services/global-settings.ts index be78a30..34d18c7 100644 --- a/src/app/services/global-settings.ts +++ b/src/app/services/global-settings.ts @@ -1,3 +1,3 @@ export interface GlobalSettings { - currentShow: string + currentShow: string; } diff --git a/src/app/services/user/role.directive.ts b/src/app/services/user/role.directive.ts index ae8dc47..4aacf13 100644 --- a/src/app/services/user/role.directive.ts +++ b/src/app/services/user/role.directive.ts @@ -41,9 +41,13 @@ export class RoleDirective implements OnInit { private checkPermission() { if (this.currentUser && this.currentUser.role) { - if (this.currentUser.role === 'admin') return true; + if (this.currentUser.role === 'admin') { + return true; + } for (const role of this.appRole) { - if (this.currentUser.role.indexOf(role) !== -1) return true; + if (this.currentUser.role.indexOf(role) !== -1) { + return true; + } } } diff --git a/src/app/services/user/user.ts b/src/app/services/user/user.ts index ee7f7a0..c63a7eb 100644 --- a/src/app/services/user/user.ts +++ b/src/app/services/user/user.ts @@ -4,5 +4,5 @@ export interface User { id: string; name: string; role: string; - chordMode: ChordMode + chordMode: ChordMode; } diff --git a/src/app/widget-modules/components/add-song/add-song.component.ts b/src/app/widget-modules/components/add-song/add-song.component.ts index 2820921..757a9dc 100644 --- a/src/app/widget-modules/components/add-song/add-song.component.ts +++ b/src/app/widget-modules/components/add-song/add-song.component.ts @@ -35,14 +35,14 @@ export class AddSongComponent { return 1; } return 0; - }) + }); const filterValue = this.filteredSongsControl.value; return filterValue ? songs.filter(_ => filterSong(_, filterValue)) : songs; } public async onAddSongSelectionChanged(event: MatSelectChange) { - let order = this.showSongs.reduce((oa, u) => Math.max(oa, u.order), 0) + 1; + 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; } diff --git a/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.ts b/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.ts index a0d40d2..9ffb2b4 100644 --- a/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.ts +++ b/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.ts @@ -11,8 +11,10 @@ export class FilterComponent { constructor(private router: Router, activatedRoute: ActivatedRoute) { activatedRoute.queryParams.subscribe(_ => { - if (_.q) this.value = _.q; - }) + if (_.q) { + this.value = _.q; + } + }); } public async valueChange(text: string): Promise { diff --git a/src/app/widget-modules/components/song-text/animation.ts b/src/app/widget-modules/components/song-text/animation.ts index dd9e9e9..6edcd7b 100644 --- a/src/app/widget-modules/components/song-text/animation.ts +++ b/src/app/widget-modules/components/song-text/animation.ts @@ -17,4 +17,4 @@ export const songSwitch = // the fade-in/fade-out animation. transition(':leave', animate(1200, style({opacity: 0})) ) - ]) + ]); diff --git a/src/app/widget-modules/components/song-text/song-text.component.ts b/src/app/widget-modules/components/song-text/song-text.component.ts index 6d63a6a..1f5cdb8 100644 --- a/src/app/widget-modules/components/song-text/song-text.component.ts +++ b/src/app/widget-modules/components/song-text/song-text.component.ts @@ -8,7 +8,7 @@ import {LineType} from '../../../modules/songs/services/line-type'; import {Section} from '../../../modules/songs/services/section'; import {Line} from '../../../modules/songs/services/line'; -export type ChordMode = 'show' | 'hide' | 'onlyFirst' +export type ChordMode = 'show' | 'hide' | 'onlyFirst'; @Component({ selector: 'app-song-text', @@ -41,10 +41,12 @@ export class SongTextComponent implements OnInit { public set text(value: string) { this.sections = null; this.offset = 0; - if (this.fullscreen) + if (this.fullscreen) { 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) + } else { + this.sections = this.textRenderingService.parse(value, this.transpose).sort((a, b) => a.type - b.type); + } } @@ -61,7 +63,9 @@ export class SongTextComponent implements OnInit { public getLines(section: Section): Line[] { return section.lines.filter(_ => { - if (_.type !== LineType.chord) return true; + if (_.type !== LineType.chord) { + return true; + } switch (this._chordMode) { case 'show': diff --git a/src/app/widget-modules/directives/autofocus/autofocus.directive.ts b/src/app/widget-modules/directives/autofocus/autofocus.directive.ts index 77c8b24..1187b22 100644 --- a/src/app/widget-modules/directives/autofocus/autofocus.directive.ts +++ b/src/app/widget-modules/directives/autofocus/autofocus.directive.ts @@ -1,7 +1,7 @@ -import {Directive, ElementRef, Input} from "@angular/core"; +import {Directive, ElementRef, Input} from '@angular/core'; @Directive({ - selector: "[autofocus]" + selector: '[autofocus]' }) export class AutofocusDirective { private focus = true; diff --git a/src/app/widget-modules/guards/role.guard.ts b/src/app/widget-modules/guards/role.guard.ts index dd78e81..cde0bad 100644 --- a/src/app/widget-modules/guards/role.guard.ts +++ b/src/app/widget-modules/guards/role.guard.ts @@ -15,21 +15,27 @@ export class RoleGuard implements CanActivate { next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { const requiredRoles = next.data.requiredRoles; - if (!requiredRoles) throw new Error('requiredRoles is not defined!'); + if (!requiredRoles) { + throw new Error('requiredRoles is not defined!'); + } return this.userService.user$.pipe( map(user => { const roles = user.role?.split(';') ?? []; - if (roles.indexOf('admin') !== -1) return true; + if (roles.indexOf('admin') !== -1) { + return true; + } const allowed = roles.some(s => requiredRoles.indexOf(s) !== -1); return allowed || this.router.createUrlTree(this.defaultRoute(roles)); }) - ) + ); } private defaultRoute(roles: string[]): string[] { - if (!roles || roles.length === 0) return ['brand', 'new-user']; + if (!roles || roles.length === 0) { + return ['brand', 'new-user']; + } switch (roles[0]) { case 'user': return ['songs'];