style changes

This commit is contained in:
sdarbinyan
2026-02-14 02:34:11 +04:00
parent 751ad48489
commit 4238d59fc6
20 changed files with 1448 additions and 1032 deletions

View File

@@ -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']);
}