add fetch entry collection + change to seen modals & improvements
This commit is contained in:
1 parent
776506b232
commit
41666cc6a3
7 files changed
+171
-82
No files matched your search
@@ -161,6 +161,12 @@
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button class="btn btn-icon-only-success wh-48" (click)="fetchEntryCollection()">
|
||||
<span class="material-symbols-outlined">
|
||||
published_with_changes
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button class="btn btn-icon-only-success wh-48" (click)="mediaModal()">
|
||||
<span class="material-symbols-outlined">
|
||||
image
|
||||
@@ -183,7 +189,7 @@
|
||||
</div>
|
||||
<!-- Series Seasons -->
|
||||
<div class="row" *ngIf="entry.is_tvseries">
|
||||
<h3>Seasons</h3>
|
||||
<h3 class="opacity-100">Seasons</h3>
|
||||
<div class="card-body p-0">
|
||||
<div class="p-3 ps ps--active-y">
|
||||
<div class="d-flex flex-column gap-3">
|
||||
|
||||
@@ -21,6 +21,7 @@ import { ToastrService } from 'ngx-toastr';
|
||||
import { EntrySeen } from '../../../shared/models/entrySeen.model';
|
||||
import { EpisodeSeenModalComponent } from '../../../shared/components/modals/episode-seen-modal/episode-seen-modal.component';
|
||||
import { MediaModalComponent } from '../media-modal/media-modal.component';
|
||||
import { environment } from '../../../../environments/environment.prod';
|
||||
|
||||
@Component({
|
||||
selector: 'app-entry-page',
|
||||
@@ -338,6 +339,20 @@ export class EntryPageComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
fetchEntryCollection() {
|
||||
this.lockActions = true;
|
||||
this.entryService.fetchEntryCollectionById(this.entry.id).subscribe({
|
||||
next: (result) => {},
|
||||
error: (error) => {
|
||||
// TODO show error notification
|
||||
console.error('Error refreching movie info:', error);
|
||||
},
|
||||
complete: () => {
|
||||
this.lockActions = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// ! EPISODE SEEN
|
||||
// ? episode marked as seen event
|
||||
onEpisodeWatchedEvent() {
|
||||
@@ -402,10 +417,14 @@ export class EntryPageComponent implements OnInit {
|
||||
addEpisodeSeen() {
|
||||
if (!this.entry) return;
|
||||
|
||||
this.seenHistory[0]
|
||||
|
||||
const dialogRef = this.dialog.open(EpisodeSeenModalComponent, {
|
||||
width: '360px',
|
||||
data: {
|
||||
entryId: this.entry.id,
|
||||
season_number: this.seenHistory[0].season_number,
|
||||
episode_number: this.seenHistory[0].episode_number,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -441,39 +460,20 @@ export class EntryPageComponent implements OnInit {
|
||||
editEpisodeSeen(episodeSeen: EpisodeSeenDto) {
|
||||
if (episodeSeen == null) return;
|
||||
|
||||
const dialogRef = this.dialog.open(SeenModalComponent, {
|
||||
const dialogRef = this.dialog.open(EpisodeSeenModalComponent, {
|
||||
width: '360px',
|
||||
data: {
|
||||
watchDate: episodeSeen.date_seen,
|
||||
watchedWith: episodeSeen.seen_with,
|
||||
entryId: this.entry.id,
|
||||
episodeSeen: episodeSeen,
|
||||
},
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
// ? dialog closed
|
||||
if (result == null) return;
|
||||
// ? dialog confimed
|
||||
// console.log('Episode seen dialog closed with:', result);
|
||||
if (result.watchDate == '') {
|
||||
// TODO show no date was passed notification
|
||||
console.log(`Episode seen dialog closed with no date.`);
|
||||
return;
|
||||
}
|
||||
if (!result.updated) return;
|
||||
|
||||
episodeSeen.date_seen = result.watchDate;
|
||||
episodeSeen.seen_with = result.watchedWith.split('\n').join(', ');
|
||||
|
||||
this.episodeSeenService.updateEpisodeSeen(episodeSeen).subscribe({
|
||||
next: () => {
|
||||
// console.log(`Episode seen updated.`);
|
||||
this.getEpisodesSeenHistory();
|
||||
// TODO show notification
|
||||
},
|
||||
error: (error) => {
|
||||
console.log(`Episode seen update error: `, error);
|
||||
// TODO show notification
|
||||
},
|
||||
});
|
||||
// ? call this function to fetch the new episode-seen history
|
||||
this.getEpisodesSeenHistory();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ export class EntryPageComponent implements OnInit {
|
||||
// * Is in library: use a local poster
|
||||
if (!poster && this.entry.medias) {
|
||||
const selectedPosters = this.entry.medias.filter(
|
||||
(m) => m.type == 'poster' && m.is_selected
|
||||
(m) => m.type == 'poster' && m.isSelected
|
||||
);
|
||||
|
||||
if (
|
||||
@@ -595,7 +595,9 @@ export class EntryPageComponent implements OnInit {
|
||||
selectedPosters[0] &&
|
||||
selectedPosters[0].path
|
||||
) {
|
||||
poster = `http://localhost:4000/api/v1/media/entries/posters/${selectedPosters[0].path}`;
|
||||
poster =
|
||||
environment.API_URL +
|
||||
`/media/entries/posters/original/${selectedPosters[0].path}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +652,7 @@ export class EntryPageComponent implements OnInit {
|
||||
// * 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 (
|
||||
@@ -658,7 +660,10 @@ export class EntryPageComponent implements OnInit {
|
||||
selectedPosters[0] &&
|
||||
selectedPosters[0].path
|
||||
) {
|
||||
return `http://localhost:4000/api/v1/media/entries/posters/${selectedPosters[0].path}`;
|
||||
return (
|
||||
environment.API_URL +
|
||||
`/media/entries/posters/original/${selectedPosters[0].path}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,7 +679,7 @@ export class EntryPageComponent implements OnInit {
|
||||
// * Is in library: use a local backdrop
|
||||
if (this.entry.medias) {
|
||||
const selectedBackdrop = this.entry.medias.filter(
|
||||
(m) => m.type == 'backdrop' && m.is_selected
|
||||
(m) => m.type == 'backdrop' && m.isSelected
|
||||
);
|
||||
|
||||
if (
|
||||
@@ -682,7 +687,10 @@ export class EntryPageComponent implements OnInit {
|
||||
selectedBackdrop[0] &&
|
||||
selectedBackdrop[0].path
|
||||
) {
|
||||
return `http://localhost:4000/api/v1/media/entries/backdrops/${selectedBackdrop[0].path}`;
|
||||
return (
|
||||
environment.API_URL +
|
||||
`/media/entries/backdrops/original/${selectedBackdrop[0].path}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user