forked from DebaucheryLibrarian/traxxx
148 lines
2.5 KiB
Vue
148 lines
2.5 KiB
Vue
<template>
|
|
<div
|
|
v-if="tag"
|
|
class="content"
|
|
>
|
|
<div
|
|
class="tag"
|
|
:class="{ nomedia: !hasMedia }"
|
|
>
|
|
<div class="header">
|
|
<h2 class="title">
|
|
<Icon icon="price-tag4" />
|
|
{{ tag.name }}
|
|
</h2>
|
|
|
|
<div
|
|
v-if="description"
|
|
class="description header-description"
|
|
v-html="description"
|
|
/>
|
|
</div>
|
|
|
|
<Scroll
|
|
v-if="hasMedia"
|
|
:expanded="expanded"
|
|
class="scroll-light"
|
|
@expand="(state) => expanded = state"
|
|
>
|
|
<Photos
|
|
:tag="tag"
|
|
:class="{ expanded }"
|
|
/>
|
|
</Scroll>
|
|
|
|
<div class="content-inner">
|
|
<FilterBar :fetch-releases="fetchReleases" />
|
|
<Releases :releases="tag.releases" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
/* eslint-disable no-v-html */
|
|
import { Converter } from 'showdown';
|
|
|
|
import escapeHtml from '../../../src/utils/escape-html';
|
|
|
|
import FilterBar from '../header/filter-bar.vue';
|
|
import Photos from './photos.vue';
|
|
import Releases from '../releases/releases.vue';
|
|
import Scroll from '../scroll/scroll.vue';
|
|
|
|
const converter = new Converter();
|
|
|
|
async function fetchReleases() {
|
|
this.tag = await this.$store.dispatch('fetchTagBySlug', {
|
|
tagSlug: this.$route.params.tagSlug,
|
|
range: this.$route.params.range,
|
|
});
|
|
|
|
this.hasMedia = this.tag.poster || this.tag.photos.length > 0;
|
|
this.description = this.tag.description && converter.makeHtml(escapeHtml(this.tag.description));
|
|
}
|
|
|
|
async function route() {
|
|
await this.fetchReleases();
|
|
}
|
|
|
|
async function mounted() {
|
|
await this.fetchReleases();
|
|
this.pageTitle = this.tag.name;
|
|
}
|
|
|
|
export default {
|
|
components: {
|
|
FilterBar,
|
|
Releases,
|
|
Photos,
|
|
Scroll,
|
|
},
|
|
data() {
|
|
return {
|
|
tag: null,
|
|
description: null,
|
|
releases: null,
|
|
pageTitle: null,
|
|
hasMedia: false,
|
|
expanded: false,
|
|
};
|
|
},
|
|
watch: {
|
|
$route: route,
|
|
},
|
|
mounted,
|
|
methods: {
|
|
fetchReleases,
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import 'theme';
|
|
|
|
.description a {
|
|
color: var(--link);
|
|
text-decoration: inherit;
|
|
|
|
&:hover {
|
|
color: var(--primary);
|
|
}
|
|
}
|
|
|
|
.header .description,
|
|
.header .description p {
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
</style>
|
|
|
|
<style lang="scss" scoped>
|
|
@import 'theme';
|
|
|
|
.header {
|
|
background: var(--profile);
|
|
color: var(--text-light);
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.title {
|
|
padding: 1rem;
|
|
margin: 0;
|
|
flex-shrink: 0;
|
|
text-transform: capitalize;
|
|
|
|
.icon {
|
|
fill: var(--text-light);
|
|
width: 1.25rem;
|
|
height: 1.25rem;
|
|
}
|
|
}
|
|
|
|
.description {
|
|
padding: 0 1rem 1rem 1rem;
|
|
line-height: 1.5;
|
|
}
|
|
</style>
|