chore: update Angular cache and TypeScript build info files
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
<ul *ngIf="!isLoading() && filteredSearchHistory().length > 0" class="space-y-3">
|
||||
<li *ngFor="let s of filteredSearchHistory()"
|
||||
class="group relative bg-slate-700/50 hover:bg-slate-700/80 rounded-lg overflow-hidden transition-all duration-200">
|
||||
<a [routerLink]="['/search']" [queryParams]="{ q: s.query, provider: getSearchProvider(s).id }"
|
||||
<a [routerLink]="['/search']" [queryParams]="getSearchProvider(s).providers ? { q: s.query, providers: getSearchProvider(s).providers } : { q: s.query, provider: getSearchProvider(s).id }"
|
||||
class="block p-4 pr-16 hover:no-underline">
|
||||
<div class="flex items-start gap-2">
|
||||
<span class="text-slate-400 mt-0.5">
|
||||
@@ -80,15 +80,7 @@
|
||||
</div>
|
||||
<div class="flex items-center mt-1 text-xs text-slate-400">
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded mr-2 border"
|
||||
[ngStyle]="getProviderColors(getSearchProvider(s).id)"
|
||||
[ngClass]="{
|
||||
'bg-red-600/15 text-red-400 border-red-500/30': getSearchProvider(s).id === 'youtube',
|
||||
'bg-sky-600/15 text-sky-300 border-sky-500/30': getSearchProvider(s).id === 'vimeo',
|
||||
'bg-blue-600/15 text-blue-300 border-blue-500/30': getSearchProvider(s).id === 'dailymotion',
|
||||
'bg-amber-600/15 text-amber-300 border-amber-500/30': getSearchProvider(s).id === 'peertube',
|
||||
'bg-green-600/15 text-green-300 border-green-500/30': getSearchProvider(s).id === 'rumble',
|
||||
'bg-slate-800/80 text-slate-300 border-slate-700': !['youtube', 'vimeo', 'dailymotion', 'peertube', 'rumble'].includes(getSearchProvider(s).id)
|
||||
}">
|
||||
[ngStyle]="getProviderColors(getSearchProvider(s).id)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
|
||||
</svg>
|
||||
@@ -122,7 +114,7 @@
|
||||
<ul *ngIf="searchHistory().length > 0" class="space-y-3">
|
||||
<li *ngFor="let s of searchHistory()"
|
||||
class="group relative bg-slate-700/50 hover:bg-slate-700/80 rounded-lg overflow-hidden transition-all duration-200">
|
||||
<a [routerLink]="['/search']" [queryParams]="{ q: s.query, provider: getSearchProvider(s).id }"
|
||||
<a [routerLink]="['/search']" [queryParams]="getSearchProvider(s).providers ? { q: s.query, providers: getSearchProvider(s).providers } : { q: s.query, provider: getSearchProvider(s).id }"
|
||||
class="block p-4 pr-16 hover:no-underline">
|
||||
<div class="flex items-start gap-2">
|
||||
<span class="text-slate-400 mt-0.5">
|
||||
@@ -136,15 +128,7 @@
|
||||
</div>
|
||||
<div class="flex items-center mt-1 text-xs text-slate-400">
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded mr-2 border"
|
||||
[ngStyle]="getProviderColors(getSearchProvider(s).id)"
|
||||
[ngClass]="{
|
||||
'bg-red-600/15 text-red-400 border-red-500/30': getSearchProvider(s).id === 'youtube',
|
||||
'bg-sky-600/15 text-sky-300 border-sky-500/30': getSearchProvider(s).id === 'vimeo',
|
||||
'bg-blue-600/15 text-blue-300 border-blue-500/30': getSearchProvider(s).id === 'dailymotion',
|
||||
'bg-amber-600/15 text-amber-300 border-amber-500/30': getSearchProvider(s).id === 'peertube',
|
||||
'bg-green-600/15 text-green-300 border-green-500/30': getSearchProvider(s).id === 'rumble',
|
||||
'bg-slate-800/80 text-slate-300 border-slate-700': !['youtube', 'vimeo', 'dailymotion', 'peertube', 'rumble'].includes(getSearchProvider(s).id)
|
||||
}">
|
||||
[ngStyle]="getProviderColors(getSearchProvider(s).id)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
|
||||
</svg>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, inject, signal, computed, effect } from '@angular/core';
|
||||
import { NgClass } from '@angular/common';
|
||||
import { CommonModule, DatePipe } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
@@ -12,7 +11,7 @@ import { HistoryService, SearchHistoryItem, WatchHistoryItem } from '../../../se
|
||||
standalone: true,
|
||||
templateUrl: './history.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
imports: [CommonModule, RouterModule, FormsModule, NgClass]
|
||||
imports: [CommonModule, RouterModule, FormsModule]
|
||||
})
|
||||
export class HistoryComponent {
|
||||
private history = inject(HistoryService);
|
||||
@@ -32,6 +31,20 @@ export class HistoryComponent {
|
||||
// Sujet pour la recherche avec debounce
|
||||
private searchTerms = new Subject<string>();
|
||||
|
||||
|
||||
// Obtenir le nom d'affichage d'un provider
|
||||
getProviderName(providerId: string): string {
|
||||
const names: Record<string, string> = {
|
||||
'youtube': 'YouTube',
|
||||
'dailymotion': 'Dailymotion',
|
||||
'twitch': 'Twitch',
|
||||
'peertube': 'PeerTube',
|
||||
'odysee': 'Odysee',
|
||||
'rumble': 'Rumble'
|
||||
};
|
||||
return names[providerId.toLowerCase()] || providerId;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
// Chargement initial des données
|
||||
this.reload();
|
||||
@@ -151,13 +164,25 @@ export class HistoryComponent {
|
||||
});
|
||||
}
|
||||
|
||||
// Get provider from search filters or query params
|
||||
getSearchProvider(item: SearchHistoryItem): { name: string; id: string } {
|
||||
// Try to get provider from filters first
|
||||
getSearchProvider(item: SearchHistoryItem): { name: string; id: string; providers?: string[] } {
|
||||
// Try to get providers from filters first
|
||||
if (item.filters_json) {
|
||||
try {
|
||||
const filters = JSON.parse(item.filters_json);
|
||||
if (filters.provider) {
|
||||
if (filters.providers) {
|
||||
// Multiple providers available
|
||||
const providers = Array.isArray(filters.providers) ? filters.providers : [filters.providers];
|
||||
if (providers.length === 1) {
|
||||
const providerName = this.formatProviderName(providers[0]);
|
||||
return { name: providerName, id: providers[0].toLowerCase() };
|
||||
} else {
|
||||
const firstProviderName = this.formatProviderName(providers[0]);
|
||||
const othersCount = providers.length - 1;
|
||||
const name = `${firstProviderName} + ${othersCount} autre${othersCount > 1 ? 's' : ''}`;
|
||||
return { name: name, id: providers[0], providers: providers };
|
||||
}
|
||||
} else if (filters.provider) {
|
||||
// Single provider
|
||||
const providerName = this.formatProviderName(filters.provider);
|
||||
return { name: providerName, id: String(filters.provider).toLowerCase() };
|
||||
}
|
||||
@@ -178,16 +203,10 @@ export class HistoryComponent {
|
||||
// Not a valid URL or no provider in query params
|
||||
}
|
||||
|
||||
// Default to the selected provider if available
|
||||
const defaultProvider = this.getDefaultProvider();
|
||||
if (defaultProvider) {
|
||||
return { name: this.formatProviderName(defaultProvider), id: defaultProvider.toLowerCase() };
|
||||
}
|
||||
|
||||
// Fallback to 'all' if no provider can be determined
|
||||
return { name: 'Tous', id: 'all' };
|
||||
}
|
||||
|
||||
|
||||
// Get the default provider from the current URL or settings
|
||||
private getDefaultProvider(): string | null {
|
||||
try {
|
||||
@@ -195,11 +214,11 @@ export class HistoryComponent {
|
||||
const url = new URL(window.location.href);
|
||||
const provider = url.searchParams.get('provider');
|
||||
if (provider) return provider.toLowerCase();
|
||||
|
||||
|
||||
// Or get from localStorage if available
|
||||
const savedProvider = localStorage.getItem('selectedProvider');
|
||||
if (savedProvider) return savedProvider.toLowerCase();
|
||||
|
||||
|
||||
// Default to youtube if nothing else
|
||||
return 'youtube';
|
||||
} catch (e) {
|
||||
@@ -207,6 +226,10 @@ export class HistoryComponent {
|
||||
}
|
||||
}
|
||||
|
||||
getProvidersWithInfo(item: SearchHistoryItem) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Format provider ID to a display name
|
||||
private formatProviderName(providerId: string): string {
|
||||
const providerMap: { [key: string]: string } = {
|
||||
@@ -225,27 +248,66 @@ export class HistoryComponent {
|
||||
return this.formatProviderName(providerId);
|
||||
}
|
||||
|
||||
// Brand colors for provider badges (inline to avoid Tailwind purge issues)
|
||||
getProviderColors(providerId: string): { [key: string]: string } {
|
||||
const id = (providerId || '').toLowerCase();
|
||||
|
||||
// Obtenir les styles pour un provider
|
||||
getProviderColors(providerId: string | null | undefined): { [key: string]: string } {
|
||||
if (!providerId) {
|
||||
return {
|
||||
'background-color': 'rgb(51 65 85 / 0.15)',
|
||||
'color': 'rgb(148 163 184)',
|
||||
'border-color': 'rgb(71 85 105 / 0.3)'
|
||||
};
|
||||
}
|
||||
|
||||
const id = providerId.toLowerCase();
|
||||
let bgColor = 'rgb(51 65 85 / 0.15)';
|
||||
let textColor = 'rgb(148 163 184)';
|
||||
let borderColor = 'rgb(71 85 105 / 0.3)';
|
||||
|
||||
switch (id) {
|
||||
case 'youtube':
|
||||
return { backgroundColor: 'rgba(220, 38, 38, 0.15)', color: 'rgb(248, 113, 113)', borderColor: 'rgba(239, 68, 68, 0.3)' };
|
||||
case 'vimeo':
|
||||
return { backgroundColor: 'rgba(2, 132, 199, 0.15)', color: 'rgb(125, 211, 252)', borderColor: 'rgba(14, 165, 233, 0.3)' };
|
||||
case 'yt':
|
||||
bgColor = 'rgb(220 38 38 / 0.15)';
|
||||
textColor = 'rgb(248 113 113)';
|
||||
borderColor = 'rgb(239 68 68 / 0.3)';
|
||||
break;
|
||||
case 'dailymotion':
|
||||
return { backgroundColor: 'rgba(37, 99, 235, 0.15)', color: 'rgb(147, 197, 253)', borderColor: 'rgba(59, 130, 246, 0.3)' };
|
||||
case 'peertube':
|
||||
return { backgroundColor: 'rgba(245, 158, 11, 0.15)', color: 'rgb(252, 211, 77)', borderColor: 'rgba(245, 158, 11, 0.3)' };
|
||||
case 'rumble':
|
||||
return { backgroundColor: 'rgba(22, 163, 74, 0.15)', color: 'rgb(134, 239, 172)', borderColor: 'rgba(34, 197, 94, 0.3)' };
|
||||
case 'dm':
|
||||
bgColor = 'rgb(37 99 235 / 0.15)';
|
||||
textColor = 'rgb(96 165 250)';
|
||||
borderColor = 'rgb(59 130 246 / 0.3)';
|
||||
break;
|
||||
case 'twitch':
|
||||
return { backgroundColor: 'rgba(168, 85, 247, 0.15)', color: 'rgb(216, 180, 254)', borderColor: 'rgba(168, 85, 247, 0.3)' };
|
||||
case 'tw':
|
||||
bgColor = 'rgb(147 51 234 / 0.15)';
|
||||
textColor = 'rgb(192 132 252)';
|
||||
borderColor = 'rgb(168 85 247 / 0.3)';
|
||||
break;
|
||||
case 'peertube':
|
||||
case 'pt':
|
||||
bgColor = 'rgb(217 119 6 / 0.15)';
|
||||
textColor = 'rgb(251 191 36)';
|
||||
borderColor = 'rgb(245 158 11 / 0.3)';
|
||||
break;
|
||||
case 'odysee':
|
||||
return { backgroundColor: 'rgba(236, 72, 153, 0.15)', color: 'rgb(251, 207, 232)', borderColor: 'rgba(236, 72, 153, 0.3)' };
|
||||
default:
|
||||
return { backgroundColor: 'rgba(30, 41, 59, 0.8)', color: 'rgb(203, 213, 225)', borderColor: 'rgb(51, 65, 85)' };
|
||||
case 'od':
|
||||
bgColor = 'rgb(22 163 74 / 0.15)';
|
||||
textColor = 'rgb(74 222 128)';
|
||||
borderColor = 'rgb(34 197 94 / 0.3)';
|
||||
break;
|
||||
case 'rumble':
|
||||
case 'ru':
|
||||
bgColor = 'rgb(234 88 12 / 0.15)';
|
||||
textColor = 'rgb(251 146 60)';
|
||||
borderColor = 'rgb(249 115 22 / 0.3)';
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
'background-color': bgColor,
|
||||
'color': textColor,
|
||||
'border-color': borderColor
|
||||
};
|
||||
}
|
||||
|
||||
// Format seconds to HH:MM:SS or MM:SS
|
||||
@@ -255,7 +317,6 @@ export class HistoryComponent {
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
const minutes = Math.floor((seconds % 3600) / 60);
|
||||
const secs = Math.floor(seconds % 60);
|
||||
|
||||
if (hours > 0) {
|
||||
return `${hours}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user