chore: update Angular cache and TypeScript build info

This commit is contained in:
2025-09-21 10:04:52 -04:00
parent 5d6aa17b81
commit 2420140cad
7 changed files with 174 additions and 43 deletions
@@ -11,37 +11,39 @@ import { AuthService } from '../../../../services/auth.service';
imports: [CommonModule, HttpClientModule],
// Le service est déjà fourni via providedIn: 'root' dans le service
template: `
<button
(click)="onClick($event)"
[class.text-red-500]="isLiked()"
[class.text-slate-400]="!isLiked()"
[class.hover\:text-red-500]="!isLiked()"
[disabled]="isLoading() || !isAuthenticated()"
class="transition-colors duration-200 p-1 rounded-full hover:bg-slate-700/50 flex items-center justify-center"
[attr.aria-label]="!isAuthenticated() ? 'Connectez-vous pour aimer' : (isLiked() ? 'Retirer des vidéos aimées' : 'Ajouter aux vidéos aimées')"
[attr.aria-pressed]="isLiked()"
>
@if (isLoading()) {
<svg class="animate-spin h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
</svg>
<span class="sr-only">Chargement...</span>
} @else {
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5"
viewBox="0 0 24 24"
fill="currentColor"
[attr.aria-hidden]="true"
>
<path
[attr.d]="isLiked() ? 'M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z' : 'M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z'"
/>
</svg>
<span class="sr-only">{{ isLiked() ? 'Retirer des vidéos aimées' : 'Ajouter aux vidéos aimées' }}</span>
}
</button>
@if (isAuthenticated()) {
<button
(click)="onClick($event)"
[class.text-red-500]="isLiked()"
[class.text-slate-400]="!isLiked()"
[class.hover\:text-red-500]="!isLiked()"
[disabled]="isLoading()"
class="transition-colors duration-200 p-1 rounded-full hover:bg-slate-700/50 flex items-center justify-center"
[attr.aria-label]="isLiked() ? 'Retirer des vidéos aimées' : 'Ajouter aux vidéos aimées'"
[attr.aria-pressed]="isLiked()"
>
@if (isLoading()) {
<svg class="animate-spin h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
</svg>
<span class="sr-only">Chargement...</span>
} @else {
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5"
viewBox="0 0 24 24"
fill="currentColor"
[attr.aria-hidden]="true"
>
<path
[attr.d]="isLiked() ? 'M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z' : 'M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z'"
/>
</svg>
<span class="sr-only">{{ isLiked() ? 'Retirer des vidéos aimées' : 'Ajouter aux vidéos aimées' }}</span>
}
</button>
}
`,
styles: [
`
@@ -107,11 +109,23 @@ export class LikeButtonComponent implements OnInit, OnDestroy, OnChanges {
ngOnInit() {
// Vérifie le statut du like à l'initialisation
this.isAuthenticated.set(!!this.auth.currentUser());
if (!this.isAuthenticated()) {
// Utilisateur non connecté: ne pas appeler l'API et ne rien afficher
this.isLiked.set(false);
this.isLoading.set(false);
return;
}
this.checkLikeStatus();
}
ngOnChanges(changes: SimpleChanges) {
// Vérifie le statut du like lorsque les propriétés d'entrée changent
this.isAuthenticated.set(!!this.auth.currentUser());
if (!this.isAuthenticated()) {
this.isLiked.set(false);
this.isLoading.set(false);
return;
}
if (changes['videoId'] && !changes['videoId'].firstChange) {
this.checkLikeStatus();
}
@@ -134,7 +148,13 @@ export class LikeButtonComponent implements OnInit, OnDestroy, OnChanges {
this.isLoading.set(false);
return;
}
// Ne rien faire si l'utilisateur n'est pas connecté
if (!this.isAuthenticated()) {
this.isLiked.set(false);
this.isLoading.set(false);
return;
}
this.isLoading.set(true);
try {
this.likesService.isLiked(this.provider, this.videoId)
+5
View File
@@ -33,6 +33,11 @@ export const authInterceptor: HttpInterceptorFn = (req, next) => {
if (isRefreshCall) {
return throwError(() => err);
}
// If there is no access token at all, we are not logged in: do not try refresh
const hasToken = !!auth.getAccessToken();
if (!hasToken) {
return throwError(() => err);
}
// Try a single refresh then retry the request once
return auth.refresh().pipe(
switchMap((ok) => {
+13 -2
View File
@@ -217,7 +217,12 @@ export class YoutubeApiService {
chart: 'mostPopular',
regionCode: String(region),
maxResults: '24',
// Optimize quota usage: only get essential parts
part: 'snippet,contentDetails,statistics',
// Add safeSearch for better content filtering
safeSearch: 'moderate',
// Video category for trending (Music = 10, Gaming = 20, etc.)
videoCategoryId: '0', // All categories
key: String(key),
});
@@ -371,11 +376,15 @@ export class YoutubeApiService {
if (!key) return of({ items: [], nextCursor: null });
const params = new URLSearchParams({
type: 'video',
part: 'snippet',
// Reduce initial page size to 12 to limit payload; unit cost per call remains but fewer follow-up calls
part: 'snippet,contentDetails,statistics',
// Optimize for quota usage: reduce initial results
maxResults: '12',
q: String(query),
regionCode: String(region),
// Add safeSearch for better content filtering
safeSearch: 'moderate',
// Video category filter for better relevance
videoCategoryId: '0', // All categories
key: String(key),
});
// Prefer results matching user's language when available
@@ -952,6 +961,8 @@ export class YoutubeApiService {
part: 'contentDetails,statistics',
id: ids.join(','),
maxResults: String(Math.min(50, ids.length)),
// Add safeSearch for consistency
safeSearch: 'moderate',
});
return this.fetchYouTube('/youtube/v3/videos', params, apiKey).pipe(
map((res: any) => Array.isArray(res?.items) ? res.items : []),