traxxx/assets/components/sites/site.vue

167 lines
2.8 KiB
Vue
Raw Normal View History

2020-01-05 00:08:38 +00:00
<template>
<div
v-if="site"
class="content site"
>
<div class="header">
<a
v-tooltip.bottom="site.url && `Go to ${site.url}`"
:href="site.url"
target="_blank"
rel="noopener noreferrer"
class="link link-site"
>
<img
:src="`/img/logos/${site.network.slug}/${site.slug}.png`"
:title="site.name"
:alt="site.name"
class="logo logo-site"
>
</a>
<ul class="tags nolist">
<li
v-for="tag in site.tags"
:key="`tag-${tag.slug}`"
class="tag"
>{{ tag.name }}</li>
</ul>
<router-link
v-tooltip.bottom="`Go to ${site.network.name} overview`"
:to="{ name: 'network', params: { networkSlug: site.network.slug } }"
class="link link-network"
>
<img
:src="`/img/logos/${site.network.slug}/network.png`"
:title="site.network.name"
:alt="site.network.name"
class="logo logo-network"
>
</router-link>
</div>
2020-05-26 23:40:10 +00:00
<FilterBar
:fetch-releases="fetchSite"
:items-total="totalCount"
:items-per-page="limit"
/>
2020-05-25 00:02:28 +00:00
<div class="content-inner">
<Releases :releases="releases" />
</div>
</div>
2020-01-05 00:08:38 +00:00
</template>
<script>
import FilterBar from '../header/filter-bar.vue';
import Releases from '../releases/releases.vue';
async function fetchSite() {
2020-05-26 23:40:10 +00:00
const { site, releases, totalCount } = await this.$store.dispatch('fetchSiteBySlug', {
siteSlug: this.$route.params.siteSlug,
range: this.$route.params.range,
2020-05-26 23:40:10 +00:00
pageNumber: Number(this.$route.params.pageNumber) || 1,
limit: this.limit,
});
2020-05-26 23:40:10 +00:00
this.site = site;
this.releases = releases;
this.totalCount = totalCount;
2020-01-05 00:08:38 +00:00
}
async function route() {
await this.fetchSite();
}
2020-01-05 00:08:38 +00:00
async function mounted() {
await this.fetchSite();
2020-01-05 00:08:38 +00:00
this.pageTitle = this.site.name;
2020-01-05 00:08:38 +00:00
}
export default {
components: {
FilterBar,
Releases,
},
data() {
return {
site: null,
releases: null,
2020-05-26 23:40:10 +00:00
totalCount: 0,
limit: 10,
pageTitle: null,
};
},
watch: {
$route: route,
},
mounted,
methods: {
fetchSite,
},
2020-01-05 00:08:38 +00:00
};
</script>
<style lang="scss" scoped>
@import 'theme';
.header {
2020-01-05 01:50:55 +00:00
background: $profile;
color: $text-contrast;
2020-01-05 00:08:38 +00:00
display: flex;
2020-01-05 01:50:55 +00:00
align-items: center;
2020-01-05 00:08:38 +00:00
justify-content: space-between;
}
.link {
2020-01-05 01:50:55 +00:00
padding: 1rem;
2020-01-05 00:08:38 +00:00
}
.link-site {
margin: 0 1rem 0 0;
justify-content: flex-start;
.logo {
object-position: 0 0;
}
}
.link-network {
justify-content: flex-end;
.logo {
object-position: 100% 0;
}
2020-01-05 00:08:38 +00:00
}
.logo {
width: 100%;
max-width: 15rem;
max-height: 5rem;
2020-01-05 00:08:38 +00:00
object-fit: contain;
filter: $logo-highlight;
2020-01-05 00:08:38 +00:00
}
2020-01-13 22:45:09 +00:00
.tag {
background: $shadow;
padding: .5rem;
margin: 0 .5rem .5rem 0;
}
@media(max-width: $breakpoint) {
.link {
padding: .5rem 1rem;
}
2020-01-05 00:08:38 +00:00
.logo {
max-height: 2.5rem;
}
2020-01-13 22:45:09 +00:00
.tags {
display: none;
}
2020-01-05 00:08:38 +00:00
}
</style>