loading on filters update

This commit is contained in:
les
2021-04-14 01:35:18 +02:00
parent 6fb73272bb
commit 3bb73cd757

View File

@@ -71,6 +71,13 @@ export default {
} }
}, },
computed: mapState(['settings', 'announcements', 'filters']), computed: mapState(['settings', 'announcements', 'filters']),
mounted () {
const tags = document.location.hash.split('#').map(tag => decodeURIComponent(tag))
if (tags) {
this.setFilters({ ...this.filters, tags })
this.updateEvents()
}
},
methods: { methods: {
// onIntersect (isIntersecting, eventId) { // onIntersect (isIntersecting, eventId) {
// this.intersecting[eventId] = isIntersecting // this.intersecting[eventId] = isIntersecting
@@ -95,8 +102,9 @@ export default {
this.updateEvents() this.updateEvents()
}, },
tagClick (tag) { tagClick (tag) {
this.$nuxt.$loading.start()
this.$router.push(`#${tag}`)
if (this.filters.tags.includes(tag)) { if (this.filters.tags.includes(tag)) {
this.filters.tags = this.filters.tags.filter(t => t !== tag)
this.setFilters({ ...this.filters, tags: this.filters.tags.filter(t => t !== tag) }) this.setFilters({ ...this.filters, tags: this.filters.tags.filter(t => t !== tag) })
} else { } else {
this.setFilters({ ...this.filters, tags: [].concat(this.filters.tags, tag) }) this.setFilters({ ...this.filters, tags: [].concat(this.filters.tags, tag) })
@@ -124,15 +132,17 @@ export default {
this.updateEvents() this.updateEvents()
}, },
updateFilters (filters) { updateFilters (filters) {
this.$nuxt.$loading.start()
this.setFilters(filters) this.setFilters(filters)
this.updateEvents() this.updateEvents()
}, },
dayChange (day) { dayChange (day) {
this.$nuxt.$loading.start()
const date = dayjs(day.date).format('YYYY-MM-DD') const date = dayjs(day.date).format('YYYY-MM-DD')
if (this.selectedDay === date) { if (this.selectedDay === date) {
this.selectedDay = null this.selectedDay = null
this.start = dayjs().unix() // .startOf('week').unix() this.start = dayjs(day.date).startOf('month').unix() // .startOf('week').unix()
this.end = null this.end = dayjs(day.date).endOf('month').unix()
this.updateEvents() this.updateEvents()
return return
} }