mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix role and type display on people cards
This commit is contained in:
parent
ebeeaa2948
commit
f002d540a2
1 changed files with 21 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
|||
* @module components/cardBuilder/cardBuilder
|
||||
*/
|
||||
|
||||
import { PersonKind } from '@jellyfin/sdk/lib/generated-client/models/person-kind';
|
||||
import escapeHtml from 'escape-html';
|
||||
|
||||
import browser from 'scripts/browser';
|
||||
|
@ -698,8 +699,26 @@ function getCardFooterText(item, apiClient, options, footerClass, progressHtml,
|
|||
}
|
||||
}
|
||||
|
||||
if (options.showPersonRoleOrType && item.Role) {
|
||||
lines.push(globalize.translate('PersonRole', escapeHtml(item.Role)));
|
||||
if (options.showPersonRoleOrType && item.Type) {
|
||||
if (item.Role) {
|
||||
if ([ PersonKind.Actor, PersonKind.GuestStar ].includes(item.Type)) {
|
||||
// List actor roles formatted like "as Character Name"
|
||||
lines.push(globalize.translate('PersonRole', escapeHtml(item.Role)));
|
||||
} else if (item.Role.toLowerCase() === item.Type.toLowerCase()) {
|
||||
// Role and Type are the same so use the localized Type
|
||||
lines.push(escapeHtml(globalize.translate(item.Type)));
|
||||
} else if (item.Role.toLowerCase().includes(item.Type.toLowerCase())) {
|
||||
// Avoid duplication if the Role includes the Type (i.e. Executive Producer)
|
||||
lines.push(escapeHtml(item.Role));
|
||||
} else {
|
||||
// Type and Role are unique so list both (i.e. Writer | Novel)
|
||||
lines.push(escapeHtml(globalize.translate(item.Type)));
|
||||
lines.push(escapeHtml(item.Role));
|
||||
}
|
||||
} else {
|
||||
// No Role so use the localized Type
|
||||
lines.push(escapeHtml(globalize.translate(item.Type)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue