Showing age at death instead of age from birth on actor tiles.

This commit is contained in:
DebaucheryLibrarian 2025-02-23 17:11:47 +01:00
parent 48331c1c5a
commit 49f1bc9ce2
3 changed files with 21 additions and 3 deletions

View File

@ -40,13 +40,19 @@
<Gender :gender="actor.gender" />
<span
v-if="actor.ageFromBirth"
v-if="actor.ageAtDeath"
:title="`Passed ${formatDate(actor.ageAtDeath, 'MMMM d, yyyy')}`"
class="age"
>{{ actor.ageAtDeath }} <Icon icon="tombstone" /></span>
<span
v-else-if="actor.ageFromBirth"
:title="`Born ${formatDate(actor.dateOfBirth, 'MMMM d, yyyy')}`"
class="age"
>{{ actor.ageFromBirth }}</span>
<span
v-if="actor.ageThen && actor.ageThen < actor.ageFromBirth"
v-if="actor.ageThen && actor.ageThen < actor.ageFromBirth && (!actor.ageAtDeath || actor.ageThen < actor.ageAtDeath)"
title="Age on date of release"
class="age age-then"
>{{ actor.ageThen }}</span>
@ -209,7 +215,16 @@ const favorited = ref(props.actor.stashes.some((actorStash) => actorStash.id ===
}
.age {
display: inline-flex;
align-items: center;
margin-right: .25rem;
.icon {
width: .8rem;
height: .8rem;
fill: var(--highlight-weak-10);
margin-left: .25rem;
}
}
.age-then {

View File

@ -74,6 +74,9 @@ export function curateActor(actor, context = {}) {
ageFromBirth: actor.date_of_birth && actor.date_of_birth.getFullYear() > 1
? differenceInYears(Date.now(), actor.date_of_birth)
: null,
ageAtDeath: actor.date_of_birth && actor.date_of_death && actor.date_of_birth.getFullYear() > 1
? differenceInYears(actor.date_of_death, actor.date_of_birth)
: null,
ageThen: context.sceneDate && actor.date_of_birth && actor.date_of_birth.getFullYear() > 1
? differenceInYears(context.sceneDate, actor.date_of_birth)
: null,

2
static

@ -1 +1 @@
Subproject commit 04c9d2175cf66bf3e286da6ffded79848a8d2488
Subproject commit 6534577c5755df26a90b318a3ea7e653636dfd35