feat(menu-lecteur): refonte UI/UX professionnelle du menu FAB
CI / build-and-test (push) Successful in 14m57s
CI / build-and-test (push) Successful in 14m57s
- FAB : pastille verre depoli 40px + icone sliders (standard options) - Panneau : en-tete (titre + fermer), verre depoli, ombre profonde, coins arrondis - Animations ouverture/fermeture (fondu + slide + scale), fermeture Echap + clic exterieur - Items : hover/active/focus, icones teintees, sections + separateurs raffinés - Playlist : modale rendue HORS du panneau (backdrop-filter piegeait position:fixed)
This commit is contained in:
@@ -4,11 +4,11 @@ import { CommonModule } from '@angular/common';
|
||||
/**
|
||||
* Bouton-menu flottant (FAB) partagé entre /watch et /shorts.
|
||||
*
|
||||
* Pastille circulaire translucide en haut à gauche du lecteur, façon
|
||||
* commandes overlay des players YouTube/Dailymotion : elle ouvre un panneau
|
||||
* déroulant qui reçoit son contenu par projection (`ng-content`) — chaque page
|
||||
* fournit ses propres options, la coque (position, style, open/close, clic
|
||||
* extérieur) est identique partout.
|
||||
* Pastille circulaire translucide en haut à gauche du lecteur (façon commandes
|
||||
* overlay des players YouTube/Dailymotion) qui ouvre un panneau déroulant en
|
||||
* « verre dépoli » avec en-tête (titre + fermeture) et contenu projeté via
|
||||
* `ng-content`. Animation d'ouverture/fermeture fluide (fondu + glissement +
|
||||
* échelle), fermeture au clic extérieur et à Échap.
|
||||
*
|
||||
* Usage : `<app-player-menu [(open)]="menuOpen"> …items… </app-player-menu>`
|
||||
* dans un conteneur `position: relative` (le `:host` se place en absolu).
|
||||
@@ -22,20 +22,29 @@ import { CommonModule } from '@angular/common';
|
||||
<button type="button"
|
||||
(click)="toggle(); $event.stopPropagation()"
|
||||
[attr.aria-expanded]="open"
|
||||
aria-haspopup="menu"
|
||||
aria-label="Menu"
|
||||
title="Menu"
|
||||
class="flex h-9 w-9 items-center justify-center rounded-full bg-black/50 text-white ring-1 ring-white/15 backdrop-blur-md transition hover:bg-black/70 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/40">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
|
||||
<path d="M4 6h16M4 12h16M4 18h16"/>
|
||||
aria-haspopup="dialog"
|
||||
[attr.aria-label]="title"
|
||||
[title]="title"
|
||||
class="pm-fab" [class.pm-fab-open]="open">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/>
|
||||
<line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/>
|
||||
<line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/>
|
||||
<line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/>
|
||||
</svg>
|
||||
</button>
|
||||
@if (open) {
|
||||
<div class="absolute left-0 top-11 max-h-[70vh] w-64 overflow-y-auto overscroll-contain rounded-xl bg-black/70 p-1.5 shadow-2xl ring-1 ring-white/10 backdrop-blur-xl"
|
||||
role="menu" (click)="$event.stopPropagation()">
|
||||
|
||||
<div class="pm-panel" [class.pm-panel-open]="open" role="dialog" [attr.aria-label]="title" (click)="$event.stopPropagation()">
|
||||
<div class="pm-panel-header">
|
||||
<span class="pm-panel-title">{{ title }}</span>
|
||||
<button type="button" class="pm-panel-close" (click)="close()" aria-label="Fermer">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18M6 6l12 12"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="pm-panel-body">
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
`,
|
||||
styles: [
|
||||
`:host { position: absolute; top: 0.5rem; left: 0.5rem; z-index: 30; display: block; }`,
|
||||
@@ -43,6 +52,7 @@ import { CommonModule } from '@angular/common';
|
||||
})
|
||||
export class PlayerMenuComponent {
|
||||
@Input() open = false;
|
||||
@Input() title = 'Options';
|
||||
@Output() openChange = new EventEmitter<boolean>();
|
||||
|
||||
constructor(private el: ElementRef<HTMLElement>) {}
|
||||
@@ -62,4 +72,9 @@ export class PlayerMenuComponent {
|
||||
if (target && this.el.nativeElement.contains(target)) return;
|
||||
this.close();
|
||||
}
|
||||
|
||||
@HostListener('document:keydown.escape')
|
||||
onEscape(): void {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import { forkJoin } from 'rxjs';
|
||||
<div [class]="menuItem ? 'relative w-full text-left' : 'relative inline-block text-left'" (click)="$event.stopPropagation();">
|
||||
<button (click)="toggleOpen($event)"
|
||||
[disabled]="!isAuthenticated()"
|
||||
[style.display]="triggerHidden ? 'none' : ''"
|
||||
[class]="menuItem ? 'pm-item' : 'flex items-center space-x-2 bg-slate-700 hover:bg-slate-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500/60 disabled:opacity-60 disabled:cursor-not-allowed px-4 py-2 rounded-full transition text-slate-200 font-semibold'"
|
||||
[attr.aria-expanded]="open()"
|
||||
[attr.aria-haspopup]="true"
|
||||
@@ -121,6 +122,8 @@ export class AddToPlaylistComponent implements OnInit, OnDestroy {
|
||||
@Input() thumbnail?: string;
|
||||
/** Rendu « élément de menu » (menu FAB du lecteur) : plein largeur, icon + label. */
|
||||
@Input() menuItem = false;
|
||||
/** Masque le bouton déclencheur (déclenchement externe via `open()`). */
|
||||
@Input() triggerHidden = false;
|
||||
|
||||
open = signal<boolean>(false);
|
||||
loading = signal<boolean>(false);
|
||||
@@ -155,6 +158,15 @@ export class AddToPlaylistComponent implements OnInit, OnDestroy {
|
||||
this.selected.set(new Set());
|
||||
}
|
||||
|
||||
/** Ouvre la boîte de dialogue (déclenchement externe, ex. menu FAB). */
|
||||
openDialog(): void {
|
||||
if (!this.isAuthenticated()) return;
|
||||
this.open.set(true);
|
||||
if (this.playlists().length === 0 && !this.loading()) {
|
||||
this.reloadPlaylists();
|
||||
}
|
||||
}
|
||||
|
||||
reloadPlaylists(): void {
|
||||
this.loading.set(true);
|
||||
this.error.set(null);
|
||||
|
||||
@@ -47,7 +47,13 @@
|
||||
@if (likeError(); as lerr) {
|
||||
<div class="px-3 py-1.5 text-[11px] text-red-300">{{ lerr }}</div>
|
||||
}
|
||||
<app-add-to-playlist [provider]="provider()" [videoId]="v.videoId" [title]="v.title" [thumbnail]="v.thumbnail" [menuItem]="true"></app-add-to-playlist>
|
||||
<button type="button" (click)="openPlaylist()" class="pm-item">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
||||
<path d="M4 6a2 2 0 012-2h12a1 1 0 010 2H6v10a1 1 0 11-2 0V6z" />
|
||||
<path d="M14 11a1 1 0 011-1h5a1 1 0 110 2h-5a1 1 0 01-1-1zM14 15a1 1 0 011-1h5a1 1 0 110 2h-5a1 1 0 01-1-1zM10 11a1 1 0 112 0v1h1a1 1 0 110 2h-1v1a1 1 0 11-2 0v-1H9a1 1 0 110-2h1v-1z" />
|
||||
</svg>
|
||||
<span class="pm-item-label">Ajouter à une playlist</span>
|
||||
</button>
|
||||
}
|
||||
|
||||
<button type="button" (click)="toggleTranscript(); closeMenu()" class="pm-item" [attr.aria-expanded]="transcriptOpen()">
|
||||
@@ -104,6 +110,11 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Boîte de dialogue playlist : rendue HORS du menu FAB (le panneau a un
|
||||
`backdrop-filter` qui créerait un bloc de positionnement pour la modale
|
||||
`position: fixed`). Déclencheur masqué, ouvert via openPlaylist(). -->
|
||||
<app-add-to-playlist #addToPlaylist [provider]="provider()" [videoId]="v.videoId" [title]="v.title" [thumbnail]="v.thumbnail" [triggerHidden]="true"></app-add-to-playlist>
|
||||
|
||||
@if (loading()) {
|
||||
<!-- Squelette des métadonnées pendant /details (le player joue déjà) -->
|
||||
<div class="mt-4 animate-pulse space-y-3" aria-hidden="true">
|
||||
|
||||
@@ -54,6 +54,7 @@ export class WatchComponent implements OnDestroy, AfterViewInit {
|
||||
private subs = inject(SubscriptionsService);
|
||||
private routeSubscription!: Subscription;
|
||||
@ViewChild('embedFrame', { static: false }) embedFrame?: ElementRef<HTMLIFrameElement>;
|
||||
@ViewChild('addToPlaylist', { static: false }) addToPlaylist?: AddToPlaylistComponent;
|
||||
private attachTryCount = 0;
|
||||
|
||||
// --- Chaîne / abonnement ---
|
||||
@@ -167,6 +168,12 @@ export class WatchComponent implements OnDestroy, AfterViewInit {
|
||||
closeMenu(): void {
|
||||
this.menuOpen.set(false);
|
||||
}
|
||||
|
||||
/** Ouvre la boîte de dialogue playlist (composant rendu hors du menu FAB). */
|
||||
openPlaylist(): void {
|
||||
this.closeMenu();
|
||||
this.addToPlaylist?.openDialog();
|
||||
}
|
||||
// Prefer full description if available; otherwise fallback to shortDescription
|
||||
descriptionText = computed(() => {
|
||||
const v = this.video();
|
||||
|
||||
Reference in New Issue
Block a user