gamebrary/src/pages/Releases.vue

80 lines
1.9 KiB
Vue
Raw Normal View History

2020-08-15 00:02:34 +00:00
<template lang="html">
2020-09-28 23:25:36 +00:00
<div>
2020-09-26 00:09:20 +00:00
<b-jumbotron
2020-10-05 18:42:04 +00:00
:header="$t('releases.title')"
2020-09-26 00:09:20 +00:00
header-level="5"
fluid
2020-10-14 00:35:40 +00:00
:bg-variant="nightMode ? 'dark' : ''"
:text-variant="nightMode ? 'white' : ''"
:border-variant="nightMode ? 'dark' : ''"
2020-09-30 23:36:23 +00:00
class="position-sticky"
2020-09-26 00:09:20 +00:00
/>
2020-09-01 22:38:59 +00:00
2020-11-01 17:52:25 +00:00
<b-container>
<b-card
v-for="release in releases"
:key="release.id"
:bg-variant="nightMode ? 'dark' : null"
:text-variant="nightMode ? 'white' : null"
hide-footer
class="mb-3"
>
<template v-slot:header>
<h6 class="mb-0">
<b-badge>{{ release.tag_name }}</b-badge>
{{ release.name }}
</h6>
</template>
2020-09-26 00:24:18 +00:00
2020-11-01 17:52:25 +00:00
<b-card-text>
<small class="text-muted">
{{ $t('releases.published') }} {{ formatDate(release.published_at) }}
</small>
2020-09-26 00:24:18 +00:00
2020-11-01 17:52:25 +00:00
<vue-markdown :source="release.body" class="w-100 releases" />
</b-card-text>
</b-card>
2020-09-26 00:09:20 +00:00
</b-container>
2020-09-28 23:25:36 +00:00
</div>
2020-08-15 00:02:34 +00:00
</template>
<script>
2020-10-14 00:35:40 +00:00
import { mapState, mapGetters } from 'vuex';
2020-08-15 00:02:34 +00:00
import VueMarkdown from 'vue-markdown';
export default {
components: {
VueMarkdown,
},
2020-09-01 22:38:59 +00:00
computed: {
...mapState(['releases', 'notification', 'settings']),
2020-10-14 00:35:40 +00:00
...mapGetters(['nightMode']),
},
mounted() {
2020-09-26 00:41:18 +00:00
const [latestRelease] = this.releases;
if (this.notification && latestRelease && latestRelease.tag_name) {
this.$store.commit('UPDATE_SETTING', { key: 'release', value: latestRelease.tag_name });
this.$store.dispatch('SAVE_SETTINGS', this.settings)
.then(() => {
this.$store.commit('SET_NOTIFICATION', false);
})
.catch(() => {
this.$bvToast.toast(
'There was an error saving your settings',
{ title: 'Error', variant: 'danger' });
});
}
2020-08-15 00:02:34 +00:00
},
methods: {
formatDate(date) {
2020-10-31 18:15:22 +00:00
return new Intl.DateTimeFormat().format(new Date(date));
2020-08-15 00:02:34 +00:00
},
},
};
</script>