From b396728db85975c7b462bf6db2ad509daf2836f5 Mon Sep 17 00:00:00 2001 From: itzMiney Date: Tue, 17 Mar 2026 01:45:09 +0100 Subject: [PATCH] refactored audio-player component --- .../audio-player/audio-player.component.css | 15 +++++++++++++-- .../audio-player/audio-player.component.html | 2 +- .../audio-player/audio-player.component.ts | 18 +++++++++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/app/shared/audio-player/audio-player.component.css b/src/app/shared/audio-player/audio-player.component.css index 9e5c3ad..61432fa 100644 --- a/src/app/shared/audio-player/audio-player.component.css +++ b/src/app/shared/audio-player/audio-player.component.css @@ -44,12 +44,23 @@ } .audio-player { + display: flex; + flex-direction: column; position: fixed; - bottom: 10px; - left: 20px; + width: 340px; + height: 130px; + bottom: 0; + left: 0; + align-items: center; + justify-content: center; z-index: 10; } +.audio-player.mobile { + background: linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)); + width: 100%; +} + .audio-player h3 { margin-left: 15px; text-align: center; diff --git a/src/app/shared/audio-player/audio-player.component.html b/src/app/shared/audio-player/audio-player.component.html index 7484b44..95ff82f 100644 --- a/src/app/shared/audio-player/audio-player.component.html +++ b/src/app/shared/audio-player/audio-player.component.html @@ -1,4 +1,4 @@ -
+

{{ nowPlayingTitle() }}

diff --git a/src/app/shared/audio-player/audio-player.component.ts b/src/app/shared/audio-player/audio-player.component.ts index 4a77b64..5518e1d 100644 --- a/src/app/shared/audio-player/audio-player.component.ts +++ b/src/app/shared/audio-player/audio-player.component.ts @@ -1,4 +1,6 @@ -import {Component, AfterViewInit, signal} from '@angular/core'; +import {Component, AfterViewInit, signal, OnInit} from '@angular/core'; +import {DeviceDetectorService} from '../services/device-detector.service'; +import {NgClass} from '@angular/common'; declare global { @@ -10,16 +12,26 @@ declare global { @Component({ selector: 'app-audio-player', - imports: [], + imports: [ + NgClass + ], templateUrl: './audio-player.component.html', styleUrl: './audio-player.component.css' }) -export class AudioPlayerComponent implements AfterViewInit { +export class AudioPlayerComponent implements AfterViewInit, OnInit { + isMobile: boolean = false; private player: any; + isPlayerReady = signal(false); isPlaying = signal(false); nowPlayingTitle = signal(''); + constructor(private deviceService: DeviceDetectorService) {} + + ngOnInit() { + this.isMobile = this.deviceService.isMobile; + } + ngAfterViewInit() { if (window.YT && window.YT.Player) { this.createPlayer();