Frontend: Added cast section to entry page
This commit is contained in:
1 parent
6c2a437d7b
commit
b6c04e765f
11 files changed
+202
-4
No files matched your search
@@ -0,0 +1,10 @@
|
||||
<div class="cast-card" (click)="navigateToCastMember()">
|
||||
<img [src]="cast?.person?.profile_path! | mediaSelector:cast?.person?.medias:'peoples':'profile':'preview'" [alt]="cast?.person?.name"
|
||||
onerror="this.src='assets/images/default/default-profile.png'" class="cast-image">
|
||||
<div class="cast-info">
|
||||
<div class="cast-details">
|
||||
<h3 class="actor-name">{{ cast?.person?.name }}</h3>
|
||||
<p class="character-name">{{ cast?.character }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,56 @@
|
||||
.cast-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #2a2a2a;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: transform 0.3s, box-shadow 0.3s;
|
||||
height: 100%;
|
||||
min-height: 200px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.cast-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.cast-image {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.cast-info {
|
||||
padding: 12px;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.cast-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.actor-name {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
margin: 0 0 6px 0;
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.character-name {
|
||||
font-size: 12px;
|
||||
color: #aaa;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Credit } from '../../../shared/models/credit.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cast-card',
|
||||
templateUrl: './cast-card.component.html',
|
||||
styleUrls: ['./cast-card.component.scss'],
|
||||
})
|
||||
export class CastCardComponent {
|
||||
@Input() cast?: Credit;
|
||||
|
||||
constructor(private router: Router) {}
|
||||
|
||||
navigateToCastMember(): void {
|
||||
if (this.cast?.person?.id) {
|
||||
this.router.navigate(['/people', this.cast.person.id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<div class="cast-section-container">
|
||||
<div class="cast-header">
|
||||
<h3>Cast</h3>
|
||||
<button class="btn btn-sm btn-outline-secondary" *ngIf="credits.length > initialCount"
|
||||
(click)="toggleShowAllCast()">
|
||||
{{ showAll ? 'Show Less' : 'View All' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="cast-scroll-container">
|
||||
<div class="cast-scroll">
|
||||
<app-cast-card *ngFor="let credit of (showAll ? credits : credits.slice(0, initialCount)); let i = index"
|
||||
[@fadeInOut] [cast]="credit" class="cast-card-item">
|
||||
</app-cast-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,59 @@
|
||||
.cast-section-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cast-scroll-container {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.cast-scroll {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 15px; /* Space for scrollbar */
|
||||
gap: 15px;
|
||||
scroll-behavior: smooth;
|
||||
-webkit-overflow-scrolling: touch; /* For smoother scrolling on iOS */
|
||||
}
|
||||
|
||||
.cast-card-item {
|
||||
flex: 0 0 auto;
|
||||
width: 150px; /* Fixed width for each card */
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.cast-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Hide scrollbar for Chrome, Safari and Opera */
|
||||
.cast-scroll::-webkit-scrollbar {
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
/* Track */
|
||||
.cast-scroll::-webkit-scrollbar-track {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* Handle */
|
||||
.cast-scroll::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* Handle on hover */
|
||||
.cast-scroll::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Credit } from '../../../shared/models/credit.model';
|
||||
import { trigger, transition, style, animate } from '@angular/animations';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cast-section',
|
||||
templateUrl: './cast-section.component.html',
|
||||
styleUrls: ['./cast-section.component.scss'],
|
||||
animations: [
|
||||
trigger('fadeInOut', [
|
||||
transition(':enter', [
|
||||
style({ opacity: 0 }),
|
||||
animate('300ms', style({ opacity: 1 })),
|
||||
]),
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class CastSectionComponent {
|
||||
@Input() credits: Credit[] = [];
|
||||
|
||||
showAll: boolean = false;
|
||||
initialCount: number = 5;
|
||||
|
||||
toggleShowAllCast(): void {
|
||||
this.showAll = !this.showAll;
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -11,6 +11,8 @@ import { EntrySettingsModalComponent } from './entry-settings-modal/entry-settin
|
||||
import { AlternateEntryPageComponent } from './alternate-entry-page/alternate-entry-page.component';
|
||||
import { SeasonPageComponent } from './season-page/season-page.component';
|
||||
import { EpisodeDialogComponent } from './episode-dialog/episode-dialog.component';
|
||||
import { CastCardComponent } from './cast-card/cast-card.component';
|
||||
import { CastSectionComponent } from './cast-section/cast-section.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -22,6 +24,8 @@ import { EpisodeDialogComponent } from './episode-dialog/episode-dialog.componen
|
||||
EntrySettingsModalComponent,
|
||||
SeasonPageComponent,
|
||||
EpisodeDialogComponent,
|
||||
CastCardComponent,
|
||||
CastSectionComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
|
||||
@@ -143,6 +143,11 @@
|
||||
<p class="p-0">{{this.entry.storyline}}</p>
|
||||
</div>
|
||||
|
||||
<!-- Cast Section -->
|
||||
<div class="row mb-4">
|
||||
<app-cast-section [credits]="entry.credits"></app-cast-section>
|
||||
</div>
|
||||
|
||||
<!-- Series Seasons -->
|
||||
<div class="row" *ngIf="entry.is_tvseries">
|
||||
<h3>Seasons</h3>
|
||||
|
||||
@@ -87,10 +87,10 @@ export class EntryPageComponent implements OnInit {
|
||||
this.entry.seasons = this.entry.seasons.sort((a, b) => {
|
||||
// ? by changing the season number of 'special' season to 999
|
||||
// ? it will show up as the last season.
|
||||
if (b.season_number == 0) b.season_number = 999; // this will make the special season go last
|
||||
if (a.season_number == 0) a.season_number = 999; // this will make the special season go last
|
||||
if (b.season_number == 0) b.season_number = -5; // this will make the special season go last
|
||||
if (a.season_number == 0) a.season_number = -5; // this will make the special season go last
|
||||
|
||||
return a.season_number - b.season_number;
|
||||
return b.season_number - a.season_number;
|
||||
});
|
||||
|
||||
// ? getting seaons episodes
|
||||
|
||||
@@ -16,7 +16,7 @@ export class MediaSelectorPipe implements PipeTransform {
|
||||
size: string = 'original'
|
||||
): string {
|
||||
if (medias.length > 0) {
|
||||
console.log(medias);
|
||||
|
||||
const selectedMedia = medias.filter(
|
||||
(m) => m.type == type && m.isSelected
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user