traxxx/assets/components/releases/tile.vue

360 lines
7.0 KiB
Vue
Raw Normal View History

2020-06-27 02:50:13 +00:00
<template>
<div
:id="`${release.type}-${release.id}`"
:class="{ [release.type]: true }"
class="tile"
>
<span class="poster">
<span class="details">
<span
v-if="release.entity.parent"
2020-06-27 02:50:13 +00:00
class="site"
>
<router-link
v-tooltip.bottom="`Part of ${release.entity.parent.name}`"
:title="`Part of ${release.entity.parent.name}`"
:to="`/${release.entity.parent.type}/${release.entity.parent.slug}`"
2020-06-27 02:50:13 +00:00
class="site-link"
><img
:src="`/img/logos/${release.entity.parent.slug}/favicon.png`"
2020-06-27 02:50:13 +00:00
class="favicon"
></router-link>
<router-link
v-tooltip.bottom="`More from ${release.entity.name}`"
:title="`More from ${release.entity.name}`"
:to="`/${release.entity.type}/${release.entity.slug}`"
2020-06-27 02:50:13 +00:00
class="site-link"
>{{ release.entity.name }}</router-link>
2020-06-27 02:50:13 +00:00
</span>
<router-link
v-else
:to="`/${release.entity.type}/${release.entity.slug}`"
class="site site-link"
><img
:src="`/img/logos/${release.entity.slug}/favicon.png`"
class="favicon"
>{{ release.entity.name }}</router-link>
2020-06-27 02:50:13 +00:00
<a
v-if="release.date"
v-tooltip.bottom="release.url && `View scene on ${release.entity.name}`"
:title="release.url && `View scene on ${release.entity.name}`"
2020-06-27 02:50:13 +00:00
:href="release.url"
:class="{ upcoming: isAfter(release.date, new Date()), new: release.isNew }"
target="_blank"
rel="noopener noreferrer"
class="date"
>{{ formatDate(release.date, 'MMM D, YYYY') }}</a>
<a
v-else
:href="release.url"
:class="{ upcoming: isAfter(release.date, new Date()), new: release.isNew }"
title="Scene date N/A, showing date added"
target="_blank"
rel="noopener noreferrer"
class="date"
>{{ `(${formatDate(release.dateAdded, 'MMM D, YYYY')})` }}</a>
</span>
<a
:href="`/${release.type || 'scene'}/${release.id}/${release.slug}`"
target="_blank"
rel="noopener noreferrer"
class="link"
>
<img
v-if="release.poster"
:data-src="sfw ? `/img/${release.poster.sfw.thumbnail}` : `/media/${release.poster.thumbnail}`"
:data-loading="sfw ? `/img/${release.poster.sfw.lazy}` : `/media/${release.poster.lazy}`"
:alt="release.title"
class="thumbnail"
>
<span
v-else-if="release.covers && release.covers.length > 0"
class="covers"
>
<img
v-for="cover in release.covers"
:key="cover.id"
:data-src="sfw ? `/img/${cover.sfw.thumbnail}` : `/media/${cover.thumbnail}`"
:data-loading="sfw ? `/img/${cover.sfw.lazy}` : `/media/${cover.lazy}`"
:alt="release.title"
class="thumbnail cover"
>
</span>
<div
v-else
:title="release.title"
class="thumbnail"
>No thumbnail available</div>
</a>
</span>
<div class="info">
<a
:href="`/${release.type || 'scene'}/${release.id}/${release.slug}`"
target="_blank"
rel="noopener noreferrer"
class="row link"
>
<h3
v-tooltip.top="release.title"
:title="release.title"
class="title"
>
<Icon
v-if="release.type === 'movie'"
icon="film"
/>{{ release.title }}
</h3>
</a>
<span class="row">
<ul class="actors nolist">
<li
v-for="actor in release.actors"
:key="actor.id"
class="actor"
>
<router-link
:to="{ name: 'actor', params: { actorId: actor.id, actorSlug: actor.slug } }"
class="actor-link"
>{{ actor.name }}</router-link>
</li>
</ul>
</span>
<ul
v-if="release.tags.length > 0"
:title="release.tags.map(tag => tag.name).join(', ')"
class="tags nolist"
>
<li
v-for="tag in release.tags"
:key="`tag-${tag.slug}`"
class="tag"
>
<router-link
:to="`/tag/${tag.slug}`"
class="tag-link"
>{{ tag.name }}</router-link>
</li>
</ul>
</div>
</div>
</template>
<script>
function sfw() {
return this.$store.state.ui.sfw;
}
export default {
props: {
release: {
type: Object,
default: null,
},
referer: {
type: String,
default: null,
},
},
computed: {
sfw,
},
};
</script>
<style lang="scss" scoped>
@import 'theme';
.tile {
background: var(--background);
display: flex;
flex-direction: column;
box-sizing: border-box;
padding: 0 0 .5rem 0;
overflow: hidden;
box-shadow: 0 0 3px var(--darken-weak);
height: 100%;
}
.poster {
position: relative;
margin: 0 0 .5rem 0;
}
.covers {
background: var(--profile);
display: flex;
.cover {
width: 50%;
}
}
.thumbnail {
width: 100%;
height: 14rem;
display: flex;
justify-content: center;
align-items: center;
object-fit: cover;
background-position: center;
background-size: cover;
background-color: var(--shadow-hint);
color: var(--shadow);
text-shadow: 1px 1px 0 var(--highlight);
}
.row {
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
padding: 0 .5rem;
margin: 0 0 .25rem 0;
}
.details {
width: 100%;
display: flex;
justify-content: space-between;
position: absolute;
font-size: 0;
.favicon {
height: 1rem;
margin: 0 .25rem 0 0;
}
}
.site,
.date {
color: var(--text-light);
display: flex;
align-items: center;
background: var(--darken);
position: relative;
font-size: .8rem;
padding: .25rem;
text-decoration: none;
}
.date {
&.upcoming:before {
content: '';
background: var(--primary);
width: .5rem;
display: inline-block;
position: absolute;
top: 0;
bottom: 0;
left: -.5rem;
}
&.new {
font-weight: bold;
}
}
.site {
font-weight: bold;
}
.site-link {
display: flex;
color: var(--text-light);
text-decoration: none;
}
.info {
display: flex;
flex-direction: column;
flex-grow: 1;
}
.link {
text-decoration: none;
}
.title {
margin: 0 .25rem .25rem 0;
color: var(--text);
max-height: 2.75rem;
font-size: 1rem;
line-height: 1.5;
text-overflow: ellipsis;
overflow: hidden;
.icon {
margin: 0 .25rem 0 0;
}
}
.network {
color: #555;
margin: 0 .25rem 0 0;
font-size: .8rem;
}
.actors {
word-wrap: break-word;
overflow: hidden;
max-height: 2.75rem;
line-height: 1.5rem;
}
.tags {
max-height: .5rem;
padding: .25rem .5rem 1rem .5rem;
word-wrap: break-word;
overflow-y: hidden;
}
.actor {
margin: 0 .25rem 0 0;
}
.tag {
margin: 0 .25rem .25rem 0;
}
.actor:not(:last-of-type)::after {
content: ",";
}
.actor-link {
text-decoration: none;
&:hover {
color: var(--primary);
}
}
.actor-link {
color: var(--link);
}
.tag-link {
color: var(--shadow);
display: inline-block;
padding: .25rem;
font-size: .75rem;
font-weight: bold;
text-decoration: none;
line-height: 1;
border: solid 1px var(--shadow-hint);
&:hover {
color: var(--primary);
}
}
</style>