6 Commits

Author SHA1 Message Date
83573fde31 fix delete show song and not deleted order song causes crash 2025-02-16 12:24:38 +01:00
2d38af1c27 fix lint files #2 2025-01-05 10:45:23 +01:00
26fd61e90a fix lint files 2025-01-05 10:40:49 +01:00
189478f078 clean up and lint files 2025-01-05 10:29:29 +01:00
54ee9a5b11 auto migrate standalone components 2025-01-05 10:26:35 +01:00
8b8395fc3c migrate standalone pipes 2025-01-05 10:20:05 +01:00
172 changed files with 993 additions and 1069 deletions

View File

@@ -1,12 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="start" type="js.build_tools.npm" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json"/>
<command value="run"/>
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="start"/>
<script value="start" />
</scripts>
<node-interpreter value="project"/>
<envs/>
<method v="2"/>
<node-interpreter value="project" />
<envs />
<EXTENSION ID="com.intellij.lang.javascript.buildTools.npm.rc.StartBrowserRunConfigurationExtension">
<browser name="98ca6316-2f89-46d9-a9e5-fa9e2b0625b3" start="true" with-js-debugger="true" url="http://localhost.4200" />
</EXTENSION>
<method v="2" />
</configuration>
</component>

View File

@@ -25,7 +25,7 @@ export const fader = trigger('fader', [
transform: 'scale(1) translateY(-10px)',
}),
],
{optional: true},
{optional: true}
),
// Animate the new page in
query(
@@ -36,10 +36,10 @@ export const fader = trigger('fader', [
style({
opacity: 1,
transform: 'scale(1) translateY(0)',
}),
})
),
],
{optional: true},
{optional: true}
),
]),
]);

View File

@@ -60,5 +60,4 @@ const routes: Routes = [
],
exports: [RouterModule],
})
export class AppRoutingModule {
}
export class AppRoutingModule {}

View File

@@ -3,14 +3,11 @@ import {RouterTestingModule} from '@angular/router/testing';
import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [AppComponent],
}).compileComponents();
}),
);
beforeEach(waitForAsync(() => {
void TestBed.configureTestingModule({
imports: [RouterTestingModule, AppComponent],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);

View File

@@ -2,6 +2,8 @@ import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core';
import {fader} from './animations';
import {ScrollService} from './services/scroll.service';
import {register} from 'swiper/element/bundle';
import {RouterOutlet} from '@angular/router';
import {NavigationComponent} from './widget-modules/components/application-frame/navigation/navigation.component';
@Component({
selector: 'app-root',
@@ -9,7 +11,7 @@ import {register} from 'swiper/element/bundle';
styleUrls: ['./app.component.less'],
animations: [fader],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
imports: [RouterOutlet, NavigationComponent],
})
export class AppComponent implements OnInit {
public constructor(private scrollService: ScrollService) {

View File

@@ -1,44 +0,0 @@
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {ServiceWorkerModule} from '@angular/service-worker';
import {environment} from '../environments/environment';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {ApplicationFrameModule} from './widget-modules/components/application-frame/application-frame.module';
import {AngularFireModule} from '@angular/fire/compat';
import {AngularFirestoreModule} from '@angular/fire/compat/firestore';
import {AngularFireStorageModule} from '@angular/fire/compat/storage';
import {AngularFireDatabaseModule} from '@angular/fire/compat/database';
import {AngularFireAuthModule} from '@angular/fire/compat/auth';
import {AngularFireAuthGuardModule} from '@angular/fire/compat/auth-guard';
import {MAT_DATE_LOCALE} from '@angular/material/core';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
ServiceWorkerModule.register('ngsw-worker.js', {
enabled: environment.production,
}),
BrowserAnimationsModule,
ApplicationFrameModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule.enablePersistence({synchronizeTabs: true}),
AngularFireStorageModule,
AngularFireDatabaseModule,
AngularFireAuthModule,
AngularFireAuthGuardModule,
FontAwesomeModule,
],
providers: [{provide: MAT_DATE_LOCALE, useValue: 'de-DE'}],
bootstrap: [AppComponent],
})
export class AppModule {
}

View File

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

View File

@@ -1,10 +1,10 @@
import {Component} from '@angular/core';
import {LogoComponent} from '../../widget-modules/components/logo/logo.component';
@Component({
selector: 'app-brand',
templateUrl: './brand.component.html',
styleUrls: ['./brand.component.less'],
standalone: false,
imports: [LogoComponent],
})
export class BrandComponent {
}
export class BrandComponent {}

View File

@@ -2,7 +2,7 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {BrandComponent} from './brand.component';
import {RouterModule, Routes} from '@angular/router';
import {LogoModule} from '../../widget-modules/components/logo/logo.module';
import {NewUserComponent} from './new-user/new-user.component';
const routes: Routes = [
@@ -18,8 +18,6 @@ const routes: Routes = [
];
@NgModule({
declarations: [BrandComponent, NewUserComponent],
imports: [CommonModule, RouterModule.forChild(routes), LogoModule],
imports: [CommonModule, RouterModule.forChild(routes), BrandComponent, NewUserComponent],
})
export class BrandModule {
}
export class BrandModule {}

View File

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

View File

@@ -2,12 +2,14 @@ import {Component} from '@angular/core';
import {UserService} from '../../../services/user/user.service';
import {Observable} from 'rxjs';
import {User} from '../../../services/user/user';
import {BrandComponent} from '../brand.component';
import {AsyncPipe, NgIf} from '@angular/common';
@Component({
selector: 'app-new-user',
templateUrl: './new-user.component.html',
styleUrls: ['./new-user.component.less'],
standalone: false,
imports: [BrandComponent, NgIf, AsyncPipe],
})
export class NewUserComponent {
public user$: Observable<User | null> | null = null;

View File

@@ -10,9 +10,8 @@ import {ShowService} from '../shows/services/show.service';
export class GuestShowService {
public constructor(
private showService: ShowService,
private guestShowDataService: GuestShowDataService,
) {
}
private guestShowDataService: GuestShowDataService
) {}
public async share(show: Show, songs: Song[]): Promise<string> {
const data = {

View File

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

View File

@@ -1,29 +1,32 @@
import {Component} from '@angular/core';
import {Component, CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import {GuestShowDataService} from './guest-show-data.service';
import {ActivatedRoute} from '@angular/router';
import {map, switchMap} from 'rxjs/operators';
import {Song} from '../songs/services/song';
import {ConfigService} from '../../services/config.service';
import {AsyncPipe, DatePipe, NgFor, NgIf} from '@angular/common';
import {SongTextComponent} from '../../widget-modules/components/song-text/song-text.component';
import {ShowTypePipe} from '../../widget-modules/pipes/show-type-translater/show-type.pipe';
@Component({
selector: 'app-guest',
templateUrl: './guest.component.html',
styleUrls: ['./guest.component.less'],
standalone: false,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [NgIf, NgFor, SongTextComponent, AsyncPipe, DatePipe, ShowTypePipe],
})
export class GuestComponent {
public show$ = this.currentRoute.params.pipe(
map(param => param.id as string),
switchMap(id => this.service.read$(id)),
switchMap(id => this.service.read$(id))
);
public config$ = this.configService.get$();
public constructor(
private currentRoute: ActivatedRoute,
private service: GuestShowDataService,
private configService: ConfigService,
) {
}
private configService: ConfigService
) {}
public trackBy = (index: number, show: Song) => show.id;
}

View File

@@ -2,11 +2,10 @@ import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {GuestComponent} from './guest.component';
import {RouterModule} from '@angular/router';
import {ShowTypeTranslaterModule} from '../../widget-modules/pipes/show-type-translater/show-type-translater.module';
import {SongTextComponent} from '../../widget-modules/components/song-text/song-text.component';
import {ShowTypePipe} from '../../widget-modules/pipes/show-type-translater/show-type.pipe';
@NgModule({
declarations: [GuestComponent],
imports: [
CommonModule,
RouterModule.forChild([
@@ -16,7 +15,8 @@ import {SongTextComponent} from '../../widget-modules/components/song-text/song-
},
]),
SongTextComponent,
ShowTypeTranslaterModule,
ShowTypePipe,
GuestComponent,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})

View File

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

View File

@@ -1,12 +1,13 @@
import {Component, Input} from '@angular/core';
import {Song} from '../../../songs/services/song';
import {Config} from '../../../../services/config';
import {NgIf} from '@angular/common';
@Component({
selector: 'app-legal',
templateUrl: './legal.component.html',
styleUrls: ['./legal.component.less'],
standalone: false,
imports: [NgIf],
})
export class LegalComponent {
@Input() public song: Song | null = null;

View File

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

View File

@@ -4,7 +4,5 @@ import {Component} from '@angular/core';
selector: 'app-logo',
templateUrl: './logo.component.html',
styleUrls: ['./logo.component.less'],
standalone: false,
})
export class LogoComponent {
}
export class LogoComponent {}

View File

@@ -34,8 +34,8 @@
[fullscreen]="true"
[header]="song.title"
[index]="index??0"
[showSwitch]="false"
[showComments]="false"
[showSwitch]="false"
[text]="song.text"
chordMode="hide"
></app-song-text>

View File

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

View File

@@ -10,16 +10,20 @@ import {ConfigService} from '../../../services/config.service';
import {songSwitch} from '../../../widget-modules/components/song-text/animation';
import {TextRenderingService} from '../../songs/services/text-rendering.service';
import {PresentationBackground, Show} from '../../shows/services/show';
import {GlobalSettings} from '../../../services/global-settings';
import {ShowSongService} from '../../shows/services/show-song.service';
import {openFullscreen} from '../../../services/fullscreen';
import {AsyncPipe, DatePipe, NgIf} from '@angular/common';
import {LogoComponent} from './logo/logo.component';
import {SongTextComponent} from '../../../widget-modules/components/song-text/song-text.component';
import {LegalComponent} from './legal/legal.component';
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
@Component({
selector: 'app-monitor',
templateUrl: './monitor.component.html',
styleUrls: ['./monitor.component.less'],
animations: [songSwitch],
standalone: false,
imports: [NgIf, LogoComponent, SongTextComponent, LegalComponent, AsyncPipe, DatePipe, ShowTypePipe],
})
export class MonitorComponent implements OnInit {
public song: Song | null = null;
@@ -41,7 +45,7 @@ export class MonitorComponent implements OnInit {
private textRenderingService: TextRenderingService,
private globalSettingsService: GlobalSettingsService,
private configService: ConfigService,
private cRef: ChangeDetectorRef,
private cRef: ChangeDetectorRef
) {
this.config$ = configService.get$();
}
@@ -52,15 +56,15 @@ export class MonitorComponent implements OnInit {
.pipe(
debounceTime(100),
filter(_ => !!_),
map(_ => _ as GlobalSettings),
map(_ => _),
map(_ => _.currentShow),
distinctUntilChanged(),
tap(_ => (this.currentShowId = _)),
tap(_ => (this.currentShowId = _))
)
.pipe(
switchMap(_ => this.showService.read$(_)),
filter(_ => !!_),
map(_ => _ as Show),
map(_ => _),
tap<Show>(_ => {
this.showType = _.showType;
this.date = _.date.toDate();
@@ -77,7 +81,7 @@ export class MonitorComponent implements OnInit {
}),
switchMap((_: Show) => this.showSongService.read$(_.id, _.presentationSongId)),
filter(_ => !!_),
map(_ => _ as Song),
map(_ => _ as Song)
)
.subscribe(_ => {
this.song = _;

View File

@@ -28,5 +28,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PresentationRoutingModule {
}
export class PresentationRoutingModule {}

View File

@@ -4,11 +4,9 @@ import {CommonModule} from '@angular/common';
import {PresentationRoutingModule} from './presentation-routing.module';
import {MonitorComponent} from './monitor/monitor.component';
import {RemoteComponent} from './remote/remote.component';
import {CardModule} from '../../widget-modules/components/card/card.module';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatSelectModule} from '@angular/material/select';
import {ShowTypeTranslaterModule} from '../../widget-modules/pipes/show-type-translater/show-type-translater.module';
import {SectionTypeTranslatorModule} from '../../widget-modules/pipes/section-type-translator/section-type-translator.module';
import {LegalComponent} from './monitor/legal/legal.component';
import {MatButtonModule} from '@angular/material/button';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
@@ -17,21 +15,21 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {LogoComponent} from './monitor/logo/logo.component';
import {SelectComponent} from './select/select.component';
import {MatInputModule} from '@angular/material/input';
import {UserNameModule} from '../../services/user/user-name/user-name.module';
import {SongTextComponent} from '../../widget-modules/components/song-text/song-text.component';
import {AddSongComponent} from '../../widget-modules/components/add-song/add-song.component';
import {SectionTypePipe} from '../../widget-modules/pipes/section-type-translator/section-type.pipe';
import {ShowTypePipe} from '../../widget-modules/pipes/show-type-translater/show-type.pipe';
@NgModule({
declarations: [MonitorComponent, RemoteComponent, LegalComponent, LogoComponent, SelectComponent],
exports: [RemoteComponent],
imports: [
CommonModule,
PresentationRoutingModule,
CardModule,
MatFormFieldModule,
MatSelectModule,
ShowTypeTranslaterModule,
SectionTypeTranslatorModule,
ShowTypePipe,
SectionTypePipe,
SongTextComponent,
MatButtonModule,
FontAwesomeModule,
@@ -40,7 +38,11 @@ import {AddSongComponent} from '../../widget-modules/components/add-song/add-son
AddSongComponent,
ReactiveFormsModule,
MatInputModule,
UserNameModule,
MonitorComponent,
RemoteComponent,
LegalComponent,
LogoComponent,
SelectComponent,
],
})
export class PresentationModule {}

View File

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

View File

@@ -11,8 +11,21 @@ import {debounceTime, filter, map} from 'rxjs/operators';
import {fade} from '../../../animations';
import {TextRenderingService} from '../../songs/services/text-rendering.service';
import {Section} from '../../songs/services/section';
import {GlobalSettings} from '../../../services/global-settings';
import {LineType} from '../../songs/services/line-type';
import {AsyncPipe, DatePipe, NgFor, NgIf} from '@angular/common';
import {CardComponent} from '../../../widget-modules/components/card/card.component';
import {MatFormField, MatLabel} from '@angular/material/form-field';
import {MatInput} from '@angular/material/input';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatButton} from '@angular/material/button';
import {RouterLink} from '@angular/router';
import {FaIconComponent} from '@fortawesome/angular-fontawesome';
import {MatSelect} from '@angular/material/select';
import {MatOption} from '@angular/material/core';
import {MatSlider, MatSliderThumb} from '@angular/material/slider';
import {AddSongComponent} from '../../../widget-modules/components/add-song/add-song.component';
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
import {SectionTypePipe} from '../../../widget-modules/pipes/section-type-translator/section-type.pipe';
export interface PresentationSong {
id: string;
@@ -26,7 +39,28 @@ export interface PresentationSong {
styleUrls: ['./remote.component.less'],
animations: [fade],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
imports: [
NgIf,
CardComponent,
NgFor,
MatFormField,
MatLabel,
MatInput,
ReactiveFormsModule,
FormsModule,
MatButton,
RouterLink,
FaIconComponent,
MatSelect,
MatOption,
MatSlider,
MatSliderThumb,
AddSongComponent,
AsyncPipe,
DatePipe,
ShowTypePipe,
SectionTypePipe,
],
})
export class RemoteComponent {
public show: Show | null = null;
@@ -46,12 +80,12 @@ export class RemoteComponent {
private songService: SongService,
private textRenderingService: TextRenderingService,
globalSettingsService: GlobalSettingsService,
private cRef: ChangeDetectorRef,
private cRef: ChangeDetectorRef
) {
globalSettingsService.get$
.pipe(
filter(_ => !!_),
map(_ => _.currentShow),
map(_ => _.currentShow)
)
.subscribe(_ => {
this.onShowChanged(_);

View File

@@ -5,13 +5,18 @@ import {Show} from '../../shows/services/show';
import {GlobalSettingsService} from '../../../services/global-settings.service';
import {Router} from '@angular/router';
import {fade} from '../../../animations';
import {AsyncPipe, DatePipe, NgFor, NgIf} from '@angular/common';
import {CardComponent} from '../../../widget-modules/components/card/card.component';
import {MatButton} from '@angular/material/button';
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-select',
templateUrl: './select.component.html',
styleUrls: ['./select.component.less'],
animations: [fade],
standalone: false,
imports: [NgIf, CardComponent, NgFor, MatButton, UserNameComponent, AsyncPipe, DatePipe, ShowTypePipe],
})
export class SelectComponent implements OnInit {
public visible = false;
@@ -19,8 +24,11 @@ export class SelectComponent implements OnInit {
.list$(true)
.pipe(map(_ => _.filter(_ => _.date.toDate() > new Date(new Date().setMonth(new Date().getMonth() - 1))).sort((a, b) => (b.date < a.date ? -1 : b.date > a.date ? 1 : 0))));
public constructor(private showService: ShowService, private globalSettingsService: GlobalSettingsService, private router: Router) {
}
public constructor(
private showService: ShowService,
private globalSettingsService: GlobalSettingsService,
private router: Router
) {}
public async selectShow(show: Show) {
this.visible = false;

View File

@@ -3,5 +3,4 @@ import {Injectable} from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class PresentationService {
}
export class PresentationService {}

View File

@@ -8,7 +8,7 @@ describe('ArchiveDialogComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ArchiveDialogComponent],
imports: [ArchiveDialogComponent],
}).compileComponents();
fixture = TestBed.createComponent(ArchiveDialogComponent);
@@ -17,6 +17,6 @@ describe('ArchiveDialogComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -1,10 +1,11 @@
import {Component} from '@angular/core';
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'],
standalone: false,
imports: [MatDialogContent, MatDialogActions, MatButton, MatDialogClose],
})
export class ArchiveDialogComponent {
}
export class ArchiveDialogComponent {}

View File

@@ -17,6 +17,6 @@ describe('ShareDialogComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -3,18 +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} 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 {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'],
standalone: false,
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[]>;
@@ -27,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$;
}
@@ -39,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({
@@ -56,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 ?? ''}`);
}
}

View File

@@ -8,7 +8,7 @@ describe('FilterComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [FilterComponent],
imports: [FilterComponent],
}).compileComponents();
});
@@ -19,6 +19,6 @@ describe('FilterComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -1,7 +1,7 @@
import {Component, Input} from '@angular/core';
import {KeyValue} from '@angular/common';
import {KeyValue, NgFor} from '@angular/common';
import {ActivatedRoute, Router} from '@angular/router';
import {UntypedFormBuilder, UntypedFormGroup} 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,12 +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 {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'],
standalone: false,
imports: [ReactiveFormsModule, MatFormField, MatLabel, MatSelect, NgFor, MatOption, MatOptgroup, ShowTypePipe],
})
export class FilterComponent {
@Input() public route = '/shows/';
@@ -39,7 +43,7 @@ export class FilterComponent {
private showService: ShowService,
private userService: UserService,
activatedRoute: ActivatedRoute,
fb: UntypedFormBuilder,
fb: UntypedFormBuilder
) {
this.filterFormGroup = fb.group({
time: 1,
@@ -64,7 +68,7 @@ export class FilterComponent {
this.showService.list$().pipe(
map(shows => {
return shows.map(show => show.owner).filter(onlyUnique);
}),
})
),
this.userService.users$,
]).pipe(
@@ -77,7 +81,7 @@ export class FilterComponent {
.sort(dynamicSort('value'));
}),
distinctUntilChanged(isEqual),
map(_ => _ as {key: string; value: string}[]),
map(_ => _ as {key: string; value: string}[])
);
};

View File

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

View File

@@ -1,11 +1,14 @@
import {Component, Input} from '@angular/core';
import {Show} from '../../services/show';
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'],
standalone: false,
imports: [NgIf, UserNameComponent, DatePipe, ShowTypePipe],
})
export class ListItemComponent {
@Input() public show: Show | null = null;

View File

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

View File

@@ -4,15 +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} 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 {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],
standalone: false,
imports: [RoleDirective, ListHeaderComponent, NgIf, FilterComponent, CardComponent, NgFor, ListItemComponent, RouterLink, AsyncPipe, SortByPipe],
})
export class ListComponent {
public shows$ = this.showService.list$();
@@ -22,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(
@@ -39,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;
}

View File

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

View File

@@ -3,15 +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} 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 {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'],
standalone: false,
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[]>;
@@ -26,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$;
}

View File

@@ -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> {
@@ -214,7 +213,7 @@ export class DocxService {
sections: Section[];
}
);
const songs = show.order.map(_ => songsLoaded.filter(f => f.showSong.id === _)[0]);
const songs = show.order.map(_ => songsLoaded.find(f => f.showSong.id === _)).filter(_ => !!_);
return {songs, show, user, config};
}

View File

@@ -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}`);

View File

@@ -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));

View File

@@ -9,7 +9,7 @@ describe('ShowService', () => {
() =>
void TestBed.configureTestingModule({
providers: [{provide: ShowDataService, useValue: mockShowDataService}],
}),
})
);
ShowService.SHOW_TYPE_PUBLIC.forEach(type => {

View File

@@ -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))
)
);
}

View File

@@ -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>

View File

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

View File

@@ -1,4 +1,4 @@
import {ChangeDetectorRef, Component, HostListener, OnDestroy, OnInit} from '@angular/core';
import {ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA, HostListener, OnDestroy, OnInit} from '@angular/core';
import {filter, map, switchMap, tap} from 'rxjs/operators';
import {ActivatedRoute, Router} from '@angular/router';
import {ShowService} from '../services/show.service';
@@ -25,20 +25,61 @@ import {
faUser,
faUsers,
} from '@fortawesome/free-solid-svg-icons';
import {CdkDragDrop, moveItemInArray} 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 {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],
standalone: false,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
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;
@@ -74,16 +115,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
@@ -91,7 +131,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 = _;
@@ -103,7 +143,7 @@ export class ShowComponent implements OnInit, OnDestroy {
.subscribe(_ => {
this.songs = _;
this.cRef.markForCheck();
}),
})
);
}
@@ -175,7 +215,7 @@ export class ShowComponent implements OnInit, OnDestroy {
return show.order.map(_ => list.filter(f => f.id === _)[0]);
}
public trackBy = (_: number, show: ShowSong) => show.id;
public trackBy = (_: number, show: ShowSong) => show?.id;
public async onChange(showId: string) {
await this.router.navigateByUrl('/shows/' + showId + '/edit');

View File

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

View File

@@ -2,19 +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} from '@angular/forms';
import {ChordMode} 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 {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],
standalone: false,
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;
@@ -33,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) {

View File

@@ -29,5 +29,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ShowsRoutingModule {
}
export class ShowsRoutingModule {}

View File

@@ -3,32 +3,28 @@ import {CommonModule} from '@angular/common';
import {ShowsRoutingModule} from './shows-routing.module';
import {NewComponent} from './new/new.component';
import {CardModule} from '../../widget-modules/components/card/card.module';
import {MatFormFieldModule} from '@angular/material/form-field';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatInputModule} from '@angular/material/input';
import {ListComponent} from './list/list.component';
import {ListItemComponent} from './list/list-item/list-item.component';
import {ListHeaderModule} from '../../widget-modules/components/list-header/list-header.module';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {ButtonRowModule} from '../../widget-modules/components/button-row/button-row.module';
import {MatButtonModule} from '@angular/material/button';
import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatSelectModule} from '@angular/material/select';
import {ShowTypeTranslaterModule} from '../../widget-modules/pipes/show-type-translater/show-type-translater.module';
import {MatNativeDateModule} from '@angular/material/core';
import {ShowComponent} from './show/show.component';
import {SongComponent} from './show/song/song.component';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {MenuButtonModule} from '../../widget-modules/components/menu-button/menu-button.module';
import {NgxMatSelectSearchModule} from 'ngx-mat-select-search';
import {ButtonModule} from '../../widget-modules/components/button/button.module';
import {OwnerModule} from '../../services/user/owner.module';
import {UserNameModule} from '../../services/user/user-name/user-name.module';
import {MatMenuModule} from '@angular/material/menu';
import {DragDropModule} from '@angular/cdk/drag-drop';
import {RoleModule} from '../../services/user/role.module';
import {SortByModule} from '../../widget-modules/pipes/sort-by/sort-by.module';
import {MatTooltipModule} from '@angular/material/tooltip';
import {FilterComponent} from './list/filter/filter.component';
import {EditComponent} from './edit/edit.component';
@@ -36,39 +32,40 @@ import {ArchiveDialogComponent} from './dialog/archive-dialog/archive-dialog.com
import {MatDialogModule} from '@angular/material/dialog';
import {SongTextComponent} from '../../widget-modules/components/song-text/song-text.component';
import {AddSongComponent} from '../../widget-modules/components/add-song/add-song.component';
import {ShowTypePipe} from '../../widget-modules/pipes/show-type-translater/show-type.pipe';
import {SortByPipe} from '../../widget-modules/pipes/sort-by/sort-by.pipe';
@NgModule({
declarations: [NewComponent, ListComponent, ListItemComponent, ShowComponent, SongComponent, FilterComponent, EditComponent, ArchiveDialogComponent],
imports: [
CommonModule,
ShowsRoutingModule,
CardModule,
MatFormFieldModule,
ReactiveFormsModule,
MatInputModule,
ListHeaderModule,
MatCheckboxModule,
ButtonRowModule,
MatButtonModule,
MatDatepickerModule,
MatNativeDateModule,
MatSelectModule,
ShowTypeTranslaterModule,
ShowTypePipe,
FontAwesomeModule,
MenuButtonModule,
FormsModule,
SongTextComponent,
NgxMatSelectSearchModule,
AddSongComponent,
ButtonModule,
OwnerModule,
UserNameModule,
MatMenuModule,
DragDropModule,
RoleModule,
SortByModule,
SortByPipe,
MatTooltipModule,
MatDialogModule,
NewComponent,
ListComponent,
ListItemComponent,
ShowComponent,
SongComponent,
FilterComponent,
EditComponent,
ArchiveDialogComponent,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})

View File

@@ -8,8 +8,7 @@ import {DbService} from '../../../services/db.service';
providedIn: 'root',
})
export class FileDataService {
public constructor(private db: DbService) {
}
public constructor(private db: DbService) {}
public async set(songId: string, file: FileServer): Promise<string> {
const songRef = this.db.doc('songs/' + songId);

View File

@@ -7,8 +7,10 @@ import {FileDataService} from './file-data.service';
providedIn: 'root',
})
export class FileService {
public constructor(private storage: AngularFireStorage, private fileDataService: FileDataService) {
}
public constructor(
private storage: AngularFireStorage,
private fileDataService: FileDataService
) {}
public getDownloadUrl(path: string): Observable<string> {
const ref = this.storage.ref(path);

View File

@@ -1,8 +1,8 @@
import {TestBed, waitForAsync} from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import {SongDataService} from './song-data.service';
import {AngularFirestore} from '@angular/fire/compat/firestore';
import {of} from 'rxjs';
import {firstValueFrom, of} from 'rxjs';
describe('SongDataService', () => {
const songs = [{title: 'title1'}];
@@ -19,7 +19,7 @@ describe('SongDataService', () => {
() =>
void TestBed.configureTestingModule({
providers: [{provide: AngularFirestore, useValue: mockAngularFirestore}],
}),
})
);
it('should be created', () => {
@@ -27,13 +27,9 @@ describe('SongDataService', () => {
void expect(service).toBeTruthy();
});
it(
'should list songs',
waitForAsync(() => {
const service: SongDataService = TestBed.inject(SongDataService);
service.list$().subscribe(s => {
void expect(s[0].title).toEqual('title1');
});
}),
);
it('should list songs', async () => {
const service: SongDataService = TestBed.inject(SongDataService);
const list = await firstValueFrom(service.list$);
void expect(list[0].title).toEqual('title1');
});
});

View File

@@ -14,6 +14,7 @@ export class SongDataService {
public constructor(private dbService: DbService) {
this.dbService.col$<Song>(this.collection).subscribe(_ => this.list$.next(_));
}
// public list$ = (): Observable<Song[]> => this.dbService.col$(this.collection);
//public read$ = (songId: string): Observable<Song | null> => this.dbService.doc$(this.collection + '/' + songId);

View File

@@ -9,8 +9,7 @@ import {filter} from 'rxjs/operators';
providedIn: 'root',
})
export class SongListResolver {
public constructor(private songService: SongService) {
}
public constructor(private songService: SongService) {}
public resolve(): Observable<Song[]> {
return this.songService.list$().pipe(filter(_ => _.length > 0));

View File

@@ -15,7 +15,7 @@ describe('SongService', () => {
() =>
void TestBed.configureTestingModule({
providers: [{provide: SongDataService, useValue: mockSongDataService}],
}),
})
);
it('should be created', () => {
@@ -23,13 +23,10 @@ describe('SongService', () => {
void expect(service).toBeTruthy();
});
it(
'should list songs',
waitForAsync(() => {
const service: SongService = TestBed.inject(SongService);
service.list$().subscribe(s => {
void expect(s[0].title).toEqual('title1');
});
}),
);
it('should list songs', waitForAsync(() => {
const service: SongService = TestBed.inject(SongService);
service.list$().subscribe(s => {
void expect(s[0].title).toEqual('title1');
});
}));
});

View File

@@ -27,7 +27,7 @@ export class SongService {
public constructor(
private songDataService: SongDataService,
private userService: UserService,
private userService: UserService
) {
// importCCLI = (songs: Song[]) => this.updateFromCLI(songs);
}

View File

@@ -10,7 +10,10 @@ import {FileServer} from './fileServer';
providedIn: 'root',
})
export class UploadService extends FileBase {
public constructor(private fileDataService: FileDataService, private angularFireStorage: AngularFireStorage) {
public constructor(
private fileDataService: FileDataService,
private angularFireStorage: AngularFireStorage
) {
super();
}

View File

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

View File

@@ -1,16 +1,24 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {UntypedFormBuilder, UntypedFormGroup} from '@angular/forms';
import {ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup} from '@angular/forms';
import {SongService} from '../../services/song.service';
import {FilterValues} from './filter-values';
import {Song} from '../../services/song';
import {KEYS} from '../../services/key.helper';
import {MatFormField, MatLabel} from '@angular/material/form-field';
import {MatInput} from '@angular/material/input';
import {MatSelect} from '@angular/material/select';
import {MatOption} from '@angular/material/core';
import {NgFor} from '@angular/common';
import {LegalTypePipe} from '../../../../widget-modules/pipes/legal-type-translator/legal-type.pipe';
import {KeyPipe} from '../../../../widget-modules/pipes/key-translator/key.pipe';
import {SongTypePipe} from '../../../../widget-modules/pipes/song-type-translater/song-type.pipe';
@Component({
selector: 'app-filter',
templateUrl: './filter.component.html',
styleUrls: ['./filter.component.less'],
standalone: false,
imports: [ReactiveFormsModule, MatFormField, MatLabel, MatInput, MatSelect, MatOption, NgFor, LegalTypePipe, KeyPipe, SongTypePipe],
})
export class FilterComponent {
public filterFormGroup: UntypedFormGroup;
@@ -20,7 +28,11 @@ export class FilterComponent {
public legalType = SongService.LEGAL_TYPE;
public keys = KEYS;
public constructor(private router: Router, activatedRoute: ActivatedRoute, fb: UntypedFormBuilder) {
public constructor(
private router: Router,
activatedRoute: ActivatedRoute,
fb: UntypedFormBuilder
) {
this.filterFormGroup = fb.group({
q: '',
type: '',

View File

@@ -15,15 +15,13 @@ describe('SongListComponent', () => {
list: () => of(songs),
};
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [SongListComponent],
providers: [{provide: SongService, useValue: mockSongService}],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();
}),
);
beforeEach(waitForAsync(() => {
void TestBed.configureTestingModule({
imports: [SongListComponent],
providers: [{provide: SongService, useValue: mockSongService}],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SongListComponent);

View File

@@ -4,11 +4,17 @@ import {Song} from '../services/song';
import {map} from 'rxjs/operators';
import {combineLatest, Observable} from 'rxjs';
import {fade} from '../../../animations';
import {ActivatedRoute} from '@angular/router';
import {ActivatedRoute, RouterLink} from '@angular/router';
import {filterSong} from '../../../services/filter.helper';
import {FilterValues} from './filter/filter-values';
import {ScrollService} from '../../../services/scroll.service';
import {faBalanceScaleRight, faCheck, faPencilRuler} from '@fortawesome/free-solid-svg-icons';
import {AsyncPipe, NgFor, NgIf} from '@angular/common';
import {ListHeaderComponent} from '../../../widget-modules/components/list-header/list-header.component';
import {FilterComponent} from './filter/filter.component';
import {CardComponent} from '../../../widget-modules/components/card/card.component';
import {RoleDirective} from '../../../services/user/role.directive';
import {FaIconComponent} from '@fortawesome/angular-fontawesome';
@Component({
selector: 'app-songs',
@@ -16,7 +22,7 @@ import {faBalanceScaleRight, faCheck, faPencilRuler} from '@fortawesome/free-sol
styleUrls: ['./song-list.component.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
animations: [fade],
standalone: false,
imports: [NgIf, ListHeaderComponent, FilterComponent, CardComponent, NgFor, RouterLink, RoleDirective, FaIconComponent, AsyncPipe],
})
export class SongListComponent implements OnInit, OnDestroy {
public anyFilterActive = false;
@@ -24,7 +30,7 @@ export class SongListComponent implements OnInit, OnDestroy {
this.activatedRoute.queryParams.pipe(map(_ => _ as FilterValues)),
this.activatedRoute.data.pipe(
map(data => data.songList as Song[]),
map(songs => songs.sort((a, b) => a.number - b.number)),
map(songs => songs.sort((a, b) => a.number - b.number))
),
]).pipe(
map(_ => {
@@ -32,14 +38,17 @@ export class SongListComponent implements OnInit, OnDestroy {
const filter = _[0];
this.anyFilterActive = this.checkIfFilterActive(filter);
return songs.filter(song => this.filter(song, filter)).sort((a, b) => a.title?.localeCompare(b.title));
}),
})
);
public faLegal = faBalanceScaleRight;
public faDraft = faPencilRuler;
public faFinal = faCheck;
public constructor(private songService: SongService, private activatedRoute: ActivatedRoute, private scrollService: ScrollService) {
}
public constructor(
private songService: SongService,
private activatedRoute: ActivatedRoute,
private scrollService: ScrollService
) {}
public ngOnInit(): void {
setTimeout(() => this.scrollService.restoreScrollPositionFor('songlist'), 100);

View File

@@ -1,43 +0,0 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {SongListComponent} from './song-list.component';
import {CardModule} from '../../../widget-modules/components/card/card.module';
import {RouterModule} from '@angular/router';
import {
LegalTypeTranslatorModule,
} from '../../../widget-modules/pipes/legal-type-translator/legal-type-translator.module';
import {ListHeaderModule} from '../../../widget-modules/components/list-header/list-header.module';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
import {FilterComponent} from './filter/filter.component';
import {ReactiveFormsModule} from '@angular/forms';
import {MatSelectModule} from '@angular/material/select';
import {SongTypeTranslaterModule} from '../../../widget-modules/pipes/song-type-translater/song-type-translater.module';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {MatTooltipModule} from '@angular/material/tooltip';
import {RoleModule} from '../../../services/user/role.module';
import {KeyTranslatorModule} from '../../../widget-modules/pipes/key-translator/key-translator.module';
@NgModule({
declarations: [SongListComponent, FilterComponent],
exports: [SongListComponent],
imports: [
CommonModule,
RouterModule,
CardModule,
LegalTypeTranslatorModule,
ListHeaderModule,
MatFormFieldModule,
MatInputModule,
ReactiveFormsModule,
MatSelectModule,
SongTypeTranslaterModule,
FontAwesomeModule,
MatTooltipModule,
RoleModule,
KeyTranslatorModule,
],
})
export class SongListModule {
}

View File

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

View File

@@ -6,12 +6,17 @@ import {map, switchMap} from 'rxjs/operators';
import {FileDataService} from '../../../services/file-data.service';
import {Observable} from 'rxjs';
import {File} from '../../../services/file';
import {CardComponent} from '../../../../../widget-modules/components/card/card.component';
import {AsyncPipe, NgFor, NgIf, NgStyle} from '@angular/common';
import {MatIconButton} from '@angular/material/button';
import {MatIcon} from '@angular/material/icon';
import {FileComponent} from './file/file.component';
@Component({
selector: 'app-edit-file',
templateUrl: './edit-file.component.html',
styleUrls: ['./edit-file.component.less'],
standalone: false,
imports: [CardComponent, NgIf, NgStyle, MatIconButton, MatIcon, NgFor, FileComponent, AsyncPipe],
})
export class EditFileComponent {
public selectedFiles: FileList | null = null;
@@ -19,11 +24,15 @@ export class EditFileComponent {
public songId: string | null = null;
public files$: Observable<File[]>;
public constructor(private activatedRoute: ActivatedRoute, private uploadService: UploadService, private fileService: FileDataService) {
public constructor(
private activatedRoute: ActivatedRoute,
private uploadService: UploadService,
private fileService: FileDataService
) {
this.activatedRoute.params
.pipe(
map(param => param as {songId: string}),
map(param => param.songId),
map(param => param.songId)
)
.subscribe(songId => {
this.songId = songId;
@@ -32,7 +41,7 @@ export class EditFileComponent {
this.files$ = this.activatedRoute.params.pipe(
map(param => param as {songId: string}),
map(param => param.songId),
switchMap(songId => this.fileService.read$(songId)),
switchMap(songId => this.fileService.read$(songId))
);
}

View File

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

View File

@@ -3,12 +3,15 @@ import {Observable} from 'rxjs';
import {File} from '../../../../services/file';
import {faTrashAlt} from '@fortawesome/free-solid-svg-icons';
import {FileService} from '../../../../services/file.service';
import {MatIconButton} from '@angular/material/button';
import {FaIconComponent} from '@fortawesome/angular-fontawesome';
import {AsyncPipe} from '@angular/common';
@Component({
selector: 'app-file',
templateUrl: './file.component.html',
styleUrls: ['./file.component.less'],
standalone: false,
imports: [MatIconButton, FaIconComponent, AsyncPipe],
})
export class FileComponent {
public url$: Observable<string> | null = null;
@@ -18,8 +21,7 @@ export class FileComponent {
private fileId: string | null = null;
private path: string | null = null;
public constructor(private fileService: FileService) {
}
public constructor(private fileService: FileService) {}
@Input()
public set file(file: File) {

View File

@@ -11,7 +11,7 @@ export class EditSongGuard {
component: EditComponent,
currentRoute: ActivatedRouteSnapshot,
currentState: RouterStateSnapshot,
nextState: RouterStateSnapshot,
nextState: RouterStateSnapshot
): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return component.editSongComponent ? component.editSongComponent.askForSave(nextState) : true;
}

View File

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

View File

@@ -1,22 +1,64 @@
import {Component, OnInit} from '@angular/core';
import {Song} from '../../../services/song';
import {UntypedFormGroup} from '@angular/forms';
import {ReactiveFormsModule, UntypedFormGroup} from '@angular/forms';
import {ActivatedRoute, Router, RouterStateSnapshot} from '@angular/router';
import {SongService} from '../../../services/song.service';
import {EditService} from '../edit.service';
import {first, map, switchMap} from 'rxjs/operators';
import {KEYS} from '../../../services/key.helper';
import {COMMA, ENTER} from '@angular/cdk/keycodes';
import {MatChipInputEvent} from '@angular/material/chips';
import {MatChipGrid, MatChipInput, MatChipInputEvent, MatChipRow} from '@angular/material/chips';
import {faExternalLinkAlt, faSave, faTimesCircle} from '@fortawesome/free-solid-svg-icons';
import {MatDialog} from '@angular/material/dialog';
import {SaveDialogComponent} from './save-dialog/save-dialog.component';
import {NgFor, NgIf} from '@angular/common';
import {CardComponent} from '../../../../../widget-modules/components/card/card.component';
import {MatFormField, MatLabel, MatSuffix} from '@angular/material/form-field';
import {MatInput} from '@angular/material/input';
import {MatSelect} from '@angular/material/select';
import {MatOption} from '@angular/material/core';
import {CdkTextareaAutosize} from '@angular/cdk/text-field';
import {SongTextComponent} from '../../../../../widget-modules/components/song-text/song-text.component';
import {FaIconComponent} from '@fortawesome/angular-fontawesome';
import {MatTooltip} from '@angular/material/tooltip';
import {ButtonRowComponent} from '../../../../../widget-modules/components/button-row/button-row.component';
import {ButtonComponent} from '../../../../../widget-modules/components/button/button.component';
import {SongTypePipe} from '../../../../../widget-modules/pipes/song-type-translater/song-type.pipe';
import {LegalOwnerPipe} from '../../../../../widget-modules/pipes/legal-owner-translator/legal-owner.pipe';
import {LegalTypePipe} from '../../../../../widget-modules/pipes/legal-type-translator/legal-type.pipe';
import {KeyPipe} from '../../../../../widget-modules/pipes/key-translator/key.pipe';
import {StatusPipe} from '../../../../../widget-modules/pipes/status-translater/status.pipe';
@Component({
selector: 'app-edit-song',
templateUrl: './edit-song.component.html',
styleUrls: ['./edit-song.component.less'],
standalone: false,
imports: [
NgIf,
CardComponent,
ReactiveFormsModule,
MatFormField,
MatLabel,
MatInput,
MatSelect,
NgFor,
MatOption,
CdkTextareaAutosize,
SongTextComponent,
MatChipGrid,
MatChipRow,
FaIconComponent,
MatChipInput,
MatSuffix,
MatTooltip,
ButtonRowComponent,
ButtonComponent,
SongTypePipe,
LegalOwnerPipe,
LegalTypePipe,
KeyPipe,
StatusPipe,
],
})
export class EditSongComponent implements OnInit {
public song: Song | null = null;
@@ -38,9 +80,8 @@ export class EditSongComponent implements OnInit {
private songService: SongService,
private editService: EditService,
private router: Router,
public dialog: MatDialog,
) {
}
public dialog: MatDialog
) {}
public ngOnInit(): void {
this.activatedRoute.params
@@ -48,7 +89,7 @@ export class EditSongComponent implements OnInit {
map(param => param as {songId: string}),
map(param => param.songId),
switchMap(songId => this.songService.read$(songId)),
first(),
first()
)
.subscribe(song => {
this.song = song;

View File

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

View File

@@ -1,10 +1,11 @@
import {Component} from '@angular/core';
import {MatDialogActions, MatDialogClose, MatDialogContent, MatDialogTitle} from '@angular/material/dialog';
import {MatButton} from '@angular/material/button';
@Component({
selector: 'app-save-dialog',
templateUrl: './save-dialog.component.html',
styleUrls: ['./save-dialog.component.less'],
standalone: false,
imports: [MatDialogClose, MatDialogTitle, MatDialogContent, MatDialogActions, MatButton],
})
export class SaveDialogComponent {
}
export class SaveDialogComponent {}

View File

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

View File

@@ -1,11 +1,13 @@
import {Component, ViewChild} from '@angular/core';
import {EditSongComponent} from './edit-song/edit-song.component';
import {EditFileComponent} from './edit-file/edit-file.component';
import {HistoryComponent} from './history/history.component';
@Component({
selector: 'app-edit',
templateUrl: './edit.component.html',
styleUrls: ['./edit.component.less'],
standalone: false,
imports: [EditSongComponent, EditFileComponent, HistoryComponent],
})
export class EditComponent {
@ViewChild(EditSongComponent) public editSongComponent: EditSongComponent | null = null;

View File

@@ -1,60 +1,59 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {EditComponent} from './edit.component';
import {CardModule} from '../../../../widget-modules/components/card/card.module';
import {SongTypeTranslaterModule} from '../../../../widget-modules/pipes/song-type-translater/song-type-translater.module';
import {ReactiveFormsModule} from '@angular/forms';
import {MatInputModule} from '@angular/material/input';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatSelectModule} from '@angular/material/select';
import {MatButtonModule} from '@angular/material/button';
import {ButtonRowModule} from '../../../../widget-modules/components/button-row/button-row.module';
import {RouterModule} from '@angular/router';
import {EditSongComponent} from './edit-song/edit-song.component';
import {EditFileComponent} from './edit-file/edit-file.component';
import {MatIconModule} from '@angular/material/icon';
import {FileComponent} from './edit-file/file/file.component';
import {LegalOwnerTranslatorModule} from '../../../../widget-modules/pipes/legal-owner-translator/legal-owner-translator.module';
import {LegalTypeTranslatorModule} from '../../../../widget-modules/pipes/legal-type-translator/legal-type-translator.module';
import {KeyTranslatorModule} from '../../../../widget-modules/pipes/key-translator/key-translator.module';
import {MatChipsModule} from '@angular/material/chips';
import {FontAwesomeModule} from '@fortawesome/angular-fontawesome';
import {StatusTranslaterModule} from '../../../../widget-modules/pipes/status-translater/status-translater.module';
import {ButtonModule} from '../../../../widget-modules/components/button/button.module';
import {MatTooltipModule} from '@angular/material/tooltip';
import {SaveDialogComponent} from './edit-song/save-dialog/save-dialog.component';
import {MatDialogModule} from '@angular/material/dialog';
import {HistoryComponent} from './history/history.component';
import {SongTextComponent} from '../../../../widget-modules/components/song-text/song-text.component';
import {KeyPipe} from '../../../../widget-modules/pipes/key-translator/key.pipe';
import {LegalOwnerPipe} from '../../../../widget-modules/pipes/legal-owner-translator/legal-owner.pipe';
import {LegalTypePipe} from '../../../../widget-modules/pipes/legal-type-translator/legal-type.pipe';
import {SongTypePipe} from '../../../../widget-modules/pipes/song-type-translater/song-type.pipe';
import {StatusPipe} from '../../../../widget-modules/pipes/status-translater/status.pipe';
@NgModule({
declarations: [EditComponent, EditSongComponent, EditFileComponent, FileComponent, SaveDialogComponent, HistoryComponent],
exports: [EditComponent],
bootstrap: [SaveDialogComponent],
imports: [
CommonModule,
CardModule,
SongTypeTranslaterModule,
SongTypePipe,
ReactiveFormsModule,
RouterModule,
MatInputModule,
MatButtonModule,
MatCheckboxModule,
MatSelectModule,
ButtonRowModule,
MatIconModule,
LegalOwnerTranslatorModule,
LegalTypeTranslatorModule,
KeyTranslatorModule,
LegalOwnerPipe,
LegalTypePipe,
KeyPipe,
MatChipsModule,
FontAwesomeModule,
StatusTranslaterModule,
ButtonModule,
StatusPipe,
MatTooltipModule,
MatDialogModule,
SongTextComponent,
EditComponent,
EditSongComponent,
EditFileComponent,
FileComponent,
HistoryComponent,
SaveDialogComponent,
],
})
export class EditModule {}

View File

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

View File

@@ -3,18 +3,22 @@ import {first, map, switchMap} from 'rxjs/operators';
import {ActivatedRoute} from '@angular/router';
import {SongService} from '../../../services/song.service';
import {Song} from '../../../services/song';
import {DatePipe, NgFor, NgIf} from '@angular/common';
import {CardComponent} from '../../../../../widget-modules/components/card/card.component';
@Component({
selector: 'app-history',
templateUrl: './history.component.html',
styleUrls: ['./history.component.less'],
standalone: false,
imports: [NgIf, CardComponent, NgFor, DatePipe],
})
export class HistoryComponent implements OnInit {
public song: Song | null = null;
public constructor(private activatedRoute: ActivatedRoute, private songService: SongService) {
}
public constructor(
private activatedRoute: ActivatedRoute,
private songService: SongService
) {}
public ngOnInit(): void {
this.activatedRoute.params
@@ -22,7 +26,7 @@ export class HistoryComponent implements OnInit {
map(param => param as {songId: string}),
map(param => param.songId),
switchMap(songId => this.songService.read$(songId)),
first(),
first()
)
.subscribe(song => {
this.song = song;

View File

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

View File

@@ -2,19 +2,19 @@ import {Component, Input} from '@angular/core';
import {File} from '../../services/file';
import {AngularFireStorage} from '@angular/fire/compat/storage';
import {Observable} from 'rxjs';
import {AsyncPipe} from '@angular/common';
@Component({
selector: 'app-file',
templateUrl: './file.component.html',
styleUrls: ['./file.component.less'],
standalone: false,
imports: [AsyncPipe],
})
export class FileComponent {
public url$: Observable<string> | null = null;
public name = '';
public constructor(private storage: AngularFireStorage) {
}
public constructor(private storage: AngularFireStorage) {}
@Input()
public set file(file: File) {

View File

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

View File

@@ -1,16 +1,21 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {faSave} from '@fortawesome/free-solid-svg-icons';
import {UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import {ReactiveFormsModule, UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import {SongService} from '../../services/song.service';
import {Song} from '../../services/song';
import {Router} from '@angular/router';
import {Subscription} from 'rxjs';
import {CardComponent} from '../../../../widget-modules/components/card/card.component';
import {MatFormField, MatLabel} from '@angular/material/form-field';
import {MatInput} from '@angular/material/input';
import {ButtonRowComponent} from '../../../../widget-modules/components/button-row/button-row.component';
import {ButtonComponent} from '../../../../widget-modules/components/button/button.component';
@Component({
selector: 'app-new',
templateUrl: './new.component.html',
styleUrls: ['./new.component.less'],
standalone: false,
imports: [CardComponent, ReactiveFormsModule, MatFormField, MatLabel, MatInput, ButtonRowComponent, ButtonComponent],
})
export class NewComponent implements OnInit, OnDestroy {
public faSave = faSave;
@@ -20,8 +25,10 @@ export class NewComponent implements OnInit, OnDestroy {
});
private subs: Subscription[] = [];
public constructor(private songService: SongService, private router: Router) {
}
public constructor(
private songService: SongService,
private router: Router
) {}
public ngOnInit(): void {
this.form.reset();
@@ -30,7 +37,7 @@ export class NewComponent implements OnInit, OnDestroy {
this.songService.list$().subscribe(songs => {
const freeSongnumber = this.getFreeSongNumber(songs);
this.form.controls.number.setValue(freeSongnumber);
}),
})
);
}

View File

@@ -1,17 +0,0 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {NewComponent} from './new.component';
import {CardModule} from '../../../../widget-modules/components/card/card.module';
import {ReactiveFormsModule} from '@angular/forms';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
import {ButtonRowModule} from '../../../../widget-modules/components/button-row/button-row.module';
import {ButtonModule} from '../../../../widget-modules/components/button/button.module';
import {AutofocusModule} from '../../../../widget-modules/directives/autofocus/autofocus.module';
@NgModule({
declarations: [NewComponent],
imports: [CommonModule, CardModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, ButtonRowModule, ButtonModule, AutofocusModule],
})
export class NewModule {
}

View File

@@ -12,14 +12,12 @@ describe('SongComponent', () => {
params: of({songId: '4711'}),
};
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [SongComponent],
providers: [{provide: ActivatedRoute, useValue: mockActivatedRoute}],
}).compileComponents();
}),
);
beforeEach(waitForAsync(() => {
void TestBed.configureTestingModule({
imports: [SongComponent],
providers: [{provide: ActivatedRoute, useValue: mockActivatedRoute}],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SongComponent);

View File

@@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {ActivatedRoute, Router, RouterLink} from '@angular/router';
import {SongService} from '../services/song.service';
import {distinctUntilChanged, map, switchMap} from 'rxjs/operators';
import {Song} from '../services/song';
@@ -12,12 +12,45 @@ import {faEdit, faFileCirclePlus, faTrash} from '@fortawesome/free-solid-svg-ico
import {ShowService} from '../../shows/services/show.service';
import {Show} from '../../shows/services/show';
import {ShowSongService} from '../../shows/services/show-song.service';
import {AsyncPipe, DatePipe, NgFor, NgIf} from '@angular/common';
import {CardComponent} from '../../../widget-modules/components/card/card.component';
import {RoleDirective} from '../../../services/user/role.directive';
import {SongTextComponent} from '../../../widget-modules/components/song-text/song-text.component';
import {MatChipListbox, MatChipOption} from '@angular/material/chips';
import {ButtonRowComponent} from '../../../widget-modules/components/button-row/button-row.component';
import {ButtonComponent} from '../../../widget-modules/components/button/button.component';
import {MatMenu, MatMenuTrigger} from '@angular/material/menu';
import {FileComponent} from './file/file.component';
import {SongTypePipe} from '../../../widget-modules/pipes/song-type-translater/song-type.pipe';
import {LegalOwnerPipe} from '../../../widget-modules/pipes/legal-owner-translator/legal-owner.pipe';
import {StatusPipe} from '../../../widget-modules/pipes/status-translater/status.pipe';
import {ShowTypePipe} from '../../../widget-modules/pipes/show-type-translater/show-type.pipe';
@Component({
selector: 'app-song',
templateUrl: './song.component.html',
styleUrls: ['./song.component.less'],
standalone: false,
imports: [
NgIf,
CardComponent,
RoleDirective,
SongTextComponent,
MatChipListbox,
NgFor,
MatChipOption,
ButtonRowComponent,
ButtonComponent,
RouterLink,
MatMenuTrigger,
MatMenu,
FileComponent,
AsyncPipe,
DatePipe,
SongTypePipe,
LegalOwnerPipe,
StatusPipe,
ShowTypePipe,
],
})
export class SongComponent implements OnInit {
public song$: Observable<Song | null> | null = null;
@@ -35,7 +68,7 @@ export class SongComponent implements OnInit {
private userService: UserService,
private router: Router,
private showService: ShowService,
private showSongService: ShowSongService,
private showSongService: ShowSongService
) {
this.user$ = userService.user$;
}
@@ -44,13 +77,13 @@ export class SongComponent implements OnInit {
this.song$ = this.activatedRoute.params.pipe(
map(param => param as {songId: string}),
map(param => param.songId),
switchMap(songId => this.songService.read$(songId)),
switchMap(songId => this.songService.read$(songId))
);
this.files$ = this.activatedRoute.params.pipe(
map(param => param as {songId: string}),
map(param => param.songId),
switchMap(songId => this.fileService.read$(songId)),
switchMap(songId => this.fileService.read$(songId))
);
}
@@ -78,6 +111,6 @@ export class SongComponent implements OnInit {
map(([user, song]) => {
return user.songUsage[song.id];
}),
distinctUntilChanged(),
distinctUntilChanged()
);
}

View File

@@ -1,40 +0,0 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {SongComponent} from './song.component';
import {CardModule} from '../../../widget-modules/components/card/card.module';
import {SongTypeTranslaterModule} from '../../../widget-modules/pipes/song-type-translater/song-type-translater.module';
import {MatButtonModule} from '@angular/material/button';
import {ButtonRowModule} from '../../../widget-modules/components/button-row/button-row.module';
import {RouterModule} from '@angular/router';
import {LegalOwnerTranslatorModule} from '../../../widget-modules/pipes/legal-owner-translator/legal-owner-translator.module';
import {MatChipsModule} from '@angular/material/chips';
import {RoleModule} from '../../../services/user/role.module';
import {StatusTranslaterModule} from '../../../widget-modules/pipes/status-translater/status-translater.module';
import {ButtonModule} from '../../../widget-modules/components/button/button.module';
import {FileComponent} from './file/file.component';
import {MatMenuModule} from '@angular/material/menu';
import {ShowTypeTranslaterModule} from '../../../widget-modules/pipes/show-type-translater/show-type-translater.module';
import {SongTextComponent} from '../../../widget-modules/components/song-text/song-text.component';
@NgModule({
declarations: [SongComponent, FileComponent],
exports: [SongComponent],
imports: [
CommonModule,
CardModule,
RouterModule,
SongTypeTranslaterModule,
MatButtonModule,
ButtonRowModule,
LegalOwnerTranslatorModule,
SongTextComponent,
MatChipsModule,
RoleModule,
StatusTranslaterModule,
ButtonModule,
MatMenuModule,
ShowTypeTranslaterModule,
],
})
export class SongModule {}

View File

@@ -33,5 +33,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class SongsRoutingModule {
}
export class SongsRoutingModule {}

View File

@@ -2,14 +2,11 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {SongsRoutingModule} from './songs-routing.module';
import {SongListModule} from './song-list/song-list.module';
import {SongModule} from './song/song.module';
import {EditModule} from './song/edit/edit.module';
import {NewModule} from './song/new/new.module';
@NgModule({
declarations: [],
imports: [CommonModule, SongsRoutingModule, SongListModule, SongModule, EditModule, NewModule],
imports: [CommonModule, SongsRoutingModule, EditModule],
})
export class SongsModule {
}
export class SongsModule {}

View File

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

View File

@@ -6,19 +6,45 @@ import {ChordMode} from '../../../widget-modules/components/song-text/song-text.
import {faSignOutAlt} from '@fortawesome/free-solid-svg-icons';
import {RolePipe} from './role.pipe';
import {roles} from '../../../services/user/roles';
import {AsyncPipe, NgIf} from '@angular/common';
import {CardComponent} from '../../../widget-modules/components/card/card.component';
import {MatFormField, MatHint, MatLabel} from '@angular/material/form-field';
import {MatSelect} from '@angular/material/select';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatOption} from '@angular/material/core';
import {ButtonRowComponent} from '../../../widget-modules/components/button-row/button-row.component';
import {ButtonComponent} from '../../../widget-modules/components/button/button.component';
import {RouterLink} from '@angular/router';
import {RoleDirective} from '../../../services/user/role.directive';
import {UsersComponent} from './users/users.component';
@Component({
selector: 'app-info',
templateUrl: './info.component.html',
styleUrls: ['./info.component.less'],
standalone: false,
imports: [
NgIf,
CardComponent,
MatFormField,
MatLabel,
MatSelect,
ReactiveFormsModule,
FormsModule,
MatOption,
MatHint,
ButtonRowComponent,
ButtonComponent,
RouterLink,
RoleDirective,
UsersComponent,
AsyncPipe,
],
})
export class InfoComponent implements OnInit {
public user$: Observable<User | null> | null = null;
public faSignOut = faSignOutAlt;
public constructor(private userService: UserService) {
}
public constructor(private userService: UserService) {}
public ngOnInit(): void {
this.user$ = this.userService.user$;

View File

@@ -1,10 +1,7 @@
import {Pipe, PipeTransform} from '@angular/core';
import {roles} from '../../../services/user/roles';
@Pipe({
name: 'role',
standalone: false,
})
@Pipe({name: 'role'})
export class RolePipe implements PipeTransform {
public transform(role: roles): string {
switch (role) {

View File

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

View File

@@ -3,12 +3,21 @@ import {User} from '../../../../../services/user/user';
import {UserService} from '../../../../../services/user/user.service';
import {ROLE_TYPES} from '../../../../../services/user/roles';
import {faTimes} from '@fortawesome/free-solid-svg-icons';
import {NgFor, NgIf} from '@angular/common';
import {MatFormField, MatLabel} from '@angular/material/form-field';
import {MatInput} from '@angular/material/input';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatSelect} from '@angular/material/select';
import {MatOption} from '@angular/material/core';
import {MatIconButton} from '@angular/material/button';
import {FaIconComponent} from '@fortawesome/angular-fontawesome';
import {RolePipe} from '../../role.pipe';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.less'],
standalone: false,
imports: [NgIf, MatFormField, MatLabel, MatInput, ReactiveFormsModule, FormsModule, MatSelect, NgFor, MatOption, MatIconButton, FaIconComponent, RolePipe],
})
export class UserComponent {
public id = '';
@@ -18,8 +27,7 @@ export class UserComponent {
public edit = false;
public faClose = faTimes;
public constructor(private userService: UserService) {
}
public constructor(private userService: UserService) {}
@Input()
public set user(value: User) {

View File

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

View File

@@ -2,12 +2,16 @@ import {Component} from '@angular/core';
import {UserService} from '../../../../services/user/user.service';
import {Observable} from 'rxjs';
import {User} from '../../../../services/user/user';
import {CardComponent} from '../../../../widget-modules/components/card/card.component';
import {AsyncPipe, NgFor} from '@angular/common';
import {UserComponent} from './user/user.component';
import {SortByPipe} from '../../../../widget-modules/pipes/sort-by/sort-by.pipe';
@Component({
selector: 'app-users',
templateUrl: './users.component.html',
styleUrls: ['./users.component.less'],
standalone: false,
imports: [CardComponent, NgFor, UserComponent, AsyncPipe, SortByPipe],
})
export class UsersComponent {
public users$: Observable<User[]>;

View File

@@ -1,9 +1,6 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'authMessage',
standalone: false,
})
@Pipe({name: 'authMessage'})
export class AuthMessagePipe implements PipeTransform {
public transform(code: string): string {
switch (code) {

View File

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

View File

@@ -1,14 +1,20 @@
import {Component, OnInit} from '@angular/core';
import {UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import {Router} from '@angular/router';
import {ReactiveFormsModule, UntypedFormControl, UntypedFormGroup, Validators} from '@angular/forms';
import {Router, RouterLink} from '@angular/router';
import {UserService} from '../../../services/user/user.service';
import {faSignInAlt, faUserPlus} from '@fortawesome/free-solid-svg-icons';
import {LogoComponent} from '../../../widget-modules/components/logo/logo.component';
import {MatFormField, MatLabel} from '@angular/material/form-field';
import {MatInput} from '@angular/material/input';
import {NgIf} from '@angular/common';
import {MatButton} from '@angular/material/button';
import {AuthMessagePipe} from './auth-message.pipe';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.less'],
standalone: false,
imports: [LogoComponent, ReactiveFormsModule, MatFormField, MatLabel, MatInput, NgIf, MatButton, RouterLink, AuthMessagePipe],
})
export class LoginComponent implements OnInit {
public form: UntypedFormGroup = new UntypedFormGroup({
@@ -19,8 +25,10 @@ export class LoginComponent implements OnInit {
public faSignIn = faSignInAlt;
public faNewUser = faUserPlus;
public constructor(private userService: UserService, private router: Router) {
}
public constructor(
private userService: UserService,
private router: Router
) {}
public ngOnInit(): void {
this.form.reset;

View File

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

Some files were not shown because too many files have changed in this diff Show More