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
+94 -104

No files matched your search

@@ -49,11 +49,37 @@ export class UserCollectionsListItemComponent {
return this.getEntryPosterPath(this.list.entries[0]); return this.getEntryPosterPath(this.list.entries[0]);
} }
return `https://www.themoviedb.org/w1280/${this.list.posterPath}`;
// * if the collection is empty // * if the collection is empty
return 'assets/images/default/default-poster.png'; 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) { getEntryPosterPath(entry: Entry) {
// * Is in library: use a local poster // * Is in library: use a local poster
if (entry.medias) { if (entry.medias) {
@@ -149,33 +149,8 @@
</div> </div>
</div> </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> </div>
<!-- watch history graph --> <!-- watch history graph -->
<div class="col-12 col-xl-7 col-xxl-8 d-flex"> <div class="col-12 col-xl-7 col-xxl-8 d-flex">
<div class="card w-100 rounded-4"> <div class="card w-100 rounded-4">
@@ -1,8 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import ApexCharts from 'apexcharts'; import ApexCharts from 'apexcharts';
import { EntrySeenService } from '../../core/services/entry-seen.service';
import { LibraryService } from '../../core/services/library.service'; import { LibraryService } from '../../core/services/library.service';
import { EpisodeSeenService } from '../../core/services/episode-seen.service';
import { forkJoin } from 'rxjs'; import { forkJoin } from 'rxjs';
import { StatisticsService } from '../../core/services/statistics.service'; import { StatisticsService } from '../../core/services/statistics.service';
import { WatchTime } from '../../shared/models/statistics/watchTime.model'; import { WatchTime } from '../../shared/models/statistics/watchTime.model';
@@ -54,9 +52,7 @@ export class HomeComponent implements OnInit {
constructor( constructor(
private statisticsService: StatisticsService, private statisticsService: StatisticsService,
private libraryService: LibraryService private libraryService: LibraryService
) { ) {}
console.log('hey im home');
}
async ngOnInit() { async ngOnInit() {
// ? get counts (movies, series, favorit, watchlist) // ? get counts (movies, series, favorit, watchlist)
@@ -61,6 +61,15 @@
white-space: normal; white-space: normal;
} }
/* ! OVER LAY 1 HIDDEN MODE */
.movie-card .card-body {
opacity: 0;
}
.movie-card:hover .card-body {
opacity: 1;
}
/* ! OVER LAY 2 */ /* ! OVER LAY 2 */
.movie-card:hover .card-overlay-2 { .movie-card:hover .card-overlay-2 {
opacity: 0; opacity: 0;
@@ -1,6 +1,7 @@
<div class="movie-card" [@fadeInOut]="animationDirection"> <div class="movie-card" [@fadeInOut]="animationDirection">
<div class="card-head"> <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="loading-overlay" *ngIf="lockActions" @animateDestroy>
<div class="d-flex justify-content-center align-items-center" style="height: 100%;"> <div class="d-flex justify-content-center align-items-center" style="height: 100%;">
@@ -18,21 +19,22 @@
</div> </div>
</div> </div>
<div class="card-overlay"> <div class="card-overlay" (click)="cardClick()">
<div class="rating"> <div class="rating">
<i class='bx bx-star'></i> <i class='bx bx-star'></i>
<span>{{formattedRate}}</span> <span>{{formattedRate}}</span>
</div> </div>
<div class="bookmark" *ngIf="!entry.isInLibrary"> <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>
<div class="bookmark" *ngIf="entry.isInLibrary"> <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>
<!-- <div [ngClass]="{'info': !entry.isInLibrary, 'bookmark': entry.isInLibrary}"> --> <!-- <div [ngClass]="{'info': !entry.isInLibrary, 'bookmark': entry.isInLibrary}"> -->
<div class="info" *ngIf="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>
</div> </div>
@@ -12,6 +12,7 @@ import { Entry } from '../../../models/entry.model';
import { LibraryService } from '../../../../core/services/library.service'; import { LibraryService } from '../../../../core/services/library.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ConfirmModalComponent } from '../../modals/confirm-modal/confirm-modal.component'; import { ConfirmModalComponent } from '../../modals/confirm-modal/confirm-modal.component';
import { environment } from '../../../../../environments/environment.prod';
@Component({ @Component({
selector: 'app-main-card', selector: 'app-main-card',
@@ -121,7 +122,7 @@ export class MainCardComponent implements OnInit {
// console.log(`Entry added to library`, entry); // console.log(`Entry added to library`, entry);
entry.isInLibrary = true; entry.isInLibrary = true;
this.entry = entry; this.entry = entry;
this.libraryService.refrechEntries().subscribe(); this.libraryService.refreshEntries().subscribe();
this.onEntryUpdate.emit(this.entry.id); this.onEntryUpdate.emit(this.entry.id);
this.lockActions = false; this.lockActions = false;
obs.unsubscribe(); obs.unsubscribe();
@@ -131,6 +132,7 @@ export class MainCardComponent implements OnInit {
// TODO error notification // TODO error notification
console.error('Error adding entry:', error); console.error('Error adding entry:', error);
this.lockActions = false; this.lockActions = false;
obs.unsubscribe();
}, },
}); });
} }
@@ -159,7 +161,7 @@ export class MainCardComponent implements OnInit {
this.entry.id = 0; this.entry.id = 0;
this.entry.isInLibrary = false; this.entry.isInLibrary = false;
this.onEntryRemove.emit(this.entry.id); this.onEntryRemove.emit(this.entry.id);
this.libraryService.refrechEntries().subscribe(); this.libraryService.refreshEntries().subscribe();
// todo entry removed notification // todo entry removed notification
}, },
error: (error) => { error: (error) => {
@@ -219,12 +221,12 @@ export class MainCardComponent implements OnInit {
get posterPath() { get posterPath() {
// * Not in library, use TMDB poster // * Not in library, use TMDB poster
if (!this.entry.isInLibrary) 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 // * Is in library: use a local poster
if (this.entry.medias) { if (this.entry.medias) {
const selectedPosters = this.entry.medias.filter( const selectedPosters = this.entry.medias.filter(
(m) => m.type == 'poster' && m.is_selected (m) => m.type == 'poster' && m.isSelected
); );
if ( if (
@@ -232,9 +234,8 @@ export class MainCardComponent implements OnInit {
selectedPosters[0] && selectedPosters[0] &&
selectedPosters[0].path selectedPosters[0].path
) { ) {
const name = selectedPosters[0].path.split('.')[0]; const name = selectedPosters[0].path;
const extention = selectedPosters[0].path.split('.')[1]; return environment.API_URL + `/media/entries/posters/preview/${name}`;
return `http://localhost:4000/api/v1/media/entries/posters/${name}_preview.${extention}`;
} }
} }
@@ -1,57 +1,38 @@
<!-- <h2 mat-dialog-title>Choose a list</h2> <div class="card border-top border-3 border-primary rounded-0 media-dialog-main mb-0">
<mat-dialog-content> <div class="modal-header card-header py-3 px-4">
<mat-form-field appearance="fill"> <h5 class="mb-0 text-primary">Add To Collection</h5>
<mat-label>List Name</mat-label> <button type="button" class="btn-close" aria-label="Close" (click)="onClose()"></button>
<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> </div>
<!-- Modal Body --> <div class="card-body p-4">
<div class="modal-body"> <div class="modal-body">
<div class="input-group mb-3 "> <div class="input-group mb-3 ">
<!-- <label for="listNameInput" class="form-label">List Name</label> --> <!-- <label for="listNameInput" class="form-label">List Name</label> -->
<input type="text" class="form-control" id="listNameInput" [formControl]="searchControl" <input type="text" class="form-control" id="listNameInput" [formControl]="searchControl"
placeholder="Collection name..." @scaleInOut> 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()"
Collection</button> (click)="createList()" @scaleInOut>Create
Collection</button>
</div> </div>
<div class="d-grid gap-2" *ngIf="doShowAddButton()"> <div class="d-grid gap-2" *ngIf="doShowAddButton()">
</div> </div>
<div data-simplebar class="simplebar-content-wrapper"> <div data-simplebar class="simplebar-content-wrapper">
<div class="list-group"> <div class="list-group">
<label *ngFor="let list of userCollectionsToShow" class="list-group-item"> <label *ngFor="let list of userCollectionsToShow" class="list-group-item">
<input class="form-check-input me-1" type="checkbox" [value]="list.id" <input class="form-check-input me-1" type="checkbox" [value]="list.id"
(change)="onSelectionChange(list, $event)" [checked]="list.isChecked"> (change)="onSelectionChange(list, $event)" [checked]="list.isChecked">
{{ list.name }} {{ list.name }}
</label> </label>
</div>
</div>
</div>
<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>
</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>
</div>
</div> </div>
@@ -64,18 +64,21 @@ export class UserCollectionsModalComponent implements OnInit {
getLists() { getLists() {
this.listService.getCollections().subscribe({ this.listService.getCollections().subscribe({
next: (c) => { next: (result) => {
c.forEach((collection) => { result.forEach((collection) => {
if ( if (
collection.userCollectionEntries.some( collection.entries.some(
(entry) => entry.entry_id == this.entryId (entry) => entry.id == this.entryId
) )
) { ) {
collection.isChecked = true; collection.isChecked = true;
} }
}); });
this.userCollections = c; this.userCollections = result;
this.userCollections = this.userCollections.filter(
(c) => c.isUserCollection
);
this.userCollectionsToShow = this.userCollections; this.userCollectionsToShow = this.userCollections;
this.applyFilter(this.searchControl.value); this.applyFilter(this.searchControl.value);
}, },
@@ -102,7 +105,7 @@ export class UserCollectionsModalComponent implements OnInit {
} }
createList() { createList() {
const listName = this.searchControl.value; // string const listName = this.searchControl.value?.toString().trim(); // string
let myNewList = { name: listName } as UserCollection; let myNewList = { name: listName } as UserCollection;
@@ -124,10 +127,7 @@ export class UserCollectionsModalComponent implements OnInit {
`Adding Entry ${this.entryId} to list: ${userCollection.name}` `Adding Entry ${this.entryId} to list: ${userCollection.name}`
); );
this.listService this.listService
.addEntryToCollection( .addEntryToCollection(userCollection.id, this.entryId)
userCollection.id,
this.entryId
)
.subscribe({ .subscribe({
next: (response) => { next: (response) => {
console.log('Successfuly added Entry To Collection:', 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(); this.dialogRef.close();
} }
confirmSelection(): void { onSubmit(): void {
this.dialogRef.close(/* Optionally pass back some data */); this.dialogRef.close();
} }
showNotification(title: string, message: string, type: string): void { showNotification(title: string, message: string, type: string): void {