Skip to content

Commit

Permalink
fixing pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jviaches committed Apr 1, 2022
1 parent f98250e commit 1cc496f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -39,4 +39,4 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
export class AppModule { }
9 changes: 4 additions & 5 deletions src/app/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1 class="title">

<div class="wrapper" style="-webkit-app-region: drag">
<div class="player">
<div class="cover" [ngStyle]="{animation:isPlaying?'rotation 3s infinite linear':''}" ></div>
<div class="cover" [ngStyle]="{animation:isPlaying?'rotation 3s infinite linear':''}"></div>
<div class="song-info">
<div class="band">{{ activeSong?.title }}</div>
<button class="small-control" style="-webkit-app-region: no-drag" (click)="togglePlayList()">
Expand Down Expand Up @@ -49,10 +49,9 @@ <h1 class="title">
</div>
<div class="progress-area">
<div #progressBar class="progress-bar" role="progressbar"
[ngStyle]="{'width': (currentProgress$ | async) + '%'}"
[attr.aria-valuenow]="(currentProgress$ | async) "
aria-valuemin="0" aria-valuemax="100">
</div>
[ngStyle]="{'width': (currentProgress$ | async) + '%'}" [attr.aria-valuenow]="(currentProgress$ | async) "
aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
<div *ngIf="isPlayListOpened === true" class="playlist" style="-webkit-app-region: no-drag">
Expand Down
18 changes: 7 additions & 11 deletions src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Expand All @@ -90,7 +86,7 @@ export class HomeComponent implements OnInit {
}
}

onEnded(){
onEnded() {
this.playNextSong();
}

Expand Down Expand Up @@ -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() {
Expand Down
9 changes: 4 additions & 5 deletions src/app/models/song.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export interface ISong {
id: number;
title: string;
path: string;
}

id: number;
title: string;
path: string;
}

0 comments on commit 1cc496f

Please sign in to comment.