add networks + random changes

This commit is contained in:
X4Lo committed 2025-02-15 23:40:34 +01:00
1 parent bb36b2bd44
commit 5dc5a023b8
26 files changed
+1399 -1975

No files matched your search

@@ -33,7 +33,7 @@ export class CalendarPageComponent implements OnInit {
dateClick: this.handleDateClick.bind(this), // Bind the date click event handler
datesSet: this.handleDatesSet.bind(this), // month change
eventClick: this.handleEventClick.bind(this), // Handle event clicks
dayMaxEvents: 4, // Limit the number of events displayed per day
dayMaxEvents: 3, // Limit the number of events displayed per day
height: 'auto',
};
@@ -45,13 +45,13 @@ export class CalendarPageComponent implements OnInit {
) {}
ngOnInit() {
const today = new Date();
const firstDayOfFirstWeek = this.getFirstMondayOfMonth(today)
.toISOString()
.split('T')[0];
const lastDayOfLastWeek = this.getLastSundayOfMonth(today)
.toISOString()
.split('T')[0];
// const today = new Date();
// const firstDayOfFirstWeek = this.getFirstMondayOfMonth(today)
// .toISOString()
// .split('T')[0];
// const lastDayOfLastWeek = this.getLastSundayOfMonth(today)
// .toISOString()
// .split('T')[0];
// console.log('First Day of First Week:', firstDayOfFirstWeek);
// console.log('Last Day of Last Week:', lastDayOfLastWeek);
@@ -49,7 +49,7 @@
<div *ngIf="isLoading" class="loading-indicator">
Loading...
</div>
<button class="loading-button" (click)="loadNext()">Load More</button>
<button class="loading-button" (click)="loadNext()" *ngIf="maxPage > currentPage">Load More</button>
<!-- Pagination -->
<!-- <div class="pagination-container d-flex justify-content-end" *ngIf="maxPage > 1">
@@ -43,7 +43,7 @@ export class SearchPageComponent implements OnInit, OnDestroy {
searchControl = new FormControl();
private scrollSubscription!: Subscription;
private queryParamsSubscription!: Subscription;
constructor(
private route: ActivatedRoute,
private tmdbService: TmdbService,
@@ -62,12 +62,14 @@ export class SearchPageComponent implements OnInit, OnDestroy {
// this.search(value); // Call your API search function here
});
this.route.queryParams.subscribe((params: any) => {
if (params && params['title']) {
let title = params['title'];
this.searchControl.setValue(title);
this.queryParamsSubscription = this.route.queryParams.subscribe(
(params: any) => {
if (params && params['title']) {
let title = params['title'];
this.searchControl.setValue(title);
}
}
});
);
this.scrollSubscription = this.scrollService.scrollEnd$.subscribe(() => {
if (!this.isLoading) {
@@ -81,6 +83,10 @@ export class SearchPageComponent implements OnInit, OnDestroy {
if (this.scrollSubscription) {
this.scrollSubscription.unsubscribe();
}
if (this.queryParamsSubscription) {
this.queryParamsSubscription.unsubscribe();
}
}
setEntryType(entryType: boolean) {
@@ -150,6 +156,8 @@ export class SearchPageComponent implements OnInit, OnDestroy {
.getByKeywordMulti(this.keyword, this.currentPage)
.subscribe({
next: (result) => {
this.maxPage = result.total_pages;
console.log(this.maxPage);
this.entries = this.entries.concat(result.entries as Entry[]);
this.isLoading = false;
},
@@ -303,10 +303,17 @@ export class LibraryPageComponent implements OnInit, AfterViewInit {
// ! Match all criteria logic
if (this.filterCriteria.matchAll) {
return (
(formattedTitle
((formattedTitle
? entry.title.toLowerCase().includes(formattedTitle) ||
entry.original_title.toLowerCase().includes(formattedTitle)
: true) &&
: true) ||
entry.networks
.map((network) => network.name.toLowerCase())
.some((networkName) =>
networkName.includes(
formattedTitle.replace('network:', '').toLowerCase().trim()
)
)) &&
(this.filterCriteria.genres?.length
? this.filterCriteria.genres.every((genre) =>
entry.genres.includes(genre)
@@ -327,10 +334,13 @@ export class LibraryPageComponent implements OnInit, AfterViewInit {
? entry.title.toLowerCase().includes(formattedTitle) ||
entry.original_title.toLowerCase().includes(formattedTitle)
: true) ||
(entry.network_studio
? entry.network_studio.toLowerCase() ==
formattedTitle.replace('studio:', '')
: true) ||
entry.networks
.map((network) => network.name.toLowerCase())
.some(
(networkName) =>
networkName ==
formattedTitle.replace('network:', '').toLowerCase()
) ||
(this.filterCriteria.genres?.length &&
this.filterCriteria.genres.some((genre) =>
entry.genres.includes(genre)
@@ -374,8 +384,6 @@ export class LibraryPageComponent implements OnInit, AfterViewInit {
const startIndex = (this.currentPage - 1) * this.pageSize;
const endIndex = startIndex + this.pageSize;
console.log(this.pageSize, startIndex, endIndex);
this.entriesToDisplay = this.entriesList.slice(startIndex, endIndex);
}