diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a500fd9..ad4eb6e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,10 +13,10 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { HomeModule } from './home/home.module'; -import { AppComponent } from './app.component'; +import { AppComponent } from './app.component'; // AoT requires an exported function for factories -const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); +const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); @NgModule({ declarations: [AppComponent], @@ -39,4 +39,4 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl providers: [], bootstrap: [AppComponent] }) -export class AppModule {} +export class AppModule { } diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 7c9810b..fce8261 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -9,7 +9,7 @@

-
+
{{ activeSong?.title }}
-
+ [ngStyle]="{'width': (currentProgress$ | async) + '%'}" [attr.aria-valuenow]="(currentProgress$ | async) " + aria-valuemin="0" aria-valuemax="100"> +
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 40ede3d..928f86a 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -60,16 +60,12 @@ export class HomeComponent implements OnInit { const songIndex = this.songs.findIndex((song) => song.id === songId); this.songs.splice(songIndex, 1); - console.log('deleteSongFromPlaylist'); - // if deleted song is an active one - if(this.activeSong.id === songId) - { + if (this.activeSong.id === songId) { this.resetSong(this.songs[0]); - if(this.songs.length !== 0) - { - this.setSongDuration(); + if (this.songs.length !== 0) { + this.setSongDuration(); } } } @@ -90,7 +86,7 @@ export class HomeComponent implements OnInit { } } - onEnded(){ + onEnded() { this.playNextSong(); } @@ -156,12 +152,12 @@ export class HomeComponent implements OnInit { playRandomSong() { let randomSong = Math.floor(Math.random() * this.songs.length); - + while (this.activeSong.id === this.songs[randomSong].id) { randomSong = Math.floor(Math.random() * this.songs.length); - } + } - this.playSong(this.songs[randomSong]); + this.playSong(this.songs[randomSong]); } rePlay() { diff --git a/src/app/models/song.model.ts b/src/app/models/song.model.ts index c97bba8..5eead31 100644 --- a/src/app/models/song.model.ts +++ b/src/app/models/song.model.ts @@ -1,6 +1,5 @@ export interface ISong { - id: number; - title: string; - path: string; - } - \ No newline at end of file + id: number; + title: string; + path: string; +}