-
-
+ @if (showSeasonal()) {
+ @defer (on viewport; prefetch on idle) {
+
+
{{ 'Discovery.SeasonalTab' | translate }}
+
+
-
+ } @placeholder(minimum 300) {
+
+
{{ 'Discovery.SeasonalTab' | translate }}
+
+ @for (item of [1,2,3,4,5,6,7,8,9,10]; track item) {
+
+ }
+
+
+ }
}
@defer (on viewport; prefetch on idle) {
{{ 'Discovery.PopularTab' | translate }}
-
-
-
+
+
+
} @placeholder(minimum 300) {
{{ 'Discovery.PopularTab' | translate }}
-
+ @for (item of [1,2,3,4,5,6,7,8,9,10]; track item) {
+
+ }
}
@@ -73,17 +81,19 @@
@defer (on viewport; prefetch on idle) {
{{ 'Discovery.TrendingTab' | translate }}
-
-
-
+
+
+
} @placeholder(minimum 300) {
{{ 'Discovery.TrendingTab' | translate }}
-
+ @for (item of [1,2,3,4,5,6,7,8,9,10]; track item) {
+
+ }
}
@@ -91,17 +101,19 @@
@defer (on viewport; prefetch on idle) {
{{ 'Discovery.UpcomingTab' | translate }}
-
-
-
+
+
+
} @placeholder(minimum 300) {
{{ 'Discovery.UpcomingTab' | translate }}
-
+ @for (item of [1,2,3,4,5,6,7,8,9,10]; track item) {
+
+ }
}
diff --git a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts
index ec50334c6..17b56443d 100644
--- a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts
+++ b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts
@@ -1,29 +1,34 @@
-import { Component, OnInit } from "@angular/core";
+import { Component, computed, inject, signal, ChangeDetectionStrategy } from "@angular/core";
import { AuthService } from "../../../auth/auth.service";
import { DiscoverType } from "../carousel-list/carousel-list.component";
@Component({
- standalone: false,
+ standalone: false,
templateUrl: "./discover.component.html",
styleUrls: ["./discover.component.scss"],
+ changeDetection: ChangeDetectionStrategy.OnPush
})
-export class DiscoverComponent implements OnInit {
-
+export class DiscoverComponent {
+ // Services using inject() function
+ private authService = inject(AuthService);
+ // Public constants
public DiscoverType = DiscoverType;
- public isAdmin: boolean;
- public showSeasonal: boolean;
+
+ // State using signals
+ public isAdmin = signal
(false);
+ public seasonalMovieCount = signal(0);
+
+ // Computed properties
+ public showSeasonal = computed(() => this.seasonalMovieCount() > 0);
- constructor(private authService: AuthService) { }
-
- public ngOnInit(): void {
- this.isAdmin = this.authService.isAdmin();
+ constructor() {
+ // Initialize admin status
+ this.isAdmin.set(this.authService.isAdmin());
}
- public setSeasonalMovieCount(count: number) {
- if (count > 0) {
- this.showSeasonal = true;
- }
+ public setSeasonalMovieCount(count: number): void {
+ this.seasonalMovieCount.set(count);
}
}