Skip to content
This repository has been archived by the owner on Jan 13, 2020. It is now read-only.

Library - Songs, shuffle function #32

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<div class="library-bg">
<span class="library-title">Library</span>
<button
aria-label="Play playlist"
class="library-button" mat-raised-button
(click)="playSong()"
>
Play
</button>
<button
aria-label="Shuffle playlist"
class="library-button" mat-raised-button
(click)="playSong(0, true)"
>
Shuffle
</button>
</div>
<div class="outer-container" *ngIf="!isLoading">
<cdk-virtual-scroll-viewport itemSize="60">
<app-song
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,25 @@
position: absolute;
top: calc( 50% - 50px );
left: calc( 50% - 50px );
}

.library-bg{
background: rgba(255, 255, 255, 0.04);
margin-top: 10px;
height: 150px;

}

.library-button {
width: 100px;
margin-right: 10px;
opacity: 1.0;
}

.library-title {
font-weight: 500;
font-size: 38px;
padding-top: 15px;
padding-bottom: 70px;
display:block;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ export class LibrarySongsComponent implements OnInit, OnDestroy {
);
}

playSong( trackIndex: number ): void {
this.playerService.setQueueFromItems( this.librarySongs, trackIndex ).subscribe();
playSong( trackIndex: number = 0, shuffle: boolean = false): void {
if (shuffle) {
this.playerService.toggleShuffleOn();
}
this.playerService.setQueueFromItems( this.librarySongs, trackIndex ).subscribe(() => {
if ( shuffle ) {
this.playerService.toggleShuffleOff();
}
});
}
}