Skip to content

Commit

Permalink
feat: Show actor age in scene in the scene detail actor tooltip (xbap…
Browse files Browse the repository at this point in the history
…ps#1397)

Co-authored-by: Alderamin <[email protected]>
  • Loading branch information
Alderamin49ly and Alderamin authored Sep 7, 2023
1 parent 8fb2fc7 commit 9ef13e8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ui/src/views/scenes/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@

<div class="image-row" v-if="activeTab != 1">
<div v-for="(image, idx) in castimages" :key="idx" class="image-wrapper">
<b-tooltip type="is-light" :label="image.actor_name" :delay=100>
<b-tooltip type="is-light" :label="image.actor_label" :delay=100>
<vue-load-image>
<img slot="image" :src="getImageURL(image.src)" alt="Image" class="thumbnail" @mouseover="showTooltip(idx)" @mouseout="hideTooltip(idx)" @click='showActorDetail([image.actor_id])' />
<img slot="preloader" :src="getImageURL('https://i.stack.imgur.com/kOnzy.gif')" style="height: 50px;display: block;margin-left:auto;margin-right: auto;" @click='showCastScenes([image.actor_name])' />
Expand Down Expand Up @@ -419,15 +419,25 @@ export default {
if (this.$store.state.optionsWeb.web.tagSort === 'alphabetically') {
item.tags.sort((a, b) => a.name < b.name ? -1 : 1)
}
let releasedate = parseISO(item.release_date)
let imgs = item.cast.map((actor) => {
let birthdate = parseISO(actor.birth_date)
let label = actor.name
if (birthdate.getFullYear() > 0) {
let age = releasedate.getFullYear() - birthdate.getFullYear()
if ((releasedate.getMonth() < birthdate.getMonth()) || (releasedate.getMonth() == birthdate.getMonth() && releasedate.getDate() < birthdate.getDate())) {
age -= 1
}
label += `, ${age} in scene`
}
let img = actor.image_url
if (img == "" ){
img = "blank" // forces an error image to load, blank won't display an image
}
if (actor.name.startsWith("aka:")) {
img = ""
}
return {src: img, visible: false, actor_name: actor.name, actor_id: actor.id};
return {src: img, visible: false, actor_name: actor.name, actor_label: label, actor_id: actor.id};
});
this.castimages = imgs.filter((img) => {
Expand Down

0 comments on commit 9ef13e8

Please sign in to comment.