F: add episode dialog component

This commit is contained in:
X4Lo committed 2025-02-19 14:30:25 +01:00
1 parent 09cd4b205a
commit 8f0e9f44a5
5 files changed
+306

No files matched your search

@@ -10,6 +10,7 @@ import { MediaUploadModalComponent } from './media-upload-modal/media-upload-mod
import { EntrySettingsModalComponent } from './entry-settings-modal/entry-settings-modal.component'; import { EntrySettingsModalComponent } from './entry-settings-modal/entry-settings-modal.component';
import { AlternateEntryPageComponent } from './alternate-entry-page/alternate-entry-page.component'; import { AlternateEntryPageComponent } from './alternate-entry-page/alternate-entry-page.component';
import { SeasonPageComponent } from './season-page/season-page.component'; import { SeasonPageComponent } from './season-page/season-page.component';
import { EpisodeDialogComponent } from './episode-dialog/episode-dialog.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
@@ -20,6 +21,7 @@ import { SeasonPageComponent } from './season-page/season-page.component';
MediaUploadModalComponent, MediaUploadModalComponent,
EntrySettingsModalComponent, EntrySettingsModalComponent,
SeasonPageComponent, SeasonPageComponent,
EpisodeDialogComponent,
], ],
imports: [ imports: [
CommonModule, CommonModule,
@@ -0,0 +1,196 @@
:host {
--dialog-bg-opacity: 0.7;
--dialog-bg: rgba(255, 255, 255, var(--dialog-bg-opacity));
--dialog-text: #333;
--dialog-border: rgba(255, 255, 255, 0.2);
--dialog-shadow: rgba(0, 0, 0, 0.2);
}
[data-bs-theme="dark"] :host {
--dialog-bg: rgba(33, 37, 41, var(--dialog-bg-opacity));
--dialog-text: #fff;
--dialog-border: rgba(0, 0, 0, 0.2);
--dialog-shadow: rgba(0, 0, 0, 0.4);
}
.dialog-backdrop {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
padding: 2rem;
}
.dialog-container {
position: relative;
width: 100%;
max-width: 900px;
max-height: 90vh;
background: var(--dialog-bg);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-radius: 15px;
box-shadow: 0 8px 32px var(--dialog-shadow);
border: 1px solid var(--dialog-border);
overflow: hidden;
color: var(--dialog-text);
}
.close-button {
position: absolute;
top: 1rem;
right: 1rem;
background: transparent;
border: none;
color: var(--dialog-text);
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 1;
transition: background-color 0.2s;
}
.close-button:hover {
background: rgba(0, 0, 0, 0.1);
}
.dialog-content {
max-height: 90vh;
overflow-y: auto;
}
/* Episode Header */
.episode-header {
position: relative;
}
.episode-still {
width: 100%;
height: 300px;
overflow: hidden;
}
.episode-still img {
width: 100%;
height: 100%;
object-fit: cover;
}
.episode-title-section {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 2rem;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
color: white;
}
.episode-title-section h1 {
margin: 0.5rem 0;
font-size: 2rem;
font-weight: 600;
}
.episode-title-section h2 {
margin: 0;
font-size: 1rem;
font-weight: 400;
opacity: 0.8;
}
.episode-meta {
display: flex;
gap: 1rem;
margin-top: 0.5rem;
opacity: 0.8;
}
.episode-meta span {
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Episode Overview */
.episode-overview {
padding: 2rem;
}
.episode-overview h3 {
margin-bottom: 1rem;
font-size: 1.5rem;
font-weight: 600;
}
/* Watch History */
.watch-history {
padding: 0 2rem 2rem;
}
.watch-history h3 {
margin-bottom: 1rem;
font-size: 1.5rem;
font-weight: 600;
}
.history-timeline {
display: flex;
flex-direction: column;
gap: 1rem;
}
.history-entry {
display: flex;
align-items: center;
gap: 2rem;
padding: 1rem;
background: rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
.history-date,
.history-rating {
display: flex;
align-items: center;
gap: 0.5rem;
}
.material-symbols-outlined {
font-size: 20px;
}
@media (max-width: 768px) {
.dialog-backdrop {
padding: 1rem;
}
.episode-still {
height: 200px;
}
.episode-title-section {
padding: 1rem;
}
.episode-title-section h1 {
font-size: 1.5rem;
}
.episode-overview,
.watch-history {
padding: 1rem;
}
}
@@ -0,0 +1,53 @@
<div class="dialog-backdrop" (click)="closeDialog()">
<div class="dialog-container" (click)="stopPropagation($event)">
<button class="close-button" (click)="closeDialog()">
<span class="material-symbols-outlined">close</span>
</button>
<div class="dialog-content">
<!-- Episode Header -->
<div class="episode-header">
<div class="episode-still">
<img [src]="posterPath(episode.still_path)" [alt]="episode.name">
</div>
<div class="episode-title-section">
<h2>Episode {{episode.episode_number}}</h2>
<h1>{{episode.name}}</h1>
<div class="episode-meta">
<span *ngIf="episode.air_date">
<span class="material-symbols-outlined">calendar_today</span>
{{episode.air_date | date:'MMM dd, yyyy'}}
</span>
<span *ngIf="episode.runtime">
<span class="material-symbols-outlined">schedule</span>
{{episode.runtime}} min
</span>
</div>
</div>
</div>
<!-- Episode Overview -->
<div class="episode-overview">
<h3>Overview</h3>
<p>{{episode.overview}}</p>
</div>
<!-- Watch History -->
<div class="watch-history" *ngIf="episode.episodeSeen?.length">
<h3>Watch History</h3>
<div class="history-timeline">
<div class="history-entry" *ngFor="let watch of episode.episodeSeen">
<div class="history-date">
<span class="material-symbols-outlined">visibility</span>
{{watch.date_seen | date:'MMM dd, yyyy'}}
</div>
<div class="history-rating">
<span class="material-symbols-outlined">star</span>
7/10
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,28 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { EpisodeDialogComponent } from './episode-dialog.component';
describe('EpisodeDialogComponent', () => {
let component: EpisodeDialogComponent;
let fixture: ComponentFixture<EpisodeDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EpisodeDialogComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EpisodeDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,27 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Episode } from '../../../shared/models/episode.models';
@Component({
selector: 'app-episode-dialog',
templateUrl: './episode-dialog.component.html',
styleUrls: ['./episode-dialog.component.css'],
})
export class EpisodeDialogComponent {
@Input() episode!: Episode;
@Input() posterPath!: (path: string) => string;
@Output() close = new EventEmitter<void>();
watch_history?: {
date: string;
rating?: number;
}[];
closeDialog() {
this.close.emit();
}
stopPropagation(event: MouseEvent) {
event.stopPropagation();
}
}