minor random fix/changes

This commit is contained in:
X4Lo committed 2024-09-10 19:04:40 +01:00
1 parent 9d89eda74c
commit b35ab48b4f
8 files changed
+75 -85

No files matched your search

@@ -49,11 +49,37 @@ export class UserCollectionsListItemComponent {
return this.getEntryPosterPath(this.list.entries[0]);
}
return `https://www.themoviedb.org/w1280/${this.list.posterPath}`;
// * if the collection is empty
return 'assets/images/default/default-poster.png';
}
}
getCollectionBakcgroundPath() {
return `https://www.themoviedb.org/w1280/${this.list.backdropPath}`;
// if (this.list.isLocal) {
// if (this.list.backdropPath == null)
// return 'assets/images/default/default-poster.png';
// // * use the collection custom poster
// return (
// environment.API_URL +
// `/media/collections/posters/preview/` +
// this.list.posterPath
// );
// } else {
// // * use the poster of the first entry in the collection if its no empty
// if (this.list.entries.length != 0) {
// return this.getEntryPosterPath(this.list.entries[0]);
// }
// return `https://www.themoviedb.org/w1280/${this.list.backdropPath}`;
// // * if the collection is empty
// return 'assets/images/default/default-poster.png';
// }
}
getEntryPosterPath(entry: Entry) {
// * Is in library: use a local poster
if (entry.medias) {
@@ -149,32 +149,7 @@
</div>
</div>
</div>
<!-- series watchtime -->
<!-- <div class="card rounded-4">
<div class="card-body">
<div class="d-flex gap-2 mb-4">
<div
class="wh-48 d-flex bg-danger text-danger bg-opacity-10 align-items-center justify-content-center rounded-circle"
style="min-width: 48px;">
<span class="material-icons-outlined">tv</span>
</div>
<h5 class="mb-0 d-flex align-items-center gap-2">
Total Time Spent Watching Tv-Series
</h5>
</div>
<div class="d-flex align-items-start justify-content">
<div class="d-flex flex-column align-items-start gap-1">
<h5 class="mb-0 time-color">{{ watchTime.allTime.series | number }} minutes</h5>
<p class="mb-0">and it is</p>
<h5 class="mb-0 time-color">{{ watchTime.allTime.series | minutesFormat:'hours' | number }} hours</h5>
<p class="mb-0">which is about {{watchTime.allTime.series | minutesFormat:'days'}} days.</p>
</div>
</div>
</div>
</div> -->
</div>
<!-- watch history graph -->
<div class="col-12 col-xl-7 col-xxl-8 d-flex">
@@ -1,8 +1,6 @@
import { Component, OnInit } from '@angular/core';
import ApexCharts from 'apexcharts';
import { EntrySeenService } from '../../core/services/entry-seen.service';
import { LibraryService } from '../../core/services/library.service';
import { EpisodeSeenService } from '../../core/services/episode-seen.service';
import { forkJoin } from 'rxjs';
import { StatisticsService } from '../../core/services/statistics.service';
import { WatchTime } from '../../shared/models/statistics/watchTime.model';
@@ -54,9 +52,7 @@ export class HomeComponent implements OnInit {
constructor(
private statisticsService: StatisticsService,
private libraryService: LibraryService
) {
console.log('hey im home');
}
) {}
async ngOnInit() {
// ? get counts (movies, series, favorit, watchlist)
@@ -61,6 +61,15 @@
white-space: normal;
}
/* ! OVER LAY 1 HIDDEN MODE */
.movie-card .card-body {
opacity: 0;
}
.movie-card:hover .card-body {
opacity: 1;
}
/* ! OVER LAY 2 */
.movie-card:hover .card-overlay-2 {
opacity: 0;
@@ -1,6 +1,7 @@
<div class="movie-card" [@fadeInOut]="animationDirection">
<div class="card-head">
<img class="card-img" [src]="posterPath" alt="Movie Poster" onerror="this.src='assets/images/default/default-poster.png'">
<img class="card-img" [src]="posterPath" alt="Movie Poster"
onerror="this.src='assets/images/default/default-poster.png'">
<div class="loading-overlay" *ngIf="lockActions" @animateDestroy>
<div class="d-flex justify-content-center align-items-center" style="height: 100%;">
@@ -18,21 +19,22 @@
</div>
</div>
<div class="card-overlay">
<div class="card-overlay" (click)="cardClick()">
<div class="rating">
<i class='bx bx-star'></i>
<span>{{formattedRate}}</span>
</div>
<div class="bookmark" *ngIf="!entry.isInLibrary">
<i class='bx bxs-add-to-queue' (click)="addEntry(entry.entryId.tmdb_id, entry.is_tvseries)"></i>
<i class='bx bxs-add-to-queue'
(click)="addEntry(entry.entryId.tmdb_id, entry.is_tvseries); $event.stopPropagation()"></i>
</div>
<div class="bookmark" *ngIf="entry.isInLibrary">
<i class='bx bxs-trash' (click)="removeEntry(entry.id)" style="color: #d42f50;"></i>
<i class='bx bxs-trash' (click)="removeEntry(entry.id); $event.stopPropagation()" style="color: #d42f50;"></i>
</div>
<!-- <div [ngClass]="{'info': !entry.isInLibrary, 'bookmark': entry.isInLibrary}"> -->
<div class="info" *ngIf="entry.isInLibrary">
<i class='bx bx-list-plus' (click)="showAddToListModal()"></i>
<i class='bx bx-list-plus' (click)="showAddToListModal(); $event.stopPropagation()"></i>
</div>
</div>
@@ -12,6 +12,7 @@ import { Entry } from '../../../models/entry.model';
import { LibraryService } from '../../../../core/services/library.service';
import { Router } from '@angular/router';
import { ConfirmModalComponent } from '../../modals/confirm-modal/confirm-modal.component';
import { environment } from '../../../../../environments/environment.prod';
@Component({
selector: 'app-main-card',
@@ -121,7 +122,7 @@ export class MainCardComponent implements OnInit {
// console.log(`Entry added to library`, entry);
entry.isInLibrary = true;
this.entry = entry;
this.libraryService.refrechEntries().subscribe();
this.libraryService.refreshEntries().subscribe();
this.onEntryUpdate.emit(this.entry.id);
this.lockActions = false;
obs.unsubscribe();
@@ -131,6 +132,7 @@ export class MainCardComponent implements OnInit {
// TODO error notification
console.error('Error adding entry:', error);
this.lockActions = false;
obs.unsubscribe();
},
});
}
@@ -159,7 +161,7 @@ export class MainCardComponent implements OnInit {
this.entry.id = 0;
this.entry.isInLibrary = false;
this.onEntryRemove.emit(this.entry.id);
this.libraryService.refrechEntries().subscribe();
this.libraryService.refreshEntries().subscribe();
// todo entry removed notification
},
error: (error) => {
@@ -219,12 +221,12 @@ export class MainCardComponent implements OnInit {
get posterPath() {
// * Not in library, use TMDB poster
if (!this.entry.isInLibrary)
return `https://image.tmdb.org/t/p/w300` + this.entry.poster_path;
return `https://image.tmdb.org/t/p/w342` + this.entry.poster_path;
// * Is in library: use a local poster
if (this.entry.medias) {
const selectedPosters = this.entry.medias.filter(
(m) => m.type == 'poster' && m.is_selected
(m) => m.type == 'poster' && m.isSelected
);
if (
@@ -232,9 +234,8 @@ export class MainCardComponent implements OnInit {
selectedPosters[0] &&
selectedPosters[0].path
) {
const name = selectedPosters[0].path.split('.')[0];
const extention = selectedPosters[0].path.split('.')[1];
return `http://localhost:4000/api/v1/media/entries/posters/${name}_preview.${extention}`;
const name = selectedPosters[0].path;
return environment.API_URL + `/media/entries/posters/preview/${name}`;
}
}
@@ -1,35 +1,17 @@
<!-- <h2 mat-dialog-title>Choose a list</h2>
<mat-dialog-content>
<mat-form-field appearance="fill">
<mat-label>List Name</mat-label>
<input [formControl]="searchControl" matInput>
</mat-form-field>
<mat-dialog-actions align="center" *ngIf="doShowAddButton()">
<button mat-button (click)="createList()" *ngIf="doShowAddButton()">Create List</button>
</mat-dialog-actions>
<mat-selection-list #shoes (selectionChange)="onSelectionChange($event)">
<mat-list-option *ngFor="let list of listsToShow" [value]="list.id" checkboxPosition="before">
{{list.name}}
</mat-list-option>
</mat-selection-list>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button [mat-dialog-close]="true">OK</button>
<button mat-button mat-dialog-close>Cancel</button>
</mat-dialog-actions> -->
<div class="modal-content user-lists">
<div class="modal-header">
<h2 class="modal-title">Choose a Collection</h2>
<button type="button" class="btn-close" (click)="closeDialog()"></button>
<div class="card border-top border-3 border-primary rounded-0 media-dialog-main mb-0">
<div class="modal-header card-header py-3 px-4">
<h5 class="mb-0 text-primary">Add To Collection</h5>
<button type="button" class="btn-close" aria-label="Close" (click)="onClose()"></button>
</div>
<!-- Modal Body -->
<div class="card-body p-4">
<div class="modal-body">
<div class="input-group mb-3 ">
<!-- <label for="listNameInput" class="form-label">List Name</label> -->
<input type="text" class="form-control" id="listNameInput" [formControl]="searchControl"
placeholder="Collection name..." @scaleInOut>
<button class="btn btn-success growing-width-element" type="button" *ngIf="doShowAddButton()" (click)="createList()" @scaleInOut>Create
<button class="btn btn-success growing-width-element" type="button" *ngIf="doShowAddButton()"
(click)="createList()" @scaleInOut>Create
Collection</button>
</div>
@@ -47,11 +29,10 @@
</div>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<div class="btn-group">
<!-- <button type="button" class="btn btn-secondary" (click)="closeDialog()">Cancel</button> -->
<button type="button" class="btn btn-primary" (click)="confirmSelection()">OK</button>
<div class="col-md-12">
<div class="d-md-flex d-grid align-items-end gap-3">
<button type="button" class="btn btn-primary px-4 rounded-0" (click)="onSubmit()">Confirm</button>
</div>
</div>
</div>
</div>
@@ -64,18 +64,21 @@ export class UserCollectionsModalComponent implements OnInit {
getLists() {
this.listService.getCollections().subscribe({
next: (c) => {
c.forEach((collection) => {
next: (result) => {
result.forEach((collection) => {
if (
collection.userCollectionEntries.some(
(entry) => entry.entry_id == this.entryId
collection.entries.some(
(entry) => entry.id == this.entryId
)
) {
collection.isChecked = true;
}
});
this.userCollections = c;
this.userCollections = result;
this.userCollections = this.userCollections.filter(
(c) => c.isUserCollection
);
this.userCollectionsToShow = this.userCollections;
this.applyFilter(this.searchControl.value);
},
@@ -102,7 +105,7 @@ export class UserCollectionsModalComponent implements OnInit {
}
createList() {
const listName = this.searchControl.value; // string
const listName = this.searchControl.value?.toString().trim(); // string
let myNewList = { name: listName } as UserCollection;
@@ -124,10 +127,7 @@ export class UserCollectionsModalComponent implements OnInit {
`Adding Entry ${this.entryId} to list: ${userCollection.name}`
);
this.listService
.addEntryToCollection(
userCollection.id,
this.entryId
)
.addEntryToCollection(userCollection.id, this.entryId)
.subscribe({
next: (response) => {
console.log('Successfuly added Entry To Collection:', response);
@@ -165,12 +165,12 @@ export class UserCollectionsModalComponent implements OnInit {
}
}
closeDialog(): void {
onClose(): void {
this.dialogRef.close();
}
confirmSelection(): void {
this.dialogRef.close(/* Optionally pass back some data */);
onSubmit(): void {
this.dialogRef.close();
}
showNotification(title: string, message: string, type: string): void {