2019-06-03 03:31:38 +00:00
|
|
|
<template>
|
2019-10-28 01:54:37 +00:00
|
|
|
<div class="content">
|
2019-11-15 01:37:17 +00:00
|
|
|
<FilterBar :fetch-releases="fetchReleases" />
|
2019-10-27 23:58:54 +00:00
|
|
|
|
2019-10-28 01:54:37 +00:00
|
|
|
<div class="content-inner">
|
2020-02-26 00:15:50 +00:00
|
|
|
<Releases :releases="releases" />
|
2019-10-28 01:54:37 +00:00
|
|
|
</div>
|
2019-06-03 03:31:38 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-11-15 01:37:17 +00:00
|
|
|
import FilterBar from '../header/filter-bar.vue';
|
2019-11-16 02:33:36 +00:00
|
|
|
import Releases from '../releases/releases.vue';
|
2019-09-10 14:48:04 +00:00
|
|
|
|
2019-11-13 02:14:24 +00:00
|
|
|
async function fetchReleases() {
|
2020-02-26 00:15:50 +00:00
|
|
|
this.releases = await this.$store.dispatch('fetchReleases', { limit: 20 });
|
2020-02-10 01:05:28 +00:00
|
|
|
this.$store.commit('setCache', {
|
|
|
|
target: 'home',
|
|
|
|
releases: this.releases,
|
|
|
|
});
|
2019-11-15 00:27:58 +00:00
|
|
|
}
|
|
|
|
|
2019-11-13 02:14:24 +00:00
|
|
|
async function mounted() {
|
2019-11-09 03:43:58 +00:00
|
|
|
this.pageTitle = '';
|
2019-11-13 02:14:24 +00:00
|
|
|
|
|
|
|
await this.fetchReleases();
|
2019-06-03 03:31:38 +00:00
|
|
|
}
|
|
|
|
|
2020-02-10 00:27:13 +00:00
|
|
|
function updated() {
|
|
|
|
if (this.from.name === 'scene' && this.from.hash === '#home') {
|
|
|
|
const releaseTile = document.querySelector(`#scene-${this.from.params.releaseId}`);
|
|
|
|
if (releaseTile) releaseTile.scrollIntoView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-03 03:31:38 +00:00
|
|
|
export default {
|
2019-11-09 03:43:58 +00:00
|
|
|
components: {
|
2019-11-13 02:14:24 +00:00
|
|
|
FilterBar,
|
2019-11-16 02:33:36 +00:00
|
|
|
Releases,
|
2019-11-09 03:43:58 +00:00
|
|
|
},
|
2019-06-03 03:31:38 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2020-02-10 01:05:28 +00:00
|
|
|
// releases: this.$store.state.releases.cache.home || [], // slows down apparent page load
|
2019-06-03 03:31:38 +00:00
|
|
|
releases: [],
|
2019-11-11 02:20:00 +00:00
|
|
|
networks: [],
|
2019-11-09 03:43:58 +00:00
|
|
|
pageTitle: null,
|
2020-02-10 00:27:13 +00:00
|
|
|
from: null,
|
2019-06-03 03:31:38 +00:00
|
|
|
};
|
|
|
|
},
|
2020-02-10 00:27:13 +00:00
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
next(vm => vm.$set(vm, 'from', from));
|
|
|
|
},
|
|
|
|
updated,
|
2019-06-03 03:31:38 +00:00
|
|
|
mounted,
|
2019-11-13 02:14:24 +00:00
|
|
|
methods: {
|
|
|
|
fetchReleases,
|
|
|
|
},
|
2019-06-03 03:31:38 +00:00
|
|
|
};
|
|
|
|
</script>
|