From 7aea8e2c7b9c25ed12a53e41197be884f7dbd808 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Fri, 2 Oct 2026 14:48:58 -0400 Subject: [PATCH] =?UTF-8?q?feat(shorts):=20bouton=20=C2=AB=20Enregistrer?= =?UTF-8?q?=20=C2=BB=20(=C3=A0=20regarder=20plus=20tard)=20+=20panneau=20?= =?UTF-8?q?=E2=93=98=20honn=C3=AAte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rail + menu FAB : « Enregistrer » branché sur la liste réelle « À regarder plus tard » (LikesService, tag `watch-later`, page /library/watch-later) — état hydraté par vidéo comme J'aime, désactivé hors connexion (la liste est serveur). C'est le bouton « Enregistrer » de la description du rail, en vrai plutôt qu'en décoration. - Panneau ⓘ : plus de promesse de commentaires — l'app n'en a aucune source (le champ du modèle est un tableau vide sur /watch) ; le bloc renvoie explicitement vers la page complète (description, téléchargements, transcript). --- .../shorts/watch-short.component.html | 23 ++++++++--- .../shorts/watch-short.component.ts | 39 +++++++++++++++++++ 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/components/shorts/watch-short.component.html b/src/components/shorts/watch-short.component.html index 16c545c..df2b286 100644 --- a/src/components/shorts/watch-short.component.html +++ b/src/components/shorts/watch-short.component.html @@ -103,6 +103,11 @@ {{ liked() ? 'Je n’aime plus' : 'J’aime' }} + + @@ -358,16 +370,17 @@ } - +
Commentaires
-

Les commentaires s’affichent dans la page Watch, avec la description complète.

+

Aucune source de commentaires pour ce fournisseur. La page complète donne la description, les pistes de téléchargement et le transcript.

@if (watchLink()) { - - Voir les commentaires + + Ouvrir la page complète }
diff --git a/src/components/shorts/watch-short.component.ts b/src/components/shorts/watch-short.component.ts index 37db8d5..4043f15 100644 --- a/src/components/shorts/watch-short.component.ts +++ b/src/components/shorts/watch-short.component.ts @@ -157,6 +157,10 @@ export class WatchShortComponent implements OnDestroy { liked = signal(false); private likedCheckedFor = ''; likeBusy = signal(false); + /** « Enregistrer » = liste « À regarder plus tard » (même stockage que J'aime). */ + saved = signal(false); + private savedCheckedFor = ''; + saveBusy = signal(false); /** Abonnement à la chaîne du short courant. */ subBusy = signal(false); /** Partage : "copié" éphémère. */ @@ -750,9 +754,20 @@ export class WatchShortComponent implements OnDestroy { error: () => {}, }); } + // État « Enregistré » (tag watch-later) : même tuyau que J'aime. + if (key !== this.savedCheckedFor) { + this.savedCheckedFor = key; + this.saved.set(false); + this.likes.isLiked(this.providerOf(v), v.videoId, 'watch-later').subscribe({ + next: (r) => { if (this.savedCheckedFor === key) this.saved.set(!!(r as any)?.liked); }, + error: () => {}, + }); + } } else { this.liked.set(false); this.likedCheckedFor = ''; + this.saved.set(false); + this.savedCheckedFor = ''; } } catch {} }); @@ -1154,6 +1169,30 @@ export class WatchShortComponent implements OnDestroy { } } + /** + * « Enregistrer » = « À regarder plus tard » (même stockage que J'aime, tag + * `watch-later`, page /library/watch-later). Connecté uniquement : la liste + * est serveur, un invité n'a nulle part où l'écrire. + */ + toggleSave(): void { + const v = this.current(); + if (!v?.videoId || !this.isLoggedIn() || this.saveBusy()) return; + const p = this.providerOf(v); + this.saveBusy.set(true); + const done = (saved: boolean) => { this.saved.set(saved); this.saveBusy.set(false); }; + if (this.saved()) { + this.likes.unlike(p, v.videoId, 'watch-later').subscribe({ + next: () => done(false), + error: () => this.saveBusy.set(false), + }); + } else { + this.likes.like(p, v.videoId, v.title, v.thumbnail, 'watch-later').subscribe({ + next: () => done(true), + error: () => this.saveBusy.set(false), + }); + } + } + toggleSubscribe(): void { const key = this.currentChannelKey(); if (!key || !this.isLoggedIn() || this.subBusy()) return;