2019-11-11 04:18:28 +00:00
|
|
|
<template>
|
2020-05-18 02:28:38 +00:00
|
|
|
<div
|
|
|
|
v-if="tag"
|
2020-07-05 02:10:35 +00:00
|
|
|
class="tag content"
|
2020-05-18 02:28:38 +00:00
|
|
|
>
|
2020-07-05 02:10:35 +00:00
|
|
|
<div class="header">
|
|
|
|
<h2 class="title">
|
|
|
|
<Icon icon="price-tag4" />
|
|
|
|
{{ tag.name }}
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
|
2021-03-24 16:17:51 +00:00
|
|
|
<div
|
|
|
|
class="content-inner"
|
|
|
|
@scroll="events.emit('scroll', $event)"
|
|
|
|
>
|
2020-07-05 02:10:35 +00:00
|
|
|
<div
|
|
|
|
v-if="description"
|
|
|
|
class="description header-description"
|
|
|
|
v-html="description"
|
|
|
|
/>
|
2020-05-18 02:28:38 +00:00
|
|
|
|
2020-07-02 23:28:22 +00:00
|
|
|
<Scroll
|
|
|
|
v-if="hasMedia"
|
2020-12-29 19:02:26 +00:00
|
|
|
v-slot="scroll"
|
2021-01-15 03:04:32 +00:00
|
|
|
class="scroll-dark"
|
2020-07-02 23:28:22 +00:00
|
|
|
>
|
2020-05-18 02:28:38 +00:00
|
|
|
<Photos
|
|
|
|
:tag="tag"
|
2020-07-02 23:28:22 +00:00
|
|
|
:class="{ expanded }"
|
2020-12-29 19:02:26 +00:00
|
|
|
@load="scroll.loaded"
|
2021-06-28 03:13:41 +00:00
|
|
|
@campaign="campaign => showBannerCampaign = !campaign"
|
2020-05-18 02:28:38 +00:00
|
|
|
/>
|
2020-07-02 23:28:22 +00:00
|
|
|
</Scroll>
|
2020-05-18 02:28:38 +00:00
|
|
|
|
2021-02-03 18:21:47 +00:00
|
|
|
<button
|
|
|
|
v-if="tag.photos && tag.photos.length > 2"
|
|
|
|
class="album-toggle"
|
|
|
|
@click="$router.push({ hash: '#album' })"
|
|
|
|
><Icon icon="grid3" />View album</button>
|
|
|
|
|
|
|
|
<Album
|
|
|
|
v-if="showAlbum"
|
|
|
|
:items="[tag.poster, ...tag.photos]"
|
|
|
|
:title="tag.name"
|
2021-02-22 01:33:39 +00:00
|
|
|
:local="true"
|
2021-06-28 03:13:41 +00:00
|
|
|
:tag="tag"
|
2021-02-03 18:21:47 +00:00
|
|
|
class="portrait"
|
2021-03-07 15:54:20 +00:00
|
|
|
@close="$router.replace({ hash: undefined })"
|
2021-02-03 18:21:47 +00:00
|
|
|
/>
|
|
|
|
|
2021-06-28 03:13:41 +00:00
|
|
|
<div
|
|
|
|
v-if="showBannerCampaign"
|
|
|
|
class="campaign-container"
|
|
|
|
>
|
|
|
|
<Campaign
|
|
|
|
:tag="tag"
|
|
|
|
:min-ratio="3"
|
|
|
|
/>
|
2021-06-27 22:05:24 +00:00
|
|
|
</div>
|
|
|
|
|
2021-01-17 20:24:20 +00:00
|
|
|
<FilterBar
|
|
|
|
ref="filter"
|
|
|
|
:fetch-releases="fetchReleases"
|
|
|
|
/>
|
|
|
|
|
2021-10-25 00:06:24 +00:00
|
|
|
<Releases
|
|
|
|
:releases="releases"
|
|
|
|
:done="done"
|
|
|
|
/>
|
2020-09-09 02:22:43 +00:00
|
|
|
|
|
|
|
<Pagination
|
|
|
|
:items-total="totalCount"
|
|
|
|
:items-per-page="limit"
|
|
|
|
class="pagination-bottom"
|
|
|
|
/>
|
2020-08-15 17:04:33 +00:00
|
|
|
|
|
|
|
<Footer />
|
2020-05-18 02:28:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-11-11 04:18:28 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-12-04 20:58:08 +00:00
|
|
|
import { Converter } from 'showdown';
|
|
|
|
|
|
|
|
import escapeHtml from '../../../src/utils/escape-html';
|
|
|
|
|
2020-07-20 02:20:33 +00:00
|
|
|
import FilterBar from '../filters/filter-bar.vue';
|
2020-01-09 00:59:30 +00:00
|
|
|
import Photos from './photos.vue';
|
2021-02-03 18:21:47 +00:00
|
|
|
import Album from '../album/album.vue';
|
2019-11-16 02:33:36 +00:00
|
|
|
import Releases from '../releases/releases.vue';
|
2020-09-09 02:22:43 +00:00
|
|
|
import Pagination from '../pagination/pagination.vue';
|
2020-07-02 23:28:22 +00:00
|
|
|
import Scroll from '../scroll/scroll.vue';
|
2021-06-28 00:50:06 +00:00
|
|
|
import Campaign from '../campaigns/campaign.vue';
|
2019-11-11 04:18:28 +00:00
|
|
|
|
2019-12-04 20:58:08 +00:00
|
|
|
const converter = new Converter();
|
|
|
|
|
2021-03-19 02:27:48 +00:00
|
|
|
async function fetchReleases(scroll = true) {
|
2021-10-25 00:06:24 +00:00
|
|
|
this.done = false;
|
|
|
|
|
2020-09-09 02:22:43 +00:00
|
|
|
const { tag, releases, totalCount } = await this.$store.dispatch('fetchTagBySlug', {
|
2020-05-18 02:28:38 +00:00
|
|
|
tagSlug: this.$route.params.tagSlug,
|
2020-09-09 02:22:43 +00:00
|
|
|
pageNumber: Number(this.$route.params.pageNumber),
|
|
|
|
limit: this.limit,
|
2020-05-18 02:28:38 +00:00
|
|
|
range: this.$route.params.range,
|
|
|
|
});
|
2020-01-09 00:59:30 +00:00
|
|
|
|
2020-09-09 02:22:43 +00:00
|
|
|
this.tag = tag;
|
|
|
|
this.releases = releases;
|
|
|
|
this.totalCount = totalCount;
|
|
|
|
|
2020-05-18 02:28:38 +00:00
|
|
|
this.hasMedia = this.tag.poster || this.tag.photos.length > 0;
|
|
|
|
this.description = this.tag.description && converter.makeHtml(escapeHtml(this.tag.description));
|
2021-01-17 20:24:20 +00:00
|
|
|
|
2021-10-25 00:06:24 +00:00
|
|
|
this.done = true;
|
|
|
|
|
2021-06-28 03:13:41 +00:00
|
|
|
if (this.hasMedia) {
|
|
|
|
this.showBannerCampaign = true;
|
|
|
|
}
|
|
|
|
|
2021-03-19 02:27:48 +00:00
|
|
|
if (scroll && this.$refs.filter) {
|
2021-01-29 23:01:40 +00:00
|
|
|
this.$refs.filter.$el.scrollIntoView();
|
|
|
|
}
|
2019-11-15 04:10:59 +00:00
|
|
|
}
|
|
|
|
|
2021-02-03 18:21:47 +00:00
|
|
|
function showAlbum() {
|
|
|
|
return this.tag.photos?.length > 0 && this.$route.hash === '#album';
|
|
|
|
}
|
|
|
|
|
|
|
|
async function watchRoute(to, from) {
|
2021-02-05 00:29:53 +00:00
|
|
|
if (to.hash !== '#album' && from.hash !== '#album') {
|
2021-02-03 18:21:47 +00:00
|
|
|
await this.fetchReleases();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-15 04:10:59 +00:00
|
|
|
async function mounted() {
|
2020-05-18 02:28:38 +00:00
|
|
|
await this.fetchReleases();
|
|
|
|
this.pageTitle = this.tag.name;
|
2019-11-11 04:18:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2020-05-18 02:28:38 +00:00
|
|
|
components: {
|
|
|
|
FilterBar,
|
|
|
|
Releases,
|
2021-02-03 18:21:47 +00:00
|
|
|
Album,
|
2020-07-02 23:28:22 +00:00
|
|
|
Photos,
|
2020-09-09 02:22:43 +00:00
|
|
|
Pagination,
|
2020-07-02 23:28:22 +00:00
|
|
|
Scroll,
|
2021-06-28 00:50:06 +00:00
|
|
|
Campaign,
|
2020-05-18 02:28:38 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
tag: null,
|
|
|
|
description: null,
|
|
|
|
releases: null,
|
2021-10-25 00:06:24 +00:00
|
|
|
done: false,
|
2020-09-09 02:22:43 +00:00
|
|
|
totalCount: 0,
|
2021-01-17 20:24:20 +00:00
|
|
|
limit: 20,
|
2020-05-18 02:28:38 +00:00
|
|
|
pageTitle: null,
|
|
|
|
hasMedia: false,
|
2020-07-02 23:28:22 +00:00
|
|
|
expanded: false,
|
2021-06-28 03:13:41 +00:00
|
|
|
showBannerCampaign: false, // only show if photo campaign is not available
|
2020-05-18 02:28:38 +00:00
|
|
|
};
|
|
|
|
},
|
2021-02-03 18:21:47 +00:00
|
|
|
computed: {
|
|
|
|
showAlbum,
|
|
|
|
},
|
2020-05-18 02:28:38 +00:00
|
|
|
watch: {
|
2021-02-03 18:21:47 +00:00
|
|
|
$route: watchRoute,
|
2021-01-04 00:30:39 +00:00
|
|
|
'$store.state.ui.tagFilter': fetchReleases,
|
2020-05-18 02:28:38 +00:00
|
|
|
},
|
|
|
|
mounted,
|
|
|
|
methods: {
|
|
|
|
fetchReleases,
|
|
|
|
},
|
2019-11-11 04:18:28 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
2019-12-04 20:58:08 +00:00
|
|
|
<style lang="scss">
|
|
|
|
@import 'theme';
|
|
|
|
|
|
|
|
.description a {
|
2020-03-23 00:43:49 +00:00
|
|
|
color: var(--link);
|
2019-12-04 20:58:08 +00:00
|
|
|
text-decoration: inherit;
|
|
|
|
|
|
|
|
&:hover {
|
2020-03-23 00:43:49 +00:00
|
|
|
color: var(--primary);
|
2019-12-04 20:58:08 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-13 00:56:20 +00:00
|
|
|
|
2020-07-05 02:10:35 +00:00
|
|
|
.description,
|
|
|
|
.description p {
|
2020-05-13 00:56:20 +00:00
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
2019-12-04 20:58:08 +00:00
|
|
|
</style>
|
|
|
|
|
2019-11-11 04:18:28 +00:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import 'theme';
|
|
|
|
|
2020-01-09 00:59:30 +00:00
|
|
|
.header {
|
2021-06-27 22:05:24 +00:00
|
|
|
display: flex;
|
2020-03-23 00:43:49 +00:00
|
|
|
background: var(--profile);
|
|
|
|
color: var(--text-light);
|
2020-05-13 00:56:20 +00:00
|
|
|
justify-content: space-between;
|
2019-11-11 04:18:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
2021-06-27 22:05:24 +00:00
|
|
|
display: inline-block;
|
2020-08-10 19:39:55 +00:00
|
|
|
padding: .5rem 1rem;
|
2020-01-09 00:59:30 +00:00
|
|
|
margin: 0;
|
|
|
|
flex-shrink: 0;
|
2019-11-11 04:18:28 +00:00
|
|
|
text-transform: capitalize;
|
2019-11-14 04:13:38 +00:00
|
|
|
|
|
|
|
.icon {
|
2020-03-23 00:43:49 +00:00
|
|
|
fill: var(--text-light);
|
2019-11-14 04:13:38 +00:00
|
|
|
width: 1.25rem;
|
|
|
|
height: 1.25rem;
|
|
|
|
}
|
2019-11-11 04:18:28 +00:00
|
|
|
}
|
2019-12-04 20:58:08 +00:00
|
|
|
|
|
|
|
.description {
|
2020-07-05 02:10:35 +00:00
|
|
|
padding: 0 1rem .5rem 1rem;
|
2019-12-04 20:58:08 +00:00
|
|
|
line-height: 1.5;
|
2020-07-05 02:10:35 +00:00
|
|
|
color: var(--text-light);
|
|
|
|
background: var(--profile);
|
2019-12-04 20:58:08 +00:00
|
|
|
}
|
2020-12-29 19:02:26 +00:00
|
|
|
|
|
|
|
.scroll {
|
|
|
|
background: var(--background-dim);
|
|
|
|
}
|
2021-06-27 22:05:24 +00:00
|
|
|
|
|
|
|
.campaign-container {
|
|
|
|
max-height: 90px;
|
|
|
|
padding: .5rem 1rem 0 1rem;
|
|
|
|
background: var(--background-dim);
|
|
|
|
text-align: center;
|
|
|
|
}
|
2019-11-11 04:18:28 +00:00
|
|
|
</style>
|