2020-06-29 23:07:48 +00:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
v-if="actor"
|
|
|
|
class="actor"
|
|
|
|
>
|
2022-11-28 04:45:25 +00:00
|
|
|
<div
|
2020-06-29 23:07:48 +00:00
|
|
|
class="link"
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
class="handle"
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
v-tooltip.top="actor.name"
|
|
|
|
class="name"
|
|
|
|
>{{ actor.name }}</span>
|
|
|
|
|
2021-09-11 22:05:45 +00:00
|
|
|
<RouterLink
|
2021-02-16 02:37:52 +00:00
|
|
|
v-if="actor.entity"
|
|
|
|
v-tooltip="actor.entity.name"
|
|
|
|
:to="{ name: actor.entity.type, params: { entitySlug: actor.entity.slug, range: 'new', pageNumber: 1 } }"
|
2020-06-29 23:07:48 +00:00
|
|
|
class="favicon"
|
|
|
|
>
|
|
|
|
<img
|
2022-05-29 22:05:33 +00:00
|
|
|
:src="`/img/logos/${actor.entity.slug}/favicon_light.png`"
|
2020-06-29 23:07:48 +00:00
|
|
|
class="favicon-icon"
|
|
|
|
>
|
2021-09-11 22:05:45 +00:00
|
|
|
</RouterLink>
|
2020-06-29 23:07:48 +00:00
|
|
|
|
|
|
|
<Icon
|
|
|
|
v-if="alias"
|
|
|
|
v-tooltip="`Alias of ${alias.name}`"
|
|
|
|
icon="users3"
|
|
|
|
class="favicon alias"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Icon
|
|
|
|
v-if="actor.dateOfDeath"
|
|
|
|
v-tooltip="`Died ${formatDate(actor.dateOfDeath, 'MMMM D, YYYY')}`"
|
|
|
|
icon="tombstone"
|
|
|
|
class="favicon died"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
|
2023-09-17 19:59:15 +00:00
|
|
|
<RouterLink
|
|
|
|
:to="hasScrolled ? '' : { name: 'actor', params: { actorId: actor.id, actorSlug: actor.slug } }"
|
2022-11-28 04:45:25 +00:00
|
|
|
class="avatar-container"
|
|
|
|
>
|
2020-06-29 23:07:48 +00:00
|
|
|
<img
|
|
|
|
v-if="actor.avatar"
|
2021-02-22 01:33:39 +00:00
|
|
|
:src="getPath(actor.avatar, 'thumbnail')"
|
|
|
|
:style="{ 'background-image': getBgPath(actor.avatar, 'lazy') }"
|
2020-12-26 22:51:27 +00:00
|
|
|
loading="lazy"
|
2022-11-28 04:45:25 +00:00
|
|
|
draggable="false"
|
2020-12-26 22:51:27 +00:00
|
|
|
class="avatar"
|
2020-06-29 23:07:48 +00:00
|
|
|
>
|
|
|
|
|
|
|
|
<span
|
|
|
|
v-else
|
|
|
|
class="avatar"
|
|
|
|
><img
|
|
|
|
:src="`/img/avatar_${actor.gender || 'female'}.svg`"
|
2022-11-28 04:45:25 +00:00
|
|
|
draggable="false"
|
2020-06-29 23:07:48 +00:00
|
|
|
class="avatar-fallback"
|
|
|
|
></span>
|
|
|
|
|
2021-03-24 00:52:27 +00:00
|
|
|
<Icon
|
2021-09-12 21:21:39 +00:00
|
|
|
v-show="(!stash || stash.primary) && favorited"
|
2021-03-24 00:52:27 +00:00
|
|
|
icon="heart7"
|
|
|
|
class="stash stashed"
|
2023-06-07 23:16:44 +00:00
|
|
|
@click.stop.native="unstashActor"
|
2021-03-24 00:52:27 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<Icon
|
2021-09-12 21:21:39 +00:00
|
|
|
v-show="(!stash || stash.primary) && favorited === false"
|
2021-03-24 00:52:27 +00:00
|
|
|
icon="heart8"
|
|
|
|
class="stash unstashed"
|
2023-06-07 23:16:44 +00:00
|
|
|
@click.stop.native="stashActor"
|
2021-03-24 00:52:27 +00:00
|
|
|
/>
|
|
|
|
|
2021-09-12 21:21:39 +00:00
|
|
|
<Icon
|
|
|
|
v-show="stash && !stash.primary"
|
|
|
|
icon="cross2"
|
|
|
|
class="stash unstash"
|
2023-06-07 23:16:44 +00:00
|
|
|
@click.stop.native="unstashActor"
|
2021-09-12 21:21:39 +00:00
|
|
|
/>
|
|
|
|
|
2022-11-28 04:45:25 +00:00
|
|
|
<span class="details">
|
2020-06-29 23:07:48 +00:00
|
|
|
<span class="gender-age">
|
|
|
|
<Gender :gender="actor.gender" />
|
|
|
|
|
|
|
|
<span
|
|
|
|
v-if="actor.ageAtDeath"
|
|
|
|
v-tooltip="`Born ${formatDate(actor.dateOfBirth, 'MMMM D, YYYY')}<br>Died ${formatDate(actor.dateOfDeath, 'MMMM D, YYYY')}`"
|
|
|
|
class="age-death"
|
|
|
|
>{{ actor.ageAtDeath }}</span>
|
|
|
|
|
|
|
|
<span
|
2020-11-29 02:59:47 +00:00
|
|
|
v-else-if="actor.ageFromBirth"
|
2020-06-29 23:07:48 +00:00
|
|
|
v-tooltip="`Born on ${formatDate(actor.dateOfBirth, 'MMMM D, YYYY')}`"
|
|
|
|
class="age-now"
|
2020-11-29 02:59:47 +00:00
|
|
|
>{{ actor.ageFromBirth }}</span>
|
|
|
|
|
|
|
|
<span
|
|
|
|
v-else-if="actor.age"
|
|
|
|
v-tooltip="`At least ${actor.age}`"
|
|
|
|
class="age-now"
|
2020-06-29 23:07:48 +00:00
|
|
|
>{{ actor.age }}</span>
|
|
|
|
|
|
|
|
<span
|
2020-12-01 22:00:14 +00:00
|
|
|
v-if="actor.ageThen && actor.ageThen < actor.ageFromBirth"
|
2020-06-29 23:07:48 +00:00
|
|
|
v-tooltip="`${actor.ageThen} years old on release date`"
|
|
|
|
class="age-then"
|
|
|
|
>{{ actor.ageThen }}</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span
|
|
|
|
v-if="actor.origin"
|
|
|
|
v-tooltip="`Born in ${actor.origin.country.alias || actor.origin.country.name}`"
|
|
|
|
class="country"
|
|
|
|
>
|
|
|
|
{{ actor.origin.country.alpha2 }}
|
|
|
|
<img
|
|
|
|
class="flag"
|
|
|
|
:src="`/img/flags/${actor.origin.country.alpha2.toLowerCase()}.svg`"
|
|
|
|
>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span
|
|
|
|
v-else
|
|
|
|
class="country"
|
|
|
|
/>
|
|
|
|
</span>
|
2023-09-17 19:59:15 +00:00
|
|
|
</RouterLink>
|
2022-11-28 04:45:25 +00:00
|
|
|
</div>
|
2020-06-29 23:07:48 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Gender from './gender.vue';
|
|
|
|
|
2021-03-24 00:52:27 +00:00
|
|
|
async function stashActor() {
|
|
|
|
this.favorited = true;
|
|
|
|
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch('stashActor', {
|
|
|
|
actorId: this.actor.id,
|
|
|
|
stashId: this.$store.getters.favorites.id,
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$emit('stash', true);
|
|
|
|
} catch (error) {
|
|
|
|
this.favorited = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function unstashActor() {
|
2021-09-12 21:21:39 +00:00
|
|
|
if (!this.stash || this.stash.primary) {
|
|
|
|
this.favorited = false;
|
|
|
|
}
|
2021-03-24 00:52:27 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch('unstashActor', {
|
|
|
|
actorId: this.actor.id,
|
2021-09-12 21:21:39 +00:00
|
|
|
stashId: this.stash?.id || this.$store.getters.favorites.id,
|
2021-03-24 00:52:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
this.$emit('stash', false);
|
|
|
|
} catch (error) {
|
|
|
|
this.favorited = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-29 23:07:48 +00:00
|
|
|
function sfw() {
|
|
|
|
return this.$store.state.ui.sfw;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Gender,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
actor: {
|
|
|
|
type: Object,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
alias: {
|
|
|
|
type: Object,
|
|
|
|
default: null,
|
|
|
|
},
|
2021-09-12 21:21:39 +00:00
|
|
|
stash: {
|
|
|
|
type: Object,
|
|
|
|
default: null,
|
|
|
|
},
|
2022-11-28 04:45:25 +00:00
|
|
|
hasScrolled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-06-29 23:07:48 +00:00
|
|
|
},
|
2021-03-24 00:52:27 +00:00
|
|
|
emits: ['stash'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
favorited: this.actor.isFavorited,
|
|
|
|
};
|
|
|
|
},
|
2020-06-29 23:07:48 +00:00
|
|
|
computed: {
|
|
|
|
sfw,
|
|
|
|
},
|
2021-03-24 00:52:27 +00:00
|
|
|
methods: {
|
|
|
|
stashActor,
|
|
|
|
unstashActor,
|
|
|
|
},
|
2020-06-29 23:07:48 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import 'theme';
|
|
|
|
|
|
|
|
.actor {
|
|
|
|
width: 100%;
|
|
|
|
display: inline-block;
|
|
|
|
position: relative;
|
|
|
|
box-shadow: 0 0 3px var(--darken-weak);
|
2021-10-30 22:31:18 +00:00
|
|
|
background: var(--info);
|
2020-06-29 23:07:48 +00:00
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
content: '';
|
|
|
|
display: inline-block;
|
|
|
|
padding-bottom: 150%;
|
|
|
|
}
|
2021-09-12 21:21:39 +00:00
|
|
|
|
|
|
|
&:hover .unstashed,
|
|
|
|
&:hover .unstash {
|
|
|
|
fill: var(--lighten);
|
|
|
|
}
|
2020-06-29 23:07:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.link {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
2021-10-30 22:31:18 +00:00
|
|
|
color: var(--text-light);
|
2020-06-29 23:07:48 +00:00
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.handle {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
font-weight: bold;
|
|
|
|
box-shadow: 0 0 3px var(--shadow);
|
|
|
|
|
|
|
|
.name {
|
2021-10-30 22:31:18 +00:00
|
|
|
padding: .25rem .5rem;
|
|
|
|
font-size: .9rem;
|
2020-06-29 23:07:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.alias {
|
|
|
|
fill: var(--shadow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.favicon {
|
|
|
|
font-size: 0;
|
|
|
|
padding: .5rem .25rem;
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
padding: .5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.died {
|
|
|
|
fill: var(--shadow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.favicon-icon {
|
|
|
|
width: 1rem;
|
|
|
|
height: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.name {
|
|
|
|
flex-grow: 1;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
|
|
|
|
.avatar-container {
|
|
|
|
display: flex;
|
|
|
|
flex-grow: 1;
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
background: var(--profile);
|
2022-11-28 04:45:25 +00:00
|
|
|
cursor: pointer;
|
2020-06-29 23:07:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.avatar {
|
|
|
|
color: var(--darken-weak);
|
|
|
|
background: var(--darken-hint);
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
object-fit: cover;
|
2021-03-21 12:45:49 +00:00
|
|
|
object-position: center 0;
|
2020-12-26 22:51:27 +00:00
|
|
|
background-size: cover;
|
2021-03-21 12:45:49 +00:00
|
|
|
background-position: center 0;
|
2020-06-29 23:07:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.avatar-fallback {
|
|
|
|
max-height: 100%;
|
|
|
|
max-width: 100%;
|
|
|
|
opacity: .1;
|
|
|
|
}
|
|
|
|
|
2021-03-24 00:52:27 +00:00
|
|
|
.stash {
|
2021-11-20 23:15:19 +00:00
|
|
|
width: 1.5rem;
|
|
|
|
height: 1.5rem;
|
2021-03-24 00:52:27 +00:00
|
|
|
padding: .25rem .25rem .5rem .5rem;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
fill: var(--lighten-weak);
|
|
|
|
filter: drop-shadow(0 0 2px var(--darken));
|
|
|
|
|
2021-09-12 21:21:39 +00:00
|
|
|
&:hover.unstashed,
|
2021-03-24 00:52:27 +00:00
|
|
|
&.stashed {
|
|
|
|
fill: var(--primary);
|
|
|
|
}
|
2021-09-12 21:21:39 +00:00
|
|
|
|
|
|
|
&:hover.unstash {
|
|
|
|
fill: var(--text-light);
|
|
|
|
filter: drop-shadow(0 0 2px var(--darken-weak));
|
|
|
|
}
|
2021-03-24 00:52:27 +00:00
|
|
|
}
|
|
|
|
|
2020-06-29 23:07:48 +00:00
|
|
|
.details {
|
|
|
|
background: var(--darken);
|
|
|
|
color: var(--text-light);
|
|
|
|
width: 100%;
|
|
|
|
height: 1.75rem;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: .5rem;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
font-size: .9rem;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
.gender-age {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.gender {
|
|
|
|
margin: .25rem .25rem 0 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.country {
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-end;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.flag {
|
|
|
|
height: .75rem;
|
|
|
|
margin: 0 0 0 .5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.age-now,
|
|
|
|
.age-death {
|
|
|
|
margin: 0 .25rem 0 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.age-then {
|
|
|
|
color: var(--lighten);
|
|
|
|
}
|
2021-02-05 02:03:57 +00:00
|
|
|
|
|
|
|
@media(max-width: $breakpoint) {
|
|
|
|
.name {
|
|
|
|
font-size: .9rem;
|
|
|
|
}
|
|
|
|
}
|
2020-06-29 23:07:48 +00:00
|
|
|
</style>
|