feat: refine category view image handling

This commit is contained in:
4gray committed 2026-01-05 21:57:07 +01:00
1 parent 7ae86a8266
commit 050ea5ae5e
3 files changed
+10 -12

No files matched your search

@@ -46,6 +46,11 @@ export class CategoryContentViewComponent implements OnInit {
ngOnInit() {
const { categoryId } = this.activatedRoute.snapshot.params;
// Clear any previous selectedItem when entering category view
// This ensures the content-header is visible
this.store.setSelectedItem(null);
// Only set category if it's different from the currently selected one
// This preserves the page state when navigating back from detail view
if (
@@ -6,26 +6,21 @@
| sortBy: sortType();
track $index
) {
@let imgSrc = item.stream_icon || item.cover || item.logo;
<mat-card (click)="itemClicked.emit(item)">
<mat-card-content>
@if (item.stream_icon || item.cover || item.logo) {
@if (imgSrc) {
<img
class="stream-icon"
[ngSrc]="
item.stream_icon || item.cover || item.logo
"
fill
priority
placeholder
placeholder="data:image/png;base64,iVBORw0K..."
[src]="imgSrc"
(error)="
$event.target.src =
'./assets/images/default-poster.png'
"
loading="lazy"
alt="channel logo"
/>
}
@if (!item.stream_icon && !item.cover && !item.logo) {
} @else {
<div class="stream-icon-placeholder"></div>
}
@if (item.rating || item.rating_imdb) {
@@ -1,4 +1,3 @@
import { NgOptimizedImage } from '@angular/common';
import { Component, EventEmitter, Input, Output, inject } from '@angular/core';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
@@ -19,7 +18,6 @@ import { PortalStore } from '../portal.store';
MatCardModule,
MatIconModule,
MatTooltipModule,
NgOptimizedImage,
PlaylistErrorViewComponent,
TranslateModule,
],