Frontend: Using MediaSelectorPipe for PersonCardComponent & added default-profile.png
This commit is contained in:
1 parent
9d8f2899d4
commit
6c2a437d7b
3 files changed
+3
-27
No files matched your search
@@ -1,13 +1,13 @@
|
||||
<div class="person-card" (click)="navigateToDetails()">
|
||||
<img [src]="getProfileImageUrl()" [alt]="person?.name" class="person-image">
|
||||
<img [src]="person?.profile_path! | mediaSelector:person?.medias:'peoples':'profile':'preview'" [alt]="person?.name"
|
||||
onerror="this.src='assets/images/default/default-profile.png'" class="person-image" class="person-image">
|
||||
<div class="person-info">
|
||||
<h3 class="person-name">{{ person?.name }}</h3>
|
||||
<div class="person-details">
|
||||
<h2 class="person-name">{{ person?.name }}</h2>
|
||||
<div class="person-popularity">
|
||||
<i class="bi bi-star-fill me-1"></i>
|
||||
{{ (person?.popularity || 0) | floatFormat:2 }}
|
||||
</div>
|
||||
<div class="person-department">{{ person?.known_for_department || 'Unknown' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -19,39 +19,15 @@ export class PersonCardComponent implements OnInit {
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
getProfileImageUrl(): string {
|
||||
if (!this.person) return this.defaultImage;
|
||||
|
||||
// First check if we have a local media
|
||||
// if (this.person.medias && this.person.medias.length > 0) {
|
||||
// const profileMedia = this.person.medias.find(m => m.type === 'profile');
|
||||
// if (profileMedia) {
|
||||
// return `${this.backendUrl}/images/people/profiles/${profileMedia.file_name}`;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Fallback to TMDB image if available
|
||||
if (this.person.profile_path) {
|
||||
return `https://image.tmdb.org/t/p/w185${this.person.profile_path}`;
|
||||
}
|
||||
|
||||
// Default image if nothing else is available
|
||||
return this.defaultImage;
|
||||
}
|
||||
|
||||
getGenderText(): string {
|
||||
if (!this.person || this.person.gender === undefined)
|
||||
return 'Not specified';
|
||||
|
||||
switch (this.person.gender) {
|
||||
case 0:
|
||||
return 'Not specified';
|
||||
case 1:
|
||||
return 'Female';
|
||||
case 2:
|
||||
return 'Male';
|
||||
case 3:
|
||||
return 'Non-binary';
|
||||
default:
|
||||
return 'Not specified';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user