From bb0676a4281b271c3eef6293d77c449076c86239 Mon Sep 17 00:00:00 2001 From: smuddyx Date: Sun, 8 Mar 2020 09:45:05 +0100 Subject: [PATCH] show component --- firestore.rules | 2 +- package-lock.json | 11 ++-- src/app/app-routing.module.ts | 8 +-- src/app/app.module.ts | 2 +- .../show/services/show.service.spec.ts | 12 ----- src/app/modules/show/services/show.service.ts | 18 ------- .../list/list-item/list-item.component.html | 2 +- .../list/list-item/list-item.component.less | 2 +- .../list-item/list-item.component.spec.ts | 0 .../list/list-item/list-item.component.ts | 0 .../{show => shows}/list/list.component.html | 0 .../{show => shows}/list/list.component.less | 0 .../list/list.component.spec.ts | 0 .../{show => shows}/list/list.component.ts | 0 .../{show => shows}/new/new.component.html | 28 +++++----- .../{show => shows}/new/new.component.less | 0 .../{show => shows}/new/new.component.spec.ts | 0 .../{show => shows}/new/new.component.ts | 14 ++--- .../services/show-data.service.spec.ts | 0 .../services/show-data.service.ts | 10 ++-- .../shows/services/show.service.spec.ts | 37 +++++++++++++ .../modules/shows/services/show.service.ts | 27 ++++++++++ .../modules/{show => shows}/services/show.ts | 0 .../modules/shows/show/show.component.html | 7 +++ .../modules/shows/show/show.component.less | 0 .../modules/shows/show/show.component.spec.ts | 25 +++++++++ src/app/modules/shows/show/show.component.ts | 29 ++++++++++ .../shows-routing.module.ts} | 7 ++- .../show.module.ts => shows/shows.module.ts} | 11 ++-- .../songs/services/text-rendering.service.ts | 9 ---- .../modules/songs/song/song.component.spec.ts | 6 +-- .../navigation/navigation.component.html | 12 ----- .../navigation/navigation.component.less | 53 ------------------- .../navigation/navigation.component.ts | 16 ------ .../application-frame.module.ts | 8 ++- .../navigation/filter/filter.component.html | 0 .../navigation/filter/filter.component.less | 2 +- .../filter/filter.component.spec.ts | 0 .../navigation/filter/filter.component.ts | 0 .../navigation/link/link.component.html | 3 ++ .../navigation/link/link.component.less | 43 +++++++++++++++ .../navigation/link/link.component.spec.ts | 25 +++++++++ .../navigation/link/link.component.ts | 13 +++++ .../navigation/navigation.component.html | 12 +++++ .../navigation/navigation.component.less | 32 +++++++++++ .../navigation/navigation.component.spec.ts | 0 .../navigation/navigation.component.ts | 23 ++++++++ .../list-header/list-header.component.html | 0 .../list-header/list-header.component.less | 0 .../list-header/list-header.component.spec.ts | 0 .../list-header/list-header.component.ts | 0 .../list-header/list-header.module.ts | 0 .../show-type-translater/show-type.pipe.ts | 20 +++++-- 53 files changed, 344 insertions(+), 185 deletions(-) delete mode 100644 src/app/modules/show/services/show.service.spec.ts delete mode 100644 src/app/modules/show/services/show.service.ts rename src/app/modules/{show => shows}/list/list-item/list-item.component.html (54%) rename src/app/modules/{show => shows}/list/list-item/list-item.component.less (90%) rename src/app/modules/{show => shows}/list/list-item/list-item.component.spec.ts (100%) rename src/app/modules/{show => shows}/list/list-item/list-item.component.ts (100%) rename src/app/modules/{show => shows}/list/list.component.html (100%) rename src/app/modules/{show => shows}/list/list.component.less (100%) rename src/app/modules/{show => shows}/list/list.component.spec.ts (100%) rename src/app/modules/{show => shows}/list/list.component.ts (100%) rename src/app/modules/{show => shows}/new/new.component.html (63%) rename src/app/modules/{show => shows}/new/new.component.less (100%) rename src/app/modules/{show => shows}/new/new.component.spec.ts (100%) rename src/app/modules/{show => shows}/new/new.component.ts (74%) rename src/app/modules/{show => shows}/services/show-data.service.spec.ts (100%) rename src/app/modules/{show => shows}/services/show-data.service.ts (60%) create mode 100644 src/app/modules/shows/services/show.service.spec.ts create mode 100644 src/app/modules/shows/services/show.service.ts rename src/app/modules/{show => shows}/services/show.ts (100%) create mode 100644 src/app/modules/shows/show/show.component.html create mode 100644 src/app/modules/shows/show/show.component.less create mode 100644 src/app/modules/shows/show/show.component.spec.ts create mode 100644 src/app/modules/shows/show/show.component.ts rename src/app/modules/{show/show-routing.module.ts => shows/shows-routing.module.ts} (75%) rename src/app/modules/{show/show.module.ts => shows/shows.module.ts} (79%) delete mode 100644 src/app/widget-modules/application-frame/navigation/navigation.component.html delete mode 100644 src/app/widget-modules/application-frame/navigation/navigation.component.less delete mode 100644 src/app/widget-modules/application-frame/navigation/navigation.component.ts rename src/app/widget-modules/{ => components}/application-frame/application-frame.module.ts (68%) rename src/app/widget-modules/{ => components}/application-frame/navigation/filter/filter.component.html (100%) rename src/app/widget-modules/{ => components}/application-frame/navigation/filter/filter.component.less (85%) rename src/app/widget-modules/{ => components}/application-frame/navigation/filter/filter.component.spec.ts (100%) rename src/app/widget-modules/{ => components}/application-frame/navigation/filter/filter.component.ts (100%) create mode 100644 src/app/widget-modules/components/application-frame/navigation/link/link.component.html create mode 100644 src/app/widget-modules/components/application-frame/navigation/link/link.component.less create mode 100644 src/app/widget-modules/components/application-frame/navigation/link/link.component.spec.ts create mode 100644 src/app/widget-modules/components/application-frame/navigation/link/link.component.ts create mode 100644 src/app/widget-modules/components/application-frame/navigation/navigation.component.html create mode 100644 src/app/widget-modules/components/application-frame/navigation/navigation.component.less rename src/app/widget-modules/{ => components}/application-frame/navigation/navigation.component.spec.ts (100%) create mode 100644 src/app/widget-modules/components/application-frame/navigation/navigation.component.ts rename src/app/widget-modules/{ => components}/list-header/list-header.component.html (100%) rename src/app/widget-modules/{ => components}/list-header/list-header.component.less (100%) rename src/app/widget-modules/{ => components}/list-header/list-header.component.spec.ts (100%) rename src/app/widget-modules/{ => components}/list-header/list-header.component.ts (100%) rename src/app/widget-modules/{ => components}/list-header/list-header.module.ts (100%) diff --git a/firestore.rules b/firestore.rules index 75ed21b..bbd672e 100644 --- a/firestore.rules +++ b/firestore.rules @@ -12,7 +12,7 @@ service cloud.firestore { allow read: if true; allow write: if true; } - match /lastmodified/{lastmodified} { + match /shows/{show} { allow read: if true; allow write: if true; } diff --git a/package-lock.json b/package-lock.json index abe8ace..4548ad7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -482,11 +482,6 @@ "resolved": "https://registry.npmjs.org/@angular/material/-/material-9.1.1.tgz", "integrity": "sha512-XtfVTTzvLvw90g1sG8mV0kzkfnp2g7I/kUgwng7Zv3NG1Tzt/wEXVe6ovI45B/8qpN6i/7f2aCl7Gz4KTldAyA==" }, - "@angular/material-moment-adapter": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@angular/material-moment-adapter/-/material-moment-adapter-9.1.1.tgz", - "integrity": "sha512-lcpZZB33zwPErlHHJ+ClcSz04VhMZiDCFRTtXSBeDr3sz3XTBEvepAkn5I2y/pRNhUX/Ige2ml5RO0AVyVjjEA==" - }, "@angular/platform-browser": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-9.0.5.tgz", @@ -12114,9 +12109,9 @@ "dev": true }, "typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", + "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", "dev": true }, "ultron": { diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 3c70523..c8bd0d1 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,5 +1,5 @@ import {NgModule} from '@angular/core'; -import {RouterModule, Routes} from '@angular/router'; +import {PreloadAllModules, RouterModule, Routes} from '@angular/router'; import {AngularFireAuthGuard, redirectUnauthorizedTo} from '@angular/fire/auth-guard'; const routes: Routes = [ @@ -15,8 +15,8 @@ const routes: Routes = [ data: {authGuardPipe: () => redirectUnauthorizedTo(['user', 'login'])} }, { - path: 'show', - loadChildren: () => import('./modules/show/show.module').then(m => m.ShowModule), + path: 'shows', + loadChildren: () => import('./modules/shows/shows.module').then(m => m.ShowsModule), canActivate: [AngularFireAuthGuard], data: {authGuardPipe: () => redirectUnauthorizedTo(['user', 'login'])} }, @@ -27,7 +27,7 @@ const routes: Routes = [ ]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + imports: [RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules})], exports: [RouterModule] }) export class AppRoutingModule { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 30f1570..cc245c4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -6,7 +6,7 @@ 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/application-frame/application-frame.module'; +import {ApplicationFrameModule} from './widget-modules/components/application-frame/application-frame.module'; import {AngularFireModule} from '@angular/fire'; import {AngularFirestoreModule} from '@angular/fire/firestore'; import {AngularFireStorageModule} from '@angular/fire/storage'; diff --git a/src/app/modules/show/services/show.service.spec.ts b/src/app/modules/show/services/show.service.spec.ts deleted file mode 100644 index 1226d98..0000000 --- a/src/app/modules/show/services/show.service.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {TestBed} from '@angular/core/testing'; - -import {ShowService} from './show.service'; - -describe('ShowService', () => { - beforeEach(() => TestBed.configureTestingModule({})); - - it('should be created', () => { - const service: ShowService = TestBed.get(ShowService); - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/modules/show/services/show.service.ts b/src/app/modules/show/services/show.service.ts deleted file mode 100644 index 68ebcab..0000000 --- a/src/app/modules/show/services/show.service.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {Injectable} from '@angular/core'; -import {ShowDataService} from './show-data.service'; -import {Show} from './show'; - -@Injectable({ - providedIn: 'root' -}) -export class ShowService { - - public SHOW_TYPE = ['praise', 'worship', 'homegroup', 'prayergroup']; - - constructor(private showDataService: ShowDataService) { - } - - public async new(data: Partial): Promise { - return await this.showDataService.add(data); - } -} diff --git a/src/app/modules/show/list/list-item/list-item.component.html b/src/app/modules/shows/list/list-item/list-item.component.html similarity index 54% rename from src/app/modules/show/list/list-item/list-item.component.html rename to src/app/modules/shows/list/list-item/list-item.component.html index 7c32e61..763efef 100644 --- a/src/app/modules/show/list/list-item/list-item.component.html +++ b/src/app/modules/shows/list/list-item/list-item.component.html @@ -1,4 +1,4 @@
+
{{show.date.toDate()|date:'dd.MM.yyyy'}}
{{show.showType|showType}}
-
{{show.date.toDate()|date:'dd.MM.yyyy HH.mm'}}
diff --git a/src/app/modules/show/list/list-item/list-item.component.less b/src/app/modules/shows/list/list-item/list-item.component.less similarity index 90% rename from src/app/modules/show/list/list-item/list-item.component.less rename to src/app/modules/shows/list/list-item/list-item.component.less index 8ee7b74..70813ae 100644 --- a/src/app/modules/show/list/list-item/list-item.component.less +++ b/src/app/modules/shows/list/list-item/list-item.component.less @@ -3,7 +3,7 @@ .list-item { padding: 5px 20px; display: grid; - grid-template-columns: 1fr 1fr; + grid-template-columns: 1fr 2fr; min-height: 34px; & > div { diff --git a/src/app/modules/show/list/list-item/list-item.component.spec.ts b/src/app/modules/shows/list/list-item/list-item.component.spec.ts similarity index 100% rename from src/app/modules/show/list/list-item/list-item.component.spec.ts rename to src/app/modules/shows/list/list-item/list-item.component.spec.ts diff --git a/src/app/modules/show/list/list-item/list-item.component.ts b/src/app/modules/shows/list/list-item/list-item.component.ts similarity index 100% rename from src/app/modules/show/list/list-item/list-item.component.ts rename to src/app/modules/shows/list/list-item/list-item.component.ts diff --git a/src/app/modules/show/list/list.component.html b/src/app/modules/shows/list/list.component.html similarity index 100% rename from src/app/modules/show/list/list.component.html rename to src/app/modules/shows/list/list.component.html diff --git a/src/app/modules/show/list/list.component.less b/src/app/modules/shows/list/list.component.less similarity index 100% rename from src/app/modules/show/list/list.component.less rename to src/app/modules/shows/list/list.component.less diff --git a/src/app/modules/show/list/list.component.spec.ts b/src/app/modules/shows/list/list.component.spec.ts similarity index 100% rename from src/app/modules/show/list/list.component.spec.ts rename to src/app/modules/shows/list/list.component.spec.ts diff --git a/src/app/modules/show/list/list.component.ts b/src/app/modules/shows/list/list.component.ts similarity index 100% rename from src/app/modules/show/list/list.component.ts rename to src/app/modules/shows/list/list.component.ts diff --git a/src/app/modules/show/new/new.component.html b/src/app/modules/shows/new/new.component.html similarity index 63% rename from src/app/modules/show/new/new.component.html rename to src/app/modules/shows/new/new.component.html index d11dcb9..a260c71 100644 --- a/src/app/modules/show/new/new.component.html +++ b/src/app/modules/shows/new/new.component.html @@ -1,29 +1,25 @@
- -

Neue Veranstaltung

- - - -

Handelt es sich um eine öffentliche Veranstaltung?

-
-
- - +

Neue Veranstaltung

+ + Art der Veranstaltung + + + {{key|showType}} + + + {{key|showType}} + + + Datum - - Art der Veranstaltung - - {{key|showType}} - -
diff --git a/src/app/modules/show/new/new.component.less b/src/app/modules/shows/new/new.component.less similarity index 100% rename from src/app/modules/show/new/new.component.less rename to src/app/modules/shows/new/new.component.less diff --git a/src/app/modules/show/new/new.component.spec.ts b/src/app/modules/shows/new/new.component.spec.ts similarity index 100% rename from src/app/modules/show/new/new.component.spec.ts rename to src/app/modules/shows/new/new.component.spec.ts diff --git a/src/app/modules/show/new/new.component.ts b/src/app/modules/shows/new/new.component.ts similarity index 74% rename from src/app/modules/show/new/new.component.ts rename to src/app/modules/shows/new/new.component.ts index 5fe1fed..64b40d1 100644 --- a/src/app/modules/show/new/new.component.ts +++ b/src/app/modules/shows/new/new.component.ts @@ -13,9 +13,9 @@ import {Router} from '@angular/router'; }) export class NewComponent implements OnInit { public shows$: Observable; - public showType = this.showService.SHOW_TYPE; + public showTypePublic = ShowService.SHOW_TYPE_PUBLIC; + public showTypePrivate = ShowService.SHOW_TYPE_PRIVATE; public form: FormGroup; - public publicChosen = false; constructor(private showService: ShowService, showDataService: ShowDataService, private router: Router) { this.shows$ = showDataService.list$(); @@ -23,22 +23,16 @@ export class NewComponent implements OnInit { public ngOnInit(): void { this.form = new FormGroup({ - public: new FormControl(null), date: new FormControl(null, Validators.required), showType: new FormControl(null, Validators.required), }) } - public onIsPublic(isPublic: boolean): void { - this.form.patchValue({public: isPublic}); - this.publicChosen = true; - } - public async onSave() { this.form.markAllAsTouched(); if (!this.form.valid) return; - const id = await this.showService.new(this.form.value); - await this.router.navigateByUrl('/show/' + id); + const id = await this.showService.new$(this.form.value); + await this.router.navigateByUrl('/shows/' + id); } } diff --git a/src/app/modules/show/services/show-data.service.spec.ts b/src/app/modules/shows/services/show-data.service.spec.ts similarity index 100% rename from src/app/modules/show/services/show-data.service.spec.ts rename to src/app/modules/shows/services/show-data.service.spec.ts diff --git a/src/app/modules/show/services/show-data.service.ts b/src/app/modules/shows/services/show-data.service.ts similarity index 60% rename from src/app/modules/show/services/show-data.service.ts rename to src/app/modules/shows/services/show-data.service.ts index 55d3dc2..b1ddf80 100644 --- a/src/app/modules/show/services/show-data.service.ts +++ b/src/app/modules/shows/services/show-data.service.ts @@ -7,11 +7,13 @@ import {Show} from './show'; providedIn: 'root' }) export class ShowDataService { + private collection = 'shows'; + constructor(private dbService: DbService) { } - public list$ = (): Observable => this.dbService.col$('show'); - public read$ = (showId: string): Observable => this.dbService.doc$('show/' + showId); - public update = async (showId: string, data: Partial): Promise => await this.dbService.doc(showId).update(data); - public add = async (data: Partial): Promise => (await this.dbService.col('show').add(data)).id + public list$ = (): Observable => this.dbService.col$(this.collection); + public read$ = (showId: string): Observable => this.dbService.doc$(`${this.collection}/${showId}`); + public update = async (showId: string, data: Partial): Promise => await this.dbService.doc(`${this.collection}/${showId}`).update(data); + public add = async (data: Partial): Promise => (await this.dbService.col(this.collection).add(data)).id } diff --git a/src/app/modules/shows/services/show.service.spec.ts b/src/app/modules/shows/services/show.service.spec.ts new file mode 100644 index 0000000..0aaf3e3 --- /dev/null +++ b/src/app/modules/shows/services/show.service.spec.ts @@ -0,0 +1,37 @@ +import {TestBed} from '@angular/core/testing'; + +import {ShowService} from './show.service'; +import {ShowDataService} from './show-data.service'; + +describe('ShowService', () => { + const mockShowDataService = {add: Promise.resolve(null)}; + beforeEach(() => TestBed.configureTestingModule({ + providers: [ + {provide: ShowDataService, useValue: mockShowDataService} + ] + })); + + ShowService.SHOW_TYPE_PUBLIC.forEach(type => { + it('should calc public flag for ' + type, async () => { + const service: ShowService = TestBed.get(ShowService); + const addSpy = spyOn(TestBed.inject(ShowDataService), 'add').and.returnValue(Promise.resolve('id')); + + const id = await service.new$({showType: type}); + + expect(id).toBe('id'); + expect(addSpy).toHaveBeenCalledWith({showType: type, public: true}); + }); + }); + + ShowService.SHOW_TYPE_PRIVATE.forEach(type => { + it('should calc private flag for ' + type, async () => { + const service: ShowService = TestBed.get(ShowService); + const addSpy = spyOn(TestBed.inject(ShowDataService), 'add').and.returnValue(Promise.resolve('id')); + + const id = await service.new$({showType: type}); + + expect(id).toBe('id'); + expect(addSpy).toHaveBeenCalledWith({showType: type, public: false}); + }); + }); +}); diff --git a/src/app/modules/shows/services/show.service.ts b/src/app/modules/shows/services/show.service.ts new file mode 100644 index 0000000..e4c7ba9 --- /dev/null +++ b/src/app/modules/shows/services/show.service.ts @@ -0,0 +1,27 @@ +import {Injectable} from '@angular/core'; +import {ShowDataService} from './show-data.service'; +import {Show} from './show'; +import {Observable} from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class ShowService { + + public static SHOW_TYPE = ['service-worship', 'service-praise', 'home-group-big', 'home-group', 'prayer-group', 'teens-group', 'kids-group', 'misc-public', 'misc-private']; + public static SHOW_TYPE_PUBLIC = ['service-worship', 'service-praise', 'home-group-big', 'teens-group', 'kids-group', 'misc-public']; + public static SHOW_TYPE_PRIVATE = ['home-group', 'prayer-group', 'misc-private',]; + + constructor(private showDataService: ShowDataService) { + } + + public read$ = (showId: string): Observable => this.showDataService.read$(showId); + + public async new$(data: Partial): Promise { + const calculatedData: Partial = { + ...data, + public: ShowService.SHOW_TYPE_PUBLIC.indexOf(data.showType) !== -1, + }; + return await this.showDataService.add(calculatedData); + } +} diff --git a/src/app/modules/show/services/show.ts b/src/app/modules/shows/services/show.ts similarity index 100% rename from src/app/modules/show/services/show.ts rename to src/app/modules/shows/services/show.ts diff --git a/src/app/modules/shows/show/show.component.html b/src/app/modules/shows/show/show.component.html new file mode 100644 index 0000000..82c9a34 --- /dev/null +++ b/src/app/modules/shows/show/show.component.html @@ -0,0 +1,7 @@ +
+ + + + +
diff --git a/src/app/modules/shows/show/show.component.less b/src/app/modules/shows/show/show.component.less new file mode 100644 index 0000000..e69de29 diff --git a/src/app/modules/shows/show/show.component.spec.ts b/src/app/modules/shows/show/show.component.spec.ts new file mode 100644 index 0000000..6cc9c43 --- /dev/null +++ b/src/app/modules/shows/show/show.component.spec.ts @@ -0,0 +1,25 @@ +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; + +import {ShowComponent} from './show.component'; + +describe('ShowComponent', () => { + let component: ShowComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ShowComponent] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ShowComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modules/shows/show/show.component.ts b/src/app/modules/shows/show/show.component.ts new file mode 100644 index 0000000..597bf29 --- /dev/null +++ b/src/app/modules/shows/show/show.component.ts @@ -0,0 +1,29 @@ +import {Component, OnInit} from '@angular/core'; +import {map, switchMap} from 'rxjs/operators'; +import {ActivatedRoute} from '@angular/router'; +import {ShowService} from '../services/show.service'; +import {Observable} from 'rxjs'; +import {Show} from '../services/show'; + +@Component({ + selector: 'app-show', + templateUrl: './show.component.html', + styleUrls: ['./show.component.less'] +}) +export class ShowComponent implements OnInit { + public show$: Observable; + + constructor( + private activatedRoute: ActivatedRoute, + private showService: ShowService + ) { + } + + ngOnInit(): void { + this.show$ = this.activatedRoute.params.pipe( + map(param => param.showId), + switchMap(showId => this.showService.read$(showId)) + ); + } + +} diff --git a/src/app/modules/show/show-routing.module.ts b/src/app/modules/shows/shows-routing.module.ts similarity index 75% rename from src/app/modules/show/show-routing.module.ts rename to src/app/modules/shows/shows-routing.module.ts index dfc5342..720c566 100644 --- a/src/app/modules/show/show-routing.module.ts +++ b/src/app/modules/shows/shows-routing.module.ts @@ -2,6 +2,7 @@ import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; import {NewComponent} from './new/new.component'; import {ListComponent} from './list/list.component'; +import {ShowComponent} from './show/show.component'; const routes: Routes = [ @@ -13,6 +14,10 @@ const routes: Routes = [ { path: 'new', component: NewComponent + }, + { + path: ':showId', + component: ShowComponent } ]; @@ -20,5 +25,5 @@ const routes: Routes = [ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) -export class ShowRoutingModule { +export class ShowsRoutingModule { } diff --git a/src/app/modules/show/show.module.ts b/src/app/modules/shows/shows.module.ts similarity index 79% rename from src/app/modules/show/show.module.ts rename to src/app/modules/shows/shows.module.ts index ee83712..e852c28 100644 --- a/src/app/modules/show/show.module.ts +++ b/src/app/modules/shows/shows.module.ts @@ -1,7 +1,7 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; -import {ShowRoutingModule} from './show-routing.module'; +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'; @@ -9,7 +9,7 @@ import {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/list-header/list-header.module'; +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'; @@ -17,13 +17,14 @@ 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'; @NgModule({ - declarations: [NewComponent, ListComponent, ListItemComponent], + declarations: [NewComponent, ListComponent, ListItemComponent, ShowComponent], imports: [ CommonModule, - ShowRoutingModule, + ShowsRoutingModule, CardModule, MatFormFieldModule, ReactiveFormsModule, @@ -38,5 +39,5 @@ import {MatNativeDateModule} from '@angular/material/core'; ShowTypeTranslaterModule ] }) -export class ShowModule { +export class ShowsModule { } diff --git a/src/app/modules/songs/services/text-rendering.service.ts b/src/app/modules/songs/services/text-rendering.service.ts index 01ac4dc..9cb23cd 100644 --- a/src/app/modules/songs/services/text-rendering.service.ts +++ b/src/app/modules/songs/services/text-rendering.service.ts @@ -32,14 +32,5 @@ export class TextRenderingService { constructor() { } - public render(text: string): Section[] { - const lines = text.match(/[^\r\n]+/g); - - - } - - private findSection(line: string) { - - } } diff --git a/src/app/modules/songs/song/song.component.spec.ts b/src/app/modules/songs/song/song.component.spec.ts index 3b1fe1e..a966e5f 100644 --- a/src/app/modules/songs/song/song.component.spec.ts +++ b/src/app/modules/songs/song/song.component.spec.ts @@ -1,4 +1,4 @@ -import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {SongComponent} from './song.component'; import {of} from 'rxjs'; @@ -32,8 +32,4 @@ describe('SongComponent', () => { expect(component).toBeTruthy(); }); - it('should provide songId', fakeAsync(() => { - tick(); - expect(component.songId).toBe('4711'); - })); }); diff --git a/src/app/widget-modules/application-frame/navigation/navigation.component.html b/src/app/widget-modules/application-frame/navigation/navigation.component.html deleted file mode 100644 index c63cf28..0000000 --- a/src/app/widget-modules/application-frame/navigation/navigation.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/src/app/widget-modules/application-frame/navigation/navigation.component.less b/src/app/widget-modules/application-frame/navigation/navigation.component.less deleted file mode 100644 index f500e5e..0000000 --- a/src/app/widget-modules/application-frame/navigation/navigation.component.less +++ /dev/null @@ -1,53 +0,0 @@ -@import "../../../../styles/styles"; -@import "../../../../styles/shadow"; - -nav { - &.head { - position: fixed; - top: 0; - left: 0; - right: 0; - height: 60px; - background: @navigation-background; - z-index: 1; - .card-3; - - display: flex; - align-items: flex-end; - justify-content: space-between; - - a { - display: block; - height: 60px; - color: @navigation-link-color; - font-size: 20px; - font-weight: bold; - text-decoration: none; - padding: 20px; - box-sizing: border-box; - background: transparent; - transition: @transition; - - &:hover { - background: #eee; - } - - &.active { - background: @primary-color; - color: #fff; - } - } - - } -} - -.actions { - display: flex; - height: 100%; - align-items: center; -} - - -.links { - display: flex; -} diff --git a/src/app/widget-modules/application-frame/navigation/navigation.component.ts b/src/app/widget-modules/application-frame/navigation/navigation.component.ts deleted file mode 100644 index ce622aa..0000000 --- a/src/app/widget-modules/application-frame/navigation/navigation.component.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {Component, OnInit} from '@angular/core'; - -@Component({ - selector: 'app-navigation', - templateUrl: './navigation.component.html', - styleUrls: ['./navigation.component.less'] -}) -export class NavigationComponent implements OnInit { - - constructor() { - } - - ngOnInit() { - } - -} diff --git a/src/app/widget-modules/application-frame/application-frame.module.ts b/src/app/widget-modules/components/application-frame/application-frame.module.ts similarity index 68% rename from src/app/widget-modules/application-frame/application-frame.module.ts rename to src/app/widget-modules/components/application-frame/application-frame.module.ts index af1df32..3e3e676 100644 --- a/src/app/widget-modules/application-frame/application-frame.module.ts +++ b/src/app/widget-modules/components/application-frame/application-frame.module.ts @@ -3,16 +3,20 @@ import {CommonModule} from '@angular/common'; import {NavigationComponent} from './navigation/navigation.component'; import {RouterModule} from '@angular/router'; import {FilterComponent} from './navigation/filter/filter.component'; +import {FontAwesomeModule} from '@fortawesome/angular-fontawesome'; +import {LinkComponent} from './navigation/link/link.component'; @NgModule({ declarations: [ NavigationComponent, - FilterComponent + FilterComponent, + LinkComponent ], imports: [ CommonModule, - RouterModule + RouterModule, + FontAwesomeModule ], exports: [ NavigationComponent diff --git a/src/app/widget-modules/application-frame/navigation/filter/filter.component.html b/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.html similarity index 100% rename from src/app/widget-modules/application-frame/navigation/filter/filter.component.html rename to src/app/widget-modules/components/application-frame/navigation/filter/filter.component.html diff --git a/src/app/widget-modules/application-frame/navigation/filter/filter.component.less b/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.less similarity index 85% rename from src/app/widget-modules/application-frame/navigation/filter/filter.component.less rename to src/app/widget-modules/components/application-frame/navigation/filter/filter.component.less index 64d0138..61f57fd 100644 --- a/src/app/widget-modules/application-frame/navigation/filter/filter.component.less +++ b/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.less @@ -1,4 +1,4 @@ -@import "../../../../../styles/styles"; +@import "../../../../../../styles/styles"; input { font-size: 16px; diff --git a/src/app/widget-modules/application-frame/navigation/filter/filter.component.spec.ts b/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.spec.ts similarity index 100% rename from src/app/widget-modules/application-frame/navigation/filter/filter.component.spec.ts rename to src/app/widget-modules/components/application-frame/navigation/filter/filter.component.spec.ts diff --git a/src/app/widget-modules/application-frame/navigation/filter/filter.component.ts b/src/app/widget-modules/components/application-frame/navigation/filter/filter.component.ts similarity index 100% rename from src/app/widget-modules/application-frame/navigation/filter/filter.component.ts rename to src/app/widget-modules/components/application-frame/navigation/filter/filter.component.ts diff --git a/src/app/widget-modules/components/application-frame/navigation/link/link.component.html b/src/app/widget-modules/components/application-frame/navigation/link/link.component.html new file mode 100644 index 0000000..de7fc30 --- /dev/null +++ b/src/app/widget-modules/components/application-frame/navigation/link/link.component.html @@ -0,0 +1,3 @@ + + +   {{text}} diff --git a/src/app/widget-modules/components/application-frame/navigation/link/link.component.less b/src/app/widget-modules/components/application-frame/navigation/link/link.component.less new file mode 100644 index 0000000..3f86720 --- /dev/null +++ b/src/app/widget-modules/components/application-frame/navigation/link/link.component.less @@ -0,0 +1,43 @@ +@import "../../../../../../styles/styles"; + +a { + display: block; + height: 60px; + color: @navigation-link-color; + font-size: 20px; + font-weight: bold; + text-decoration: none; + padding: 20px; + box-sizing: border-box; + background: transparent; + transition: @transition; + + fa-icon { + display: inline-block; + transform: scale(1); + transition: @transition; + } + + @media screen and (max-width: 860px) { + .link-text { + display: none; + } + } + + &:hover { + background: #eee; + + fa-icon { + transform: scale(1.2); + } + } + + &.active { + background: @primary-color; + color: #fff; + + fa-icon { + transform: scale(1.3); + } + } +} diff --git a/src/app/widget-modules/components/application-frame/navigation/link/link.component.spec.ts b/src/app/widget-modules/components/application-frame/navigation/link/link.component.spec.ts new file mode 100644 index 0000000..8f1d50f --- /dev/null +++ b/src/app/widget-modules/components/application-frame/navigation/link/link.component.spec.ts @@ -0,0 +1,25 @@ +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; + +import {LinkComponent} from './link.component'; + +describe('LinkComponent', () => { + let component: LinkComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [LinkComponent] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(LinkComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/widget-modules/components/application-frame/navigation/link/link.component.ts b/src/app/widget-modules/components/application-frame/navigation/link/link.component.ts new file mode 100644 index 0000000..869c1d1 --- /dev/null +++ b/src/app/widget-modules/components/application-frame/navigation/link/link.component.ts @@ -0,0 +1,13 @@ +import {Component, Input} from '@angular/core'; +import {IconProp} from '@fortawesome/fontawesome-svg-core'; + +@Component({ + selector: 'app-link', + templateUrl: './link.component.html', + styleUrls: ['./link.component.less'] +}) +export class LinkComponent { + @Input() public text: string; + @Input() public link: string; + @Input() public icon: IconProp; +} diff --git a/src/app/widget-modules/components/application-frame/navigation/navigation.component.html b/src/app/widget-modules/components/application-frame/navigation/navigation.component.html new file mode 100644 index 0000000..afb6e9c --- /dev/null +++ b/src/app/widget-modules/components/application-frame/navigation/navigation.component.html @@ -0,0 +1,12 @@ + + + diff --git a/src/app/widget-modules/components/application-frame/navigation/navigation.component.less b/src/app/widget-modules/components/application-frame/navigation/navigation.component.less new file mode 100644 index 0000000..6bbba0b --- /dev/null +++ b/src/app/widget-modules/components/application-frame/navigation/navigation.component.less @@ -0,0 +1,32 @@ +@import "../../../../../styles/styles"; +@import "../../../../../styles/shadow"; + +nav { + &.head { + position: fixed; + top: 0; + left: 0; + right: 0; + height: 60px; + background: @navigation-background; + z-index: 1; + .card-3; + + display: flex; + align-items: flex-end; + justify-content: space-between; + + + } +} + +.actions { + display: flex; + height: 100%; + align-items: center; +} + + +.links { + display: flex; +} diff --git a/src/app/widget-modules/application-frame/navigation/navigation.component.spec.ts b/src/app/widget-modules/components/application-frame/navigation/navigation.component.spec.ts similarity index 100% rename from src/app/widget-modules/application-frame/navigation/navigation.component.spec.ts rename to src/app/widget-modules/components/application-frame/navigation/navigation.component.spec.ts diff --git a/src/app/widget-modules/components/application-frame/navigation/navigation.component.ts b/src/app/widget-modules/components/application-frame/navigation/navigation.component.ts new file mode 100644 index 0000000..b137daa --- /dev/null +++ b/src/app/widget-modules/components/application-frame/navigation/navigation.component.ts @@ -0,0 +1,23 @@ +import {Component, OnInit} from '@angular/core'; +import {faMusic} from '@fortawesome/free-solid-svg-icons/faMusic'; +import {faPersonBooth} from '@fortawesome/free-solid-svg-icons/faPersonBooth'; +import {faUserCog} from '@fortawesome/free-solid-svg-icons/faUserCog'; + +@Component({ + selector: 'app-navigation', + templateUrl: './navigation.component.html', + styleUrls: ['./navigation.component.less'] +}) +export class NavigationComponent implements OnInit { + + public faSongs = faMusic; + public faShows = faPersonBooth; + public faUser = faUserCog; + + constructor() { + } + + ngOnInit() { + } + +} diff --git a/src/app/widget-modules/list-header/list-header.component.html b/src/app/widget-modules/components/list-header/list-header.component.html similarity index 100% rename from src/app/widget-modules/list-header/list-header.component.html rename to src/app/widget-modules/components/list-header/list-header.component.html diff --git a/src/app/widget-modules/list-header/list-header.component.less b/src/app/widget-modules/components/list-header/list-header.component.less similarity index 100% rename from src/app/widget-modules/list-header/list-header.component.less rename to src/app/widget-modules/components/list-header/list-header.component.less diff --git a/src/app/widget-modules/list-header/list-header.component.spec.ts b/src/app/widget-modules/components/list-header/list-header.component.spec.ts similarity index 100% rename from src/app/widget-modules/list-header/list-header.component.spec.ts rename to src/app/widget-modules/components/list-header/list-header.component.spec.ts diff --git a/src/app/widget-modules/list-header/list-header.component.ts b/src/app/widget-modules/components/list-header/list-header.component.ts similarity index 100% rename from src/app/widget-modules/list-header/list-header.component.ts rename to src/app/widget-modules/components/list-header/list-header.component.ts diff --git a/src/app/widget-modules/list-header/list-header.module.ts b/src/app/widget-modules/components/list-header/list-header.module.ts similarity index 100% rename from src/app/widget-modules/list-header/list-header.module.ts rename to src/app/widget-modules/components/list-header/list-header.module.ts diff --git a/src/app/widget-modules/pipes/show-type-translater/show-type.pipe.ts b/src/app/widget-modules/pipes/show-type-translater/show-type.pipe.ts index 0f0ffa1..e332f0d 100644 --- a/src/app/widget-modules/pipes/show-type-translater/show-type.pipe.ts +++ b/src/app/widget-modules/pipes/show-type-translater/show-type.pipe.ts @@ -7,16 +7,26 @@ export class ShowTypePipe implements PipeTransform { transform(type: string): string { switch (type) { - case 'worship': + case 'service-worship': return 'Gottesdienst Anbetung'; - case 'praise': + case 'service-praise': return 'Gottesdienst Lobpreis'; - case 'homegroup': + case 'home-group-big': + return 'großer Hauskreis'; + case 'home-group': return 'Hauskreis'; - case 'prayergroup': + case 'prayer-group': return 'Gebetskreis'; + case 'teens-group': + return 'Teeniekreis'; + case 'kids-group': + return 'Kinderkreis'; + case 'misc-public': + return 'sonstige öffentliche Veranstaltung'; + case 'misc-private': + return 'sonstige private Veranstaltung'; } - ; + } }