mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-07-04 17:21:43 +02:00
Adapt Anngular frontend to karafun terminology
This commit is contained in:
@ -46,12 +46,14 @@ import { EntryListingComponent } from './entry-listing/entry-listing.component';
|
|||||||
import { SongSearchComponent } from './song-search/song-search.component';
|
import { SongSearchComponent } from './song-search/song-search.component';
|
||||||
|
|
||||||
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||||
|
import { SongChipComponent } from './song-chip/song-chip.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
EntryListingComponent,
|
EntryListingComponent,
|
||||||
SongSearchComponent
|
SongSearchComponent,
|
||||||
|
SongChipComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -4,23 +4,23 @@ import { Artist } from './artist.model';
|
|||||||
|
|
||||||
export class Song {
|
export class Song {
|
||||||
|
|
||||||
constructor(title: string, artist: Artist, karafun_id: number, duet: boolean, explicit: boolean, id: number, genres: Array<String>, languages: Array<String>) {
|
constructor(title: string, artist: Artist, karafun_id: number, duo: boolean, explicit: boolean, id: number, styles: Array<String>, languages: Array<String>) {
|
||||||
this.title=title;
|
this.title=title;
|
||||||
this.artist=artist;
|
this.artist=artist;
|
||||||
this.karafun_id=karafun_id;
|
this.karafun_id=karafun_id;
|
||||||
this.duet=duet;
|
this.duo=duo;
|
||||||
this.explicit=explicit;
|
this.explicit=explicit;
|
||||||
this.id=id;
|
this.id=id;
|
||||||
this.genres=genres;
|
this.styles=styles;
|
||||||
this.languages=languages;
|
this.languages=languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
title: string;
|
title: string;
|
||||||
artist: Artist;
|
artist: Artist;
|
||||||
karafun_id: number;
|
karafun_id: number;
|
||||||
duet: boolean;
|
duo: boolean;
|
||||||
explicit: boolean;
|
explicit: boolean;
|
||||||
id: number;
|
id: number;
|
||||||
genres: Array<String>;
|
styles: Array<String>;
|
||||||
languages: Array<String>;
|
languages: Array<String>;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
<mat-card class="result">
|
||||||
|
<div class="card-left">
|
||||||
|
<mat-card-title>{{song.artist}} - {{song.title}}</mat-card-title>
|
||||||
|
<div class="song-info">
|
||||||
|
<div class="info-icons">
|
||||||
|
<ng-template [ngIf]="song.duo==1" [ngIfElse]="nonduet">
|
||||||
|
<mat-icon svgIcon="account-multiple"></mat-icon>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template #nonduet>
|
||||||
|
<mat-icon svgIcon="account"></mat-icon>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template [ngIf]="song.explicit==1" [ngIfElse]="nonexplicit">
|
||||||
|
<mat-icon svgIcon="alpha-e-box"></mat-icon>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template #nonexplicit>
|
||||||
|
<mat-icon svgIcon="alpha-e-box" class="icon-disabled"></mat-icon>
|
||||||
|
</ng-template>
|
||||||
|
</div>
|
||||||
|
<div class="genre-list">
|
||||||
|
<mat-icon svgIcon="music-circle"></mat-icon>
|
||||||
|
<mat-chip-list *ngFor="let style of song.styles">
|
||||||
|
<mat-chip>{{style}}</mat-chip>
|
||||||
|
</mat-chip-list>
|
||||||
|
</div>
|
||||||
|
<div class="language-list">
|
||||||
|
<mat-icon svgIcon="account-voice"></mat-icon>
|
||||||
|
<mat-chip-list *ngFor="let language of song.languages">
|
||||||
|
<mat-chip>{{language}}</mat-chip>
|
||||||
|
</mat-chip-list>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button mat-flat-button color="accent" class="add-button">
|
||||||
|
<mat-icon svgIcon="playlist-plus"></mat-icon>
|
||||||
|
</button>
|
||||||
|
</mat-card>
|
@ -0,0 +1,21 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { SongChipComponent } from './song-chip.component';
|
||||||
|
|
||||||
|
describe('SongChipComponent', () => {
|
||||||
|
let component: SongChipComponent;
|
||||||
|
let fixture: ComponentFixture<SongChipComponent>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [SongChipComponent]
|
||||||
|
});
|
||||||
|
fixture = TestBed.createComponent(SongChipComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,10 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-song-chip',
|
||||||
|
templateUrl: './song-chip.component.html',
|
||||||
|
styleUrls: ['./song-chip.component.scss']
|
||||||
|
})
|
||||||
|
export class SongChipComponent {
|
||||||
|
|
||||||
|
}
|
@ -8,41 +8,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="resultcontainer">
|
<div class="resultcontainer">
|
||||||
<mat-list *ngFor="let song of songs">
|
<mat-list *ngFor="let song of songs">
|
||||||
<mat-card class="result">
|
|
||||||
<div class="card-left">
|
|
||||||
<mat-card-title>{{song.artist}} - {{song.title}}</mat-card-title>
|
|
||||||
<div class="song-info">
|
|
||||||
<div class="info-icons">
|
|
||||||
<ng-template [ngIf]="song.duet==true" [ngIfElse]="nonduet">
|
|
||||||
<mat-icon svgIcon="account-multiple"></mat-icon>
|
|
||||||
</ng-template>
|
|
||||||
<ng-template #nonduet>
|
|
||||||
<mat-icon svgIcon="account"></mat-icon>
|
|
||||||
</ng-template>
|
|
||||||
<ng-template [ngIf]="song.explicit==true" [ngIfElse]="nonexplicit">
|
|
||||||
<mat-icon svgIcon="alpha-e-box"></mat-icon>
|
|
||||||
</ng-template>
|
|
||||||
<ng-template #nonexplicit>
|
|
||||||
<mat-icon svgIcon="alpha-e-box" class="icon-disabled"></mat-icon>
|
|
||||||
</ng-template>
|
|
||||||
</div>
|
|
||||||
<div class="genre-list">
|
|
||||||
<mat-icon svgIcon="music-circle"></mat-icon>
|
|
||||||
<mat-chip-list *ngFor="let genre of song.genres">
|
|
||||||
<mat-chip>{{genre}}</mat-chip>
|
|
||||||
</mat-chip-list>
|
|
||||||
</div>
|
|
||||||
<div class="language-list">
|
|
||||||
<mat-icon svgIcon="account-voice"></mat-icon>
|
|
||||||
<mat-chip-list *ngFor="let language of song.languages">
|
|
||||||
<mat-chip>{{language}}</mat-chip>
|
|
||||||
</mat-chip-list>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button mat-flat-button color="accent" class="add-button">
|
|
||||||
<mat-icon svgIcon="playlist-plus"></mat-icon>
|
|
||||||
</button>
|
|
||||||
</mat-card>
|
|
||||||
</mat-list>
|
</mat-list>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,11 +25,19 @@ export class SongServiceService {
|
|||||||
|
|
||||||
let out = new Array<Song>();
|
let out = new Array<Song>();
|
||||||
|
|
||||||
this.http.get(this.api +"/songs/compl?search="+text).subscribe((data: Observable<JSON>) => {
|
this.http.get(this.api +"/songs/search?q="+text).subscribe((data: Observable<JSON>) => {
|
||||||
data.forEach(element => {
|
data.forEach(element => {
|
||||||
console.log(element);
|
let styles = new Array<String>();
|
||||||
out.push(new Song(element["title"],element["artist"],element["karafun_id"],element["duo"],element["explicit"],element["_id"],element["styles"],element["languages"]));
|
let languages = new Array<String>();
|
||||||
|
for (let style of element["styles"].split(",")) {
|
||||||
|
styles.push(style);
|
||||||
|
}
|
||||||
|
for (let language of element["languages"].split(",")) {
|
||||||
|
languages.push(language);
|
||||||
|
}
|
||||||
|
out.push(new Song(element["title"],element["artist"],element["karafun_id"],element["duo"],element["explicit"],element["_id"],styles,languages));
|
||||||
});
|
});
|
||||||
|
console.log(out);
|
||||||
});
|
});
|
||||||
|
|
||||||
const observable = new Observable<Array<Song>>( subscriber => {
|
const observable = new Observable<Array<Song>>( subscriber => {
|
||||||
|
Reference in New Issue
Block a user