mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-12 03:56:15 -08:00
refactor: change input decorator usage and improve season selection logic
This commit is contained in:
1 parent
80e1a7b1f5
commit
715c624328
3 files changed
+10
-7
No files matched your search
@@ -2,7 +2,6 @@
|
||||
@if (selectedSeason) {
|
||||
<button
|
||||
mat-button
|
||||
class="back-button"
|
||||
class="back-to-seasons"
|
||||
(click)="selectedSeason = undefined"
|
||||
>
|
||||
@@ -12,13 +11,13 @@
|
||||
}
|
||||
<div class="seasons-container">
|
||||
@if (!selectedSeason) {
|
||||
@for (season of seasons | keyvalue: compareSeasons; track $index) {
|
||||
@for (season of seasons() | keyvalue: compareSeasons; track $index) {
|
||||
<mat-card class="season-item" (click)="selectSeason(season.key)">
|
||||
<mat-card-content>Season {{ season.key }}</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
} @else {
|
||||
@for (episode of seasons[selectedSeason]; track $index) {
|
||||
@for (episode of seasons()[selectedSeason]; track $index) {
|
||||
<mat-card class="episode-item" (click)="selectEpisode(episode)">
|
||||
@if (episode.info?.movie_image) {
|
||||
<mat-card-content
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.episode-item {
|
||||
mat-card-content {
|
||||
padding: 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { KeyValuePipe } from '@angular/common';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Output, input } from '@angular/core';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
@@ -9,10 +9,10 @@ import { XtreamSerieEpisode } from '../../../../shared/xtream-serie-details.inte
|
||||
selector: 'app-season-container',
|
||||
templateUrl: './season-container.component.html',
|
||||
styleUrls: ['./season-container.component.scss'],
|
||||
imports: [KeyValuePipe, MatCardModule, MatIcon, MatButton]
|
||||
imports: [KeyValuePipe, MatCardModule, MatIcon, MatButton],
|
||||
})
|
||||
export class SeasonContainerComponent {
|
||||
@Input({ required: true }) seasons: Record<string, XtreamSerieEpisode[]>;
|
||||
readonly seasons = input.required<Record<string, XtreamSerieEpisode[]>>();
|
||||
|
||||
@Output() episodeClicked = new EventEmitter<any>();
|
||||
|
||||
@@ -26,7 +26,7 @@ export class SeasonContainerComponent {
|
||||
this.selectedSeason = seasonKey;
|
||||
}
|
||||
|
||||
selectEpisode(episode: any) {
|
||||
selectEpisode(episode: XtreamSerieEpisode) {
|
||||
this.episodeClicked.emit(episode);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user