mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-12 03:56:15 -08:00
feat(stalker): add back button in details view
Add clearSelectedItem() to the stalker store to reset selected item state (selectedVodId, selectedSerialId, selectedItvId, selectedItem). This centralizes clearing logic and avoids manual nulling elsewhere. Introduce goBackToList() in the container component to use the new store method when navigating back from item details. Update the template to conditionally show the back button when a selected item exists, and ensure category title rendering and the disabled category button behave correctly with the new conditional structure. These changes simplify state management for returning from detail views and make the template logic clearer and less error-prone.
This commit is contained in:
1 parent
97aa1d4a59
commit
94a07d3a63
3 files changed
+18
-8
No files matched your search
@@ -90,19 +90,17 @@
|
||||
<div class="main-content">
|
||||
<div class="content-header">
|
||||
<h2>
|
||||
@if (
|
||||
currentLayout === 'vod-details' ||
|
||||
currentLayout === 'serial-details'
|
||||
) {
|
||||
<button mat-icon-button (click)="historyBack()">
|
||||
@if (stalkerStore.selectedItem()) {
|
||||
<button mat-icon-button (click)="goBackToList()">
|
||||
<mat-icon>chevron_left</mat-icon>
|
||||
</button>
|
||||
} @else if (!isItvCategorySelected) {
|
||||
<button mat-icon-button disabled>
|
||||
<mat-icon>category</mat-icon>
|
||||
</button>
|
||||
}
|
||||
|
||||
@if (!isItvCategorySelected) {
|
||||
<button mat-icon-button disabled>
|
||||
<mat-icon>category</mat-icon>
|
||||
</button>
|
||||
{{ selectedCategoryTitle() }}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,4 +236,8 @@ export class StalkerMainContainerComponent {
|
||||
backToCategories() {
|
||||
this.stalkerStore.setSelectedCategory(null);
|
||||
}
|
||||
|
||||
goBackToList() {
|
||||
this.stalkerStore.clearSelectedItem();
|
||||
}
|
||||
}
|
||||
@@ -332,6 +332,14 @@ export const StalkerStore = signalStore(
|
||||
selectedItem,
|
||||
});
|
||||
},
|
||||
clearSelectedItem() {
|
||||
patchState(store, {
|
||||
selectedVodId: undefined,
|
||||
selectedSerialId: undefined,
|
||||
selectedItvId: undefined,
|
||||
selectedItem: undefined,
|
||||
});
|
||||
},
|
||||
setCategories(type: 'vod' | 'series' | 'itv', categories: any[]) {
|
||||
if (type === 'vod') {
|
||||
patchState(store, { vodCategories: categories });
|
||||
|
||||
Reference in new issue
Block a user