minor on collections / announcement layout

This commit is contained in:
les
2022-11-10 08:48:48 +01:00
parent 44f0d3ce2a
commit 253d4bcc85
2 changed files with 36 additions and 35 deletions

View File

@@ -4,13 +4,13 @@
<Confirm/> <Confirm/>
<Nav/> <Nav/>
<v-main> <v-main>
<div v-if='showCollections || showBack'> <!-- <div v-if='showCollections || showBack'>
<v-btn class='ml-2 mt-2' v-if='showBack' outlined color='primary' to='/'><v-icon v-text='mdiChevronLeft'></v-icon></v-btn> <v-btn class='ml-2 mt-2' v-if='showBack' outlined color='primary' to='/'><v-icon v-text='mdiChevronLeft'></v-icon></v-btn>
<v-btn class='ml-2 mt-2' outlined v-for='collection in collections' color='primary' :key='collection.id' :to='`/collection/${collection.name}`'>{{collection.name}}</v-btn> <v-btn class='ml-2 mt-2' outlined v-for='collection in collections' color='primary' :key='collection.id' :to='`/collection/${collection.name}`'>{{collection.name}}</v-btn>
</div> </div> -->
<v-fade-transition hide-on-leave> <!-- <v-fade-transition hide-on-leave> -->
<nuxt /> <nuxt />
</v-fade-transition> <!-- </v-fade-transition> -->
</v-main> </v-main>
<Footer/> <Footer/>
@@ -35,28 +35,24 @@ export default {
link: [{ rel: 'icon', type: 'image/png', href: this.settings.baseurl + '/logo.png' }], link: [{ rel: 'icon', type: 'image/png', href: this.settings.baseurl + '/logo.png' }],
} }
}, },
data () { // async fetch () {
return { collections: [], mdiChevronLeft } // if (this.$route.name && ['tag-tag', 'index', 'g-collection', 'p-place'].includes(this.$route.name)) {
}, // this.collections = await this.$axios.$get('collections').catch(_e => [])
async fetch () { // } else {
if (this.$route.name && ['tag-tag', 'index', 'g-collection', 'p-place'].includes(this.$route.name)) { // this.collections = []
this.collections = await this.$axios.$get('collections').catch(_e => []) // }
} else { // },
this.collections = []
}
},
name: 'Default', name: 'Default',
components: { Nav, Snackbar, Footer, Confirm }, components: { Nav, Snackbar, Footer, Confirm },
computed: { computed: {
...mapState(['settings', 'locale']), ...mapState(['settings']),
showBack () { // showBack () {
return ['tag-tag', 'collection-collection', 'place-place', 'search', 'announcement-id'].includes(this.$route.name) // return ['tag-tag', 'collection-collection', 'place-place', 'search', 'announcement-id'].includes(this.$route.name)
}, // },
showCollections () { // showCollections () {
if (!this.collections || this.collections.length === 0) return false // if (!this.collections || this.collections.length === 0) return false
return ['tag-tag', 'index', 'g-collection', 'p-place'].includes(this.$route.name) // return ['tag-tag', 'index', 'g-collection', 'p-place'].includes(this.$route.name)
} // }
}, },
created () { created () {
this.$vuetify.theme.dark = this.settings['theme.is_dark'] this.$vuetify.theme.dark = this.settings['theme.is_dark']

View File

@@ -1,14 +1,16 @@
<template lang="pug"> <template lang="pug">
v-container.pa-0 v-container.px-2.px-sm-6.pt-0
div(v-if='collections.length')
v-btn.mr-2(outlined v-for='collection in collections' color='primary' :key='collection.id' :to='`/collection/${collection.name}`') {{collection.name}}
//- Announcements //- Announcements
#announcements.ma-2(v-if='announcements.length') #announcements.mt-2.mt-sm-4(v-if='announcements.length')
Announcement(v-for='announcement in announcements' :key='`a_${announcement.id}`' :announcement='announcement') Announcement(v-for='announcement in announcements' :key='`a_${announcement.id}`' :announcement='announcement')
//- Calendar and search bar //- Calendar and search bar
//- v-row.ma-2(v-if='!settings.hide_calendar') //- v-row.ma-2(v-if='!settings.hide_calendar')
//- .calh.col-xl-5.col-lg-5.col-md-7.col-sm-10.col-xs-12.pa-0.mx-sm-2.mx-0.my-0.mt-sm-2 //- .calh.col-xl-5.col-lg-5.col-md-7.col-sm-10.col-xs-12.pa-0.mx-sm-2.mx-0.my-0.mt-sm-2
.calh.mx-2.mx-sm-4.mt-2.mt-sm-4(v-if='!settings.hide_calendar') .calh.mt-2.mt-sm-4(v-if='!settings.hide_calendar')
//- this is needed as v-calendar does not support SSR //- this is needed as v-calendar does not support SSR
//- https://github.com/nathanreyes/v-calendar/issues/336 //- https://github.com/nathanreyes/v-calendar/issues/336
client-only(placeholder='Loading...') client-only(placeholder='Loading...')
@@ -30,7 +32,7 @@ v-container.pa-0
//- Events //- Events
#events.ma-sm-4.ma-2 #events.mt-sm-4.mt-2
Event(:event='event' @destroy='destroy' v-for='(event, idx) in visibleEvents' :lazy='idx>2' :key='event.id') Event(:event='event' @destroy='destroy' v-for='(event, idx) in visibleEvents' :lazy='idx>2' :key='event.id')
</template> </template>
@@ -46,13 +48,15 @@ export default {
name: 'Index', name: 'Index',
components: { Event, Announcement, Calendar }, components: { Event, Announcement, Calendar },
middleware: 'setup', middleware: 'setup',
async asyncData ({ $api }) { async asyncData ({ $api, $axios }) {
const events = await $api.getEvents({ const [collections, events] = await Promise.all([
start: dayjs().startOf('month').unix(), $axios.$get('collections').catch(_e => []),
end: null, $api.getEvents({
show_recurrent: true start: dayjs().startOf('month').unix(),
}) end: null,
return { events } show_recurrent: true
})])
return { events, collections }
}, },
data ({ $store }) { data ({ $store }) {
return { return {
@@ -64,7 +68,8 @@ export default {
start: dayjs().startOf('month').unix(), start: dayjs().startOf('month').unix(),
end: null, end: null,
selectedDay: null, selectedDay: null,
show_recurrent: $store.state.settings.recurrent_event_visible show_recurrent: $store.state.settings.recurrent_event_visible,
collections: []
} }
}, },
head () { head () {