style changes
This commit is contained in:
@@ -20,6 +20,7 @@ export class HomeComponent implements OnInit {
|
||||
isnovo = environment.theme === 'novo';
|
||||
categories = signal<Category[]>([]);
|
||||
itemCounts = signal<Map<number, number>>(new Map());
|
||||
wideCategories = signal<Set<number>>(new Set());
|
||||
loading = signal(true);
|
||||
error = signal<string | null>(null);
|
||||
|
||||
@@ -55,6 +56,7 @@ export class HomeComponent implements OnInit {
|
||||
this.categories.set(categories);
|
||||
this.loading.set(false);
|
||||
this.loadItemCounts();
|
||||
this.detectWideImages(categories);
|
||||
},
|
||||
error: (err) => {
|
||||
this.error.set('Failed to load categories');
|
||||
@@ -97,6 +99,30 @@ export class HomeComponent implements OnInit {
|
||||
return this.subcategoriesCache().get(parentID) || [];
|
||||
}
|
||||
|
||||
isWideCategory(categoryID: number): boolean {
|
||||
return this.wideCategories().has(categoryID);
|
||||
}
|
||||
|
||||
private detectWideImages(categories: Category[]): void {
|
||||
const topLevel = categories.filter(c => c.parentID === 0);
|
||||
topLevel.forEach(cat => {
|
||||
const src = cat.wideBanner || null;
|
||||
if (!src) return;
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
const ratio = img.naturalWidth / img.naturalHeight;
|
||||
if (ratio > 2) {
|
||||
this.wideCategories.update(set => {
|
||||
const next = new Set(set);
|
||||
next.add(cat.categoryID);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
};
|
||||
img.src = src;
|
||||
});
|
||||
}
|
||||
|
||||
navigateToSearch(): void {
|
||||
this.router.navigate(['/search']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user