add entry page feature
This commit is contained in:
1 parent
9fb4202640
commit
e1223171b0
8 files changed
+526
-74
No files matched your search
@@ -5,7 +5,6 @@ import { SearchComponent } from './features/discover/search/search.component';
|
|||||||
import { TrendingComponent } from './features/discover/trending/trending.component';
|
import { TrendingComponent } from './features/discover/trending/trending.component';
|
||||||
import { PopularComponent } from './features/discover/popular/popular.component';
|
import { PopularComponent } from './features/discover/popular/popular.component';
|
||||||
import { LibraryComponent } from './features/library/library.component';
|
import { LibraryComponent } from './features/library/library.component';
|
||||||
import { EntryPageComponent } from './features/entry/entry-page/entry-page.component';
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||||
@@ -15,7 +14,21 @@ const routes: Routes = [
|
|||||||
{ path: 'trending', component: TrendingComponent },
|
{ path: 'trending', component: TrendingComponent },
|
||||||
|
|
||||||
{ path: 'library', component: LibraryComponent },
|
{ path: 'library', component: LibraryComponent },
|
||||||
{ path: 'entry', component: EntryPageComponent },
|
{ path: 'entry', component: LibraryComponent },
|
||||||
|
// {
|
||||||
|
// path: 'entry/:id',
|
||||||
|
// component: EntryPageComponent,
|
||||||
|
// resolve: {
|
||||||
|
// entry: EntryResolverService,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
path: 'entry',
|
||||||
|
loadChildren: () =>
|
||||||
|
import('./features/entry/entries.module').then(
|
||||||
|
(m) => m.EntriesModule
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'user-collections',
|
path: 'user-collections',
|
||||||
loadChildren: () =>
|
loadChildren: () =>
|
||||||
|
|||||||
@@ -5,62 +5,58 @@ import { AppRoutingModule } from './app-routing.module';
|
|||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
|
|
||||||
|
|
||||||
import { CoreModule } from './core/core.module';
|
import { CoreModule } from './core/core.module';
|
||||||
import { SharedModule } from './shared/shared.module';
|
import { CommonModule, DatePipe } from '@angular/common';
|
||||||
|
|
||||||
|
import { ModalModule } from 'ngx-bootstrap/modal';
|
||||||
|
import { AccordionModule } from 'ngx-bootstrap/accordion';
|
||||||
|
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
|
||||||
import { MatInputModule } from '@angular/material/input';
|
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
|
||||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
||||||
import { MatListModule } from '@angular/material/list';
|
|
||||||
|
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
||||||
import { HomeComponent } from './features/home/home.component';
|
import { HomeComponent } from './features/home/home.component';
|
||||||
import { PopularComponent } from './features/discover/popular/popular.component';
|
import { PopularComponent } from './features/discover/popular/popular.component';
|
||||||
import { TrendingComponent } from './features/discover/trending/trending.component';
|
import { TrendingComponent } from './features/discover/trending/trending.component';
|
||||||
import { SearchComponent } from './features/discover/search/search.component';
|
import { SearchComponent } from './features/discover/search/search.component';
|
||||||
import { LibraryComponent } from './features/library/library.component';
|
import { LibraryComponent } from './features/library/library.component';
|
||||||
|
|
||||||
import { DynamicEntryListComponent } from './shared/components/lists/dynamic-entry-list/dynamic-entry-list.component';
|
import { DynamicEntryListComponent } from './shared/components/lists/dynamic-entry-list/dynamic-entry-list.component';
|
||||||
import { NotificationPopupComponent } from './shared/components/notification-popup/notification-popup.component';
|
import { NotificationPopupComponent } from './shared/components/notification-popup/notification-popup.component';
|
||||||
import { MainCardComponent } from './shared/components/cards/main-card/main-card.component';
|
import { MainCardComponent } from './shared/components/cards/main-card/main-card.component';
|
||||||
import { UserCollectionsModalComponent } from './shared/components/modals/list-selection-modal/user-collections-modal.component';
|
import { UserCollectionsModalComponent } from './shared/components/modals/list-selection-modal/user-collections-modal.component';
|
||||||
import { EntryPageComponent } from './features/entry/entry-page/entry-page.component';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
|
|
||||||
|
// pages
|
||||||
HomeComponent,
|
HomeComponent,
|
||||||
PopularComponent,
|
PopularComponent,
|
||||||
TrendingComponent,
|
TrendingComponent,
|
||||||
SearchComponent,
|
SearchComponent,
|
||||||
LibraryComponent,
|
LibraryComponent,
|
||||||
|
// EntryPageComponent,
|
||||||
|
|
||||||
// ? components
|
// ? temp shared components
|
||||||
NotificationPopupComponent,
|
|
||||||
MainCardComponent,
|
MainCardComponent,
|
||||||
DynamicEntryListComponent,
|
DynamicEntryListComponent,
|
||||||
NotificationPopupComponent,
|
NotificationPopupComponent,
|
||||||
UserCollectionsModalComponent,
|
UserCollectionsModalComponent,
|
||||||
EntryPageComponent,
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
CoreModule,
|
CoreModule,
|
||||||
|
CommonModule,
|
||||||
|
|
||||||
|
AppRoutingModule,
|
||||||
|
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
AppRoutingModule,
|
BrowserAnimationsModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
|
|
||||||
// MatDialogModule,
|
|
||||||
// MatInputModule,
|
|
||||||
// MatButtonModule,
|
|
||||||
// MatCheckboxModule,
|
|
||||||
// MatListModule,
|
|
||||||
BrowserAnimationsModule,
|
|
||||||
|
|
||||||
DragDropModule,
|
DragDropModule,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { ToggleService } from './services/toggle.service';
|
|||||||
import { SidebarComponent } from './components/sidebar/sidebar.component';
|
import { SidebarComponent } from './components/sidebar/sidebar.component';
|
||||||
import { NavbarComponent } from './components/navbar/navbar.component';
|
import { NavbarComponent } from './components/navbar/navbar.component';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { EntrySeenService } from './services/entry-seen.service';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [SidebarComponent, NavbarComponent],
|
declarations: [SidebarComponent, NavbarComponent],
|
||||||
@@ -17,6 +18,7 @@ import { RouterModule } from '@angular/router';
|
|||||||
TmdbService,
|
TmdbService,
|
||||||
LibraryService,
|
LibraryService,
|
||||||
EntryService,
|
EntryService,
|
||||||
|
EntrySeenService,
|
||||||
UserCollectionService,
|
UserCollectionService,
|
||||||
ToggleService,
|
ToggleService,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
import { EntryPageComponent } from './entry-page/entry-page.component';
|
||||||
|
import { EntryResolverService } from '../../core/resolvers/entry-resolver.service';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: ':id',
|
||||||
|
component: EntryPageComponent,
|
||||||
|
resolve: {
|
||||||
|
entry: EntryResolverService,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule],
|
||||||
|
})
|
||||||
|
export class EntriesRoutingModule {}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { EntryPageComponent } from './entry-page/entry-page.component';
|
||||||
|
import { EntriesRoutingModule } from './entries-routing.module';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [EntryPageComponent],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
SharedModule,
|
||||||
|
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
EntriesRoutingModule,
|
||||||
|
],
|
||||||
|
exports: [],
|
||||||
|
})
|
||||||
|
export class EntriesModule {}
|
||||||
@@ -1,40 +1,66 @@
|
|||||||
.background-image {
|
.background-wrapper {
|
||||||
position: fixed; /* Keep the background fixed */
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%; /* Cover the full view width */
|
width: 100%;
|
||||||
height: 100%; /* Cover the full view height */
|
height: 80vh;
|
||||||
z-index: -1; /* Place it behind the content */
|
/* Use 100vh to ensure it covers the viewport height */
|
||||||
|
z-index: -1;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.background-wrapper img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: fill;
|
||||||
|
}
|
||||||
|
|
||||||
|
.background-wrapper::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 60%, #eff1f3 100%);
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-bs-theme=dark] .background-wrapper::after {
|
||||||
|
background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 60%, #181c1f 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-wrapper {
|
.content-wrapper {
|
||||||
color: #212529;
|
color: #212529;
|
||||||
background-color: rgba(
|
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.461) 10%, #eff1f3 100%);
|
||||||
255,
|
|
||||||
255,
|
backdrop-filter: blur(10px);
|
||||||
255,
|
/* Blur effect */
|
||||||
0.461
|
padding: 20px;
|
||||||
); /* Light semi-transparent background */
|
/* Padding for content */
|
||||||
backdrop-filter: blur(10px); /* Blur effect */
|
border-radius: 8px;
|
||||||
padding: 20px; /* Padding for content */
|
/* Rounded corners */
|
||||||
border-radius: 8px; /* Rounded corners */
|
border: 1px solid #eff1f3;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.2); /* Optional: subtle border */
|
/* Optional: subtle border */
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Soft shadow for depth */
|
/* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-wrapper-dark {
|
[data-bs-theme=dark] .content-wrapper {
|
||||||
color: #a7acb1;
|
color: #a7acb1;
|
||||||
background-color: rgba(
|
background: linear-gradient(to bottom, rgba(33,
|
||||||
33,
|
|
||||||
37,
|
37,
|
||||||
41,
|
41,
|
||||||
0.7
|
0.7) 50%, #181c1f 100%);
|
||||||
); /* Dark semi-transparent background */
|
|
||||||
backdrop-filter: blur(10px); /* Blur effect */
|
background-color: rgba(33,
|
||||||
padding: 20px; /* Padding for content */
|
37,
|
||||||
border-radius: 8px; /* Rounded corners */
|
41,
|
||||||
border: 1px solid #212529; /* Subtle light border for contrast */
|
0.7);
|
||||||
box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1); /* Lighter shadow for a glow effect */
|
/* Dark semi-transparent background */
|
||||||
|
border: 1px solid #181c1f;
|
||||||
|
/* Subtle light border for contrast */
|
||||||
|
/* box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1); */
|
||||||
|
/* Lighter shadow for a glow effect */
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-container {
|
.main-container {
|
||||||
@@ -42,14 +68,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.poster {
|
.poster {
|
||||||
padding: 10px 10px 0 10px;
|
padding: px 10px 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poster img {
|
.poster img {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
.side-info {
|
|
||||||
|
.rating {
|
||||||
|
color: var(--shz-gold-1);
|
||||||
|
font-size: 25px;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.side-info .list-group-item {
|
||||||
background-color: rgba(255, 255, 255, 0.461) !important;
|
background-color: rgba(255, 255, 255, 0.461) !important;
|
||||||
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ! DESCRIPTION */
|
/* ! DESCRIPTION */
|
||||||
@@ -58,3 +94,43 @@
|
|||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
font-size: 2.9rem !important;
|
font-size: 2.9rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[data-bs-theme=dark] .title {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.side-info strong {
|
||||||
|
color: #008cff;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon-only {
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
color: inherit;
|
||||||
|
margin: 0 5px 3px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon-only:hover {
|
||||||
|
color: #fc185a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon-only-success:hover {
|
||||||
|
color: #008cff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interaction-btns {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 15px;
|
||||||
|
background-color: aquamarine;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interaction-btns button {
|
||||||
|
display: block;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
@@ -1,33 +1,123 @@
|
|||||||
<img src="https://image.tmdb.org/t/p/original/4LZuFMhLivOSO7zuWAQ3RffMnnr.jpg" alt="Banner Image"
|
<div class="background-wrapper">
|
||||||
class="background-image">
|
<img [src]="banner" alt="Banner Image">
|
||||||
|
</div>
|
||||||
<div class="container mt-5 content-wrapper main-container">
|
<div class="container mt-5 content-wrapper main-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-3">
|
||||||
<!-- Movie Poster -->
|
<!-- Movie Poster -->
|
||||||
<div class="poster">
|
<div class="poster">
|
||||||
<img src="https://www.themoviedb.org/t/p/w600_and_h900_bestv2/l3Bn2jgYndSFvcPpddqMxQXiiCe.jpg"
|
<img [src]="poster" alt="Movie Poster" class="img-fluid mb-3">
|
||||||
alt="Movie Poster" class="img-fluid mb-3">
|
</div>
|
||||||
|
<div class="d-flex justify-content-center rating">
|
||||||
|
<rating [(ngModel)]="entry.entryRating.user_rating" [max]="10" [readonly]="false"
|
||||||
|
(click)="onRatingChange($event)">
|
||||||
|
</rating>
|
||||||
|
</div>
|
||||||
|
<!-- Movie Side Info -->
|
||||||
|
<ul class="list-group side-info">
|
||||||
|
<li class="list-group-item"><strong>Rating:</strong> {{tmdbRating}}/10</li>
|
||||||
|
<li class="list-group-item"><strong>Premiere:</strong> {{releaseDate}}</li>
|
||||||
|
<li class="list-group-item" *ngIf="entry.is_tvseries"><strong>Next Episode:</strong> {{nextEpisode}}</li>
|
||||||
|
<li class="list-group-item"><strong>Status:</strong> {{status}}</li>
|
||||||
|
<li class="list-group-item"><strong>Genre:</strong> {{genres}}</li>
|
||||||
|
</ul>
|
||||||
|
<!-- End Movie Side Info -->
|
||||||
|
<br>
|
||||||
|
<!-- watch history -->
|
||||||
|
<div class="card" *ngIf="entry.entrySeen.length > 0">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Watch History</h5>
|
||||||
|
<hr>
|
||||||
|
<div class="accordion" id="accordionWatchHistory">
|
||||||
|
<!-- start watch history - item -->
|
||||||
|
<div class="accordion-item" *ngFor="let seen of entry.entrySeen">
|
||||||
|
<h2 class="accordion-header" id="heading{{seen.id}}">
|
||||||
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
|
||||||
|
[attr.data-bs-target]="'#collapse'+seen.id" aria-expanded="false"
|
||||||
|
[attr.aria-controls]="'collapse' + seen.id">
|
||||||
|
{{seen.date_seen.toString().substring(0, 10)}}
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="collapse{{seen.id}}" class="accordion-collapse collapse"
|
||||||
|
[attr.aria-labelledby]="'heading' + seen.id" data-bs-parent="#accordionWatchHistory">
|
||||||
|
<div class="accordion-body"> <strong>Seen With:</strong><br>Person1, person 2</div>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<button type="button" class="btn btn-icon-only">
|
||||||
|
<span class="material-symbols-outlined" (click)="removeEntrySeen(seen.id)">
|
||||||
|
delete_forever
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end watch history - item -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Movie Info -->
|
|
||||||
<ul class="list-group side-info">
|
|
||||||
<li class="list-group-item"><strong>Next Episode:</strong> 2023-05-11</li>
|
|
||||||
<li class="list-group-item"><strong>Status:</strong> Released</li>
|
|
||||||
<li class="list-group-item"><strong>Genre:</strong> Action, Adventure</li>
|
|
||||||
<li class="list-group-item"><strong>Rating:</strong> 8.5/10</li>
|
|
||||||
<li class="list-group-item"><strong>Rating:</strong> 8.5/10</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end watch history -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<!-- Movie Title -->
|
<!-- Movie Title -->
|
||||||
<h2 class="title">Movie Title</h2>
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<!-- Movie Release Date -->
|
<h2 class="title">{{this.entry.title}}</h2>
|
||||||
<p><strong>Release Date:</strong> January 1, 2024</p>
|
|
||||||
<!-- Movie Overview -->
|
<!-- Interraction buttons -->
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque habitant morbi tristique senectus et
|
<div class="row">
|
||||||
netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit
|
<button class="btn btn-icon-only-success wh-48" (click)="openDialog()">
|
||||||
amet, ante.</p>
|
<span class="material-symbols-outlined">
|
||||||
|
visibility
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button class="btn btn-icon-only-success wh-48" (click)="showAddToListModal()">
|
||||||
|
<span class="material-symbols-outlined">
|
||||||
|
playlist_add
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button class="btn btn-icon-only-success wh-48" (click)="refrechEntry()">
|
||||||
|
<span class="material-symbols-outlined">
|
||||||
|
update
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- End Interraction buttons -->
|
||||||
|
</div>
|
||||||
|
<!-- Movie Release Date -->
|
||||||
|
<p>{{year}} • {{genres}}</p>
|
||||||
|
|
||||||
|
<!-- Movie Overview -->
|
||||||
|
<p><strong>{{this.entry.tagline}}</strong></p>
|
||||||
|
<p>{{this.entry.storyline}}</p>
|
||||||
|
|
||||||
|
<!-- Series Seasons -->
|
||||||
|
<div class="row" *ngIf="entry.is_tvseries">
|
||||||
|
<h3>Seasons</h3>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="p-3 ps ps--active-y">
|
||||||
|
<div class="d-flex flex-column gap-3">
|
||||||
|
<app-season-main-card
|
||||||
|
*ngFor="let season of (showAll ? entry.seasons : entry.seasons | slice:0:initialCount); let i = index"
|
||||||
|
[@fadeInOut] [season]="season">
|
||||||
|
</app-season-main-card>
|
||||||
|
</div>
|
||||||
|
<!-- show all/less when entry has more that 2 seasons -->
|
||||||
|
<p class="text-center clickable" *ngIf="entry.seasons.length > initialCount"
|
||||||
|
(click)="toggleShowAllSeasons()" style="cursor: pointer;">
|
||||||
|
{{ showAll ? 'Show Less' : 'Show All' }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<h3>Cast</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,10 +1,245 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
||||||
|
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
|
||||||
|
import { Entry } from '../../../shared/models/entry.model';
|
||||||
|
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
|
import { UserCollectionsModalComponent } from '../../../shared/components/modals/list-selection-modal/user-collections-modal.component';
|
||||||
|
import { SeenModalComponent } from '../../../shared/components/modals/seen-modal/seen-modal.component';
|
||||||
|
|
||||||
|
import { EntrySeenService } from '../../../core/services/entry-seen.service';
|
||||||
|
import { EntryRatingsService } from '../../../core/services/entry-ratings.service';
|
||||||
|
import { TmdbService } from '../../../core/services/tmdb.service';
|
||||||
|
import { LibraryService } from '../../../core/services/library.service';
|
||||||
|
import { EntryService } from '../../../core/services/entry.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-entry-page',
|
selector: 'app-entry-page',
|
||||||
templateUrl: './entry-page.component.html',
|
templateUrl: './entry-page.component.html',
|
||||||
styleUrls: ['./entry-page.component.css']
|
styleUrls: ['./entry-page.component.css'],
|
||||||
|
encapsulation: ViewEncapsulation.None,
|
||||||
|
animations: [
|
||||||
|
trigger('fadeInOut', [
|
||||||
|
transition(':enter', [ // void => *
|
||||||
|
style({ opacity: 0 }),
|
||||||
|
animate('0.5s ease-in', style({ opacity: 1 }))
|
||||||
|
]),
|
||||||
|
transition(':leave', [ // * => void
|
||||||
|
animate('0.5s ease-out', style({ opacity: 0 }))
|
||||||
|
])
|
||||||
|
])
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class EntryPageComponent {
|
export class EntryPageComponent implements OnInit {
|
||||||
|
entry: Entry = {} as Entry;
|
||||||
|
public showAll = false;
|
||||||
|
public initialCount = 2;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
public dialog: MatDialog,
|
||||||
|
private tmdbService: TmdbService,
|
||||||
|
private libraryService: LibraryService,
|
||||||
|
private entryService: EntryService,
|
||||||
|
private entrySeenService: EntrySeenService,
|
||||||
|
private entryRatingsService: EntryRatingsService,
|
||||||
|
private datePipe: DatePipe
|
||||||
|
) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.data.subscribe(
|
||||||
|
(data) => {
|
||||||
|
this.entry = data['entry'] as Entry;
|
||||||
|
this.entry.seasons = this.entry.seasons.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
console.log(this.entry);
|
||||||
|
if (!this.entry) {
|
||||||
|
this.router.navigate(['/error'], {
|
||||||
|
queryParams: { error: 'Entry not found' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.error('Error when trying to access route data', error);
|
||||||
|
this.router.navigate(['/error'], {
|
||||||
|
queryParams: { error: 'Error fetching data' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
openDialog() {
|
||||||
|
if (!this.entry) return;
|
||||||
|
|
||||||
|
const dialogRef = this.dialog.open(SeenModalComponent, {
|
||||||
|
width: '400px',
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Seen dialog opened');
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe((result) => {
|
||||||
|
if (result) {
|
||||||
|
console.log('Seen dialog closed with:', result);
|
||||||
|
|
||||||
|
if (result.watchDate == '') {
|
||||||
|
// TODO show no was passed date notification
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let watchedWith = result.watchedWith.split('\n').join(', ');
|
||||||
|
|
||||||
|
this.entrySeenService
|
||||||
|
.createEntrySeen(
|
||||||
|
this.entry.id.toString(),
|
||||||
|
result.watchDate,
|
||||||
|
watchedWith
|
||||||
|
)
|
||||||
|
.subscribe({
|
||||||
|
next: (entrySeen) => {
|
||||||
|
if (entrySeen) {
|
||||||
|
// TODO show confirm notification
|
||||||
|
console.log(`EntrySeen Added`, entrySeen);
|
||||||
|
this.entry.entrySeen.push(entrySeen);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Error adding entrySeen:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO show notification
|
||||||
|
} else {
|
||||||
|
console.log('Seen dialog was cancelled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onRatingChange(event: Event) {
|
||||||
|
this.entryRatingsService
|
||||||
|
.updateEntryRatings(this.entry.entryRating)
|
||||||
|
.subscribe({
|
||||||
|
next: (entryRatings) => {
|
||||||
|
if (entryRatings) {
|
||||||
|
// TODO show notification
|
||||||
|
this.entry.entryRating = entryRatings;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
// TODO show notification
|
||||||
|
console.error('Error updating entryRatings:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
removeEntrySeen(id: number) {
|
||||||
|
// TODO add confirm modal
|
||||||
|
this.entrySeenService.removeEntrySeen(id).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.entry.entrySeen = this.entry.entrySeen.filter(
|
||||||
|
(item) => item.id !== id
|
||||||
|
);
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
// TODO show notification
|
||||||
|
console.error('Error deleting entrySeen:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
showAddToListModal() {
|
||||||
|
if (this.entry) {
|
||||||
|
const dialogRef = this.dialog.open(UserCollectionsModalComponent, {
|
||||||
|
width: '400px',
|
||||||
|
height: '55%',
|
||||||
|
data: {
|
||||||
|
entryId: this.entry.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe((result) => {
|
||||||
|
console.log('Modal Closed: ', result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
refrechEntry() {
|
||||||
|
this.entryService.refrechEntryById(this.entry.id).subscribe({
|
||||||
|
next: (entry) => {
|
||||||
|
this.entry = entry;
|
||||||
|
console.log(`Entry refreched: `, entry);
|
||||||
|
// TODO show updated notification
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
// TODO show error notification
|
||||||
|
console.error('Error refreching movie info:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleShowAllSeasons() {
|
||||||
|
this.showAll = !this.showAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * getters
|
||||||
|
get status() {
|
||||||
|
return this.entry.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
get createdDate() {
|
||||||
|
return this.datePipe.transform(this.entry.createdAt, 'dd MMMM, yyyy');
|
||||||
|
}
|
||||||
|
|
||||||
|
get releaseDate() {
|
||||||
|
return this.datePipe.transform(this.entry.release_date, 'MMM dd, yyyy');
|
||||||
|
}
|
||||||
|
|
||||||
|
get year() {
|
||||||
|
return this.datePipe.transform(this.entry.release_date, 'yyyy');
|
||||||
|
}
|
||||||
|
|
||||||
|
get runtime() {
|
||||||
|
return this.entry.runtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
get genres(): string {
|
||||||
|
return this.entry.genres.join(', ');
|
||||||
|
}
|
||||||
|
|
||||||
|
get userRating(): string {
|
||||||
|
if (!this.entry.entryRating.user_rating) return '0';
|
||||||
|
return this.entry.entryRating.user_rating.toFixed(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
get tmdbRating(): string {
|
||||||
|
if (!this.entry.entryRating.tmdb_rating) return '0';
|
||||||
|
return this.entry.entryRating.tmdb_rating.toFixed(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
get imdbRating(): string {
|
||||||
|
if (!this.entry.entryRating.imdb_rating) return '0';
|
||||||
|
return this.entry.entryRating.imdb_rating.toFixed(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
get poster(): string {
|
||||||
|
if (this.entry.poster_path == null)
|
||||||
|
return 'assets/images/default/default-poster.png';
|
||||||
|
|
||||||
|
return `https://image.tmdb.org/t/p/w500` + this.entry.poster_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
get banner(): string {
|
||||||
|
if (this.entry.banner_path == null)
|
||||||
|
return 'assets/images/default/default-poster.png';
|
||||||
|
|
||||||
|
return `https://image.tmdb.org/t/p/w1280` + this.entry.banner_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
get nextEpisode() {
|
||||||
|
if (!this.entry.is_tvseries) return 'This is a movie';
|
||||||
|
return 'sooon';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user