diff --git a/WEB/src/app/app.component.html b/WEB/src/app/app.component.html
index 3d67f1d..79be59c 100644
--- a/WEB/src/app/app.component.html
+++ b/WEB/src/app/app.component.html
@@ -1,3 +1,2 @@
-
diff --git a/WEB/src/app/app.module.ts b/WEB/src/app/app.module.ts
index dbbc69e..df02245 100644
--- a/WEB/src/app/app.module.ts
+++ b/WEB/src/app/app.module.ts
@@ -1,7 +1,7 @@
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
-import { ReactiveFormsModule } from '@angular/forms';
+import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { ODataModule } from 'odata-v4-ng';
import { AppRoutingModule } from './app-routing.module';
@@ -9,29 +9,37 @@ import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
+import { MatInputModule } from '@angular/material/input';
import { MatTableModule } from '@angular/material/table';
import { MatCardModule } from '@angular/material/card';
import { MatButtonModule } from '@angular/material/button';
import { MatChipsModule } from '@angular/material/chips';
+import { MatRadioModule } from '@angular/material/radio';
+import { MatSelectModule } from '@angular/material/select';
import { TableComponent } from './components/songs/table/table.component';
import { SongsComponent } from './components/songs/songs.component';
import { SongComponent } from './components/songs/song/song.component';
+import { SongEditComponent } from './components/songs/song-edit/song-edit.component';
@NgModule({
- declarations: [AppComponent, SongsComponent, TableComponent, SongComponent],
+ declarations: [AppComponent, SongsComponent, TableComponent, SongComponent, SongEditComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
+ FormsModule,
ReactiveFormsModule,
AppRoutingModule,
HttpClientModule,
ODataModule,
+ MatInputModule,
MatCardModule,
MatTableModule,
MatButtonModule,
MatChipsModule,
+ MatRadioModule,
+ MatSelectModule,
FontAwesomeModule
],
diff --git a/WEB/src/app/components/songs/song-edit/song-edit.component.html b/WEB/src/app/components/songs/song-edit/song-edit.component.html
new file mode 100644
index 0000000..4a76b48
--- /dev/null
+++ b/WEB/src/app/components/songs/song-edit/song-edit.component.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+ Titel bearbeiten
+
+
+
+
+
+
+
+
diff --git a/WEB/src/app/components/songs/song-edit/song-edit.component.less b/WEB/src/app/components/songs/song-edit/song-edit.component.less
new file mode 100644
index 0000000..131b502
--- /dev/null
+++ b/WEB/src/app/components/songs/song-edit/song-edit.component.less
@@ -0,0 +1,9 @@
+form {
+ display: flex;
+ flex-direction: column;
+ .row {
+ display: grid;
+ grid-template-columns: 2fr 1fr 1fr;
+ grid-column-gap: 20px;
+ }
+}
diff --git a/WEB/src/app/components/songs/song-edit/song-edit.component.ts b/WEB/src/app/components/songs/song-edit/song-edit.component.ts
new file mode 100644
index 0000000..944dfa5
--- /dev/null
+++ b/WEB/src/app/components/songs/song-edit/song-edit.component.ts
@@ -0,0 +1,74 @@
+import { SongsService } from 'src/app/data/songs.service';
+import { FormGroup } from '@angular/forms';
+import {
+ Component,
+ OnInit,
+ ChangeDetectionStrategy,
+ ChangeDetectorRef
+} from '@angular/core';
+import { blend } from 'src/app/services/animation';
+import { EditSongService } from 'src/app/data/edit-song.service';
+import { faLongArrowAltLeft } from '@fortawesome/free-solid-svg-icons';
+
+@Component({
+ selector: 'app-song-edit',
+ templateUrl: './song-edit.component.html',
+ styleUrls: ['./song-edit.component.less'],
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ animations: [blend]
+})
+export class SongEditComponent implements OnInit {
+ public form: FormGroup = null;
+ public faArrow = faLongArrowAltLeft;
+ public keys = [
+ 'C',
+ 'C#',
+ 'Db',
+ 'D',
+ 'D#',
+ 'Eb',
+ 'E',
+ 'F',
+ 'F#',
+ 'Gb',
+ 'G',
+ 'G#',
+ 'Ab',
+ 'A',
+ 'A#',
+ 'B',
+ 'H',
+ 'c',
+ 'c#',
+ 'db',
+ 'd',
+ 'd#',
+ 'eb',
+ 'e',
+ 'f',
+ 'f#',
+ 'gb',
+ 'g',
+ 'g#',
+ 'ab',
+ 'a',
+ 'A#',
+ 'b',
+ 'h'
+ ];
+
+ constructor(
+ private editSongService: EditSongService,
+ private songsService: SongsService,
+ private change: ChangeDetectorRef
+ ) {}
+
+ ngOnInit() {
+ this.form = this.editSongService.initEditForm();
+ this.change.markForCheck();
+ }
+
+ public onBack(): void {
+ this.songsService.edit = false;
+ }
+}
diff --git a/WEB/src/app/components/songs/song/song.component.html b/WEB/src/app/components/songs/song/song.component.html
index ea9fd8c..f3d541d 100644
--- a/WEB/src/app/components/songs/song/song.component.html
+++ b/WEB/src/app/components/songs/song/song.component.html
@@ -14,6 +14,9 @@
+
diff --git a/WEB/src/app/components/songs/song/song.component.ts b/WEB/src/app/components/songs/song/song.component.ts
index b1961cc..ba1680d 100644
--- a/WEB/src/app/components/songs/song/song.component.ts
+++ b/WEB/src/app/components/songs/song/song.component.ts
@@ -4,33 +4,22 @@ import {
ChangeDetectionStrategy,
ChangeDetectorRef
} from '@angular/core';
-import { faLongArrowAltLeft } from '@fortawesome/free-solid-svg-icons';
+import { faLongArrowAltLeft, faEdit } from '@fortawesome/free-solid-svg-icons';
import { Song } from 'src/app/models/song.model';
import { DownloadService } from 'src/app/data/download.service';
-import { trigger, transition, style, animate } from '@angular/animations';
+import { blend } from 'src/app/services/animation';
@Component({
selector: 'app-song',
templateUrl: './song.component.html',
styleUrls: ['./song.component.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
- animations: [
- trigger('blend', [
- transition(':enter', [
- style({ opacity: 0 }),
- animate('700ms', style({ opacity: 0 })),
- animate('300ms', style({ opacity: 1 }))
- ]),
- transition(':leave', [
- style({ opacity: 1 }),
- animate('300ms', style({ opacity: 0 }))
- ])
- ])
- ]
+ animations: [blend]
})
export class SongComponent {
public song: Song;
public faArrow = faLongArrowAltLeft;
+ public faEdit = faEdit;
public selectedSongId = 0;
constructor(
@@ -58,6 +47,10 @@ export class SongComponent {
this.downloadService.get(id, false);
}
+ public onClickEdit(): void {
+ this.songService.edit = true;
+ }
+
public get text(): string[] {
return this.song.Text.split(/\r?\n/).filter(_ => _ !== ' ');
}
diff --git a/WEB/src/app/components/songs/songs.component.html b/WEB/src/app/components/songs/songs.component.html
index 9ac8fe6..d14670f 100644
--- a/WEB/src/app/components/songs/songs.component.html
+++ b/WEB/src/app/components/songs/songs.component.html
@@ -1,2 +1,3 @@
-
+
+
diff --git a/WEB/src/app/components/songs/songs.component.ts b/WEB/src/app/components/songs/songs.component.ts
index 88151c7..bcf2c7c 100644
--- a/WEB/src/app/components/songs/songs.component.ts
+++ b/WEB/src/app/components/songs/songs.component.ts
@@ -7,7 +7,7 @@ import { SongsService } from 'src/app/data/songs.service';
styleUrls: ['./songs.component.less']
})
export class SongsComponent {
- constructor(songService: SongsService) {
- songService.loadSongList();
+ constructor(public songsService: SongsService) {
+ songsService.loadSongList();
}
}
diff --git a/WEB/src/app/data/edit-song.service.ts b/WEB/src/app/data/edit-song.service.ts
index eaa43cd..a2d6de3 100644
--- a/WEB/src/app/data/edit-song.service.ts
+++ b/WEB/src/app/data/edit-song.service.ts
@@ -8,9 +8,10 @@ import { FormGroup, FormControl, Validators } from '@angular/forms';
})
export class EditSongService {
- constructor(private songService: SongsService) { }
+ constructor(private songsService: SongsService) { }
- public initEditForm(song: Song): FormGroup {
+ public initEditForm(): FormGroup {
+ const song = this.songsService.selectedSong.value;
const form = new FormGroup({
ID: new FormControl(song.ID),
Number: new FormControl(song.Number),
diff --git a/WEB/src/app/data/songs.service.ts b/WEB/src/app/data/songs.service.ts
index afc401d..f902f77 100644
--- a/WEB/src/app/data/songs.service.ts
+++ b/WEB/src/app/data/songs.service.ts
@@ -8,6 +8,8 @@ import { BehaviorSubject } from 'rxjs';
providedIn: 'root'
})
export class SongsService extends OdataService {
+ public edit = false;
+
public songs: BehaviorSubject = new BehaviorSubject([]);
public selectedSong: BehaviorSubject = new BehaviorSubject(null);
@@ -20,6 +22,7 @@ export class SongsService extends OdataService {
}
public selectSong(id: number): void {
+ this.edit = false;
const filter = this.songs.value.filter(_ => _.ID === id);
const song = filter.length === 1 ? filter[0] : null;
this.selectedSong.next(song);
diff --git a/WEB/src/app/services/animation.ts b/WEB/src/app/services/animation.ts
new file mode 100644
index 0000000..da83201
--- /dev/null
+++ b/WEB/src/app/services/animation.ts
@@ -0,0 +1,13 @@
+import { trigger, transition, style, animate } from '@angular/animations';
+
+export const blend = trigger('blend', [
+ transition(':enter', [
+ style({ opacity: 0 }),
+ animate('700ms', style({ opacity: 0 })),
+ animate('300ms', style({ opacity: 1 }))
+ ]),
+ transition(':leave', [
+ style({ opacity: 1 }),
+ animate('300ms', style({ opacity: 0 }))
+ ])
+ ]);
\ No newline at end of file
diff --git a/WEB/src/styles.less b/WEB/src/styles.less
index 183c8ab..21bf707 100644
--- a/WEB/src/styles.less
+++ b/WEB/src/styles.less
@@ -1,7 +1,6 @@
/* You can add global styles to this file, and also import other style files */
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
-
body {
margin: 0px;
}
@@ -70,6 +69,34 @@ html {
border-top-left-radius: 0px;
transition: all 300ms ease-in-out;
}
-
+ }
+}
+
+.mat-card {
+ width: 500px;
+ border-radius: 8px;
+ background: #fffd;
+ margin: 20px;
+ box-sizing: border-box;
+}
+
+.mat-card-title {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ width: 420px;
+}
+
+.mat-card-content {
+ white-space: pre-wrap;
+}
+
+.song-detail-container {
+ margin-left: 30vw;
+ .mat-form-field-infix {
+ width: 80px;
+ }
+ .mat-radio-button {
+ margin: 15px 10px 0 10px;
}
}